@wordpress/block-editor 7.0.2 → 8.0.1

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 (801) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +45 -1
  3. package/build/components/autocomplete/index.js +1 -1
  4. package/build/components/autocomplete/index.js.map +1 -1
  5. package/build/components/block-actions/index.js +8 -4
  6. package/build/components/block-actions/index.js.map +1 -1
  7. package/build/components/block-alignment-control/ui.js +61 -14
  8. package/build/components/block-alignment-control/ui.js.map +1 -1
  9. package/build/components/block-alignment-control/use-available-alignments.js +25 -3
  10. package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
  11. package/build/components/block-controls/fill.js +2 -2
  12. package/build/components/block-controls/fill.js.map +1 -1
  13. package/build/components/block-controls/hook.js +3 -3
  14. package/build/components/block-controls/hook.js.map +1 -1
  15. package/build/components/block-icon/index.js +5 -1
  16. package/build/components/block-icon/index.js.map +1 -1
  17. package/build/components/block-icon/index.native.js +9 -11
  18. package/build/components/block-icon/index.native.js.map +1 -1
  19. package/build/components/block-inspector/index.js +8 -0
  20. package/build/components/block-inspector/index.js.map +1 -1
  21. package/build/components/block-list/block-html.js +5 -0
  22. package/build/components/block-list/block-html.js.map +1 -1
  23. package/build/components/block-list/block.js +12 -5
  24. package/build/components/block-list/block.js.map +1 -1
  25. package/build/components/block-list/block.native.js +4 -3
  26. package/build/components/block-list/block.native.js.map +1 -1
  27. package/build/components/block-list/index.native.js +1 -1
  28. package/build/components/block-list/index.native.js.map +1 -1
  29. package/build/components/block-list/use-block-props/use-multi-selection.js +21 -8
  30. package/build/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
  31. package/build/components/block-list-appender/index.js +9 -1
  32. package/build/components/block-list-appender/index.js.map +1 -1
  33. package/build/components/block-mover/index.js +4 -4
  34. package/build/components/block-mover/index.js.map +1 -1
  35. package/build/components/block-mover/index.native.js +4 -4
  36. package/build/components/block-mover/index.native.js.map +1 -1
  37. package/build/components/block-navigation/dropdown.js +0 -1
  38. package/build/components/block-navigation/dropdown.js.map +1 -1
  39. package/build/components/block-patterns-list/index.js +1 -8
  40. package/build/components/block-patterns-list/index.js.map +1 -1
  41. package/build/components/block-preview/auto.js +1 -1
  42. package/build/components/block-preview/auto.js.map +1 -1
  43. package/build/components/block-settings/container.native.js +5 -2
  44. package/build/components/block-settings/container.native.js.map +1 -1
  45. package/build/components/block-settings-menu/block-settings-dropdown.js +26 -5
  46. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  47. package/build/components/block-settings-menu-controls/index.js +10 -3
  48. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  49. package/build/components/block-styles/preview.native.js +2 -2
  50. package/build/components/block-styles/preview.native.js.map +1 -1
  51. package/build/components/block-switcher/block-styles-menu.js +1 -1
  52. package/build/components/block-switcher/block-styles-menu.js.map +1 -1
  53. package/build/components/block-switcher/index.js +10 -3
  54. package/build/components/block-switcher/index.js.map +1 -1
  55. package/build/components/block-title/index.js +3 -2
  56. package/build/components/block-title/index.js.map +1 -1
  57. package/build/components/block-tools/block-popover.js +2 -4
  58. package/build/components/block-tools/block-popover.js.map +1 -1
  59. package/build/components/block-tools/index.js +4 -1
  60. package/build/components/block-tools/index.js.map +1 -1
  61. package/build/components/block-tools/insertion-point.js +96 -7
  62. package/build/components/block-tools/insertion-point.js.map +1 -1
  63. package/build/components/border-radius-control/index.js.map +1 -1
  64. package/build/components/border-radius-control/utils.js +17 -8
  65. package/build/components/border-radius-control/utils.js.map +1 -1
  66. package/build/components/colors/utils.js +11 -3
  67. package/build/components/colors/utils.js.map +1 -1
  68. package/build/components/colors-gradients/control.js +22 -57
  69. package/build/components/colors-gradients/control.js.map +1 -1
  70. package/build/components/colors-gradients/panel-color-gradient-settings.js +83 -7
  71. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  72. package/build/components/contrast-checker/index.js +18 -12
  73. package/build/components/contrast-checker/index.js.map +1 -1
  74. package/build/components/copy-handler/index.js +9 -3
  75. package/build/components/copy-handler/index.js.map +1 -1
  76. package/build/components/default-block-appender/index.js +2 -2
  77. package/build/components/default-block-appender/index.js.map +1 -1
  78. package/build/components/duotone-control/index.js +41 -39
  79. package/build/components/duotone-control/index.js.map +1 -1
  80. package/build/components/editor-styles/index.js +9 -3
  81. package/build/components/editor-styles/index.js.map +1 -1
  82. package/build/components/font-appearance-control/index.js +32 -21
  83. package/build/components/font-appearance-control/index.js.map +1 -1
  84. package/build/components/iframe/index.js +6 -4
  85. package/build/components/iframe/index.js.map +1 -1
  86. package/build/components/image-editor/aspect-ratio-dropdown.js +126 -0
  87. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
  88. package/build/components/image-editor/constants.js +16 -0
  89. package/build/components/image-editor/constants.js.map +1 -0
  90. package/build/components/image-editor/context.js +59 -0
  91. package/build/components/image-editor/context.js.map +1 -0
  92. package/build/components/image-editor/cropper.js +83 -0
  93. package/build/components/image-editor/cropper.js.map +1 -0
  94. package/build/components/image-editor/form-controls.js +36 -0
  95. package/build/components/image-editor/form-controls.js.map +1 -0
  96. package/build/components/image-editor/index.js +60 -0
  97. package/build/components/image-editor/index.js.map +1 -0
  98. package/build/components/image-editor/rotation-button.js +37 -0
  99. package/build/components/image-editor/rotation-button.js.map +1 -0
  100. package/build/components/image-editor/use-save-image.js +84 -0
  101. package/build/components/image-editor/use-save-image.js.map +1 -0
  102. package/build/components/image-editor/use-transform-image.js +135 -0
  103. package/build/components/image-editor/use-transform-image.js.map +1 -0
  104. package/build/components/image-editor/zoom-dropdown.js +55 -0
  105. package/build/components/image-editor/zoom-dropdown.js.map +1 -0
  106. package/build/components/image-size-control/use-dimension-handler.js +14 -3
  107. package/build/components/image-size-control/use-dimension-handler.js.map +1 -1
  108. package/build/components/index.js +36 -20
  109. package/build/components/index.js.map +1 -1
  110. package/build/components/index.native.js +2 -2
  111. package/build/components/index.native.js.map +1 -1
  112. package/build/components/inner-blocks/button-block-appender.js +11 -1
  113. package/build/components/inner-blocks/button-block-appender.js.map +1 -1
  114. package/build/components/inner-blocks/index.js +8 -5
  115. package/build/components/inner-blocks/index.js.map +1 -1
  116. package/build/components/inner-blocks/index.native.js +4 -3
  117. package/build/components/inner-blocks/index.native.js.map +1 -1
  118. package/build/components/inner-blocks/use-nested-settings-update.js +24 -13
  119. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  120. package/build/components/inserter/block-patterns-explorer/explorer.js +62 -0
  121. package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
  122. package/build/components/inserter/block-patterns-explorer/patterns-list.js +111 -0
  123. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
  124. package/build/components/inserter/block-patterns-explorer/sidebar.js +78 -0
  125. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
  126. package/build/components/inserter/block-patterns-tab.js +74 -35
  127. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  128. package/build/components/inserter/block-types-tab.native.js +3 -11
  129. package/build/components/inserter/block-types-tab.native.js.map +1 -1
  130. package/build/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
  131. package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  132. package/build/components/inserter/hooks/use-clipboard-block.native.js +5 -4
  133. package/build/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
  134. package/build/components/inserter/index.js +12 -4
  135. package/build/components/inserter/index.js.map +1 -1
  136. package/build/components/inserter/index.native.js +1 -7
  137. package/build/components/inserter/index.native.js.map +1 -1
  138. package/build/components/inserter/library.js +2 -0
  139. package/build/components/inserter/library.js.map +1 -1
  140. package/build/components/inserter/menu.js +2 -1
  141. package/build/components/inserter/menu.js.map +1 -1
  142. package/build/components/inserter/menu.native.js +11 -15
  143. package/build/components/inserter/menu.native.js.map +1 -1
  144. package/build/components/inserter/pattern-panel.js +19 -10
  145. package/build/components/inserter/pattern-panel.js.map +1 -1
  146. package/build/components/inserter/preview-panel.js +1 -1
  147. package/build/components/inserter/preview-panel.js.map +1 -1
  148. package/build/components/inserter/quick-inserter.js +2 -1
  149. package/build/components/inserter/quick-inserter.js.map +1 -1
  150. package/build/components/inserter/reusable-blocks-tab.native.js +5 -6
  151. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  152. package/build/components/inserter/search-results.native.js +6 -11
  153. package/build/components/inserter/search-results.native.js.map +1 -1
  154. package/build/components/inserter/utils.native.js +44 -0
  155. package/build/components/inserter/utils.native.js.map +1 -0
  156. package/build/components/inspector-controls/block-support-slot-container.js +28 -0
  157. package/build/components/inspector-controls/block-support-slot-container.js.map +1 -0
  158. package/build/components/inspector-controls/block-support-tools-panel.js +78 -0
  159. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -0
  160. package/build/components/inspector-controls/fill.js +16 -1
  161. package/build/components/inspector-controls/fill.js.map +1 -1
  162. package/build/components/inspector-controls/groups.js +5 -1
  163. package/build/components/inspector-controls/groups.js.map +1 -1
  164. package/build/components/inspector-controls/slot.js +15 -0
  165. package/build/components/inspector-controls/slot.js.map +1 -1
  166. package/build/components/letter-spacing-control/index.js +9 -6
  167. package/build/components/letter-spacing-control/index.js.map +1 -1
  168. package/build/components/link-control/index.js +93 -34
  169. package/build/components/link-control/index.js.map +1 -1
  170. package/build/components/link-control/link-preview.js +45 -15
  171. package/build/components/link-control/link-preview.js.map +1 -1
  172. package/build/components/link-control/search-input.js +25 -7
  173. package/build/components/link-control/search-input.js.map +1 -1
  174. package/build/components/list-view/block-contents.js +1 -20
  175. package/build/components/list-view/block-contents.js.map +1 -1
  176. package/build/components/list-view/block.js +54 -69
  177. package/build/components/list-view/block.js.map +1 -1
  178. package/build/components/list-view/branch.js +102 -76
  179. package/build/components/list-view/branch.js.map +1 -1
  180. package/build/components/list-view/index.js +45 -20
  181. package/build/components/list-view/index.js.map +1 -1
  182. package/build/components/list-view/leaf.js +2 -2
  183. package/build/components/list-view/leaf.js.map +1 -1
  184. package/build/components/list-view/list-item.js +3 -2
  185. package/build/components/list-view/list-item.js.map +1 -1
  186. package/build/components/list-view/use-list-view-client-ids.js +13 -54
  187. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  188. package/build/components/media-placeholder/index.js +29 -20
  189. package/build/components/media-placeholder/index.js.map +1 -1
  190. package/build/components/media-replace-flow/index.js +5 -3
  191. package/build/components/media-replace-flow/index.js.map +1 -1
  192. package/build/components/navigable-toolbar/index.js +1 -4
  193. package/build/components/navigable-toolbar/index.js.map +1 -1
  194. package/build/components/observe-typing/index.js +1 -1
  195. package/build/components/observe-typing/index.js.map +1 -1
  196. package/build/components/plain-text/index.native.js +30 -1
  197. package/build/components/plain-text/index.native.js.map +1 -1
  198. package/build/components/rich-text/embed-handler-picker.native.js +66 -0
  199. package/build/components/rich-text/embed-handler-picker.native.js.map +1 -0
  200. package/build/components/rich-text/format-edit.js +28 -2
  201. package/build/components/rich-text/format-edit.js.map +1 -1
  202. package/build/components/rich-text/format-toolbar/index.js +32 -11
  203. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  204. package/build/components/rich-text/index.js +5 -1
  205. package/build/components/rich-text/index.js.map +1 -1
  206. package/build/components/rich-text/index.native.js +41 -2
  207. package/build/components/rich-text/index.native.js.map +1 -1
  208. package/build/components/rich-text/use-paste-handler.js +28 -9
  209. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  210. package/build/components/rich-text/utils.js +22 -0
  211. package/build/components/rich-text/utils.js.map +1 -1
  212. package/build/components/typewriter/index.js +1 -1
  213. package/build/components/typewriter/index.js.map +1 -1
  214. package/build/components/url-input/index.js +25 -11
  215. package/build/components/url-input/index.js.map +1 -1
  216. package/build/components/use-moving-animation/index.js +13 -10
  217. package/build/components/use-moving-animation/index.js.map +1 -1
  218. package/build/components/use-on-block-drop/index.js +2 -1
  219. package/build/components/use-on-block-drop/index.js.map +1 -1
  220. package/build/components/use-setting/index.js +48 -9
  221. package/build/components/use-setting/index.js.map +1 -1
  222. package/build/components/writing-flow/use-multi-selection.js +6 -0
  223. package/build/components/writing-flow/use-multi-selection.js.map +1 -1
  224. package/build/components/writing-flow/use-tab-nav.js +10 -1
  225. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  226. package/build/hooks/align.js +13 -10
  227. package/build/hooks/align.js.map +1 -1
  228. package/build/hooks/anchor.js +1 -1
  229. package/build/hooks/anchor.js.map +1 -1
  230. package/build/hooks/border.js +5 -5
  231. package/build/hooks/border.js.map +1 -1
  232. package/build/hooks/color-panel.js +5 -2
  233. package/build/hooks/color-panel.js.map +1 -1
  234. package/build/hooks/color.js +1 -1
  235. package/build/hooks/color.js.map +1 -1
  236. package/build/hooks/dimensions.js +23 -27
  237. package/build/hooks/dimensions.js.map +1 -1
  238. package/build/hooks/duotone.js +60 -16
  239. package/build/hooks/duotone.js.map +1 -1
  240. package/build/hooks/font-appearance.js +49 -6
  241. package/build/hooks/font-appearance.js.map +1 -1
  242. package/build/hooks/font-family.js +123 -32
  243. package/build/hooks/font-family.js.map +1 -1
  244. package/build/hooks/font-size.js +51 -9
  245. package/build/hooks/font-size.js.map +1 -1
  246. package/build/hooks/gap.js +2 -1
  247. package/build/hooks/gap.js.map +1 -1
  248. package/build/hooks/index.js +10 -0
  249. package/build/hooks/index.js.map +1 -1
  250. package/build/hooks/index.native.js +8 -0
  251. package/build/hooks/index.native.js.map +1 -1
  252. package/build/hooks/letter-spacing.js +44 -7
  253. package/build/hooks/letter-spacing.js.map +1 -1
  254. package/build/hooks/line-height.js +45 -8
  255. package/build/hooks/line-height.js.map +1 -1
  256. package/build/hooks/lock.js +43 -0
  257. package/build/hooks/lock.js.map +1 -0
  258. package/build/hooks/margin.js +1 -1
  259. package/build/hooks/margin.js.map +1 -1
  260. package/build/hooks/padding.js +1 -1
  261. package/build/hooks/padding.js.map +1 -1
  262. package/build/hooks/style.js +7 -4
  263. package/build/hooks/style.js.map +1 -1
  264. package/build/hooks/text-decoration.js +42 -6
  265. package/build/hooks/text-decoration.js.map +1 -1
  266. package/build/hooks/text-transform.js +42 -6
  267. package/build/hooks/text-transform.js.map +1 -1
  268. package/build/hooks/typography.js +108 -8
  269. package/build/hooks/typography.js.map +1 -1
  270. package/build/hooks/use-cached-truthy.js +29 -0
  271. package/build/hooks/use-cached-truthy.js.map +1 -0
  272. package/build/index.js +7 -0
  273. package/build/index.js.map +1 -1
  274. package/build/layouts/flex.js +160 -34
  275. package/build/layouts/flex.js.map +1 -1
  276. package/build/layouts/flow.js +75 -8
  277. package/build/layouts/flow.js.map +1 -1
  278. package/build/store/actions.js +323 -265
  279. package/build/store/actions.js.map +1 -1
  280. package/build/store/defaults.native.js +13 -1
  281. package/build/store/defaults.native.js.map +1 -1
  282. package/build/store/index.js +1 -3
  283. package/build/store/index.js.map +1 -1
  284. package/build/store/reducer.js +33 -22
  285. package/build/store/reducer.js.map +1 -1
  286. package/build/store/selectors.js +172 -38
  287. package/build/store/selectors.js.map +1 -1
  288. package/build/utils/index.js +10 -1
  289. package/build/utils/index.js.map +1 -1
  290. package/build/utils/parse-css-unit-to-px.js +51 -1
  291. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  292. package/build/utils/transform-styles/transforms/wrap.js +16 -0
  293. package/build/utils/transform-styles/transforms/wrap.js.map +1 -1
  294. package/build-module/components/autocomplete/index.js +2 -2
  295. package/build-module/components/autocomplete/index.js.map +1 -1
  296. package/build-module/components/block-actions/index.js +8 -4
  297. package/build-module/components/block-actions/index.js.map +1 -1
  298. package/build-module/components/block-alignment-control/ui.js +64 -17
  299. package/build-module/components/block-alignment-control/ui.js.map +1 -1
  300. package/build-module/components/block-alignment-control/use-available-alignments.js +25 -3
  301. package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
  302. package/build-module/components/block-controls/fill.js +2 -2
  303. package/build-module/components/block-controls/fill.js.map +1 -1
  304. package/build-module/components/block-controls/hook.js +3 -3
  305. package/build-module/components/block-controls/hook.js.map +1 -1
  306. package/build-module/components/block-icon/index.js +5 -1
  307. package/build-module/components/block-icon/index.js.map +1 -1
  308. package/build-module/components/block-icon/index.native.js +10 -11
  309. package/build-module/components/block-icon/index.native.js.map +1 -1
  310. package/build-module/components/block-inspector/index.js +8 -0
  311. package/build-module/components/block-inspector/index.js.map +1 -1
  312. package/build-module/components/block-list/block-html.js +5 -0
  313. package/build-module/components/block-list/block-html.js.map +1 -1
  314. package/build-module/components/block-list/block.js +12 -5
  315. package/build-module/components/block-list/block.js.map +1 -1
  316. package/build-module/components/block-list/block.native.js +4 -3
  317. package/build-module/components/block-list/block.native.js.map +1 -1
  318. package/build-module/components/block-list/index.native.js +1 -1
  319. package/build-module/components/block-list/index.native.js.map +1 -1
  320. package/build-module/components/block-list/use-block-props/use-multi-selection.js +21 -8
  321. package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
  322. package/build-module/components/block-list-appender/index.js +9 -1
  323. package/build-module/components/block-list-appender/index.js.map +1 -1
  324. package/build-module/components/block-mover/index.js +4 -4
  325. package/build-module/components/block-mover/index.js.map +1 -1
  326. package/build-module/components/block-mover/index.native.js +4 -4
  327. package/build-module/components/block-mover/index.native.js.map +1 -1
  328. package/build-module/components/block-navigation/dropdown.js +0 -1
  329. package/build-module/components/block-navigation/dropdown.js.map +1 -1
  330. package/build-module/components/block-patterns-list/index.js +1 -6
  331. package/build-module/components/block-patterns-list/index.js.map +1 -1
  332. package/build-module/components/block-preview/auto.js +1 -1
  333. package/build-module/components/block-preview/auto.js.map +1 -1
  334. package/build-module/components/block-settings/container.native.js +6 -3
  335. package/build-module/components/block-settings/container.native.js.map +1 -1
  336. package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -7
  337. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  338. package/build-module/components/block-settings-menu-controls/index.js +10 -3
  339. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  340. package/build-module/components/block-styles/preview.native.js +2 -2
  341. package/build-module/components/block-styles/preview.native.js.map +1 -1
  342. package/build-module/components/block-switcher/block-styles-menu.js +1 -1
  343. package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
  344. package/build-module/components/block-switcher/index.js +10 -3
  345. package/build-module/components/block-switcher/index.js.map +1 -1
  346. package/build-module/components/block-title/index.js +3 -2
  347. package/build-module/components/block-title/index.js.map +1 -1
  348. package/build-module/components/block-tools/block-popover.js +3 -5
  349. package/build-module/components/block-tools/block-popover.js.map +1 -1
  350. package/build-module/components/block-tools/index.js +4 -1
  351. package/build-module/components/block-tools/index.js.map +1 -1
  352. package/build-module/components/block-tools/insertion-point.js +96 -8
  353. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  354. package/build-module/components/border-radius-control/index.js.map +1 -1
  355. package/build-module/components/border-radius-control/utils.js +16 -9
  356. package/build-module/components/border-radius-control/utils.js.map +1 -1
  357. package/build-module/components/colors/utils.js +9 -3
  358. package/build-module/components/colors/utils.js.map +1 -1
  359. package/build-module/components/colors-gradients/control.js +26 -63
  360. package/build-module/components/colors-gradients/control.js.map +1 -1
  361. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +84 -7
  362. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  363. package/build-module/components/contrast-checker/index.js +13 -10
  364. package/build-module/components/contrast-checker/index.js.map +1 -1
  365. package/build-module/components/copy-handler/index.js +9 -3
  366. package/build-module/components/copy-handler/index.js.map +1 -1
  367. package/build-module/components/default-block-appender/index.js +2 -2
  368. package/build-module/components/default-block-appender/index.js.map +1 -1
  369. package/build-module/components/duotone-control/index.js +43 -39
  370. package/build-module/components/duotone-control/index.js.map +1 -1
  371. package/build-module/components/editor-styles/index.js +7 -3
  372. package/build-module/components/editor-styles/index.js.map +1 -1
  373. package/build-module/components/font-appearance-control/index.js +28 -21
  374. package/build-module/components/font-appearance-control/index.js.map +1 -1
  375. package/build-module/components/iframe/index.js +6 -4
  376. package/build-module/components/iframe/index.js.map +1 -1
  377. package/build-module/components/image-editor/aspect-ratio-dropdown.js +115 -0
  378. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
  379. package/build-module/components/image-editor/constants.js +7 -0
  380. package/build-module/components/image-editor/constants.js.map +1 -0
  381. package/build-module/components/image-editor/context.js +44 -0
  382. package/build-module/components/image-editor/context.js.map +1 -0
  383. package/build-module/components/image-editor/cropper.js +69 -0
  384. package/build-module/components/image-editor/cropper.js.map +1 -0
  385. package/build-module/components/image-editor/form-controls.js +26 -0
  386. package/build-module/components/image-editor/form-controls.js.map +1 -0
  387. package/build-module/components/image-editor/index.js +37 -0
  388. package/build-module/components/image-editor/index.js.map +1 -0
  389. package/build-module/components/image-editor/rotation-button.js +26 -0
  390. package/build-module/components/image-editor/rotation-button.js.map +1 -0
  391. package/build-module/components/image-editor/use-save-image.js +70 -0
  392. package/build-module/components/image-editor/use-save-image.js.map +1 -0
  393. package/build-module/components/image-editor/use-transform-image.js +127 -0
  394. package/build-module/components/image-editor/use-transform-image.js.map +1 -0
  395. package/build-module/components/image-editor/zoom-dropdown.js +43 -0
  396. package/build-module/components/image-editor/zoom-dropdown.js.map +1 -0
  397. package/build-module/components/image-size-control/use-dimension-handler.js +13 -2
  398. package/build-module/components/image-size-control/use-dimension-handler.js.map +1 -1
  399. package/build-module/components/index.js +4 -3
  400. package/build-module/components/index.js.map +1 -1
  401. package/build-module/components/index.native.js +1 -1
  402. package/build-module/components/index.native.js.map +1 -1
  403. package/build-module/components/inner-blocks/button-block-appender.js +10 -1
  404. package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
  405. package/build-module/components/inner-blocks/index.js +9 -6
  406. package/build-module/components/inner-blocks/index.js.map +1 -1
  407. package/build-module/components/inner-blocks/index.native.js +5 -4
  408. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  409. package/build-module/components/inner-blocks/use-nested-settings-update.js +24 -13
  410. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  411. package/build-module/components/inserter/block-patterns-explorer/explorer.js +50 -0
  412. package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
  413. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +92 -0
  414. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
  415. package/build-module/components/inserter/block-patterns-explorer/sidebar.js +69 -0
  416. package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
  417. package/build-module/components/inserter/block-patterns-tab.js +75 -36
  418. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  419. package/build-module/components/inserter/block-types-tab.native.js +2 -10
  420. package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
  421. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
  422. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  423. package/build-module/components/inserter/hooks/use-clipboard-block.native.js +5 -4
  424. package/build-module/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
  425. package/build-module/components/inserter/index.js +12 -4
  426. package/build-module/components/inserter/index.js.map +1 -1
  427. package/build-module/components/inserter/index.native.js +1 -7
  428. package/build-module/components/inserter/index.native.js.map +1 -1
  429. package/build-module/components/inserter/library.js +2 -0
  430. package/build-module/components/inserter/library.js.map +1 -1
  431. package/build-module/components/inserter/menu.js +2 -1
  432. package/build-module/components/inserter/menu.js.map +1 -1
  433. package/build-module/components/inserter/menu.native.js +10 -15
  434. package/build-module/components/inserter/menu.native.js.map +1 -1
  435. package/build-module/components/inserter/pattern-panel.js +21 -13
  436. package/build-module/components/inserter/pattern-panel.js.map +1 -1
  437. package/build-module/components/inserter/preview-panel.js +1 -1
  438. package/build-module/components/inserter/preview-panel.js.map +1 -1
  439. package/build-module/components/inserter/quick-inserter.js +2 -1
  440. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  441. package/build-module/components/inserter/reusable-blocks-tab.native.js +4 -5
  442. package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  443. package/build-module/components/inserter/search-results.native.js +5 -10
  444. package/build-module/components/inserter/search-results.native.js.map +1 -1
  445. package/build-module/components/inserter/utils.native.js +35 -0
  446. package/build-module/components/inserter/utils.native.js.map +1 -0
  447. package/build-module/components/inspector-controls/block-support-slot-container.js +18 -0
  448. package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -0
  449. package/build-module/components/inspector-controls/block-support-tools-panel.js +67 -0
  450. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -0
  451. package/build-module/components/inspector-controls/fill.js +16 -2
  452. package/build-module/components/inspector-controls/fill.js.map +1 -1
  453. package/build-module/components/inspector-controls/groups.js +5 -1
  454. package/build-module/components/inspector-controls/groups.js.map +1 -1
  455. package/build-module/components/inspector-controls/slot.js +13 -0
  456. package/build-module/components/inspector-controls/slot.js.map +1 -1
  457. package/build-module/components/letter-spacing-control/index.js +9 -6
  458. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  459. package/build-module/components/link-control/index.js +93 -35
  460. package/build-module/components/link-control/index.js.map +1 -1
  461. package/build-module/components/link-control/link-preview.js +46 -17
  462. package/build-module/components/link-control/link-preview.js.map +1 -1
  463. package/build-module/components/link-control/search-input.js +24 -7
  464. package/build-module/components/link-control/search-input.js.map +1 -1
  465. package/build-module/components/list-view/block-contents.js +1 -18
  466. package/build-module/components/list-view/block-contents.js.map +1 -1
  467. package/build-module/components/list-view/block.js +56 -71
  468. package/build-module/components/list-view/block.js.map +1 -1
  469. package/build-module/components/list-view/branch.js +102 -78
  470. package/build-module/components/list-view/branch.js.map +1 -1
  471. package/build-module/components/list-view/index.js +48 -23
  472. package/build-module/components/list-view/index.js.map +1 -1
  473. package/build-module/components/list-view/leaf.js +2 -2
  474. package/build-module/components/list-view/leaf.js.map +1 -1
  475. package/build-module/components/list-view/list-item.js +3 -2
  476. package/build-module/components/list-view/list-item.js.map +1 -1
  477. package/build-module/components/list-view/use-list-view-client-ids.js +13 -54
  478. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  479. package/build-module/components/media-placeholder/index.js +29 -20
  480. package/build-module/components/media-placeholder/index.js.map +1 -1
  481. package/build-module/components/media-replace-flow/index.js +5 -3
  482. package/build-module/components/media-replace-flow/index.js.map +1 -1
  483. package/build-module/components/navigable-toolbar/index.js +1 -4
  484. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  485. package/build-module/components/observe-typing/index.js +1 -1
  486. package/build-module/components/observe-typing/index.js.map +1 -1
  487. package/build-module/components/plain-text/index.native.js +29 -2
  488. package/build-module/components/plain-text/index.native.js.map +1 -1
  489. package/build-module/components/rich-text/embed-handler-picker.native.js +54 -0
  490. package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -0
  491. package/build-module/components/rich-text/format-edit.js +28 -3
  492. package/build-module/components/rich-text/format-edit.js.map +1 -1
  493. package/build-module/components/rich-text/format-toolbar/index.js +29 -11
  494. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  495. package/build-module/components/rich-text/index.js +4 -1
  496. package/build-module/components/rich-text/index.js.map +1 -1
  497. package/build-module/components/rich-text/index.native.js +41 -3
  498. package/build-module/components/rich-text/index.native.js.map +1 -1
  499. package/build-module/components/rich-text/use-paste-handler.js +28 -9
  500. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  501. package/build-module/components/rich-text/utils.js +20 -0
  502. package/build-module/components/rich-text/utils.js.map +1 -1
  503. package/build-module/components/typewriter/index.js +1 -1
  504. package/build-module/components/typewriter/index.js.map +1 -1
  505. package/build-module/components/url-input/index.js +25 -11
  506. package/build-module/components/url-input/index.js.map +1 -1
  507. package/build-module/components/use-moving-animation/index.js +13 -10
  508. package/build-module/components/use-moving-animation/index.js.map +1 -1
  509. package/build-module/components/use-on-block-drop/index.js +3 -2
  510. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  511. package/build-module/components/use-setting/index.js +48 -9
  512. package/build-module/components/use-setting/index.js.map +1 -1
  513. package/build-module/components/writing-flow/use-multi-selection.js +6 -0
  514. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  515. package/build-module/components/writing-flow/use-tab-nav.js +10 -1
  516. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  517. package/build-module/hooks/align.js +13 -10
  518. package/build-module/hooks/align.js.map +1 -1
  519. package/build-module/hooks/anchor.js +1 -1
  520. package/build-module/hooks/anchor.js.map +1 -1
  521. package/build-module/hooks/border.js +5 -5
  522. package/build-module/hooks/border.js.map +1 -1
  523. package/build-module/hooks/color-panel.js +6 -3
  524. package/build-module/hooks/color-panel.js.map +1 -1
  525. package/build-module/hooks/color.js +1 -1
  526. package/build-module/hooks/color.js.map +1 -1
  527. package/build-module/hooks/dimensions.js +24 -27
  528. package/build-module/hooks/dimensions.js.map +1 -1
  529. package/build-module/hooks/duotone.js +59 -16
  530. package/build-module/hooks/duotone.js.map +1 -1
  531. package/build-module/hooks/font-appearance.js +45 -6
  532. package/build-module/hooks/font-appearance.js.map +1 -1
  533. package/build-module/hooks/font-family.js +117 -33
  534. package/build-module/hooks/font-family.js.map +1 -1
  535. package/build-module/hooks/font-size.js +47 -9
  536. package/build-module/hooks/font-size.js.map +1 -1
  537. package/build-module/hooks/gap.js +2 -1
  538. package/build-module/hooks/gap.js.map +1 -1
  539. package/build-module/hooks/index.js +2 -0
  540. package/build-module/hooks/index.js.map +1 -1
  541. package/build-module/hooks/index.native.js +1 -0
  542. package/build-module/hooks/index.native.js.map +1 -1
  543. package/build-module/hooks/letter-spacing.js +40 -7
  544. package/build-module/hooks/letter-spacing.js.map +1 -1
  545. package/build-module/hooks/line-height.js +41 -8
  546. package/build-module/hooks/line-height.js.map +1 -1
  547. package/build-module/hooks/lock.js +33 -0
  548. package/build-module/hooks/lock.js.map +1 -0
  549. package/build-module/hooks/margin.js +1 -1
  550. package/build-module/hooks/margin.js.map +1 -1
  551. package/build-module/hooks/padding.js +1 -1
  552. package/build-module/hooks/padding.js.map +1 -1
  553. package/build-module/hooks/style.js +7 -4
  554. package/build-module/hooks/style.js.map +1 -1
  555. package/build-module/hooks/text-decoration.js +38 -6
  556. package/build-module/hooks/text-decoration.js.map +1 -1
  557. package/build-module/hooks/text-transform.js +38 -6
  558. package/build-module/hooks/text-transform.js.map +1 -1
  559. package/build-module/hooks/typography.js +117 -17
  560. package/build-module/hooks/typography.js.map +1 -1
  561. package/build-module/hooks/use-cached-truthy.js +21 -0
  562. package/build-module/hooks/use-cached-truthy.js.map +1 -0
  563. package/build-module/index.js +1 -1
  564. package/build-module/index.js.map +1 -1
  565. package/build-module/layouts/flex.js +163 -38
  566. package/build-module/layouts/flex.js.map +1 -1
  567. package/build-module/layouts/flow.js +74 -8
  568. package/build-module/layouts/flow.js.map +1 -1
  569. package/build-module/store/actions.js +286 -241
  570. package/build-module/store/actions.js.map +1 -1
  571. package/build-module/store/defaults.native.js +12 -1
  572. package/build-module/store/defaults.native.js.map +1 -1
  573. package/build-module/store/index.js +1 -2
  574. package/build-module/store/index.js.map +1 -1
  575. package/build-module/store/reducer.js +33 -22
  576. package/build-module/store/reducer.js.map +1 -1
  577. package/build-module/store/selectors.js +160 -34
  578. package/build-module/store/selectors.js.map +1 -1
  579. package/build-module/utils/index.js +1 -0
  580. package/build-module/utils/index.js.map +1 -1
  581. package/build-module/utils/parse-css-unit-to-px.js +48 -1
  582. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  583. package/build-module/utils/transform-styles/transforms/wrap.js +16 -0
  584. package/build-module/utils/transform-styles/transforms/wrap.js.map +1 -1
  585. package/build-style/style-rtl.css +267 -144
  586. package/build-style/style.css +267 -144
  587. package/package.json +28 -27
  588. package/src/components/autocomplete/index.js +5 -2
  589. package/src/components/block-actions/index.js +9 -5
  590. package/src/components/block-alignment-control/style.scss +5 -0
  591. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +15 -1
  592. package/src/components/block-alignment-control/test/index.native.js +37 -0
  593. package/src/components/block-alignment-control/ui.js +98 -27
  594. package/src/components/block-alignment-control/use-available-alignments.js +31 -10
  595. package/src/components/block-controls/fill.js +5 -2
  596. package/src/components/block-controls/hook.js +3 -3
  597. package/src/components/block-draggable/style.scss +19 -4
  598. package/src/components/block-icon/index.js +4 -1
  599. package/src/components/block-icon/index.native.js +10 -16
  600. package/src/components/block-inspector/index.js +10 -0
  601. package/src/components/block-list/block-html.js +5 -0
  602. package/src/components/block-list/block.js +11 -3
  603. package/src/components/block-list/block.native.js +5 -3
  604. package/src/components/block-list/index.native.js +1 -1
  605. package/src/components/block-list/style.scss +15 -0
  606. package/src/components/block-list/use-block-props/use-multi-selection.js +27 -7
  607. package/src/components/block-list-appender/index.js +8 -0
  608. package/src/components/block-mover/index.js +4 -4
  609. package/src/components/block-mover/index.native.js +4 -4
  610. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +10 -6
  611. package/src/components/block-mover/test/index.native.js +26 -28
  612. package/src/components/block-navigation/dropdown.js +0 -1
  613. package/src/components/block-patterns-list/index.js +1 -8
  614. package/src/components/block-patterns-list/style.scss +22 -12
  615. package/src/components/block-preview/README.md +1 -1
  616. package/src/components/block-preview/auto.js +1 -1
  617. package/src/components/block-preview/style.scss +0 -17
  618. package/src/components/block-settings/container.native.js +7 -0
  619. package/src/components/block-settings-menu/block-settings-dropdown.js +26 -13
  620. package/src/components/block-settings-menu-controls/index.js +9 -6
  621. package/src/components/block-styles/preview.native.js +2 -2
  622. package/src/components/block-switcher/block-styles-menu.js +1 -1
  623. package/src/components/block-switcher/index.js +7 -3
  624. package/src/components/block-switcher/test/__snapshots__/index.js.snap +1 -1
  625. package/src/components/block-switcher/test/index.js +3 -0
  626. package/src/components/block-title/index.js +5 -2
  627. package/src/components/block-tools/block-popover.js +3 -5
  628. package/src/components/block-tools/index.js +5 -2
  629. package/src/components/block-tools/insertion-point.js +97 -9
  630. package/src/components/block-tools/style.scss +4 -35
  631. package/src/components/block-types-list/style.scss +0 -3
  632. package/src/components/border-radius-control/index.js +1 -0
  633. package/src/components/border-radius-control/test/utils.js +216 -0
  634. package/src/components/border-radius-control/utils.js +18 -10
  635. package/src/components/color-palette/test/__snapshots__/control.js.snap +128 -71
  636. package/src/components/colors/test/utils.js +41 -0
  637. package/src/components/colors/utils.js +9 -5
  638. package/src/components/colors-gradients/control.js +70 -110
  639. package/src/components/colors-gradients/panel-color-gradient-settings.js +79 -7
  640. package/src/components/colors-gradients/style.scss +10 -18
  641. package/src/components/colors-gradients/test/control.js +41 -66
  642. package/src/components/contrast-checker/index.js +14 -10
  643. package/src/components/copy-handler/index.js +6 -1
  644. package/src/components/default-block-appender/index.js +2 -2
  645. package/src/components/default-block-appender/test/__snapshots__/index.js.snap +3 -3
  646. package/src/components/duotone-control/index.js +49 -41
  647. package/src/components/duotone-control/style.scss +27 -12
  648. package/src/components/editor-styles/index.js +7 -4
  649. package/src/components/font-appearance-control/index.js +41 -33
  650. package/src/components/font-appearance-control/style.scss +1 -1
  651. package/src/components/iframe/index.js +4 -4
  652. package/src/components/image-editor/aspect-ratio-dropdown.js +129 -0
  653. package/src/components/image-editor/constants.js +6 -0
  654. package/src/components/image-editor/context.js +56 -0
  655. package/src/components/image-editor/cropper.js +74 -0
  656. package/src/components/image-editor/form-controls.js +22 -0
  657. package/src/components/image-editor/index.js +52 -0
  658. package/src/components/image-editor/rotation-button.js +24 -0
  659. package/src/components/image-editor/use-save-image.js +97 -0
  660. package/src/components/image-editor/use-transform-image.js +162 -0
  661. package/src/components/image-editor/zoom-dropdown.js +40 -0
  662. package/src/components/image-size-control/use-dimension-handler.js +18 -1
  663. package/src/components/index.js +7 -6
  664. package/src/components/index.native.js +1 -4
  665. package/src/components/inner-blocks/button-block-appender.js +9 -0
  666. package/src/components/inner-blocks/index.js +8 -4
  667. package/src/components/inner-blocks/index.native.js +7 -4
  668. package/src/components/inner-blocks/use-nested-settings-update.js +26 -11
  669. package/src/components/inserter/block-patterns-explorer/explorer.js +50 -0
  670. package/src/components/inserter/block-patterns-explorer/patterns-list.js +122 -0
  671. package/src/components/inserter/block-patterns-explorer/sidebar.js +73 -0
  672. package/src/components/inserter/block-patterns-tab.js +107 -73
  673. package/src/components/inserter/block-types-tab.native.js +3 -15
  674. package/src/components/inserter/hooks/use-block-type-impressions.native.js +14 -21
  675. package/src/components/inserter/hooks/use-clipboard-block.native.js +3 -2
  676. package/src/components/inserter/index.js +15 -3
  677. package/src/components/inserter/index.native.js +2 -19
  678. package/src/components/inserter/library.js +2 -0
  679. package/src/components/inserter/menu.js +4 -1
  680. package/src/components/inserter/menu.native.js +9 -14
  681. package/src/components/inserter/pattern-panel.js +33 -16
  682. package/src/components/inserter/preview-panel.js +1 -1
  683. package/src/components/inserter/quick-inserter.js +1 -1
  684. package/src/components/inserter/reusable-blocks-tab.native.js +4 -6
  685. package/src/components/inserter/search-results.native.js +5 -15
  686. package/src/components/inserter/style.scss +80 -16
  687. package/src/components/inserter/test/block-types-tab.native.js +1 -1
  688. package/src/components/inserter/test/fixtures/index.native.js +12 -0
  689. package/src/components/inserter/utils.native.js +35 -0
  690. package/src/components/inserter-list-item/style.scss +4 -2
  691. package/src/components/inspector-controls/block-support-slot-container.js +10 -0
  692. package/src/components/inspector-controls/block-support-tools-panel.js +60 -0
  693. package/src/components/inspector-controls/fill.js +23 -2
  694. package/src/components/inspector-controls/groups.js +8 -0
  695. package/src/components/inspector-controls/slot.js +15 -0
  696. package/src/components/letter-spacing-control/index.js +12 -6
  697. package/src/components/link-control/README.md +47 -14
  698. package/src/components/link-control/index.js +102 -31
  699. package/src/components/link-control/link-preview.js +53 -20
  700. package/src/components/link-control/search-input.js +21 -7
  701. package/src/components/link-control/style.scss +66 -19
  702. package/src/components/link-control/test/index.js +311 -4
  703. package/src/components/list-view/block-contents.js +17 -38
  704. package/src/components/list-view/block.js +73 -84
  705. package/src/components/list-view/branch.js +123 -94
  706. package/src/components/list-view/index.js +82 -30
  707. package/src/components/list-view/leaf.js +2 -2
  708. package/src/components/list-view/list-item.js +5 -4
  709. package/src/components/list-view/style.scss +70 -33
  710. package/src/components/list-view/use-list-view-client-ids.js +9 -68
  711. package/src/components/media-placeholder/index.js +26 -19
  712. package/src/components/media-replace-flow/README.md +7 -0
  713. package/src/components/media-replace-flow/index.js +4 -1
  714. package/src/components/media-upload/README.md +1 -1
  715. package/src/components/navigable-toolbar/index.js +1 -4
  716. package/src/components/observe-typing/index.js +3 -2
  717. package/src/components/plain-text/index.native.js +26 -4
  718. package/src/components/rich-text/embed-handler-picker.native.js +68 -0
  719. package/src/components/rich-text/format-edit.js +36 -2
  720. package/src/components/rich-text/format-toolbar/index.js +25 -6
  721. package/src/components/rich-text/index.js +12 -8
  722. package/src/components/rich-text/index.native.js +35 -1
  723. package/src/components/rich-text/use-paste-handler.js +30 -12
  724. package/src/components/rich-text/utils.js +16 -0
  725. package/src/components/skip-to-selected-block/README.md +39 -0
  726. package/src/components/typewriter/index.js +3 -2
  727. package/src/components/url-input/index.js +26 -10
  728. package/src/components/use-moving-animation/index.js +9 -8
  729. package/src/components/use-on-block-drop/index.js +5 -1
  730. package/src/components/use-setting/index.js +49 -11
  731. package/src/components/writing-flow/use-multi-selection.js +6 -0
  732. package/src/components/writing-flow/use-tab-nav.js +17 -3
  733. package/src/hooks/align.js +19 -10
  734. package/src/hooks/anchor.js +2 -2
  735. package/src/hooks/border.js +8 -11
  736. package/src/hooks/color-panel.js +4 -1
  737. package/src/hooks/color.js +7 -4
  738. package/src/hooks/dimensions.js +48 -59
  739. package/src/hooks/duotone.js +68 -19
  740. package/src/hooks/font-appearance.js +38 -7
  741. package/src/hooks/font-family.js +129 -33
  742. package/src/hooks/font-size.js +42 -6
  743. package/src/hooks/gap.js +2 -1
  744. package/src/hooks/index.js +2 -0
  745. package/src/hooks/index.native.js +1 -0
  746. package/src/hooks/layout.scss +8 -0
  747. package/src/hooks/letter-spacing.js +35 -7
  748. package/src/hooks/line-height.js +37 -9
  749. package/src/hooks/lock.js +34 -0
  750. package/src/hooks/margin.js +1 -1
  751. package/src/hooks/padding.js +1 -1
  752. package/src/hooks/style.js +15 -11
  753. package/src/hooks/text-decoration.js +34 -6
  754. package/src/hooks/text-transform.js +34 -6
  755. package/src/hooks/typography.js +165 -15
  756. package/src/hooks/typography.scss +16 -0
  757. package/src/hooks/use-cached-truthy.js +20 -0
  758. package/src/index.js +1 -0
  759. package/src/layouts/flex.js +179 -50
  760. package/src/layouts/flow.js +54 -8
  761. package/src/store/actions.js +239 -377
  762. package/src/store/defaults.native.js +12 -0
  763. package/src/store/index.js +1 -2
  764. package/src/store/reducer.js +54 -18
  765. package/src/store/selectors.js +173 -47
  766. package/src/store/test/actions.js +407 -705
  767. package/src/store/test/reducer.js +22 -54
  768. package/src/store/test/selectors.js +79 -21
  769. package/src/style.scss +2 -1
  770. package/src/utils/index.js +1 -0
  771. package/src/utils/parse-css-unit-to-px.js +43 -1
  772. package/src/utils/test/parse-css-unit-to-px.js +148 -165
  773. package/src/utils/transform-styles/transforms/test/wrap.js +1 -1
  774. package/src/utils/transform-styles/transforms/wrap.js +16 -0
  775. package/tsconfig.tsbuildinfo +1 -1
  776. package/build/components/duotone-control/duotone-picker-popover.js +0 -44
  777. package/build/components/duotone-control/duotone-picker-popover.js.map +0 -1
  778. package/build/components/list-view/block-slot.js +0 -121
  779. package/build/components/list-view/block-slot.js.map +0 -1
  780. package/build/components/list-view/editor.js +0 -35
  781. package/build/components/list-view/editor.js.map +0 -1
  782. package/build/components/text-decoration-and-transform/index.js +0 -39
  783. package/build/components/text-decoration-and-transform/index.js.map +0 -1
  784. package/build/store/controls.js +0 -44
  785. package/build/store/controls.js.map +0 -1
  786. package/build-module/components/duotone-control/duotone-picker-popover.js +0 -35
  787. package/build-module/components/duotone-control/duotone-picker-popover.js.map +0 -1
  788. package/build-module/components/list-view/block-slot.js +0 -96
  789. package/build-module/components/list-view/block-slot.js.map +0 -1
  790. package/build-module/components/list-view/editor.js +0 -25
  791. package/build-module/components/list-view/editor.js.map +0 -1
  792. package/build-module/components/text-decoration-and-transform/index.js +0 -30
  793. package/build-module/components/text-decoration-and-transform/index.js.map +0 -1
  794. package/build-module/store/controls.js +0 -32
  795. package/build-module/store/controls.js.map +0 -1
  796. package/src/components/duotone-control/duotone-picker-popover.js +0 -36
  797. package/src/components/list-view/block-slot.js +0 -120
  798. package/src/components/list-view/editor.js +0 -29
  799. package/src/components/text-decoration-and-transform/index.js +0 -36
  800. package/src/components/text-decoration-and-transform/style.scss +0 -3
  801. package/src/store/controls.js +0 -39
@@ -16,6 +16,8 @@ var _data = require("@wordpress/data");
16
16
 
17
17
  var _components = require("@wordpress/components");
18
18
 
19
+ var _compose = require("@wordpress/compose");
20
+
19
21
  var _i18n = require("@wordpress/i18n");
20
22
 
21
23
  var _inserter = _interopRequireDefault(require("../inserter"));
@@ -94,6 +96,7 @@ function InsertionPointPopover({
94
96
  }, []);
95
97
  const previousElement = (0, _useBlockRefs.__unstableUseBlockElement)(previousClientId);
96
98
  const nextElement = (0, _useBlockRefs.__unstableUseBlockElement)(nextClientId);
99
+ const isVertical = orientation === 'vertical';
97
100
  const style = (0, _element.useMemo)(() => {
98
101
  if (!previousElement && !nextElement) {
99
102
  return {};
@@ -102,7 +105,7 @@ function InsertionPointPopover({
102
105
  const previousRect = previousElement ? previousElement.getBoundingClientRect() : null;
103
106
  const nextRect = nextElement ? nextElement.getBoundingClientRect() : null;
104
107
 
105
- if (orientation === 'vertical') {
108
+ if (isVertical) {
106
109
  return {
107
110
  width: previousElement ? previousElement.offsetWidth : nextElement.offsetWidth,
108
111
  height: nextRect && previousRect ? nextRect.top - previousRect.bottom : 0
@@ -131,7 +134,7 @@ function InsertionPointPopover({
131
134
  const previousRect = previousElement ? previousElement.getBoundingClientRect() : null;
132
135
  const nextRect = nextElement ? nextElement.getBoundingClientRect() : null;
133
136
 
134
- if (orientation === 'vertical') {
137
+ if (isVertical) {
135
138
  if ((0, _i18n.isRTL)()) {
136
139
  return {
137
140
  top: previousRect ? previousRect.bottom : nextRect.top,
@@ -170,6 +173,7 @@ function InsertionPointPopover({
170
173
  };
171
174
  }, [previousElement, nextElement]);
172
175
  const popoverScrollRef = (0, _usePopoverScroll.usePopoverScroll)(__unstableContentRef);
176
+ const disableMotion = (0, _compose.useReducedMotion)();
173
177
  const className = (0, _classnames.default)('block-editor-block-list__insertion-point', 'is-' + orientation);
174
178
 
175
179
  function onClick(event) {
@@ -188,7 +192,81 @@ function InsertionPointPopover({
188
192
  // previous and a next element.
189
193
 
190
194
 
191
- const showInsertionPointInserter = previousElement && nextElement && isInserterShown;
195
+ const showInsertionPointInserter = previousElement && nextElement && isInserterShown; // Define animation variants for the line element.
196
+
197
+ const horizontalLine = {
198
+ start: {
199
+ width: 0,
200
+ top: '50%',
201
+ bottom: '50%',
202
+ x: 0
203
+ },
204
+ rest: {
205
+ width: 4,
206
+ top: 0,
207
+ bottom: 0,
208
+ x: -2
209
+ },
210
+ hover: {
211
+ width: 4,
212
+ top: 0,
213
+ bottom: 0,
214
+ x: -2
215
+ }
216
+ };
217
+ const verticalLine = {
218
+ start: {
219
+ height: 0,
220
+ left: '50%',
221
+ right: '50%',
222
+ y: 0
223
+ },
224
+ rest: {
225
+ height: 4,
226
+ left: 0,
227
+ right: 0,
228
+ y: -2
229
+ },
230
+ hover: {
231
+ height: 4,
232
+ left: 0,
233
+ right: 0,
234
+ y: -2
235
+ }
236
+ };
237
+ const lineVariants = {
238
+ // Initial position starts from the center and invisible.
239
+ start: { ...(!isVertical ? horizontalLine.start : verticalLine.start),
240
+ opacity: 0
241
+ },
242
+ // The line expands to fill the container. If the inserter is visible it
243
+ // is delayed so it appears orchestrated.
244
+ rest: { ...(!isVertical ? horizontalLine.rest : verticalLine.rest),
245
+ opacity: 1,
246
+ borderRadius: '2px',
247
+ transition: {
248
+ delay: showInsertionPointInserter ? 0.4 : 0
249
+ }
250
+ },
251
+ hover: { ...(!isVertical ? horizontalLine.hover : verticalLine.hover),
252
+ opacity: 1,
253
+ borderRadius: '2px',
254
+ transition: {
255
+ delay: 0.4
256
+ }
257
+ }
258
+ };
259
+ const inserterVariants = {
260
+ start: {
261
+ scale: disableMotion ? 1 : 0
262
+ },
263
+ rest: {
264
+ scale: 1,
265
+ transition: {
266
+ delay: 0.2
267
+ }
268
+ }
269
+ };
192
270
  /* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
193
271
  // While ideally it would be enough to capture the
194
272
  // bubbling focus event from the Inserter, due to the
@@ -206,8 +284,17 @@ function InsertionPointPopover({
206
284
  className: "block-editor-block-list__insertion-point-popover" // Render in the old slot if needed for backward compatibility,
207
285
  // otherwise render in place (not in the the default popover slot).
208
286
  ,
209
- __unstableSlotName: __unstablePopoverSlot || null
210
- }, (0, _element.createElement)("div", {
287
+ __unstableSlotName: __unstablePopoverSlot || null // Forces a remount of the popover when its position changes
288
+ // This makes sure the popover doesn't animate from its previous position.
289
+ ,
290
+ key: nextClientId + '--' + rootClientId
291
+ }, (0, _element.createElement)(_components.__unstableMotion.div, {
292
+ layout: !disableMotion,
293
+ initial: disableMotion ? 'rest' : 'start',
294
+ animate: "rest",
295
+ whileHover: "hover",
296
+ whileTap: "pressed",
297
+ exit: "start",
211
298
  ref: ref,
212
299
  tabIndex: -1,
213
300
  onClick: onClick,
@@ -216,9 +303,11 @@ function InsertionPointPopover({
216
303
  'is-with-inserter': showInsertionPointInserter
217
304
  }),
218
305
  style: style
219
- }, (0, _element.createElement)("div", {
306
+ }, (0, _element.createElement)(_components.__unstableMotion.div, {
307
+ variants: lineVariants,
220
308
  className: "block-editor-block-list__insertion-point-indicator"
221
- }), showInsertionPointInserter && (0, _element.createElement)("div", {
309
+ }), showInsertionPointInserter && (0, _element.createElement)(_components.__unstableMotion.div, {
310
+ variants: inserterVariants,
222
311
  className: (0, _classnames.default)('block-editor-block-list__insertion-point-inserter')
223
312
  }, (0, _element.createElement)(_inserter.default, {
224
313
  position: "bottom center",
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/insertion-point.js"],"names":["InsertionPointOpenRef","InsertionPointPopover","__unstablePopoverSlot","__unstableContentRef","selectBlock","blockEditorStore","openRef","ref","orientation","previousClientId","nextClientId","rootClientId","isInserterShown","select","getBlockOrder","getBlockListSettings","getBlockInsertionPoint","isBlockBeingDragged","getPreviousBlockClientId","getNextBlockClientId","insertionPoint","order","length","_previousClientId","index","_nextClientId","__unstableWithInserter","previousElement","nextElement","style","previousRect","getBoundingClientRect","nextRect","width","offsetWidth","height","top","bottom","left","right","offsetHeight","getAnchorRect","ownerDocument","popoverScrollRef","className","onClick","event","target","current","onFocus","showInsertionPointInserter","isOpen","InsertionPoint","children","isVisible","isBlockInsertionPointVisible"],"mappings":";;;;;;;;;;AASA;;AANA;;AAKA;;AAQA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAGA;AACA;AACA;;AAYA;AACA;AACA;AAMO,MAAMA,qBAAqB,GAAG,6BAA9B;;;AAEP,SAASC,qBAAT,CAAgC;AAC/BC,EAAAA,qBAD+B;AAE/BC,EAAAA;AAF+B,CAAhC,EAGI;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAkB,uBAAaC,YAAb,CAAxB;AACA,QAAMC,OAAO,GAAG,yBAAYN,qBAAZ,CAAhB;AACA,QAAMO,GAAG,GAAG,sBAAZ;AACA,QAAM;AACLC,IAAAA,WADK;AAELC,IAAAA,gBAFK;AAGLC,IAAAA,YAHK;AAILC,IAAAA,YAJK;AAKLC,IAAAA;AALK,MAMF,qBAAaC,MAAF,IAAc;AAAA;;AAC5B,UAAM;AACLC,MAAAA,aADK;AAELC,MAAAA,oBAFK;AAGLC,MAAAA,sBAHK;AAILC,MAAAA,mBAJK;AAKLC,MAAAA,wBALK;AAMLC,MAAAA;AANK,QAOFN,MAAM,CAAER,YAAF,CAPV;AAQA,UAAMe,cAAc,GAAGJ,sBAAsB,EAA7C;AACA,UAAMK,KAAK,GAAGP,aAAa,CAAEM,cAAc,CAACT,YAAjB,CAA3B;;AAEA,QAAK,CAAEU,KAAK,CAACC,MAAb,EAAsB;AACrB,aAAO,EAAP;AACA;;AAED,QAAIC,iBAAiB,GAAGF,KAAK,CAAED,cAAc,CAACI,KAAf,GAAuB,CAAzB,CAA7B;AACA,QAAIC,aAAa,GAAGJ,KAAK,CAAED,cAAc,CAACI,KAAjB,CAAzB;;AAE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AAD;AACC,IAAA,QAAQ,EAAC,eADV;AAEC,IAAA,QAAQ,EAAGxC,YAFZ;AAGC,IAAA,YAAY,EAAGC,YAHhB;AAIC,IAAA,qBAAqB,MAJtB;AAKC,IAAA,QAAQ,EAAKwC,MAAF,IAAc;AACxB7C,MAAAA,OAAO,CAAC0C,OAAR,GAAkBG,MAAlB;AACA,KAPF;AAQC,IAAA,eAAe,EAAG,MAAM;AACvB7C,MAAAA,OAAO,CAAC0C,OAAR,GAAkB,KAAlB;AACA;AAVF,IALD,CAZF,CAXD,CADD;AA8CA;AACA;;AAEc,SAASI,cAAT,CAAyB;AACvCC,EAAAA,QADuC;AAEvCnD,EAAAA,qBAFuC;AAGvCC,EAAAA;AAHuC,CAAzB,EAIX;AACH,QAAMmD,SAAS,GAAG,qBAAazC,MAAF,IAAc;AAC1C,WAAOA,MAAM,CAAER,YAAF,CAAN,CAA2BkD,4BAA3B,EAAP;AACA,GAFiB,EAEf,EAFe,CAAlB;AAIA,SACC,4BAAC,qBAAD,CAAuB,QAAvB;AAAgC,IAAA,KAAK,EAAG,qBAAQ,KAAR;AAAxC,KACGD,SAAS,IACV,4BAAC,qBAAD;AACC,IAAA,qBAAqB,EAAGpD,qBADzB;AAEC,IAAA,oBAAoB,EAAGC;AAFxB,IAFF,EAOGkD,QAPH,CADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseCallback,\n\tuseRef,\n\tuseMemo,\n\tcreateContext,\n\tuseContext,\n} from '@wordpress/element';\nimport { Popover } from '@wordpress/components';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport { store as blockEditorStore } from '../../store';\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport { usePopoverScroll } from './use-popover-scroll';\n\nexport const InsertionPointOpenRef = createContext();\n\nfunction InsertionPointPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst ref = useRef();\n\tconst {\n\t\torientation,\n\t\tpreviousClientId,\n\t\tnextClientId,\n\t\trootClientId,\n\t\tisInserterShown,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockOrder,\n\t\t\tgetBlockListSettings,\n\t\t\tgetBlockInsertionPoint,\n\t\t\tisBlockBeingDragged,\n\t\t\tgetPreviousBlockClientId,\n\t\t\tgetNextBlockClientId,\n\t\t} = select( blockEditorStore );\n\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet _previousClientId = order[ insertionPoint.index - 1 ];\n\t\tlet _nextClientId = order[ insertionPoint.index ];\n\n\t\twhile ( isBlockBeingDragged( _previousClientId ) ) {\n\t\t\t_previousClientId = getPreviousBlockClientId( _previousClientId );\n\t\t}\n\n\t\twhile ( isBlockBeingDragged( _nextClientId ) ) {\n\t\t\t_nextClientId = getNextBlockClientId( _nextClientId );\n\t\t}\n\n\t\treturn {\n\t\t\tpreviousClientId: _previousClientId,\n\t\t\tnextClientId: _nextClientId,\n\t\t\torientation:\n\t\t\t\tgetBlockListSettings( insertionPoint.rootClientId )\n\t\t\t\t\t?.orientation || 'vertical',\n\t\t\trootClientId: insertionPoint.rootClientId,\n\t\t\tisInserterShown: insertionPoint?.__unstableWithInserter,\n\t\t};\n\t}, [] );\n\tconst previousElement = useBlockElement( previousClientId );\n\tconst nextElement = useBlockElement( nextClientId );\n\n\tconst style = useMemo( () => {\n\t\tif ( ! previousElement && ! nextElement ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst previousRect = previousElement\n\t\t\t? previousElement.getBoundingClientRect()\n\t\t\t: null;\n\t\tconst nextRect = nextElement\n\t\t\t? nextElement.getBoundingClientRect()\n\t\t\t: null;\n\n\t\tif ( orientation === 'vertical' ) {\n\t\t\treturn {\n\t\t\t\twidth: previousElement\n\t\t\t\t\t? previousElement.offsetWidth\n\t\t\t\t\t: nextElement.offsetWidth,\n\t\t\t\theight:\n\t\t\t\t\tnextRect && previousRect\n\t\t\t\t\t\t? nextRect.top - previousRect.bottom\n\t\t\t\t\t\t: 0,\n\t\t\t};\n\t\t}\n\n\t\tlet width = 0;\n\t\tif ( previousRect && nextRect ) {\n\t\t\twidth = isRTL()\n\t\t\t\t? previousRect.left - nextRect.right\n\t\t\t\t: nextRect.left - previousRect.right;\n\t\t}\n\n\t\treturn {\n\t\t\twidth,\n\t\t\theight: previousElement\n\t\t\t\t? previousElement.offsetHeight\n\t\t\t\t: nextElement.offsetHeight,\n\t\t};\n\t}, [ previousElement, nextElement ] );\n\n\tconst getAnchorRect = useCallback( () => {\n\t\tif ( ! previousElement && ! nextElement ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst { ownerDocument } = previousElement || nextElement;\n\n\t\tconst previousRect = previousElement\n\t\t\t? previousElement.getBoundingClientRect()\n\t\t\t: null;\n\t\tconst nextRect = nextElement\n\t\t\t? nextElement.getBoundingClientRect()\n\t\t\t: null;\n\n\t\tif ( orientation === 'vertical' ) {\n\t\t\tif ( isRTL() ) {\n\t\t\t\treturn {\n\t\t\t\t\ttop: previousRect ? previousRect.bottom : nextRect.top,\n\t\t\t\t\tleft: previousRect ? previousRect.right : nextRect.right,\n\t\t\t\t\tright: previousRect ? previousRect.left : nextRect.left,\n\t\t\t\t\tbottom: nextRect ? nextRect.top : previousRect.bottom,\n\t\t\t\t\townerDocument,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttop: previousRect ? previousRect.bottom : nextRect.top,\n\t\t\t\tleft: previousRect ? previousRect.left : nextRect.left,\n\t\t\t\tright: previousRect ? previousRect.right : nextRect.right,\n\t\t\t\tbottom: nextRect ? nextRect.top : previousRect.bottom,\n\t\t\t\townerDocument,\n\t\t\t};\n\t\t}\n\n\t\tif ( isRTL() ) {\n\t\t\treturn {\n\t\t\t\ttop: previousRect ? previousRect.top : nextRect.top,\n\t\t\t\tleft: previousRect ? previousRect.left : nextRect.right,\n\t\t\t\tright: nextRect ? nextRect.right : previousRect.left,\n\t\t\t\tbottom: previousRect ? previousRect.bottom : nextRect.bottom,\n\t\t\t\townerDocument,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\ttop: previousRect ? previousRect.top : nextRect.top,\n\t\t\tleft: previousRect ? previousRect.right : nextRect.left,\n\t\t\tright: nextRect ? nextRect.left : previousRect.right,\n\t\t\tbottom: previousRect ? previousRect.bottom : nextRect.bottom,\n\t\t\townerDocument,\n\t\t};\n\t}, [ previousElement, nextElement ] );\n\n\tconst popoverScrollRef = usePopoverScroll( __unstableContentRef );\n\n\tconst className = classnames(\n\t\t'block-editor-block-list__insertion-point',\n\t\t'is-' + orientation\n\t);\n\n\tfunction onClick( event ) {\n\t\tif ( event.target === ref.current && nextClientId ) {\n\t\t\tselectBlock( nextClientId, -1 );\n\t\t}\n\t}\n\n\tfunction onFocus( event ) {\n\t\t// Only handle click on the wrapper specifically, and not an event\n\t\t// bubbled from the inserter itself.\n\t\tif ( event.target !== ref.current ) {\n\t\t\topenRef.current = true;\n\t\t}\n\t}\n\n\t// Only show the in-between inserter between blocks, so when there's a\n\t// previous and a next element.\n\tconst showInsertionPointInserter =\n\t\tpreviousElement && nextElement && isInserterShown;\n\n\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n\t// While ideally it would be enough to capture the\n\t// bubbling focus event from the Inserter, due to the\n\t// characteristics of click focusing of `button`s in\n\t// Firefox and Safari, it is not reliable.\n\t//\n\t// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\treturn (\n\t\t<Popover\n\t\t\tref={ popoverScrollRef }\n\t\t\tnoArrow\n\t\t\tanimate={ false }\n\t\t\tgetAnchorRect={ getAnchorRect }\n\t\t\tfocusOnMount={ false }\n\t\t\tclassName=\"block-editor-block-list__insertion-point-popover\"\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot || null }\n\t\t>\n\t\t\t<div\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ -1 }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tclassName={ classnames( className, {\n\t\t\t\t\t'is-with-inserter': showInsertionPointInserter,\n\t\t\t\t} ) }\n\t\t\t\tstyle={ style }\n\t\t\t>\n\t\t\t\t<div className=\"block-editor-block-list__insertion-point-indicator\" />\n\t\t\t\t{ showInsertionPointInserter && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'block-editor-block-list__insertion-point-inserter'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Inserter\n\t\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\t\tclientId={ nextClientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t\t\tonToggle={ ( isOpen ) => {\n\t\t\t\t\t\t\t\topenRef.current = isOpen;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonSelectOrClose={ () => {\n\t\t\t\t\t\t\t\topenRef.current = false;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</Popover>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n}\n\nexport default function InsertionPoint( {\n\tchildren,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst isVisible = useSelect( ( select ) => {\n\t\treturn select( blockEditorStore ).isBlockInsertionPointVisible();\n\t}, [] );\n\n\treturn (\n\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t{ isVisible && (\n\t\t\t\t<InsertionPointPopover\n\t\t\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ children }\n\t\t</InsertionPointOpenRef.Provider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/insertion-point.js"],"names":["InsertionPointOpenRef","InsertionPointPopover","__unstablePopoverSlot","__unstableContentRef","selectBlock","blockEditorStore","openRef","ref","orientation","previousClientId","nextClientId","rootClientId","isInserterShown","select","getBlockOrder","getBlockListSettings","getBlockInsertionPoint","isBlockBeingDragged","getPreviousBlockClientId","getNextBlockClientId","insertionPoint","order","length","_previousClientId","index","_nextClientId","__unstableWithInserter","previousElement","nextElement","isVertical","style","previousRect","getBoundingClientRect","nextRect","width","offsetWidth","height","top","bottom","left","right","offsetHeight","getAnchorRect","ownerDocument","popoverScrollRef","disableMotion","className","onClick","event","target","current","onFocus","showInsertionPointInserter","horizontalLine","start","x","rest","hover","verticalLine","y","lineVariants","opacity","borderRadius","transition","delay","inserterVariants","scale","isOpen","InsertionPoint","children","isVisible","isBlockInsertionPointVisible"],"mappings":";;;;;;;;;;AASA;;AANA;;AAKA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AA1BA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AAMO,MAAMA,qBAAqB,GAAG,6BAA9B;;;AAEP,SAASC,qBAAT,CAAgC;AAC/BC,EAAAA,qBAD+B;AAE/BC,EAAAA;AAF+B,CAAhC,EAGI;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAkB,uBAAaC,YAAb,CAAxB;AACA,QAAMC,OAAO,GAAG,yBAAYN,qBAAZ,CAAhB;AACA,QAAMO,GAAG,GAAG,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c;AAC1C,WAAOA,MAAM,CAAER,YAAF,CAAN,CAA2BkE,4BAA3B,EAAP;AACA,GAFiB,EAEf,EAFe,CAAlB;AAIA,SACC,4BAAC,qBAAD,CAAuB,QAAvB;AAAgC,IAAA,KAAK,EAAG,qBAAQ,KAAR;AAAxC,KACGD,SAAS,IACV,4BAAC,qBAAD;AACC,IAAA,qBAAqB,EAAGpE,qBADzB;AAEC,IAAA,oBAAoB,EAAGC;AAFxB,IAFF,EAOGkE,QAPH,CADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseCallback,\n\tuseRef,\n\tuseMemo,\n\tcreateContext,\n\tuseContext,\n} from '@wordpress/element';\nimport { Popover, __unstableMotion as motion } from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport { store as blockEditorStore } from '../../store';\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport { usePopoverScroll } from './use-popover-scroll';\n\nexport const InsertionPointOpenRef = createContext();\n\nfunction InsertionPointPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst ref = useRef();\n\tconst {\n\t\torientation,\n\t\tpreviousClientId,\n\t\tnextClientId,\n\t\trootClientId,\n\t\tisInserterShown,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockOrder,\n\t\t\tgetBlockListSettings,\n\t\t\tgetBlockInsertionPoint,\n\t\t\tisBlockBeingDragged,\n\t\t\tgetPreviousBlockClientId,\n\t\t\tgetNextBlockClientId,\n\t\t} = select( blockEditorStore );\n\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet _previousClientId = order[ insertionPoint.index - 1 ];\n\t\tlet _nextClientId = order[ insertionPoint.index ];\n\n\t\twhile ( isBlockBeingDragged( _previousClientId ) ) {\n\t\t\t_previousClientId = getPreviousBlockClientId( _previousClientId );\n\t\t}\n\n\t\twhile ( isBlockBeingDragged( _nextClientId ) ) {\n\t\t\t_nextClientId = getNextBlockClientId( _nextClientId );\n\t\t}\n\n\t\treturn {\n\t\t\tpreviousClientId: _previousClientId,\n\t\t\tnextClientId: _nextClientId,\n\t\t\torientation:\n\t\t\t\tgetBlockListSettings( insertionPoint.rootClientId )\n\t\t\t\t\t?.orientation || 'vertical',\n\t\t\trootClientId: insertionPoint.rootClientId,\n\t\t\tisInserterShown: insertionPoint?.__unstableWithInserter,\n\t\t};\n\t}, [] );\n\tconst previousElement = useBlockElement( previousClientId );\n\tconst nextElement = useBlockElement( nextClientId );\n\tconst isVertical = orientation === 'vertical';\n\tconst style = useMemo( () => {\n\t\tif ( ! previousElement && ! nextElement ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst previousRect = previousElement\n\t\t\t? previousElement.getBoundingClientRect()\n\t\t\t: null;\n\t\tconst nextRect = nextElement\n\t\t\t? nextElement.getBoundingClientRect()\n\t\t\t: null;\n\n\t\tif ( isVertical ) {\n\t\t\treturn {\n\t\t\t\twidth: previousElement\n\t\t\t\t\t? previousElement.offsetWidth\n\t\t\t\t\t: nextElement.offsetWidth,\n\t\t\t\theight:\n\t\t\t\t\tnextRect && previousRect\n\t\t\t\t\t\t? nextRect.top - previousRect.bottom\n\t\t\t\t\t\t: 0,\n\t\t\t};\n\t\t}\n\n\t\tlet width = 0;\n\t\tif ( previousRect && nextRect ) {\n\t\t\twidth = isRTL()\n\t\t\t\t? previousRect.left - nextRect.right\n\t\t\t\t: nextRect.left - previousRect.right;\n\t\t}\n\n\t\treturn {\n\t\t\twidth,\n\t\t\theight: previousElement\n\t\t\t\t? previousElement.offsetHeight\n\t\t\t\t: nextElement.offsetHeight,\n\t\t};\n\t}, [ previousElement, nextElement ] );\n\n\tconst getAnchorRect = useCallback( () => {\n\t\tif ( ! previousElement && ! nextElement ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst { ownerDocument } = previousElement || nextElement;\n\n\t\tconst previousRect = previousElement\n\t\t\t? previousElement.getBoundingClientRect()\n\t\t\t: null;\n\t\tconst nextRect = nextElement\n\t\t\t? nextElement.getBoundingClientRect()\n\t\t\t: null;\n\n\t\tif ( isVertical ) {\n\t\t\tif ( isRTL() ) {\n\t\t\t\treturn {\n\t\t\t\t\ttop: previousRect ? previousRect.bottom : nextRect.top,\n\t\t\t\t\tleft: previousRect ? previousRect.right : nextRect.right,\n\t\t\t\t\tright: previousRect ? previousRect.left : nextRect.left,\n\t\t\t\t\tbottom: nextRect ? nextRect.top : previousRect.bottom,\n\t\t\t\t\townerDocument,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttop: previousRect ? previousRect.bottom : nextRect.top,\n\t\t\t\tleft: previousRect ? previousRect.left : nextRect.left,\n\t\t\t\tright: previousRect ? previousRect.right : nextRect.right,\n\t\t\t\tbottom: nextRect ? nextRect.top : previousRect.bottom,\n\t\t\t\townerDocument,\n\t\t\t};\n\t\t}\n\n\t\tif ( isRTL() ) {\n\t\t\treturn {\n\t\t\t\ttop: previousRect ? previousRect.top : nextRect.top,\n\t\t\t\tleft: previousRect ? previousRect.left : nextRect.right,\n\t\t\t\tright: nextRect ? nextRect.right : previousRect.left,\n\t\t\t\tbottom: previousRect ? previousRect.bottom : nextRect.bottom,\n\t\t\t\townerDocument,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\ttop: previousRect ? previousRect.top : nextRect.top,\n\t\t\tleft: previousRect ? previousRect.right : nextRect.left,\n\t\t\tright: nextRect ? nextRect.left : previousRect.right,\n\t\t\tbottom: previousRect ? previousRect.bottom : nextRect.bottom,\n\t\t\townerDocument,\n\t\t};\n\t}, [ previousElement, nextElement ] );\n\n\tconst popoverScrollRef = usePopoverScroll( __unstableContentRef );\n\tconst disableMotion = useReducedMotion();\n\n\tconst className = classnames(\n\t\t'block-editor-block-list__insertion-point',\n\t\t'is-' + orientation\n\t);\n\n\tfunction onClick( event ) {\n\t\tif ( event.target === ref.current && nextClientId ) {\n\t\t\tselectBlock( nextClientId, -1 );\n\t\t}\n\t}\n\n\tfunction onFocus( event ) {\n\t\t// Only handle click on the wrapper specifically, and not an event\n\t\t// bubbled from the inserter itself.\n\t\tif ( event.target !== ref.current ) {\n\t\t\topenRef.current = true;\n\t\t}\n\t}\n\n\t// Only show the in-between inserter between blocks, so when there's a\n\t// previous and a next element.\n\tconst showInsertionPointInserter =\n\t\tpreviousElement && nextElement && isInserterShown;\n\n\t// Define animation variants for the line element.\n\tconst horizontalLine = {\n\t\tstart: {\n\t\t\twidth: 0,\n\t\t\ttop: '50%',\n\t\t\tbottom: '50%',\n\t\t\tx: 0,\n\t\t},\n\t\trest: {\n\t\t\twidth: 4,\n\t\t\ttop: 0,\n\t\t\tbottom: 0,\n\t\t\tx: -2,\n\t\t},\n\t\thover: {\n\t\t\twidth: 4,\n\t\t\ttop: 0,\n\t\t\tbottom: 0,\n\t\t\tx: -2,\n\t\t},\n\t};\n\tconst verticalLine = {\n\t\tstart: {\n\t\t\theight: 0,\n\t\t\tleft: '50%',\n\t\t\tright: '50%',\n\t\t\ty: 0,\n\t\t},\n\t\trest: {\n\t\t\theight: 4,\n\t\t\tleft: 0,\n\t\t\tright: 0,\n\t\t\ty: -2,\n\t\t},\n\t\thover: {\n\t\t\theight: 4,\n\t\t\tleft: 0,\n\t\t\tright: 0,\n\t\t\ty: -2,\n\t\t},\n\t};\n\tconst lineVariants = {\n\t\t// Initial position starts from the center and invisible.\n\t\tstart: {\n\t\t\t...( ! isVertical ? horizontalLine.start : verticalLine.start ),\n\t\t\topacity: 0,\n\t\t},\n\t\t// The line expands to fill the container. If the inserter is visible it\n\t\t// is delayed so it appears orchestrated.\n\t\trest: {\n\t\t\t...( ! isVertical ? horizontalLine.rest : verticalLine.rest ),\n\t\t\topacity: 1,\n\t\t\tborderRadius: '2px',\n\t\t\ttransition: { delay: showInsertionPointInserter ? 0.4 : 0 },\n\t\t},\n\t\thover: {\n\t\t\t...( ! isVertical ? horizontalLine.hover : verticalLine.hover ),\n\t\t\topacity: 1,\n\t\t\tborderRadius: '2px',\n\t\t\ttransition: { delay: 0.4 },\n\t\t},\n\t};\n\n\tconst inserterVariants = {\n\t\tstart: {\n\t\t\tscale: disableMotion ? 1 : 0,\n\t\t},\n\t\trest: {\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: 0.2 },\n\t\t},\n\t};\n\n\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n\t// While ideally it would be enough to capture the\n\t// bubbling focus event from the Inserter, due to the\n\t// characteristics of click focusing of `button`s in\n\t// Firefox and Safari, it is not reliable.\n\t//\n\t// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\treturn (\n\t\t<Popover\n\t\t\tref={ popoverScrollRef }\n\t\t\tnoArrow\n\t\t\tanimate={ false }\n\t\t\tgetAnchorRect={ getAnchorRect }\n\t\t\tfocusOnMount={ false }\n\t\t\tclassName=\"block-editor-block-list__insertion-point-popover\"\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot || null }\n\t\t\t// Forces a remount of the popover when its position changes\n\t\t\t// This makes sure the popover doesn't animate from its previous position.\n\t\t\tkey={ nextClientId + '--' + rootClientId }\n\t\t>\n\t\t\t<motion.div\n\t\t\t\tlayout={ ! disableMotion }\n\t\t\t\tinitial={ disableMotion ? 'rest' : 'start' }\n\t\t\t\tanimate=\"rest\"\n\t\t\t\twhileHover=\"hover\"\n\t\t\t\twhileTap=\"pressed\"\n\t\t\t\texit=\"start\"\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ -1 }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tclassName={ classnames( className, {\n\t\t\t\t\t'is-with-inserter': showInsertionPointInserter,\n\t\t\t\t} ) }\n\t\t\t\tstyle={ style }\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ lineVariants }\n\t\t\t\t\tclassName=\"block-editor-block-list__insertion-point-indicator\"\n\t\t\t\t/>\n\t\t\t\t{ showInsertionPointInserter && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tvariants={ inserterVariants }\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'block-editor-block-list__insertion-point-inserter'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Inserter\n\t\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\t\tclientId={ nextClientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t\t\tonToggle={ ( isOpen ) => {\n\t\t\t\t\t\t\t\topenRef.current = isOpen;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonSelectOrClose={ () => {\n\t\t\t\t\t\t\t\topenRef.current = false;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</motion.div>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t</Popover>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n}\n\nexport default function InsertionPoint( {\n\tchildren,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst isVisible = useSelect( ( select ) => {\n\t\treturn select( blockEditorStore ).isBlockInsertionPointVisible();\n\t}, [] );\n\n\treturn (\n\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t{ isVisible && (\n\t\t\t\t<InsertionPointPopover\n\t\t\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ children }\n\t\t</InsertionPointOpenRef.Provider>\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/border-radius-control/index.js"],"names":["DEFAULT_VALUES","topLeft","topRight","bottomLeft","bottomRight","MIN_BORDER_RADIUS_VALUE","MAX_BORDER_RADIUS_VALUES","px","em","rem","BorderRadiusControl","onChange","values","isLinked","setIsLinked","units","availableUnits","unit","unitConfig","find","item","value","step","allValue","toggleLinked","handleSliderChange","next","undefined"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AASA;AACA;AACA;AAYA,MAAMA,cAAc,GAAG;AACtBC,EAAAA,OAAO,EAAE,IADa;AAEtBC,EAAAA,QAAQ,EAAE,IAFY;AAGtBC,EAAAA,UAAU,EAAE,IAHU;AAItBC,EAAAA,WAAW,EAAE;AAJS,CAAvB;AAMA,MAAMC,uBAAuB,GAAG,CAAhC;AACA,MAAMC,wBAAwB,GAAG;AAChCC,EAAAA,EAAE,EAAE,GAD4B;AAEhCC,EAAAA,EAAE,EAAE,EAF4B;AAGhCC,EAAAA,GAAG,EAAE;AAH2B,CAAjC;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASC,mBAAT,CAA8B;AAAEC,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,CAA9B,EAAqD;AACnE,QAAM,CAAEC,QAAF,EAAYC,WAAZ,IAA4B,uBACjC,CAAE,6BAAkBF,MAAlB,CAAF,IAAgC,CAAE,2BAAgBA,MAAhB,CADD,CAAlC;AAIA,QAAMG,KAAK,GAAG,8CAAgB;AAC7BC,IAAAA,cAAc,EAAE,yBAAY,eAAZ,KAAiC,CAAE,IAAF,EAAQ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EAAGH;AARR,IATD,CADS,GAsBT,4BAAC,sBAAD;AACC,IAAA,GAAG,EAAGjB,uBADP;AAEC,IAAA,QAAQ,EAAGM,QAFZ;AAGC,IAAA,MAAM,EAAGC,MAAM,IAAIZ,cAHpB;AAIC,IAAA,KAAK,EAAGe;AAJT,IAvBF,EA8BC,4BAAC,qBAAD;AAAc,IAAA,OAAO,EAAGS,YAAxB;AAAuC,IAAA,QAAQ,EAAGX;AAAlD,IA9BD,CAFD,CADD;AAqCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tRangeControl,\n\t__experimentalParseUnit as parseUnit,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport AllInputControl from './all-input-control';\nimport InputControls from './input-controls';\nimport LinkedButton from './linked-button';\nimport useSetting from '../use-setting';\nimport {\n\tgetAllValue,\n\tgetAllUnit,\n\thasDefinedValues,\n\thasMixedValues,\n} from './utils';\n\nconst DEFAULT_VALUES = {\n\ttopLeft: null,\n\ttopRight: null,\n\tbottomLeft: null,\n\tbottomRight: null,\n};\nconst MIN_BORDER_RADIUS_VALUE = 0;\nconst MAX_BORDER_RADIUS_VALUES = {\n\tpx: 100,\n\tem: 20,\n\trem: 20,\n};\n\n/**\n * Control to display border radius options.\n *\n * @param {Object} props Component props.\n * @param {Function} props.onChange Callback to handle onChange.\n * @param {Object} props.values Border radius values.\n *\n * @return {WPElement} Custom border radius control.\n */\nexport default function BorderRadiusControl( { onChange, values } ) {\n\tconst [ isLinked, setIsLinked ] = useState(\n\t\t! hasDefinedValues( values ) || ! hasMixedValues( values )\n\t);\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [ 'px', 'em', 'rem' ],\n\t} );\n\tconst unit = getAllUnit( values );\n\tconst unitConfig = units && units.find( ( item ) => item.value === unit );\n\tconst step = unitConfig?.step || 1;\n\n\tconst [ allValue ] = parseUnit( getAllValue( values ) );\n\n\tconst toggleLinked = () => setIsLinked( ! isLinked );\n\n\tconst handleSliderChange = ( next ) => {\n\t\tonChange( next !== undefined ? `${ next }${ unit }` : undefined );\n\t};\n\n\treturn (\n\t\t<fieldset className=\"components-border-radius-control\">\n\t\t\t<legend>{ __( 'Radius' ) }</legend>\n\t\t\t<div className=\"components-border-radius-control__wrapper\">\n\t\t\t\t{ isLinked ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<AllInputControl\n\t\t\t\t\t\t\tclassName=\"components-border-radius-control__unit-control\"\n\t\t\t\t\t\t\tvalues={ values }\n\t\t\t\t\t\t\tmin={ MIN_BORDER_RADIUS_VALUE }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tunit={ unit }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\tclassName=\"components-border-radius-control__range-control\"\n\t\t\t\t\t\t\tvalue={ allValue }\n\t\t\t\t\t\t\tmin={ MIN_BORDER_RADIUS_VALUE }\n\t\t\t\t\t\t\tmax={ MAX_BORDER_RADIUS_VALUES[ unit ] }\n\t\t\t\t\t\t\tinitialPosition={ 0 }\n\t\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\t\tonChange={ handleSliderChange }\n\t\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\t<InputControls\n\t\t\t\t\t\tmin={ MIN_BORDER_RADIUS_VALUE }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tvalues={ values || DEFAULT_VALUES }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<LinkedButton onClick={ toggleLinked } isLinked={ isLinked } />\n\t\t\t</div>\n\t\t</fieldset>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/border-radius-control/index.js"],"names":["DEFAULT_VALUES","topLeft","topRight","bottomLeft","bottomRight","MIN_BORDER_RADIUS_VALUE","MAX_BORDER_RADIUS_VALUES","px","em","rem","BorderRadiusControl","onChange","values","isLinked","setIsLinked","units","availableUnits","unit","unitConfig","find","item","value","step","allValue","toggleLinked","handleSliderChange","next","undefined"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AASA;AACA;AACA;AAYA,MAAMA,cAAc,GAAG;AACtBC,EAAAA,OAAO,EAAE,IADa;AAEtBC,EAAAA,QAAQ,EAAE,IAFY;AAGtBC,EAAAA,UAAU,EAAE,IAHU;AAItBC,EAAAA,WAAW,EAAE;AAJS,CAAvB;AAMA,MAAMC,uBAAuB,GAAG,CAAhC;AACA,MAAMC,wBAAwB,GAAG;AAChCC,EAAAA,EAAE,EAAE,GAD4B;AAEhCC,EAAAA,EAAE,EAAE,EAF4B;AAGhCC,EAAAA,GAAG,EAAE;AAH2B,CAAjC;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASC,mBAAT,CAA8B;AAAEC,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,CAA9B,EAAqD;AACnE,QAAM,CAAEC,QAAF,EAAYC,WAAZ,IAA4B,uBACjC,CAAE,6BAAkBF,MAAlB,CAAF,IAAgC,CAAE,2BAAgBA,MAAhB,CADD,CAAlC;AAIA,QAAMG,KAAK,GAAG,8CAAgB;AAC7BC,IAAAA,cAAc,EAAE,yBAAY,eAAZ,KAAiC,CAAE,IAAF,EAAQ,IAAR,EAAc,KAAd;AADpB,GAAhB,CAAd;AAIA,QAAMC,IAAI,GAAG,uBAAYL,MAAZ,CAAb;AACA,QAAMM,UAAU,GAAGH,KAAK,IAAIA,KAAK,CAACI,IAAN,CAAcC,IAAF,IAAYA,IAAI,CAACC,KAAL,KAAeJ,IAAvC,CAA5B;AACA,QAAMK,IAAI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,IAAA,OAAO,EAAGS,YAAxB;AAAuC,IAAA,QAAQ,EAAGX;AAAlD,IA9BD,CAFD,CADD;AAqCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tRangeControl,\n\t__experimentalParseUnit as parseUnit,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport AllInputControl from './all-input-control';\nimport InputControls from './input-controls';\nimport LinkedButton from './linked-button';\nimport useSetting from '../use-setting';\nimport {\n\tgetAllValue,\n\tgetAllUnit,\n\thasDefinedValues,\n\thasMixedValues,\n} from './utils';\n\nconst DEFAULT_VALUES = {\n\ttopLeft: null,\n\ttopRight: null,\n\tbottomLeft: null,\n\tbottomRight: null,\n};\nconst MIN_BORDER_RADIUS_VALUE = 0;\nconst MAX_BORDER_RADIUS_VALUES = {\n\tpx: 100,\n\tem: 20,\n\trem: 20,\n};\n\n/**\n * Control to display border radius options.\n *\n * @param {Object} props Component props.\n * @param {Function} props.onChange Callback to handle onChange.\n * @param {Object} props.values Border radius values.\n *\n * @return {WPElement} Custom border radius control.\n */\nexport default function BorderRadiusControl( { onChange, values } ) {\n\tconst [ isLinked, setIsLinked ] = useState(\n\t\t! hasDefinedValues( values ) || ! hasMixedValues( values )\n\t);\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [ 'px', 'em', 'rem' ],\n\t} );\n\n\tconst unit = getAllUnit( values );\n\tconst unitConfig = units && units.find( ( item ) => item.value === unit );\n\tconst step = unitConfig?.step || 1;\n\n\tconst [ allValue ] = parseUnit( getAllValue( values ) );\n\n\tconst toggleLinked = () => setIsLinked( ! isLinked );\n\n\tconst handleSliderChange = ( next ) => {\n\t\tonChange( next !== undefined ? `${ next }${ unit }` : undefined );\n\t};\n\n\treturn (\n\t\t<fieldset className=\"components-border-radius-control\">\n\t\t\t<legend>{ __( 'Radius' ) }</legend>\n\t\t\t<div className=\"components-border-radius-control__wrapper\">\n\t\t\t\t{ isLinked ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<AllInputControl\n\t\t\t\t\t\t\tclassName=\"components-border-radius-control__unit-control\"\n\t\t\t\t\t\t\tvalues={ values }\n\t\t\t\t\t\t\tmin={ MIN_BORDER_RADIUS_VALUE }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tunit={ unit }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\tclassName=\"components-border-radius-control__range-control\"\n\t\t\t\t\t\t\tvalue={ allValue }\n\t\t\t\t\t\t\tmin={ MIN_BORDER_RADIUS_VALUE }\n\t\t\t\t\t\t\tmax={ MAX_BORDER_RADIUS_VALUES[ unit ] }\n\t\t\t\t\t\t\tinitialPosition={ 0 }\n\t\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\t\tonChange={ handleSliderChange }\n\t\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\t<InputControls\n\t\t\t\t\t\tmin={ MIN_BORDER_RADIUS_VALUE }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tvalues={ values || DEFAULT_VALUES }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<LinkedButton onClick={ toggleLinked } isLinked={ isLinked } />\n\t\t\t</div>\n\t\t</fieldset>\n\t);\n}\n"]}
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.mode = mode;
6
7
  exports.getAllUnit = getAllUnit;
7
8
  exports.getAllValue = getAllValue;
8
9
  exports.hasMixedValues = hasMixedValues;
@@ -15,20 +16,28 @@ var _components = require("@wordpress/components");
15
16
  */
16
17
 
17
18
  /**
18
- * Gets the item with the highest occurrence within an array
19
- * https://stackoverflow.com/a/20762713
19
+ * Gets the (non-undefined) item with the highest occurrence within an array
20
+ * Based in part on: https://stackoverflow.com/a/20762713
20
21
  *
21
- * @param {Array<any>} arr Array of items to check.
22
- * @return {any} The item with the most occurrences.
22
+ * Undefined values are always sorted to the end by `sort`, so this function
23
+ * returns the first element, to always prioritize real values over undefined
24
+ * values.
25
+ *
26
+ * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description
27
+ *
28
+ * @param {Array<any>} inputArray Array of items to check.
29
+ * @return {any} The item with the most occurrences.
23
30
  */
24
- function mode(arr) {
25
- return arr.sort((a, b) => arr.filter(v => v === a).length - arr.filter(v => v === b).length).pop();
31
+ function mode(inputArray) {
32
+ const arr = [...inputArray];
33
+ return arr.sort((a, b) => inputArray.filter(v => v === b).length - inputArray.filter(v => v === a).length).shift();
26
34
  }
27
35
  /**
28
36
  * Returns the most common CSS unit in the radius values.
37
+ * Falls back to `px` as a default unit.
29
38
  *
30
39
  * @param {Object|string} values Radius values.
31
- * @return {string} Most common CSS unit in values.
40
+ * @return {string} Most common CSS unit in values. Default: `px`.
32
41
  */
33
42
 
34
43
 
@@ -42,7 +51,7 @@ function getAllUnit(values = {}) {
42
51
  const [, unit] = (0, _components.__experimentalParseUnit)(value);
43
52
  return unit;
44
53
  });
45
- return mode(allUnits);
54
+ return mode(allUnits) || 'px';
46
55
  }
47
56
  /**
48
57
  * Gets the 'all' input value and unit from values data.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/border-radius-control/utils.js"],"names":["mode","arr","sort","a","b","filter","v","length","pop","getAllUnit","values","unit","allUnits","Object","map","value","getAllValue","parsedValues","allValues","every","allValue","hasMixedValues","isMixed","isNaN","parseFloat","hasDefinedValues","filteredValues"],"mappings":";;;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,IAAT,CAAeC,GAAf,E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AS,CAACC,KAAV,CAAmBb,CAAF,IAASA,CAAC,KAAKY,SAAS,CAAE,CAAF,CAAzC,IACXA,SAAS,CAAE,CAAF,CADE,GAEX,EAFH;AAGA,QAAMP,IAAI,GAAGX,IAAI,CAAEY,QAAF,CAAjB;AAEA,QAAMQ,QAAQ,GAAGL,KAAK,KAAK,CAAV,IAAeA,KAAf,GAAwB,GAAGA,KAAO,GAAGJ,IAAM,EAA3C,GAA+C,IAAhE;AAEA,SAAOS,QAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,cAAT,CAAyBX,MAAM,GAAG,EAAlC,EAAuC;AAC7C,QAAMU,QAAQ,GAAGJ,WAAW,CAAEN,MAAF,CAA5B;AACA,QAAMY,OAAO,GAAGC,KAAK,CAAEC,UAAU,CAAEJ,QAAF,CAAZ,CAArB;AAEA,SAAOE,OAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASG,gBAAT,CAA2Bf,MAA3B,EAAoC;AAC1C,MAAK,CAAEA,MAAP,EAAgB;AACf,WAAO,KAAP;AACA,GAHyC,CAK1C;;;AACA,MAAK,OAAOA,MAAP,KAAkB,QAAvB,EAAkC;AACjC,WAAO,IAAP;AACA,GARyC,CAU1C;AACA;;;AACA,QAAMgB,cAAc,GAAGb,MAAM,CAACH,MAAP,CAAeA,MAAf,EAAwBL,MAAxB,CAAkCU,KAAF,IAAa;AACnE,WAAO,CAAC,CAAEA,KAAH,IAAYA,KAAK,KAAK,CAA7B;AACA,GAFsB,CAAvB;AAIA,SAAO,CAAC,CAAEW,cAAc,CAACnB,MAAzB;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalParseUnit as parseUnit } from '@wordpress/components';\n\n/**\n * Gets the item with the highest occurrence within an array\n * https://stackoverflow.com/a/20762713\n *\n * @param {Array<any>} arr Array of items to check.\n * @return {any} The item with the most occurrences.\n */\nfunction mode( arr ) {\n\treturn arr\n\t\t.sort(\n\t\t\t( a, b ) =>\n\t\t\t\tarr.filter( ( v ) => v === a ).length -\n\t\t\t\tarr.filter( ( v ) => v === b ).length\n\t\t)\n\t\t.pop();\n}\n\n/**\n * Returns the most common CSS unit in the radius values.\n *\n * @param {Object|string} values Radius values.\n * @return {string} Most common CSS unit in values.\n */\nexport function getAllUnit( values = {} ) {\n\tif ( typeof values === 'string' ) {\n\t\tconst [ , unit ] = parseUnit( values );\n\t\treturn unit || 'px';\n\t}\n\n\tconst allUnits = Object.values( values ).map( ( value ) => {\n\t\tconst [ , unit ] = parseUnit( value );\n\t\treturn unit;\n\t} );\n\n\treturn mode( allUnits );\n}\n\n/**\n * Gets the 'all' input value and unit from values data.\n *\n * @param {Object|string} values Radius values.\n * @return {string} A value + unit for the 'all' input.\n */\nexport function getAllValue( values = {} ) {\n\t/**\n\t * Border radius support was originally a single pixel value.\n\t *\n\t * To maintain backwards compatibility treat this case as the all value.\n\t */\n\tif ( typeof values === 'string' ) {\n\t\treturn values;\n\t}\n\n\tconst parsedValues = Object.values( values ).map( ( value ) =>\n\t\tparseUnit( value )\n\t);\n\n\tconst allValues = parsedValues.map( ( value ) => value[ 0 ] );\n\tconst allUnits = parsedValues.map( ( value ) => value[ 1 ] );\n\n\tconst value = allValues.every( ( v ) => v === allValues[ 0 ] )\n\t\t? allValues[ 0 ]\n\t\t: '';\n\tconst unit = mode( allUnits );\n\n\tconst allValue = value === 0 || value ? `${ value }${ unit }` : null;\n\n\treturn allValue;\n}\n\n/**\n * Checks to determine if values are mixed.\n *\n * @param {Object} values Radius values.\n * @return {boolean} Whether values are mixed.\n */\nexport function hasMixedValues( values = {} ) {\n\tconst allValue = getAllValue( values );\n\tconst isMixed = isNaN( parseFloat( allValue ) );\n\n\treturn isMixed;\n}\n\n/**\n * Checks to determine if values are defined.\n *\n * @param {Object} values Radius values.\n * @return {boolean} Whether values are mixed.\n */\nexport function hasDefinedValues( values ) {\n\tif ( ! values ) {\n\t\treturn false;\n\t}\n\n\t// A string value represents a shorthand value.\n\tif ( typeof values === 'string' ) {\n\t\treturn true;\n\t}\n\n\t// An object represents longhand border radius values, if any are set\n\t// flag values as being defined.\n\tconst filteredValues = Object.values( values ).filter( ( value ) => {\n\t\treturn !! value || value === 0;\n\t} );\n\n\treturn !! filteredValues.length;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/border-radius-control/utils.js"],"names":["mode","inputArray","arr","sort","a","b","filter","v","length","shift","getAllUnit","values","unit","allUnits","Object","map","value","getAllValue","parsedValues","allValues","every","allValue","hasMixedValues","isMixed","isNaN","parseFloat","hasDefinedValues","filteredValues"],"mappings":";;;;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,IAAT,CAAeC,UAAf,EAA4B;AAClC,QAAMC,GAAG,GAAG,CAAE,GAAGD,UAAL,CAAZ;AACA,SAAOC,GAAG,CACRC,IADK,CAEL,CAAEC,CAAF,EAAKC,CAAL,KACCJ,UAAU,CAACK,MAAX,CAAqBC,CAAF,IAASA,CAAC,KAAKF,CAAlC,EAAsCG,MAAtC,GACAP,UAAU,CAACK,MAAX,CAAqBC,CAAF,IAASA,CAAC,KAAKH,CAAlC,EAAsCI,MAJlC,EAMLC,KANK,EAAP;AAOA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,UAAT,CAAqBC,MAAM,GAAG,EAA9B,EAAmC;AACzC,MAAK,OAAOA,MAAP,KAAkB,QAAvB,EAAkC;AACjC,UAAM,GAAIC,IAAJ,IAAa,yCAAWD,MAAX,CAAnB;AACA,WAAOC,IAAI,IAAI,IAAf;AACA;;AAED,QAAMC,QAAQ,GAAGC,MAAM,CAACH,MAAP,CAAeA,MAAf,EAAwBI,GAAxB,CAA+BC,KAAF,IAAa;AAC1D,UAAM,GAAIJ,IAAJ,IAAa,yCAAWI,KAAX,CAAnB;AACA,WAAOJ,IAAP;AACA,GAHgB,CAAjB;AAKA,SA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f,WAAO,KAAP;AACA,GAHyC,CAK1C;;;AACA,MAAK,OAAOA,MAAP,KAAkB,QAAvB,EAAkC;AACjC,WAAO,IAAP;AACA,GARyC,CAU1C;AACA;;;AACA,QAAMgB,cAAc,GAAGb,MAAM,CAACH,MAAP,CAAeA,MAAf,EAAwBL,MAAxB,CAAkCU,KAAF,IAAa;AACnE,WAAO,CAAC,CAAEA,KAAH,IAAYA,KAAK,KAAK,CAA7B;AACA,GAFsB,CAAvB;AAIA,SAAO,CAAC,CAAEW,cAAc,CAACnB,MAAzB;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalParseUnit as parseUnit } from '@wordpress/components';\n\n/**\n * Gets the (non-undefined) item with the highest occurrence within an array\n * Based in part on: https://stackoverflow.com/a/20762713\n *\n * Undefined values are always sorted to the end by `sort`, so this function\n * returns the first element, to always prioritize real values over undefined\n * values.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description\n *\n * @param {Array<any>} inputArray Array of items to check.\n * @return {any} The item with the most occurrences.\n */\nexport function mode( inputArray ) {\n\tconst arr = [ ...inputArray ];\n\treturn arr\n\t\t.sort(\n\t\t\t( a, b ) =>\n\t\t\t\tinputArray.filter( ( v ) => v === b ).length -\n\t\t\t\tinputArray.filter( ( v ) => v === a ).length\n\t\t)\n\t\t.shift();\n}\n\n/**\n * Returns the most common CSS unit in the radius values.\n * Falls back to `px` as a default unit.\n *\n * @param {Object|string} values Radius values.\n * @return {string} Most common CSS unit in values. Default: `px`.\n */\nexport function getAllUnit( values = {} ) {\n\tif ( typeof values === 'string' ) {\n\t\tconst [ , unit ] = parseUnit( values );\n\t\treturn unit || 'px';\n\t}\n\n\tconst allUnits = Object.values( values ).map( ( value ) => {\n\t\tconst [ , unit ] = parseUnit( value );\n\t\treturn unit;\n\t} );\n\n\treturn mode( allUnits ) || 'px';\n}\n\n/**\n * Gets the 'all' input value and unit from values data.\n *\n * @param {Object|string} values Radius values.\n * @return {string} A value + unit for the 'all' input.\n */\nexport function getAllValue( values = {} ) {\n\t/**\n\t * Border radius support was originally a single pixel value.\n\t *\n\t * To maintain backwards compatibility treat this case as the all value.\n\t */\n\tif ( typeof values === 'string' ) {\n\t\treturn values;\n\t}\n\n\tconst parsedValues = Object.values( values ).map( ( value ) =>\n\t\tparseUnit( value )\n\t);\n\n\tconst allValues = parsedValues.map( ( value ) => value[ 0 ] );\n\tconst allUnits = parsedValues.map( ( value ) => value[ 1 ] );\n\n\tconst value = allValues.every( ( v ) => v === allValues[ 0 ] )\n\t\t? allValues[ 0 ]\n\t\t: '';\n\tconst unit = mode( allUnits );\n\n\tconst allValue = value === 0 || value ? `${ value }${ unit }` : null;\n\n\treturn allValue;\n}\n\n/**\n * Checks to determine if values are mixed.\n *\n * @param {Object} values Radius values.\n * @return {boolean} Whether values are mixed.\n */\nexport function hasMixedValues( values = {} ) {\n\tconst allValue = getAllValue( values );\n\tconst isMixed = isNaN( parseFloat( allValue ) );\n\n\treturn isMixed;\n}\n\n/**\n * Checks to determine if values are defined.\n *\n * @param {Object} values Radius values.\n * @return {boolean} Whether values are mixed.\n */\nexport function hasDefinedValues( values ) {\n\tif ( ! values ) {\n\t\treturn false;\n\t}\n\n\t// A string value represents a shorthand value.\n\tif ( typeof values === 'string' ) {\n\t\treturn true;\n\t}\n\n\t// An object represents longhand border radius values, if any are set\n\t// flag values as being defined.\n\tconst filteredValues = Object.values( values ).filter( ( value ) => {\n\t\treturn !! value || value === 0;\n\t} );\n\n\treturn !! filteredValues.length;\n}\n"]}
@@ -11,12 +11,16 @@ exports.getColorObjectByColorValue = exports.getColorObjectByAttributeValues = v
11
11
 
12
12
  var _lodash = require("lodash");
13
13
 
14
- var _tinycolor = _interopRequireDefault(require("tinycolor2"));
14
+ var _colord = require("colord");
15
+
16
+ var _names = _interopRequireDefault(require("colord/plugins/names"));
17
+
18
+ var _a11y = _interopRequireDefault(require("colord/plugins/a11y"));
15
19
 
16
20
  /**
17
21
  * External dependencies
18
22
  */
19
-
23
+ (0, _colord.extend)([_names.default, _a11y.default]);
20
24
  /**
21
25
  * Provided an array of color objects as set by the theme or by the editor defaults,
22
26
  * and the values of the defined color or custom color returns a color object describing the color.
@@ -29,6 +33,7 @@ var _tinycolor = _interopRequireDefault(require("tinycolor2"));
29
33
  * the color object exactly as set by the theme or editor defaults is returned.
30
34
  * Otherwise, an object that just sets the color is defined.
31
35
  */
36
+
32
37
  const getColorObjectByAttributeValues = (colors, definedColor, customColor) => {
33
38
  if (definedColor) {
34
39
  const colorObj = (0, _lodash.find)(colors, {
@@ -93,6 +98,9 @@ function getColorClassName(colorContextName, colorSlug) {
93
98
 
94
99
 
95
100
  function getMostReadableColor(colors, colorValue) {
96
- return _tinycolor.default.mostReadable(colorValue, (0, _lodash.map)(colors, 'color')).toHexString();
101
+ const colordColor = (0, _colord.colord)(colorValue);
102
+ return (0, _lodash.maxBy)(colors, ({
103
+ color
104
+ }) => colordColor.contrast(color)).color;
97
105
  }
98
106
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/colors/utils.js"],"names":["getColorObjectByAttributeValues","colors","definedColor","customColor","colorObj","slug","color","getColorObjectByColorValue","colorValue","getColorClassName","colorContextName","colorSlug","undefined","getMostReadableColor","tinycolor","mostReadable","toHexString"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,+BAA+B,GAAG,CAC9CC,MAD8C,EAE9CC,YAF8C,EAG9CC,WAH8C,KAI1C;AACJ,MAAKD,YAAL,EAAoB;AACnB,UAAME,QAAQ,GAAG,kBAAMH,MAAN,EAAc;AAAEI,MAAAA,IAAI,EAAEH;AAAR,KAAd,CAAjB;;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;;;;;AACO,MAAMI,0BAA0B,GAAG,CAAEN,MAAF,EAAUO,UAAV,KAA0B;AACnE,SAAO,kBAAMP,MAAN,EAAc;AAAEK,IAAAA,KAAK,EAAEE;AAAT,GAAd,CAAP;AACA,CAFM;AAIP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,SAASC,iBAAT,CAA4BC,gBAA5B,EAA8CC,SAA9C,EAA0D;AAChE,MAAK,CAAED,gBAAF,IAAsB,CAAEC,SAA7B,EAAyC;AACxC,WAAOC,SAAP;AACA;;AAED,SAAQ,OAAO,uBAAWD,SAAX,CAAwB,IAAID,gBAAkB,EAA7D;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASG,oBAAT,CAA+BZ,MAA/B,EAAuCO,UAAvC,EAAoD;AAC1D,SAAOM,mBACLC,YADK,CACSP,UADT,EACqB,iBAAKP,MAAL,EAAa,OAAb,CADrB,EAELe,WAFK,EAAP;AAGA","sourcesContent":["/**\n * External dependencies\n */\nimport { find, kebabCase, map } from 'lodash';\nimport tinycolor from 'tinycolor2';\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\treturn tinycolor\n\t\t.mostReadable( colorValue, map( colors, 'color' ) )\n\t\t.toHexString();\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/colors/utils.js"],"names":["namesPlugin","a11yPlugin","getColorObjectByAttributeValues","colors","definedColor","customColor","colorObj","slug","color","getColorObjectByColorValue","colorValue","getColorClassName","colorContextName","colorSlug","undefined","getMostReadableColor","colordColor","contrast"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AANA;AACA;AACA;AAMA,oBAAQ,CAAEA,cAAF,EAAeC,aAAf,CAAR;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,MAAMC,+BAA+B,GAAG,CAC9CC,MAD8C,EAE9CC,YAF8C,EAG9CC,WAH8C,KAI1C;AACJ,MAAKD,YAAL,EAAoB;AACnB,UAAME,QAAQ,GAAG,kBAAMH,MAAN,EAAc;AAAEI,MAAAA,IAAI,EAAEH;AAAR,KAAd,CAAjB;;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;;;;;AACO,MAAMI,0BAA0B,GAAG,CAAEN,MAAF,EAAUO,UAAV,KAA0B;AACnE,SAAO,kBAAMP,MAAN,EAAc;AAAEK,IAAAA,KAAK,EAAEE;AAAT,GAAd,CAAP;AACA,CAFM;AAIP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,SAASC,iBAAT,CAA4BC,gBAA5B,EAA8CC,SAA9C,EAA0D;AAChE,MAAK,CAAED,gBAAF,IAAsB,CAAEC,SAA7B,EAAyC;AACxC,WAAOC,SAAP;AACA;;AAED,SAAQ,OAAO,uBAAWD,SAAX,CAAwB,IAAID,gBAAkB,EAA7D;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASG,oBAAT,CAA+BZ,MAA/B,EAAuCO,UAAvC,EAAoD;AAC1D,QAAMM,WAAW,GAAG,oBAAQN,UAAR,CAApB;AACA,SAAO,mBAAOP,MAAP,EAAe,CAAE;AAAEK,IAAAA;AAAF,GAAF,KAAiBQ,WAAW,CAACC,QAAZ,CAAsBT,KAAtB,CAAhC,EACLA,KADF;AAEA","sourcesContent":["/**\n * External dependencies\n */\nimport { find, kebabCase, maxBy } 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\treturn maxBy( colors, ( { color } ) => colordColor.contrast( color ) )\n\t\t.color;\n}\n"]}
@@ -19,10 +19,6 @@ var _components = require("@wordpress/components");
19
19
 
20
20
  var _i18n = require("@wordpress/i18n");
21
21
 
22
- var _colors = require("../colors");
23
-
24
- var _gradients = require("../gradients");
25
-
26
22
  var _useSetting = _interopRequireDefault(require("../use-setting"));
27
23
 
28
24
  /**
@@ -36,54 +32,22 @@ var _useSetting = _interopRequireDefault(require("../use-setting"));
36
32
  /**
37
33
  * Internal dependencies
38
34
  */
39
- // translators: first %s: the color name or value (e.g. red or #ff0000)
40
- const colorIndicatorAriaLabel = (0, _i18n.__)('(Color: %s)'); // translators: first %s: the gradient name or value (e.g. red to green or linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)
41
-
42
- const gradientIndicatorAriaLabel = (0, _i18n.__)('(Gradient: %s)');
43
35
  const colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients'];
44
36
 
45
- function VisualLabel({
46
- colors,
47
- gradients,
48
- label,
49
- currentTab,
50
- colorValue,
51
- gradientValue
52
- }) {
53
- let value, ariaLabel;
54
-
55
- if (currentTab === 'color') {
56
- if (colorValue) {
57
- value = colorValue;
58
- const colorObject = (0, _colors.getColorObjectByColorValue)(colors, value);
59
- const colorName = colorObject && colorObject.name;
60
- ariaLabel = (0, _i18n.sprintf)(colorIndicatorAriaLabel, colorName || value);
61
- }
62
- } else if (currentTab === 'gradient' && gradientValue) {
63
- value = gradientValue;
64
- const gradientObject = (0, _gradients.__experimentalGetGradientObjectByGradientValue)(gradients, value);
65
- const gradientName = gradientObject && gradientObject.name;
66
- ariaLabel = (0, _i18n.sprintf)(gradientIndicatorAriaLabel, gradientName || value);
67
- }
68
-
69
- return (0, _element.createElement)(_element.Fragment, null, label, !!value && (0, _element.createElement)(_components.ColorIndicator, {
70
- colorValue: value,
71
- "aria-label": ariaLabel
72
- }));
73
- }
74
-
75
37
  function ColorGradientControlInner({
76
38
  colors,
77
39
  gradients,
78
40
  disableCustomColors,
79
41
  disableCustomGradients,
42
+ __experimentalHasMultipleOrigins,
80
43
  className,
81
44
  label,
82
45
  onColorChange,
83
46
  onGradientChange,
84
47
  colorValue,
85
48
  gradientValue,
86
- clearable
49
+ clearable,
50
+ showTitle = true
87
51
  }) {
88
52
  const canChooseAColor = onColorChange && (!(0, _lodash.isEmpty)(colors) || !disableCustomColors);
89
53
  const canChooseAGradient = onGradientChange && (!(0, _lodash.isEmpty)(gradients) || !disableCustomGradients);
@@ -95,24 +59,23 @@ function ColorGradientControlInner({
95
59
 
96
60
  return (0, _element.createElement)(_components.BaseControl, {
97
61
  className: (0, _classnames.default)('block-editor-color-gradient-control', className)
98
- }, (0, _element.createElement)("fieldset", null, (0, _element.createElement)("legend", null, (0, _element.createElement)("div", {
62
+ }, (0, _element.createElement)("fieldset", null, (0, _element.createElement)(_components.__experimentalVStack, {
63
+ spacing: 1
64
+ }, showTitle && (0, _element.createElement)("legend", null, (0, _element.createElement)("div", {
99
65
  className: "block-editor-color-gradient-control__color-indicator"
100
- }, (0, _element.createElement)(_components.BaseControl.VisualLabel, null, (0, _element.createElement)(VisualLabel, {
101
- currentTab: currentTab,
102
- label: label,
103
- colorValue: colorValue,
104
- gradientValue: gradientValue
105
- })))), canChooseAColor && canChooseAGradient && (0, _element.createElement)(_components.ButtonGroup, {
106
- className: "block-editor-color-gradient-control__button-tabs"
107
- }, (0, _element.createElement)(_components.Button, {
108
- isSmall: true,
109
- isPressed: currentTab === 'color',
110
- onClick: () => setCurrentTab('color')
111
- }, (0, _i18n.__)('Solid')), (0, _element.createElement)(_components.Button, {
112
- isSmall: true,
113
- isPressed: currentTab === 'gradient',
114
- onClick: () => setCurrentTab('gradient')
115
- }, (0, _i18n.__)('Gradient'))), (currentTab === 'color' || !canChooseAGradient) && (0, _element.createElement)(_components.ColorPalette, {
66
+ }, (0, _element.createElement)(_components.BaseControl.VisualLabel, null, label))), canChooseAColor && canChooseAGradient && (0, _element.createElement)(_components.__experimentalToggleGroupControl, {
67
+ value: currentTab,
68
+ onChange: setCurrentTab,
69
+ label: (0, _i18n.__)('Select color type'),
70
+ hideLabelFromVision: true,
71
+ isBlock: true
72
+ }, (0, _element.createElement)(_components.__experimentalToggleGroupControlOption, {
73
+ value: "color",
74
+ label: (0, _i18n.__)('Solid')
75
+ }), (0, _element.createElement)(_components.__experimentalToggleGroupControlOption, {
76
+ value: "gradient",
77
+ label: (0, _i18n.__)('Gradient')
78
+ })), (currentTab === 'color' || !canChooseAGradient) && (0, _element.createElement)(_components.ColorPalette, {
116
79
  value: colorValue,
117
80
  onChange: canChooseAGradient ? newColor => {
118
81
  onColorChange(newColor);
@@ -120,6 +83,7 @@ function ColorGradientControlInner({
120
83
  } : onColorChange,
121
84
  colors,
122
85
  disableCustomColors,
86
+ __experimentalHasMultipleOrigins: __experimentalHasMultipleOrigins,
123
87
  clearable: clearable
124
88
  }), (currentTab === 'gradient' || !canChooseAColor) && (0, _element.createElement)(_components.GradientPicker, {
125
89
  value: gradientValue,
@@ -129,8 +93,9 @@ function ColorGradientControlInner({
129
93
  } : onGradientChange,
130
94
  gradients,
131
95
  disableCustomGradients,
96
+ __experimentalHasMultipleOrigins: __experimentalHasMultipleOrigins,
132
97
  clearable: clearable
133
- })));
98
+ }))));
134
99
  }
135
100
 
136
101
  function ColorGradientControlSelect(props) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/colors-gradients/control.js"],"names":["colorIndicatorAriaLabel","gradientIndicatorAriaLabel","colorsAndGradientKeys","VisualLabel","colors","gradients","label","currentTab","colorValue","gradientValue","value","ariaLabel","colorObject","colorName","name","gradientObject","gradientName","ColorGradientControlInner","disableCustomColors","disableCustomGradients","className","onColorChange","onGradientChange","clearable","canChooseAColor","canChooseAGradient","setCurrentTab","newColor","newGradient","ColorGradientControlSelect","props","colorGradientSettings","ColorGradientControl","key","hasOwnProperty"],"mappings":";;;;;;;;;AASA;;;;AANA;;AACA;;AAMA;;AAQA;;AAKA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAIA;AACA;AACA;;AAYA;AACA;AACA;AAKA;AACA,MAAMA,uBAAuB,GAAG,cAAI,aAA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AgC+B,GAAF,IAAWH,KAAK,CAACI,cAAN,CAAsBD,GAAtB,CAAzC,CADD,EAEE;AACD,WAAO,4BAAC,yBAAD,EAAgCH,KAAhC,CAAP;AACA;;AACD,SAAO,4BAAC,0BAAD,EAAiCA,KAAjC,CAAP;AACA;;eAEcE,oB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { every, isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport {\n\tBaseControl,\n\tButton,\n\tButtonGroup,\n\tColorIndicator,\n\tColorPalette,\n\tGradientPicker,\n} from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getColorObjectByColorValue } from '../colors';\nimport { __experimentalGetGradientObjectByGradientValue } from '../gradients';\nimport useSetting from '../use-setting';\n\n// translators: first %s: the color name or value (e.g. red or #ff0000)\nconst colorIndicatorAriaLabel = __( '(Color: %s)' );\n\n// translators: first %s: the gradient name or value (e.g. red to green or linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)\nconst gradientIndicatorAriaLabel = __( '(Gradient: %s)' );\n\nconst colorsAndGradientKeys = [\n\t'colors',\n\t'disableCustomColors',\n\t'gradients',\n\t'disableCustomGradients',\n];\n\nfunction VisualLabel( {\n\tcolors,\n\tgradients,\n\tlabel,\n\tcurrentTab,\n\tcolorValue,\n\tgradientValue,\n} ) {\n\tlet value, ariaLabel;\n\tif ( currentTab === 'color' ) {\n\t\tif ( colorValue ) {\n\t\t\tvalue = colorValue;\n\t\t\tconst colorObject = getColorObjectByColorValue( colors, value );\n\t\t\tconst colorName = colorObject && colorObject.name;\n\t\t\tariaLabel = sprintf( colorIndicatorAriaLabel, colorName || value );\n\t\t}\n\t} else if ( currentTab === 'gradient' && gradientValue ) {\n\t\tvalue = gradientValue;\n\t\tconst gradientObject = __experimentalGetGradientObjectByGradientValue(\n\t\t\tgradients,\n\t\t\tvalue\n\t\t);\n\t\tconst gradientName = gradientObject && gradientObject.name;\n\t\tariaLabel = sprintf(\n\t\t\tgradientIndicatorAriaLabel,\n\t\t\tgradientName || value\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ label }\n\t\t\t{ !! value && (\n\t\t\t\t<ColorIndicator colorValue={ value } aria-label={ ariaLabel } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction ColorGradientControlInner( {\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\tclassName,\n\tlabel,\n\tonColorChange,\n\tonGradientChange,\n\tcolorValue,\n\tgradientValue,\n\tclearable,\n} ) {\n\tconst canChooseAColor =\n\t\tonColorChange && ( ! isEmpty( colors ) || ! disableCustomColors );\n\tconst canChooseAGradient =\n\t\tonGradientChange &&\n\t\t( ! isEmpty( gradients ) || ! disableCustomGradients );\n\tconst [ currentTab, setCurrentTab ] = useState(\n\t\tgradientValue ? 'gradient' : !! canChooseAColor && 'color'\n\t);\n\n\tif ( ! canChooseAColor && ! canChooseAGradient ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<BaseControl\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>\n\t\t\t\t<legend>\n\t\t\t\t\t<div className=\"block-editor-color-gradient-control__color-indicator\">\n\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t<VisualLabel\n\t\t\t\t\t\t\t\tcurrentTab={ currentTab }\n\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\tcolorValue={ colorValue }\n\t\t\t\t\t\t\t\tgradientValue={ gradientValue }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t</div>\n\t\t\t\t</legend>\n\t\t\t\t{ canChooseAColor && canChooseAGradient && (\n\t\t\t\t\t<ButtonGroup className=\"block-editor-color-gradient-control__button-tabs\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\tisPressed={ currentTab === 'color' }\n\t\t\t\t\t\t\tonClick={ () => setCurrentTab( 'color' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Solid' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\tisPressed={ currentTab === 'gradient' }\n\t\t\t\t\t\t\tonClick={ () => setCurrentTab( 'gradient' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Gradient' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</ButtonGroup>\n\t\t\t\t) }\n\t\t\t\t{ ( currentTab === 'color' || ! canChooseAGradient ) && (\n\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\tvalue={ colorValue }\n\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\tcanChooseAGradient\n\t\t\t\t\t\t\t\t? ( newColor ) => {\n\t\t\t\t\t\t\t\t\t\tonColorChange( newColor );\n\t\t\t\t\t\t\t\t\t\tonGradientChange();\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: onColorChange\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...{ colors, disableCustomColors } }\n\t\t\t\t\t\tclearable={ clearable }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ( currentTab === 'gradient' || ! canChooseAColor ) && (\n\t\t\t\t\t<GradientPicker\n\t\t\t\t\t\tvalue={ gradientValue }\n\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\tcanChooseAColor\n\t\t\t\t\t\t\t\t? ( newGradient ) => {\n\t\t\t\t\t\t\t\t\t\tonGradientChange( newGradient );\n\t\t\t\t\t\t\t\t\t\tonColorChange();\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: onGradientChange\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...{ gradients, disableCustomGradients } }\n\t\t\t\t\t\tclearable={ clearable }\n\t\t\t\t\t/>\n\t\t\t\t) }\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\tevery( colorsAndGradientKeys, ( 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":["colorsAndGradientKeys","ColorGradientControlInner","colors","gradients","disableCustomColors","disableCustomGradients","__experimentalHasMultipleOrigins","className","label","onColorChange","onGradientChange","colorValue","gradientValue","clearable","showTitle","canChooseAColor","canChooseAGradient","currentTab","setCurrentTab","newColor","newGradient","ColorGradientControlSelect","props","colorGradientSettings","ColorGradientControl","key","hasOwnProperty"],"mappings":";;;;;;;;;AASA;;;;AANA;;AACA;;AAMA;;AAQA;;AAKA;;AAvBA;AACA;AACA;;AAIA;AACA;AACA;;AAYA;AACA;AACA;AAGA,MAAMA,qBAAqB,GAAG,CAC7B,QAD6B,EAE7B,qBAF6B,EAG7B,WAH6B,EAI7B,wBAJ6B,CAA9B;;AAOA,SAASC,yBAAT,CAAoC;AACnCC,EAAAA,MADmC;AAEnCC,EAAAA,SAFmC;AAGnCC,EAAAA,mBAHmC;AAInCC,EAAAA,sBAJmC;AA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C,MACC,mBAAOtB,qBAAP,EAAgCyB,GAAF,IAAWH,KAAK,CAACI,cAAN,CAAsBD,GAAtB,CAAzC,CADD,EAEE;AACD,WAAO,4BAAC,yBAAD,EAAgCH,KAAhC,CAAP;AACA;;AACD,SAAO,4BAAC,0BAAD,EAAiCA,KAAjC,CAAP;AACA;;eAEcE,oB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { every, isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport {\n\tBaseControl,\n\t__experimentalVStack as VStack,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\tColorPalette,\n\tGradientPicker,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\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\nfunction ColorGradientControlInner( {\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\t__experimentalHasMultipleOrigins,\n\tclassName,\n\tlabel,\n\tonColorChange,\n\tonGradientChange,\n\tcolorValue,\n\tgradientValue,\n\tclearable,\n\tshowTitle = true,\n} ) {\n\tconst canChooseAColor =\n\t\tonColorChange && ( ! isEmpty( colors ) || ! disableCustomColors );\n\tconst canChooseAGradient =\n\t\tonGradientChange &&\n\t\t( ! isEmpty( gradients ) || ! disableCustomGradients );\n\tconst [ currentTab, setCurrentTab ] = useState(\n\t\tgradientValue ? 'gradient' : !! canChooseAColor && 'color'\n\t);\n\n\tif ( ! canChooseAColor && ! canChooseAGradient ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<BaseControl\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>\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<ToggleGroupControl\n\t\t\t\t\t\t\tvalue={ currentTab }\n\t\t\t\t\t\t\tonChange={ setCurrentTab }\n\t\t\t\t\t\t\tlabel={ __( 'Select color type' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"color\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Solid' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"gradient\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Gradient' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ( currentTab === 'color' || ! canChooseAGradient ) && (\n\t\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\t\tvalue={ colorValue }\n\t\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\t\tcanChooseAGradient\n\t\t\t\t\t\t\t\t\t? ( newColor ) => {\n\t\t\t\t\t\t\t\t\t\t\tonColorChange( newColor );\n\t\t\t\t\t\t\t\t\t\t\tonGradientChange();\n\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t: onColorChange\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t{ ...{ colors, disableCustomColors } }\n\t\t\t\t\t\t\t__experimentalHasMultipleOrigins={\n\t\t\t\t\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclearable={ clearable }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ( currentTab === 'gradient' || ! canChooseAColor ) && (\n\t\t\t\t\t\t<GradientPicker\n\t\t\t\t\t\t\tvalue={ gradientValue }\n\t\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\t\tcanChooseAColor\n\t\t\t\t\t\t\t\t\t? ( newGradient ) => {\n\t\t\t\t\t\t\t\t\t\t\tonGradientChange( newGradient );\n\t\t\t\t\t\t\t\t\t\t\tonColorChange();\n\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t: onGradientChange\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t{ ...{ gradients, disableCustomGradients } }\n\t\t\t\t\t\t\t__experimentalHasMultipleOrigins={\n\t\t\t\t\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclearable={ clearable }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\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\tevery( colorsAndGradientKeys, ( key ) => props.hasOwnProperty( key ) )\n\t) {\n\t\treturn <ColorGradientControlInner { ...props } />;\n\t}\n\treturn <ColorGradientControlSelect { ...props } />;\n}\n\nexport default ColorGradientControl;\n"]}