@wordpress/block-editor 7.0.1-next.5df0cd52b7.0 → 7.0.4

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 (905) hide show
  1. package/README.md +16 -4
  2. package/build/components/alignment-control/ui.js +2 -1
  3. package/build/components/alignment-control/ui.js.map +1 -1
  4. package/build/components/autocomplete/index.js +1 -1
  5. package/build/components/autocomplete/index.js.map +1 -1
  6. package/build/components/block-actions/index.js +8 -4
  7. package/build/components/block-actions/index.js.map +1 -1
  8. package/build/components/block-alignment-control/ui.js +61 -14
  9. package/build/components/block-alignment-control/ui.js.map +1 -1
  10. package/build/components/block-alignment-control/use-available-alignments.js +25 -3
  11. package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
  12. package/build/components/block-content-overlay/index.js +2 -4
  13. package/build/components/block-content-overlay/index.js.map +1 -1
  14. package/build/components/block-controls/fill.js +6 -6
  15. package/build/components/block-controls/fill.js.map +1 -1
  16. package/build/components/block-controls/groups.js +3 -1
  17. package/build/components/block-controls/groups.js.map +1 -1
  18. package/build/components/block-controls/hook.js +57 -0
  19. package/build/components/block-controls/hook.js.map +1 -0
  20. package/build/components/block-edit/context.js +6 -5
  21. package/build/components/block-edit/context.js.map +1 -1
  22. package/build/components/block-edit/edit.js +1 -1
  23. package/build/components/block-edit/edit.js.map +1 -1
  24. package/build/components/block-icon/index.native.js +13 -9
  25. package/build/components/block-icon/index.native.js.map +1 -1
  26. package/build/components/block-inspector/index.js +10 -7
  27. package/build/components/block-inspector/index.js.map +1 -1
  28. package/build/components/block-list/block-html.js +5 -0
  29. package/build/components/block-list/block-html.js.map +1 -1
  30. package/build/components/block-list/block-list-item.native.js +31 -12
  31. package/build/components/block-list/block-list-item.native.js.map +1 -1
  32. package/build/components/block-list/block-selection-button.native.js +4 -4
  33. package/build/components/block-list/block-selection-button.native.js.map +1 -1
  34. package/build/components/block-list/block.js +15 -9
  35. package/build/components/block-list/block.js.map +1 -1
  36. package/build/components/block-list/block.native.js +6 -7
  37. package/build/components/block-list/block.native.js.map +1 -1
  38. package/build/components/block-list/grid-item.native.js +68 -0
  39. package/build/components/block-list/grid-item.native.js.map +1 -0
  40. package/build/components/block-list/index.js +19 -15
  41. package/build/components/block-list/index.js.map +1 -1
  42. package/build/components/block-list/index.native.js +12 -8
  43. package/build/components/block-list/index.native.js.map +1 -1
  44. package/build/components/block-list/use-block-props/index.js +6 -6
  45. package/build/components/block-list/use-block-props/index.js.map +1 -1
  46. package/build/components/block-list/use-block-props/use-block-custom-class-name.js +4 -6
  47. package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +1 -1
  48. package/build/components/block-list/use-block-props/use-block-default-class-name.js +1 -1
  49. package/build/components/block-list/use-block-props/use-block-default-class-name.js.map +1 -1
  50. package/build/components/block-list/use-block-props/use-multi-selection.js +4 -2
  51. package/build/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
  52. package/build/components/block-list/use-in-between-inserter.js +9 -1
  53. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  54. package/build/components/block-list-appender/index.js +9 -1
  55. package/build/components/block-list-appender/index.js.map +1 -1
  56. package/build/components/block-mover/index.js +4 -4
  57. package/build/components/block-mover/index.js.map +1 -1
  58. package/build/components/block-mover/index.native.js +4 -4
  59. package/build/components/block-mover/index.native.js.map +1 -1
  60. package/build/components/block-preview/auto.js +42 -14
  61. package/build/components/block-preview/auto.js.map +1 -1
  62. package/build/components/block-settings-menu/block-settings-dropdown.js +4 -3
  63. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  64. package/build/components/block-settings-menu-controls/index.js +10 -3
  65. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  66. package/build/components/block-styles/index.js +5 -1
  67. package/build/components/block-styles/index.js.map +1 -1
  68. package/build/components/block-styles/preview.native.js +1 -1
  69. package/build/components/block-styles/preview.native.js.map +1 -1
  70. package/build/components/block-switcher/block-styles-menu.js +1 -1
  71. package/build/components/block-switcher/block-styles-menu.js.map +1 -1
  72. package/build/components/block-switcher/index.js +10 -3
  73. package/build/components/block-switcher/index.js.map +1 -1
  74. package/build/components/block-title/index.js +3 -2
  75. package/build/components/block-title/index.js.map +1 -1
  76. package/build/components/block-toolbar/index.js +3 -0
  77. package/build/components/block-toolbar/index.js.map +1 -1
  78. package/build/components/block-tools/block-contextual-toolbar.js +1 -1
  79. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  80. package/build/components/block-tools/block-popover.js +8 -7
  81. package/build/components/block-tools/block-popover.js.map +1 -1
  82. package/build/components/block-tools/block-selection-button.js +2 -4
  83. package/build/components/block-tools/block-selection-button.js.map +1 -1
  84. package/build/components/block-tools/index.js +4 -1
  85. package/build/components/block-tools/index.js.map +1 -1
  86. package/build/components/block-tools/insertion-point.js +96 -7
  87. package/build/components/block-tools/insertion-point.js.map +1 -1
  88. package/build/components/block-types-list/index.native.js +3 -2
  89. package/build/components/block-types-list/index.native.js.map +1 -1
  90. package/build/components/border-radius-control/index.js.map +1 -1
  91. package/build/components/border-radius-control/utils.js +17 -8
  92. package/build/components/border-radius-control/utils.js.map +1 -1
  93. package/build/components/colors/utils.js +11 -3
  94. package/build/components/colors/utils.js.map +1 -1
  95. package/build/components/colors-gradients/control.js +17 -13
  96. package/build/components/colors-gradients/control.js.map +1 -1
  97. package/build/components/colors-gradients/panel-color-gradient-settings.js +2 -1
  98. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  99. package/build/components/contrast-checker/index.js +18 -12
  100. package/build/components/contrast-checker/index.js.map +1 -1
  101. package/build/components/copy-handler/index.js +9 -3
  102. package/build/components/copy-handler/index.js.map +1 -1
  103. package/build/components/default-block-appender/index.js +2 -2
  104. package/build/components/default-block-appender/index.js.map +1 -1
  105. package/build/components/duotone-control/index.js +38 -39
  106. package/build/components/duotone-control/index.js.map +1 -1
  107. package/build/components/editor-styles/index.js +9 -3
  108. package/build/components/editor-styles/index.js.map +1 -1
  109. package/build/components/font-appearance-control/index.js +27 -7
  110. package/build/components/font-appearance-control/index.js.map +1 -1
  111. package/build/components/font-sizes/index.native.js +24 -0
  112. package/build/components/font-sizes/index.native.js.map +1 -1
  113. package/build/components/iframe/index.js +45 -62
  114. package/build/components/iframe/index.js.map +1 -1
  115. package/build/components/image-editor/aspect-ratio-dropdown.js +126 -0
  116. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
  117. package/build/components/image-editor/constants.js +16 -0
  118. package/build/components/image-editor/constants.js.map +1 -0
  119. package/build/components/image-editor/context.js +59 -0
  120. package/build/components/image-editor/context.js.map +1 -0
  121. package/build/components/image-editor/cropper.js +83 -0
  122. package/build/components/image-editor/cropper.js.map +1 -0
  123. package/build/components/image-editor/form-controls.js +36 -0
  124. package/build/components/image-editor/form-controls.js.map +1 -0
  125. package/build/components/image-editor/index.js +60 -0
  126. package/build/components/image-editor/index.js.map +1 -0
  127. package/build/components/image-editor/rotation-button.js +37 -0
  128. package/build/components/image-editor/rotation-button.js.map +1 -0
  129. package/build/components/image-editor/use-save-image.js +84 -0
  130. package/build/components/image-editor/use-save-image.js.map +1 -0
  131. package/build/components/image-editor/use-transform-image.js +135 -0
  132. package/build/components/image-editor/use-transform-image.js.map +1 -0
  133. package/build/components/image-editor/zoom-dropdown.js +55 -0
  134. package/build/components/image-editor/zoom-dropdown.js.map +1 -0
  135. package/build/components/image-size-control/use-dimension-handler.js +14 -3
  136. package/build/components/image-size-control/use-dimension-handler.js.map +1 -1
  137. package/build/components/index.js +22 -35
  138. package/build/components/index.js.map +1 -1
  139. package/build/components/index.native.js +12 -7
  140. package/build/components/index.native.js.map +1 -1
  141. package/build/components/inner-blocks/button-block-appender.js +11 -1
  142. package/build/components/inner-blocks/button-block-appender.js.map +1 -1
  143. package/build/components/inner-blocks/index.js +23 -6
  144. package/build/components/inner-blocks/index.js.map +1 -1
  145. package/build/components/inner-blocks/index.native.js +38 -1
  146. package/build/components/inner-blocks/index.native.js.map +1 -1
  147. package/build/components/inner-blocks/use-nested-settings-update.js +24 -13
  148. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  149. package/build/components/inserter/block-patterns-tab.js +11 -1
  150. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  151. package/build/components/inserter/block-types-tab.native.js +3 -6
  152. package/build/components/inserter/block-types-tab.native.js.map +1 -1
  153. package/build/components/inserter/hooks/use-clipboard-block.native.js +5 -4
  154. package/build/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
  155. package/build/components/inserter/index.js +12 -4
  156. package/build/components/inserter/index.js.map +1 -1
  157. package/build/components/inserter/index.native.js +1 -7
  158. package/build/components/inserter/index.native.js.map +1 -1
  159. package/build/components/inserter/library.js +2 -0
  160. package/build/components/inserter/library.js.map +1 -1
  161. package/build/components/inserter/menu.js +2 -1
  162. package/build/components/inserter/menu.js.map +1 -1
  163. package/build/components/inserter/menu.native.js +18 -17
  164. package/build/components/inserter/menu.native.js.map +1 -1
  165. package/build/components/inserter/preview-panel.js +1 -1
  166. package/build/components/inserter/preview-panel.js.map +1 -1
  167. package/build/components/inserter/quick-inserter.js +2 -1
  168. package/build/components/inserter/quick-inserter.js.map +1 -1
  169. package/build/components/inserter/reusable-blocks-tab.native.js +5 -6
  170. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  171. package/build/components/inserter/search-results.native.js +9 -2
  172. package/build/components/inserter/search-results.native.js.map +1 -1
  173. package/build/components/inserter/tabs.native.js +1 -4
  174. package/build/components/inserter/tabs.native.js.map +1 -1
  175. package/build/components/inserter/utils.native.js +44 -0
  176. package/build/components/inserter/utils.native.js.map +1 -0
  177. package/build/components/inspector-controls/block-support-slot-container.js +28 -0
  178. package/build/components/inspector-controls/block-support-slot-container.js.map +1 -0
  179. package/build/components/inspector-controls/block-support-tools-panel.js +78 -0
  180. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -0
  181. package/build/components/inspector-controls/fill.js +64 -0
  182. package/build/components/inspector-controls/fill.js.map +1 -0
  183. package/build/components/inspector-controls/{index.native.js → fill.native.js} +20 -19
  184. package/build/components/inspector-controls/fill.native.js.map +1 -0
  185. package/build/components/inspector-controls/groups.js +23 -0
  186. package/build/components/inspector-controls/groups.js.map +1 -0
  187. package/build/components/inspector-controls/index.js +22 -20
  188. package/build/components/inspector-controls/index.js.map +1 -1
  189. package/build/components/inspector-controls/slot.js +67 -0
  190. package/build/components/inspector-controls/slot.js.map +1 -0
  191. package/build/components/inspector-controls/slot.native.js +38 -0
  192. package/build/components/inspector-controls/slot.native.js.map +1 -0
  193. package/build/components/line-height-control/index.native.js +39 -0
  194. package/build/components/line-height-control/index.native.js.map +1 -0
  195. package/build/components/link-control/index.js +11 -5
  196. package/build/components/link-control/index.js.map +1 -1
  197. package/build/components/link-control/link-preview.js +26 -9
  198. package/build/components/link-control/link-preview.js.map +1 -1
  199. package/build/components/link-control/search-input.js +13 -4
  200. package/build/components/link-control/search-input.js.map +1 -1
  201. package/build/components/list-view/block-contents.js +1 -20
  202. package/build/components/list-view/block-contents.js.map +1 -1
  203. package/build/components/list-view/block.js +7 -48
  204. package/build/components/list-view/block.js.map +1 -1
  205. package/build/components/list-view/branch.js +20 -13
  206. package/build/components/list-view/branch.js.map +1 -1
  207. package/build/components/list-view/index.js +21 -14
  208. package/build/components/list-view/index.js.map +1 -1
  209. package/build/components/list-view/leaf.js +1 -1
  210. package/build/components/list-view/leaf.js.map +1 -1
  211. package/build/components/list-view/list-item.js +3 -2
  212. package/build/components/list-view/list-item.js.map +1 -1
  213. package/build/components/list-view/use-list-view-client-ids.js +24 -15
  214. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  215. package/build/components/media-placeholder/index.js +35 -21
  216. package/build/components/media-placeholder/index.js.map +1 -1
  217. package/build/components/media-placeholder/index.native.js +2 -1
  218. package/build/components/media-placeholder/index.native.js.map +1 -1
  219. package/build/components/media-replace-flow/index.js +5 -3
  220. package/build/components/media-replace-flow/index.js.map +1 -1
  221. package/build/components/navigable-toolbar/index.js +1 -4
  222. package/build/components/navigable-toolbar/index.js.map +1 -1
  223. package/build/components/observe-typing/index.js +1 -1
  224. package/build/components/observe-typing/index.js.map +1 -1
  225. package/build/components/plain-text/index.native.js +30 -1
  226. package/build/components/plain-text/index.native.js.map +1 -1
  227. package/build/components/rich-text/embed-handler-picker.native.js +65 -0
  228. package/build/components/rich-text/embed-handler-picker.native.js.map +1 -0
  229. package/build/components/rich-text/format-toolbar/index.js +31 -11
  230. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  231. package/build/components/rich-text/index.js +29 -7
  232. package/build/components/rich-text/index.js.map +1 -1
  233. package/build/components/rich-text/index.native.js +43 -5
  234. package/build/components/rich-text/index.native.js.map +1 -1
  235. package/build/components/rich-text/input-event.js +25 -24
  236. package/build/components/rich-text/input-event.js.map +1 -1
  237. package/build/components/rich-text/shortcut.js +23 -9
  238. package/build/components/rich-text/shortcut.js.map +1 -1
  239. package/build/components/rich-text/use-input-events.js +27 -0
  240. package/build/components/rich-text/use-input-events.js.map +1 -0
  241. package/build/components/rich-text/use-paste-handler.js +45 -10
  242. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  243. package/build/components/rich-text/use-shortcuts.js +27 -0
  244. package/build/components/rich-text/use-shortcuts.js.map +1 -0
  245. package/build/components/rich-text/utils.js +22 -0
  246. package/build/components/rich-text/utils.js.map +1 -1
  247. package/build/components/typewriter/index.js +1 -1
  248. package/build/components/typewriter/index.js.map +1 -1
  249. package/build/components/url-input/index.js +14 -7
  250. package/build/components/url-input/index.js.map +1 -1
  251. package/build/components/use-display-block-controls/index.js +5 -7
  252. package/build/components/use-display-block-controls/index.js.map +1 -1
  253. package/build/components/use-moving-animation/index.js +13 -10
  254. package/build/components/use-moving-animation/index.js.map +1 -1
  255. package/build/components/use-on-block-drop/index.js +2 -1
  256. package/build/components/use-on-block-drop/index.js.map +1 -1
  257. package/build/components/use-resize-canvas/index.js +2 -13
  258. package/build/components/use-resize-canvas/index.js.map +1 -1
  259. package/build/components/use-setting/index.js +3 -7
  260. package/build/components/use-setting/index.js.map +1 -1
  261. package/build/components/writing-flow/use-multi-selection.js +6 -0
  262. package/build/components/writing-flow/use-multi-selection.js.map +1 -1
  263. package/build/components/writing-flow/use-tab-nav.js +18 -3
  264. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  265. package/build/hooks/align.js +14 -14
  266. package/build/hooks/align.js.map +1 -1
  267. package/build/hooks/anchor.js +4 -2
  268. package/build/hooks/anchor.js.map +1 -1
  269. package/build/hooks/border-color.js +9 -5
  270. package/build/hooks/border-color.js.map +1 -1
  271. package/build/hooks/color-panel.js +4 -2
  272. package/build/hooks/color-panel.js.map +1 -1
  273. package/build/hooks/color.js +6 -4
  274. package/build/hooks/color.js.map +1 -1
  275. package/build/hooks/compat.js +23 -0
  276. package/build/hooks/compat.js.map +1 -0
  277. package/build/hooks/custom-class-name.js +3 -1
  278. package/build/hooks/custom-class-name.js.map +1 -1
  279. package/build/hooks/dimensions.js +63 -28
  280. package/build/hooks/dimensions.js.map +1 -1
  281. package/build/hooks/duotone.js +47 -13
  282. package/build/hooks/duotone.js.map +1 -1
  283. package/build/hooks/font-family.js +93 -23
  284. package/build/hooks/font-family.js.map +1 -1
  285. package/build/hooks/gap.js +163 -0
  286. package/build/hooks/gap.js.map +1 -0
  287. package/build/hooks/index.js +4 -0
  288. package/build/hooks/index.js.map +1 -1
  289. package/build/hooks/index.native.js +2 -0
  290. package/build/hooks/index.native.js.map +1 -1
  291. package/build/hooks/layout.js +47 -30
  292. package/build/hooks/layout.js.map +1 -1
  293. package/build/hooks/letter-spacing.js +1 -1
  294. package/build/hooks/letter-spacing.js.map +1 -1
  295. package/build/hooks/lock.js +43 -0
  296. package/build/hooks/lock.js.map +1 -0
  297. package/build/hooks/margin.js +5 -2
  298. package/build/hooks/margin.js.map +1 -1
  299. package/build/hooks/padding.js +5 -2
  300. package/build/hooks/padding.js.map +1 -1
  301. package/build/hooks/style.js +39 -11
  302. package/build/hooks/style.js.map +1 -1
  303. package/build/hooks/typography.js +1 -1
  304. package/build/hooks/typography.js.map +1 -1
  305. package/build/hooks/typography.native.js +60 -0
  306. package/build/hooks/typography.native.js.map +1 -0
  307. package/build/layouts/flex.js +121 -9
  308. package/build/layouts/flex.js.map +1 -1
  309. package/build/layouts/flow.js +99 -6
  310. package/build/layouts/flow.js.map +1 -1
  311. package/build/store/actions.js +40 -13
  312. package/build/store/actions.js.map +1 -1
  313. package/build/store/defaults.js +2 -0
  314. package/build/store/defaults.js.map +1 -1
  315. package/build/store/defaults.native.js +16 -1
  316. package/build/store/defaults.native.js.map +1 -1
  317. package/build/store/reducer.js +164 -114
  318. package/build/store/reducer.js.map +1 -1
  319. package/build/store/selectors.js +161 -82
  320. package/build/store/selectors.js.map +1 -1
  321. package/build/utils/index.js +10 -1
  322. package/build/utils/index.js.map +1 -1
  323. package/build/utils/parse-css-unit-to-px.js +295 -0
  324. package/build/utils/parse-css-unit-to-px.js.map +1 -0
  325. package/build/utils/transform-styles/transforms/wrap.js +16 -0
  326. package/build/utils/transform-styles/transforms/wrap.js.map +1 -1
  327. package/build-module/components/alignment-control/ui.js +2 -1
  328. package/build-module/components/alignment-control/ui.js.map +1 -1
  329. package/build-module/components/autocomplete/index.js +2 -2
  330. package/build-module/components/autocomplete/index.js.map +1 -1
  331. package/build-module/components/block-actions/index.js +8 -4
  332. package/build-module/components/block-actions/index.js.map +1 -1
  333. package/build-module/components/block-alignment-control/ui.js +64 -17
  334. package/build-module/components/block-alignment-control/ui.js.map +1 -1
  335. package/build-module/components/block-alignment-control/use-available-alignments.js +25 -3
  336. package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
  337. package/build-module/components/block-content-overlay/index.js +2 -4
  338. package/build-module/components/block-content-overlay/index.js.map +1 -1
  339. package/build-module/components/block-controls/fill.js +6 -5
  340. package/build-module/components/block-controls/fill.js.map +1 -1
  341. package/build-module/components/block-controls/groups.js +3 -1
  342. package/build-module/components/block-controls/groups.js.map +1 -1
  343. package/build-module/components/block-controls/hook.js +42 -0
  344. package/build-module/components/block-controls/hook.js.map +1 -0
  345. package/build-module/components/block-edit/context.js +4 -4
  346. package/build-module/components/block-edit/context.js.map +1 -1
  347. package/build-module/components/block-edit/edit.js +1 -1
  348. package/build-module/components/block-edit/edit.js.map +1 -1
  349. package/build-module/components/block-icon/index.native.js +14 -9
  350. package/build-module/components/block-icon/index.native.js.map +1 -1
  351. package/build-module/components/block-inspector/index.js +8 -6
  352. package/build-module/components/block-inspector/index.js.map +1 -1
  353. package/build-module/components/block-list/block-html.js +5 -0
  354. package/build-module/components/block-list/block-html.js.map +1 -1
  355. package/build-module/components/block-list/block-list-item.native.js +30 -12
  356. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  357. package/build-module/components/block-list/block-selection-button.native.js +3 -4
  358. package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
  359. package/build-module/components/block-list/block.js +16 -10
  360. package/build-module/components/block-list/block.js.map +1 -1
  361. package/build-module/components/block-list/block.native.js +6 -7
  362. package/build-module/components/block-list/block.native.js.map +1 -1
  363. package/build-module/components/block-list/grid-item.native.js +57 -0
  364. package/build-module/components/block-list/grid-item.native.js.map +1 -0
  365. package/build-module/components/block-list/index.js +17 -14
  366. package/build-module/components/block-list/index.js.map +1 -1
  367. package/build-module/components/block-list/index.native.js +12 -8
  368. package/build-module/components/block-list/index.native.js.map +1 -1
  369. package/build-module/components/block-list/use-block-props/index.js +7 -7
  370. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  371. package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js +5 -7
  372. package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +1 -1
  373. package/build-module/components/block-list/use-block-props/use-block-default-class-name.js +2 -2
  374. package/build-module/components/block-list/use-block-props/use-block-default-class-name.js.map +1 -1
  375. package/build-module/components/block-list/use-block-props/use-multi-selection.js +4 -2
  376. package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
  377. package/build-module/components/block-list/use-in-between-inserter.js +9 -1
  378. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  379. package/build-module/components/block-list-appender/index.js +9 -1
  380. package/build-module/components/block-list-appender/index.js.map +1 -1
  381. package/build-module/components/block-mover/index.js +4 -4
  382. package/build-module/components/block-mover/index.js.map +1 -1
  383. package/build-module/components/block-mover/index.native.js +4 -4
  384. package/build-module/components/block-mover/index.native.js.map +1 -1
  385. package/build-module/components/block-preview/auto.js +40 -16
  386. package/build-module/components/block-preview/auto.js.map +1 -1
  387. package/build-module/components/block-settings-menu/block-settings-dropdown.js +4 -3
  388. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  389. package/build-module/components/block-settings-menu-controls/index.js +10 -3
  390. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  391. package/build-module/components/block-styles/index.js +5 -1
  392. package/build-module/components/block-styles/index.js.map +1 -1
  393. package/build-module/components/block-styles/preview.native.js +1 -1
  394. package/build-module/components/block-styles/preview.native.js.map +1 -1
  395. package/build-module/components/block-switcher/block-styles-menu.js +1 -1
  396. package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
  397. package/build-module/components/block-switcher/index.js +10 -3
  398. package/build-module/components/block-switcher/index.js.map +1 -1
  399. package/build-module/components/block-title/index.js +3 -2
  400. package/build-module/components/block-title/index.js.map +1 -1
  401. package/build-module/components/block-toolbar/index.js +3 -0
  402. package/build-module/components/block-toolbar/index.js.map +1 -1
  403. package/build-module/components/block-tools/block-contextual-toolbar.js +1 -1
  404. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  405. package/build-module/components/block-tools/block-popover.js +9 -8
  406. package/build-module/components/block-tools/block-popover.js.map +1 -1
  407. package/build-module/components/block-tools/block-selection-button.js +2 -4
  408. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  409. package/build-module/components/block-tools/index.js +4 -1
  410. package/build-module/components/block-tools/index.js.map +1 -1
  411. package/build-module/components/block-tools/insertion-point.js +96 -8
  412. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  413. package/build-module/components/block-types-list/index.native.js +3 -2
  414. package/build-module/components/block-types-list/index.native.js.map +1 -1
  415. package/build-module/components/border-radius-control/index.js.map +1 -1
  416. package/build-module/components/border-radius-control/utils.js +16 -9
  417. package/build-module/components/border-radius-control/utils.js.map +1 -1
  418. package/build-module/components/colors/utils.js +9 -3
  419. package/build-module/components/colors/utils.js.map +1 -1
  420. package/build-module/components/colors-gradients/control.js +18 -14
  421. package/build-module/components/colors-gradients/control.js.map +1 -1
  422. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +2 -1
  423. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  424. package/build-module/components/contrast-checker/index.js +13 -10
  425. package/build-module/components/contrast-checker/index.js.map +1 -1
  426. package/build-module/components/copy-handler/index.js +9 -3
  427. package/build-module/components/copy-handler/index.js.map +1 -1
  428. package/build-module/components/default-block-appender/index.js +2 -2
  429. package/build-module/components/default-block-appender/index.js.map +1 -1
  430. package/build-module/components/duotone-control/index.js +40 -39
  431. package/build-module/components/duotone-control/index.js.map +1 -1
  432. package/build-module/components/editor-styles/index.js +7 -3
  433. package/build-module/components/editor-styles/index.js.map +1 -1
  434. package/build-module/components/font-appearance-control/index.js +27 -7
  435. package/build-module/components/font-appearance-control/index.js.map +1 -1
  436. package/build-module/components/font-sizes/index.native.js +3 -1
  437. package/build-module/components/font-sizes/index.native.js.map +1 -1
  438. package/build-module/components/iframe/index.js +46 -64
  439. package/build-module/components/iframe/index.js.map +1 -1
  440. package/build-module/components/image-editor/aspect-ratio-dropdown.js +115 -0
  441. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
  442. package/build-module/components/image-editor/constants.js +7 -0
  443. package/build-module/components/image-editor/constants.js.map +1 -0
  444. package/build-module/components/image-editor/context.js +44 -0
  445. package/build-module/components/image-editor/context.js.map +1 -0
  446. package/build-module/components/image-editor/cropper.js +69 -0
  447. package/build-module/components/image-editor/cropper.js.map +1 -0
  448. package/build-module/components/image-editor/form-controls.js +26 -0
  449. package/build-module/components/image-editor/form-controls.js.map +1 -0
  450. package/build-module/components/image-editor/index.js +37 -0
  451. package/build-module/components/image-editor/index.js.map +1 -0
  452. package/build-module/components/image-editor/rotation-button.js +26 -0
  453. package/build-module/components/image-editor/rotation-button.js.map +1 -0
  454. package/build-module/components/image-editor/use-save-image.js +70 -0
  455. package/build-module/components/image-editor/use-save-image.js.map +1 -0
  456. package/build-module/components/image-editor/use-transform-image.js +127 -0
  457. package/build-module/components/image-editor/use-transform-image.js.map +1 -0
  458. package/build-module/components/image-editor/zoom-dropdown.js +43 -0
  459. package/build-module/components/image-editor/zoom-dropdown.js.map +1 -0
  460. package/build-module/components/image-size-control/use-dimension-handler.js +13 -2
  461. package/build-module/components/image-size-control/use-dimension-handler.js.map +1 -1
  462. package/build-module/components/index.js +2 -5
  463. package/build-module/components/index.js.map +1 -1
  464. package/build-module/components/index.native.js +2 -3
  465. package/build-module/components/index.native.js.map +1 -1
  466. package/build-module/components/inner-blocks/button-block-appender.js +10 -1
  467. package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
  468. package/build-module/components/inner-blocks/index.js +24 -7
  469. package/build-module/components/inner-blocks/index.js.map +1 -1
  470. package/build-module/components/inner-blocks/index.native.js +36 -1
  471. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  472. package/build-module/components/inner-blocks/use-nested-settings-update.js +24 -13
  473. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  474. package/build-module/components/inserter/block-patterns-tab.js +11 -1
  475. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  476. package/build-module/components/inserter/block-types-tab.native.js +2 -5
  477. package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
  478. package/build-module/components/inserter/hooks/use-clipboard-block.native.js +5 -4
  479. package/build-module/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
  480. package/build-module/components/inserter/index.js +12 -4
  481. package/build-module/components/inserter/index.js.map +1 -1
  482. package/build-module/components/inserter/index.native.js +1 -7
  483. package/build-module/components/inserter/index.native.js.map +1 -1
  484. package/build-module/components/inserter/library.js +2 -0
  485. package/build-module/components/inserter/library.js.map +1 -1
  486. package/build-module/components/inserter/menu.js +2 -1
  487. package/build-module/components/inserter/menu.js.map +1 -1
  488. package/build-module/components/inserter/menu.native.js +17 -17
  489. package/build-module/components/inserter/menu.native.js.map +1 -1
  490. package/build-module/components/inserter/preview-panel.js +1 -1
  491. package/build-module/components/inserter/preview-panel.js.map +1 -1
  492. package/build-module/components/inserter/quick-inserter.js +2 -1
  493. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  494. package/build-module/components/inserter/reusable-blocks-tab.native.js +4 -5
  495. package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  496. package/build-module/components/inserter/search-results.native.js +8 -2
  497. package/build-module/components/inserter/search-results.native.js.map +1 -1
  498. package/build-module/components/inserter/tabs.native.js +1 -4
  499. package/build-module/components/inserter/tabs.native.js.map +1 -1
  500. package/build-module/components/inserter/utils.native.js +35 -0
  501. package/build-module/components/inserter/utils.native.js.map +1 -0
  502. package/build-module/components/inspector-controls/block-support-slot-container.js +18 -0
  503. package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -0
  504. package/build-module/components/inspector-controls/block-support-tools-panel.js +67 -0
  505. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -0
  506. package/build-module/components/inspector-controls/fill.js +50 -0
  507. package/build-module/components/inspector-controls/fill.js.map +1 -0
  508. package/build-module/components/inspector-controls/{index.native.js → fill.native.js} +16 -18
  509. package/build-module/components/inspector-controls/fill.native.js.map +1 -0
  510. package/build-module/components/inspector-controls/groups.js +14 -0
  511. package/build-module/components/inspector-controls/groups.js.map +1 -0
  512. package/build-module/components/inspector-controls/index.js +16 -17
  513. package/build-module/components/inspector-controls/index.js.map +1 -1
  514. package/build-module/components/inspector-controls/slot.js +52 -0
  515. package/build-module/components/inspector-controls/slot.js.map +1 -0
  516. package/build-module/components/inspector-controls/slot.native.js +27 -0
  517. package/build-module/components/inspector-controls/slot.native.js.map +1 -0
  518. package/build-module/components/line-height-control/index.native.js +29 -0
  519. package/build-module/components/line-height-control/index.native.js.map +1 -0
  520. package/build-module/components/link-control/index.js +11 -5
  521. package/build-module/components/link-control/index.js.map +1 -1
  522. package/build-module/components/link-control/link-preview.js +28 -11
  523. package/build-module/components/link-control/link-preview.js.map +1 -1
  524. package/build-module/components/link-control/search-input.js +13 -4
  525. package/build-module/components/link-control/search-input.js.map +1 -1
  526. package/build-module/components/list-view/block-contents.js +1 -18
  527. package/build-module/components/list-view/block-contents.js.map +1 -1
  528. package/build-module/components/list-view/block.js +9 -49
  529. package/build-module/components/list-view/block.js.map +1 -1
  530. package/build-module/components/list-view/branch.js +20 -15
  531. package/build-module/components/list-view/branch.js.map +1 -1
  532. package/build-module/components/list-view/index.js +22 -17
  533. package/build-module/components/list-view/index.js.map +1 -1
  534. package/build-module/components/list-view/leaf.js +1 -1
  535. package/build-module/components/list-view/leaf.js.map +1 -1
  536. package/build-module/components/list-view/list-item.js +3 -2
  537. package/build-module/components/list-view/list-item.js.map +1 -1
  538. package/build-module/components/list-view/use-list-view-client-ids.js +24 -15
  539. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  540. package/build-module/components/media-placeholder/index.js +35 -21
  541. package/build-module/components/media-placeholder/index.js.map +1 -1
  542. package/build-module/components/media-placeholder/index.native.js +2 -1
  543. package/build-module/components/media-placeholder/index.native.js.map +1 -1
  544. package/build-module/components/media-replace-flow/index.js +5 -3
  545. package/build-module/components/media-replace-flow/index.js.map +1 -1
  546. package/build-module/components/navigable-toolbar/index.js +1 -4
  547. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  548. package/build-module/components/observe-typing/index.js +1 -1
  549. package/build-module/components/observe-typing/index.js.map +1 -1
  550. package/build-module/components/plain-text/index.native.js +29 -2
  551. package/build-module/components/plain-text/index.native.js.map +1 -1
  552. package/build-module/components/rich-text/embed-handler-picker.native.js +53 -0
  553. package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -0
  554. package/build-module/components/rich-text/format-toolbar/index.js +28 -11
  555. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  556. package/build-module/components/rich-text/index.js +22 -6
  557. package/build-module/components/rich-text/index.js.map +1 -1
  558. package/build-module/components/rich-text/index.native.js +43 -6
  559. package/build-module/components/rich-text/index.native.js.map +1 -1
  560. package/build-module/components/rich-text/input-event.js +24 -22
  561. package/build-module/components/rich-text/input-event.js.map +1 -1
  562. package/build-module/components/rich-text/shortcut.js +22 -9
  563. package/build-module/components/rich-text/shortcut.js.map +1 -1
  564. package/build-module/components/rich-text/use-input-events.js +19 -0
  565. package/build-module/components/rich-text/use-input-events.js.map +1 -0
  566. package/build-module/components/rich-text/use-paste-handler.js +44 -10
  567. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  568. package/build-module/components/rich-text/use-shortcuts.js +19 -0
  569. package/build-module/components/rich-text/use-shortcuts.js.map +1 -0
  570. package/build-module/components/rich-text/utils.js +20 -0
  571. package/build-module/components/rich-text/utils.js.map +1 -1
  572. package/build-module/components/typewriter/index.js +1 -1
  573. package/build-module/components/typewriter/index.js.map +1 -1
  574. package/build-module/components/url-input/index.js +14 -7
  575. package/build-module/components/url-input/index.js.map +1 -1
  576. package/build-module/components/use-display-block-controls/index.js +5 -7
  577. package/build-module/components/use-display-block-controls/index.js.map +1 -1
  578. package/build-module/components/use-moving-animation/index.js +13 -10
  579. package/build-module/components/use-moving-animation/index.js.map +1 -1
  580. package/build-module/components/use-on-block-drop/index.js +3 -2
  581. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  582. package/build-module/components/use-resize-canvas/index.js +2 -10
  583. package/build-module/components/use-resize-canvas/index.js.map +1 -1
  584. package/build-module/components/use-setting/index.js +1 -6
  585. package/build-module/components/use-setting/index.js.map +1 -1
  586. package/build-module/components/writing-flow/use-multi-selection.js +6 -0
  587. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  588. package/build-module/components/writing-flow/use-tab-nav.js +18 -3
  589. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  590. package/build-module/hooks/align.js +15 -15
  591. package/build-module/hooks/align.js.map +1 -1
  592. package/build-module/hooks/anchor.js +5 -3
  593. package/build-module/hooks/anchor.js.map +1 -1
  594. package/build-module/hooks/border-color.js +10 -5
  595. package/build-module/hooks/border-color.js.map +1 -1
  596. package/build-module/hooks/color-panel.js +5 -3
  597. package/build-module/hooks/color-panel.js.map +1 -1
  598. package/build-module/hooks/color.js +6 -4
  599. package/build-module/hooks/color.js.map +1 -1
  600. package/build-module/hooks/compat.js +20 -0
  601. package/build-module/hooks/compat.js.map +1 -0
  602. package/build-module/hooks/custom-class-name.js +4 -2
  603. package/build-module/hooks/custom-class-name.js.map +1 -1
  604. package/build-module/hooks/dimensions.js +57 -26
  605. package/build-module/hooks/dimensions.js.map +1 -1
  606. package/build-module/hooks/duotone.js +46 -13
  607. package/build-module/hooks/duotone.js.map +1 -1
  608. package/build-module/hooks/font-family.js +91 -24
  609. package/build-module/hooks/font-family.js.map +1 -1
  610. package/build-module/hooks/gap.js +140 -0
  611. package/build-module/hooks/gap.js.map +1 -0
  612. package/build-module/hooks/index.js +2 -0
  613. package/build-module/hooks/index.js.map +1 -1
  614. package/build-module/hooks/index.native.js +1 -0
  615. package/build-module/hooks/index.native.js.map +1 -1
  616. package/build-module/hooks/layout.js +47 -30
  617. package/build-module/hooks/layout.js.map +1 -1
  618. package/build-module/hooks/letter-spacing.js +1 -1
  619. package/build-module/hooks/letter-spacing.js.map +1 -1
  620. package/build-module/hooks/lock.js +33 -0
  621. package/build-module/hooks/lock.js.map +1 -0
  622. package/build-module/hooks/margin.js +6 -3
  623. package/build-module/hooks/margin.js.map +1 -1
  624. package/build-module/hooks/padding.js +6 -3
  625. package/build-module/hooks/padding.js.map +1 -1
  626. package/build-module/hooks/style.js +39 -11
  627. package/build-module/hooks/style.js.map +1 -1
  628. package/build-module/hooks/typography.js +1 -2
  629. package/build-module/hooks/typography.js.map +1 -1
  630. package/build-module/hooks/typography.native.js +41 -0
  631. package/build-module/hooks/typography.native.js.map +1 -0
  632. package/build-module/layouts/flex.js +115 -9
  633. package/build-module/layouts/flex.js.map +1 -1
  634. package/build-module/layouts/flow.js +99 -7
  635. package/build-module/layouts/flow.js.map +1 -1
  636. package/build-module/store/actions.js +40 -13
  637. package/build-module/store/actions.js.map +1 -1
  638. package/build-module/store/defaults.js +2 -0
  639. package/build-module/store/defaults.js.map +1 -1
  640. package/build-module/store/defaults.native.js +15 -1
  641. package/build-module/store/defaults.native.js.map +1 -1
  642. package/build-module/store/reducer.js +166 -115
  643. package/build-module/store/reducer.js.map +1 -1
  644. package/build-module/store/selectors.js +148 -75
  645. package/build-module/store/selectors.js.map +1 -1
  646. package/build-module/utils/index.js +1 -0
  647. package/build-module/utils/index.js.map +1 -1
  648. package/build-module/utils/parse-css-unit-to-px.js +285 -0
  649. package/build-module/utils/parse-css-unit-to-px.js.map +1 -0
  650. package/build-module/utils/transform-styles/transforms/wrap.js +16 -0
  651. package/build-module/utils/transform-styles/transforms/wrap.js.map +1 -1
  652. package/build-style/default-editor-styles-rtl.css +114 -0
  653. package/build-style/default-editor-styles.css +114 -0
  654. package/build-style/style-rtl.css +136 -128
  655. package/build-style/style.css +136 -128
  656. package/build-types/components/block-context/index.d.ts +1 -1
  657. package/build-types/components/block-context/index.d.ts.map +1 -1
  658. package/package.json +31 -29
  659. package/src/components/alignment-control/test/__snapshots__/index.js.snap +2 -0
  660. package/src/components/alignment-control/ui.js +4 -1
  661. package/src/components/autocomplete/index.js +5 -2
  662. package/src/components/block-actions/index.js +9 -5
  663. package/src/components/block-alignment-control/style.scss +5 -0
  664. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +15 -1
  665. package/src/components/block-alignment-control/test/index.native.js +37 -0
  666. package/src/components/block-alignment-control/ui.js +98 -27
  667. package/src/components/block-alignment-control/use-available-alignments.js +31 -10
  668. package/src/components/block-content-overlay/index.js +3 -6
  669. package/src/components/block-content-overlay/style.scss +9 -21
  670. package/src/components/block-controls/fill.js +7 -4
  671. package/src/components/block-controls/groups.js +2 -0
  672. package/src/components/block-controls/hook.js +44 -0
  673. package/src/components/block-edit/context.js +4 -3
  674. package/src/components/block-edit/edit.js +1 -4
  675. package/src/components/block-icon/index.native.js +11 -12
  676. package/src/components/block-inspector/index.js +14 -9
  677. package/src/components/block-list/block-html.js +5 -0
  678. package/src/components/block-list/block-list-item.native.js +34 -11
  679. package/src/components/block-list/block-list-item.native.scss +4 -0
  680. package/src/components/block-list/block-selection-button.native.js +8 -5
  681. package/src/components/block-list/block.js +13 -9
  682. package/src/components/block-list/block.native.js +7 -5
  683. package/src/components/block-list/grid-item.native.js +58 -0
  684. package/src/components/block-list/index.js +33 -27
  685. package/src/components/block-list/index.native.js +9 -3
  686. package/src/components/block-list/style.native.scss +0 -1
  687. package/src/components/block-list/style.scss +15 -0
  688. package/src/components/block-list/use-block-props/index.js +4 -7
  689. package/src/components/block-list/use-block-props/use-block-custom-class-name.js +5 -7
  690. package/src/components/block-list/use-block-props/use-block-default-class-name.js +2 -8
  691. package/src/components/block-list/use-block-props/use-multi-selection.js +7 -1
  692. package/src/components/block-list/use-in-between-inserter.js +9 -0
  693. package/src/components/block-list-appender/index.js +8 -0
  694. package/src/components/block-mover/index.js +4 -4
  695. package/src/components/block-mover/index.native.js +4 -4
  696. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +10 -6
  697. package/src/components/block-mover/test/index.native.js +26 -28
  698. package/src/components/block-preview/README.md +1 -1
  699. package/src/components/block-preview/auto.js +36 -18
  700. package/src/components/block-preview/style.scss +0 -20
  701. package/src/components/block-settings-menu/block-settings-dropdown.js +7 -6
  702. package/src/components/block-settings-menu-controls/index.js +9 -6
  703. package/src/components/block-styles/index.js +6 -1
  704. package/src/components/block-styles/preview.native.js +1 -1
  705. package/src/components/block-switcher/block-styles-menu.js +1 -1
  706. package/src/components/block-switcher/index.js +7 -3
  707. package/src/components/block-switcher/test/index.js +3 -0
  708. package/src/components/block-title/index.js +5 -2
  709. package/src/components/block-toolbar/index.js +4 -0
  710. package/src/components/block-tools/block-contextual-toolbar.js +7 -5
  711. package/src/components/block-tools/block-popover.js +8 -8
  712. package/src/components/block-tools/block-selection-button.js +2 -4
  713. package/src/components/block-tools/index.js +5 -2
  714. package/src/components/block-tools/insertion-point.js +97 -9
  715. package/src/components/block-tools/style.scss +4 -35
  716. package/src/components/block-types-list/index.native.js +8 -2
  717. package/src/components/block-types-list/style.scss +0 -3
  718. package/src/components/block-variation-picker/README.md +47 -14
  719. package/src/components/block-variation-picker/style.native.scss +4 -0
  720. package/src/components/border-radius-control/index.js +1 -0
  721. package/src/components/border-radius-control/test/utils.js +216 -0
  722. package/src/components/border-radius-control/utils.js +18 -10
  723. package/src/components/color-palette/test/__snapshots__/control.js.snap +103 -71
  724. package/src/components/colors/test/utils.js +41 -0
  725. package/src/components/colors/utils.js +9 -5
  726. package/src/components/colors-gradients/control.js +64 -61
  727. package/src/components/colors-gradients/panel-color-gradient-settings.js +3 -1
  728. package/src/components/colors-gradients/style.scss +8 -5
  729. package/src/components/colors-gradients/test/control.js +43 -52
  730. package/src/components/contrast-checker/index.js +14 -10
  731. package/src/components/copy-handler/index.js +6 -1
  732. package/src/components/default-block-appender/index.js +2 -2
  733. package/src/components/default-block-appender/test/__snapshots__/index.js.snap +3 -3
  734. package/src/components/duotone-control/index.js +43 -41
  735. package/src/components/editor-styles/index.js +8 -4
  736. package/src/components/font-appearance-control/index.js +49 -19
  737. package/src/components/font-appearance-control/style.scss +1 -1
  738. package/src/components/font-sizes/index.native.js +7 -1
  739. package/src/components/iframe/index.js +63 -74
  740. package/src/components/image-editor/aspect-ratio-dropdown.js +129 -0
  741. package/src/components/image-editor/constants.js +6 -0
  742. package/src/components/image-editor/context.js +56 -0
  743. package/src/components/image-editor/cropper.js +74 -0
  744. package/src/components/image-editor/form-controls.js +22 -0
  745. package/src/components/image-editor/index.js +52 -0
  746. package/src/components/image-editor/rotation-button.js +24 -0
  747. package/src/components/image-editor/use-save-image.js +97 -0
  748. package/src/components/image-editor/use-transform-image.js +162 -0
  749. package/src/components/image-editor/zoom-dropdown.js +40 -0
  750. package/src/components/image-size-control/use-dimension-handler.js +18 -1
  751. package/src/components/index.js +8 -5
  752. package/src/components/index.native.js +8 -3
  753. package/src/components/inner-blocks/button-block-appender.js +9 -0
  754. package/src/components/inner-blocks/index.js +40 -11
  755. package/src/components/inner-blocks/index.native.js +41 -0
  756. package/src/components/inner-blocks/use-nested-settings-update.js +26 -11
  757. package/src/components/inserter/block-patterns-tab.js +11 -4
  758. package/src/components/inserter/block-types-tab.native.js +3 -6
  759. package/src/components/inserter/hooks/use-clipboard-block.native.js +3 -2
  760. package/src/components/inserter/index.js +15 -3
  761. package/src/components/inserter/index.native.js +2 -19
  762. package/src/components/inserter/library.js +2 -0
  763. package/src/components/inserter/menu.js +4 -1
  764. package/src/components/inserter/menu.native.js +18 -15
  765. package/src/components/inserter/preview-panel.js +1 -1
  766. package/src/components/inserter/quick-inserter.js +1 -1
  767. package/src/components/inserter/reusable-blocks-tab.native.js +4 -6
  768. package/src/components/inserter/search-results.native.js +8 -1
  769. package/src/components/inserter/style.native.scss +8 -5
  770. package/src/components/inserter/style.scss +16 -15
  771. package/src/components/inserter/tabs.native.js +1 -7
  772. package/src/components/inserter/test/block-types-tab.native.js +2 -1
  773. package/src/components/inserter/utils.native.js +35 -0
  774. package/src/components/inserter-list-item/style.scss +4 -2
  775. package/src/components/inspector-controls/README.md +43 -198
  776. package/src/components/inspector-controls/block-support-slot-container.js +10 -0
  777. package/src/components/inspector-controls/block-support-tools-panel.js +60 -0
  778. package/src/components/inspector-controls/fill.js +53 -0
  779. package/src/components/inspector-controls/{index.native.js → fill.native.js} +14 -14
  780. package/src/components/inspector-controls/groups.js +18 -0
  781. package/src/components/inspector-controls/index.js +16 -18
  782. package/src/components/inspector-controls/slot.js +45 -0
  783. package/src/components/inspector-controls/slot.native.js +22 -0
  784. package/src/components/line-height-control/index.native.js +25 -0
  785. package/src/components/link-control/README.md +40 -14
  786. package/src/components/link-control/index.js +7 -1
  787. package/src/components/link-control/link-preview.js +36 -15
  788. package/src/components/link-control/search-input.js +12 -4
  789. package/src/components/link-control/style.scss +36 -5
  790. package/src/components/link-control/test/index.js +132 -0
  791. package/src/components/list-view/block-contents.js +17 -38
  792. package/src/components/list-view/block.js +8 -63
  793. package/src/components/list-view/branch.js +19 -12
  794. package/src/components/list-view/index.js +45 -26
  795. package/src/components/list-view/leaf.js +1 -1
  796. package/src/components/list-view/list-item.js +5 -4
  797. package/src/components/list-view/style.scss +56 -30
  798. package/src/components/list-view/use-list-view-client-ids.js +22 -22
  799. package/src/components/media-placeholder/README.md +9 -0
  800. package/src/components/media-placeholder/index.js +31 -20
  801. package/src/components/media-placeholder/index.native.js +2 -1
  802. package/src/components/media-placeholder/style.scss +2 -0
  803. package/src/components/media-replace-flow/README.md +7 -0
  804. package/src/components/media-replace-flow/index.js +4 -1
  805. package/src/components/media-replace-flow/style.scss +11 -12
  806. package/src/components/media-upload/README.md +1 -1
  807. package/src/components/navigable-toolbar/index.js +1 -4
  808. package/src/components/observe-typing/index.js +3 -2
  809. package/src/components/plain-text/index.native.js +26 -4
  810. package/src/components/rich-text/embed-handler-picker.native.js +67 -0
  811. package/src/components/rich-text/format-toolbar/index.js +22 -6
  812. package/src/components/rich-text/index.js +38 -12
  813. package/src/components/rich-text/index.native.js +37 -4
  814. package/src/components/rich-text/input-event.js +21 -20
  815. package/src/components/rich-text/shortcut.js +24 -9
  816. package/src/components/rich-text/style.scss +7 -5
  817. package/src/components/rich-text/use-input-events.js +19 -0
  818. package/src/components/rich-text/use-paste-handler.js +47 -12
  819. package/src/components/rich-text/use-shortcuts.js +19 -0
  820. package/src/components/rich-text/utils.js +16 -0
  821. package/src/components/skip-to-selected-block/README.md +39 -0
  822. package/src/components/tool-selector/style.scss +5 -5
  823. package/src/components/typewriter/index.js +3 -2
  824. package/src/components/url-input/index.js +12 -6
  825. package/src/components/use-display-block-controls/index.js +7 -10
  826. package/src/components/use-moving-animation/index.js +9 -8
  827. package/src/components/use-on-block-drop/index.js +5 -1
  828. package/src/components/use-resize-canvas/index.js +2 -17
  829. package/src/components/use-setting/index.js +1 -7
  830. package/src/components/writing-flow/use-multi-selection.js +6 -0
  831. package/src/components/writing-flow/use-tab-nav.js +21 -11
  832. package/src/default-editor-styles.scss +24 -0
  833. package/src/hooks/align.js +28 -20
  834. package/src/hooks/anchor.js +5 -5
  835. package/src/hooks/border-color.js +12 -1
  836. package/src/hooks/color-panel.js +3 -1
  837. package/src/hooks/color.js +11 -4
  838. package/src/hooks/compat.js +23 -0
  839. package/src/hooks/custom-class-name.js +3 -3
  840. package/src/hooks/dimensions.js +94 -50
  841. package/src/hooks/duotone.js +49 -14
  842. package/src/hooks/font-family.js +107 -27
  843. package/src/hooks/gap.js +146 -0
  844. package/src/hooks/index.js +2 -0
  845. package/src/hooks/index.native.js +1 -0
  846. package/src/hooks/layout.js +82 -56
  847. package/src/hooks/layout.scss +6 -0
  848. package/src/hooks/letter-spacing.js +2 -1
  849. package/src/hooks/lock.js +34 -0
  850. package/src/hooks/margin.js +12 -2
  851. package/src/hooks/padding.js +12 -2
  852. package/src/hooks/style.js +57 -18
  853. package/src/hooks/test/style.js +4 -0
  854. package/src/hooks/typography.js +2 -6
  855. package/src/hooks/typography.native.js +64 -0
  856. package/src/layouts/flex.js +139 -12
  857. package/src/layouts/flow.js +81 -14
  858. package/src/store/actions.js +54 -16
  859. package/src/store/defaults.js +2 -0
  860. package/src/store/defaults.native.js +15 -0
  861. package/src/store/reducer.js +230 -145
  862. package/src/store/selectors.js +164 -115
  863. package/src/store/test/actions.js +89 -88
  864. package/src/store/test/reducer.js +184 -146
  865. package/src/store/test/selectors.js +118 -156
  866. package/src/style.scss +1 -14
  867. package/src/utils/index.js +1 -0
  868. package/src/utils/parse-css-unit-to-px.js +272 -0
  869. package/src/utils/test/parse-css-unit-to-px.js +206 -0
  870. package/src/utils/transform-styles/transforms/test/wrap.js +1 -1
  871. package/src/utils/transform-styles/transforms/wrap.js +16 -0
  872. package/tsconfig.tsbuildinfo +1 -466
  873. package/build/components/block-list/head.js +0 -27
  874. package/build/components/block-list/head.js.map +0 -1
  875. package/build/components/duotone-control/duotone-picker-popover.js +0 -44
  876. package/build/components/duotone-control/duotone-picker-popover.js.map +0 -1
  877. package/build/components/inspector-advanced-controls/index.js +0 -46
  878. package/build/components/inspector-advanced-controls/index.js.map +0 -1
  879. package/build/components/inspector-controls/index.native.js.map +0 -1
  880. package/build/components/list-view/block-slot.js +0 -121
  881. package/build/components/list-view/block-slot.js.map +0 -1
  882. package/build/components/list-view/editor.js +0 -35
  883. package/build/components/list-view/editor.js.map +0 -1
  884. package/build/components/use-simulated-media-query/index.js +0 -137
  885. package/build/components/use-simulated-media-query/index.js.map +0 -1
  886. package/build-module/components/block-list/head.js +0 -19
  887. package/build-module/components/block-list/head.js.map +0 -1
  888. package/build-module/components/duotone-control/duotone-picker-popover.js +0 -35
  889. package/build-module/components/duotone-control/duotone-picker-popover.js.map +0 -1
  890. package/build-module/components/inspector-advanced-controls/index.js +0 -36
  891. package/build-module/components/inspector-advanced-controls/index.js.map +0 -1
  892. package/build-module/components/inspector-controls/index.native.js.map +0 -1
  893. package/build-module/components/list-view/block-slot.js +0 -96
  894. package/build-module/components/list-view/block-slot.js.map +0 -1
  895. package/build-module/components/list-view/editor.js +0 -25
  896. package/build-module/components/list-view/editor.js.map +0 -1
  897. package/build-module/components/use-simulated-media-query/index.js +0 -126
  898. package/build-module/components/use-simulated-media-query/index.js.map +0 -1
  899. package/src/components/block-list/head.js +0 -18
  900. package/src/components/duotone-control/duotone-picker-popover.js +0 -36
  901. package/src/components/inspector-advanced-controls/README.md +0 -72
  902. package/src/components/inspector-advanced-controls/index.js +0 -32
  903. package/src/components/list-view/block-slot.js +0 -120
  904. package/src/components/list-view/editor.js +0 -29
  905. package/src/components/use-simulated-media-query/index.js +0 -144
@@ -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,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C,IAAA,OAAO,EAAGI,OAJX;AAKC,IAAA,SAAS,EAAG,yBAAYL,SAAZ,EAAuB;AAClC,0BAAoBM;AADc,KAAvB,CALb;AAQC,IAAA,KAAK,EAAGrB;AART,KAUC;AAAK,IAAA,SAAS,EAAC;AAAf,IAVD,EAWGqB,0BAA0B,IAC3B;AACC,IAAA,SAAS,EAAG,yBACX,mDADW;AADb,KAKC,4BAAC,iBAAD;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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AAG,MAAM;AACvB7D,MAAAA,OAAO,CAAC4C,OAAR,GAAkB,KAAlB;AACA;AAVF,IAND,CArBF,CAdD,CADD;AA2DA;AACA;;AAEc,SAASkB,cAAT,CAAyB;AACvCC,EAAAA,QADuC;AAEvCnE,EAAAA,qBAFuC;AAGvCC,EAAAA;AAHuC,CAAzB,EAIX;AACH,QAAMmE,SAAS,GAAG,qBAAazD,MAAF,IAAc;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"]}
@@ -34,7 +34,8 @@ function BlockTypesList({
34
34
  name,
35
35
  items,
36
36
  onSelect,
37
- listProps
37
+ listProps,
38
+ initialNumToRender = 3
38
39
  }) {
39
40
  const [numberOfColumns, setNumberOfColumns] = (0, _element.useState)(MIN_COL_NUM);
40
41
  const [itemWidth, setItemWidth] = (0, _element.useState)();
@@ -88,7 +89,7 @@ function BlockTypesList({
88
89
  keyboardShouldPersistTaps: "always",
89
90
  numColumns: numberOfColumns,
90
91
  data: items,
91
- initialNumToRender: 3,
92
+ initialNumToRender: initialNumToRender,
92
93
  ItemSeparatorComponent: () => (0, _element.createElement)(_reactNative.TouchableWithoutFeedback, {
93
94
  accessible: false
94
95
  }, (0, _element.createElement)(_reactNative.View, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/block-types-list/index.native.js"],"names":["MIN_COL_NUM","BlockTypesList","name","items","onSelect","listProps","numberOfColumns","setNumberOfColumns","itemWidth","setItemWidth","maxWidth","setMaxWidth","Dimensions","addEventListener","onLayout","removeEventListener","calculateItemWidth","paddingLeft","itemPaddingLeft","paddingRight","itemPaddingRight","InserterButton","Styles","modalItem","width","modalIconWrapper","columnStyle","styles","sumLeftRightPadding","bottomSheetWidth","BottomSheet","getWidth","containerTotalWidth","itemTotalWidth","columnsFitToWidth","Math","floor","numColumns","max","updatedItemWidth","contentContainerStyle","StyleSheet","flatten","item","id","paddingBottom","safeAreaBottomInset"],"mappings":";;;;;;;;;AAcA;;;;AAXA;;AAYA;;AAKA;;AApBA;AACA;AACA;;AASA;AACA;AACA;;AAIA;AACA;AACA;AAGA,MAAMA,WAAW,GAAG,CAApB;;AAEe,SAASC,cAAT,CAAyB;AAAEC,EAAAA,IAAF;AAAQC,EAAAA,KAAR;AAAeC,EAAAA,QAAf;AAAyBC,EAAAA;AAAzB,CAAzB,EAAgE;AAC9E,QAAM,CAAEC,eAAF,EAAmBC,kBAAnB,IAA0C,uBAAUP,WAAV,CAAhD;AACA,QAAM,CAAEQ,SAAF,EAAaC,YAAb,IAA8B,wBAApC;AACA,QAAM,CAAEC,QAAF,EAAYC,WAAZ,IAA4B,wBAAlC;AAEA,0BAAW,MAAM;AAChBC,4BAAWC,gBAAX,CAA6B,QAA7B,EAAuCC,QAAvC;;AACAA,IAAAA,QAAQ;AACR,WAAO,MAAM;AACZF,8BAAWG,mBAAX,CAAgC,QAAhC,EAA0CD,QAA1C;AACA,KAFD;AAGA,GAND,EAMG,EANH;;AAQA,WAASE,kBAAT,GAA8B;AAC7B,UAAM;AACLC,MAAAA,WAAW,EAAEC,eADR;AAELC,MAAAA,YAAY,EAAEC;AAFT,QAGFC,2BAAeC,MAAf,CAAsBC,SAH1B;AAIA,UAAM;AAAEC,MAAAA;AAAF,QAAYH,2BAAeC,MAAf,CAAsBG,gBAAxC;AACA,WAAOD,KAAK,GAAGN,eAAR,GAA0BE,gBAAjC;AACA;;AAED,WAASN,QAAT,GAAoB;AACnB,UAAMY,WAAW,GAAGC,eAAQ,0BAAR,CAApB;AACA,UAAMC,mBAAmB,GACxBF,WAAW,CAACT,WAAZ,GAA0BS,WAAW,CAACP,YADvC;;AAGA,UAAMU,gBAAgB,GAAGC,wBAAYC,QAAZ,EAAzB;;AACA,UAAMC,mBAAmB,GAAGH,gBAAgB,GAAGD,mB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QAJF;AAKEN,MAAAA;AALF;AAjBF,KA0BMC,SA1BN;AA2BC,IAAA,qBAAqB,EAAG,EACvB,GAAGmC,qBADoB;AAEvBK,MAAAA,aAAa,EAAEV,IAAI,CAACG,GAAL,CACdjC,SAAS,CAACyC,mBADI,EAEdN,qBAAqB,CAACK,aAFR;AAFQ;AA3BzB,KADD;AAqCA","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tDimensions,\n\tFlatList,\n\tStyleSheet,\n\tTouchableWithoutFeedback,\n\tView,\n} from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\nimport { BottomSheet, InserterButton } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nconst MIN_COL_NUM = 3;\n\nexport default function BlockTypesList( { name, items, onSelect, listProps } ) {\n\tconst [ numberOfColumns, setNumberOfColumns ] = useState( MIN_COL_NUM );\n\tconst [ itemWidth, setItemWidth ] = useState();\n\tconst [ maxWidth, setMaxWidth ] = useState();\n\n\tuseEffect( () => {\n\t\tDimensions.addEventListener( 'change', onLayout );\n\t\tonLayout();\n\t\treturn () => {\n\t\t\tDimensions.removeEventListener( 'change', onLayout );\n\t\t};\n\t}, [] );\n\n\tfunction calculateItemWidth() {\n\t\tconst {\n\t\t\tpaddingLeft: itemPaddingLeft,\n\t\t\tpaddingRight: itemPaddingRight,\n\t\t} = InserterButton.Styles.modalItem;\n\t\tconst { width } = InserterButton.Styles.modalIconWrapper;\n\t\treturn width + itemPaddingLeft + itemPaddingRight;\n\t}\n\n\tfunction onLayout() {\n\t\tconst columnStyle = styles[ 'block-types-list__column' ];\n\t\tconst sumLeftRightPadding =\n\t\t\tcolumnStyle.paddingLeft + columnStyle.paddingRight;\n\n\t\tconst bottomSheetWidth = BottomSheet.getWidth();\n\t\tconst containerTotalWidth = bottomSheetWidth - sumLeftRightPadding;\n\t\tconst itemTotalWidth = calculateItemWidth();\n\n\t\tconst columnsFitToWidth = Math.floor(\n\t\t\tcontainerTotalWidth / itemTotalWidth\n\t\t);\n\n\t\tconst numColumns = Math.max( MIN_COL_NUM, columnsFitToWidth );\n\n\t\tsetNumberOfColumns( numColumns );\n\t\tsetMaxWidth( containerTotalWidth / numColumns );\n\n\t\tif ( columnsFitToWidth < MIN_COL_NUM ) {\n\t\t\tconst updatedItemWidth =\n\t\t\t\t( bottomSheetWidth - 2 * sumLeftRightPadding ) / MIN_COL_NUM;\n\t\t\tsetItemWidth( updatedItemWidth );\n\t\t}\n\t}\n\n\tconst contentContainerStyle = StyleSheet.flatten(\n\t\tlistProps.contentContainerStyle\n\t);\n\n\treturn (\n\t\t<FlatList\n\t\t\tonLayout={ onLayout }\n\t\t\tkey={ `InserterUI-${ name }-${ numberOfColumns }` } //re-render when numberOfColumns changes\n\t\t\ttestID={ `InserterUI-${ name }` }\n\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\tnumColumns={ numberOfColumns }\n\t\t\tdata={ items }\n\t\t\tinitialNumToRender={ 3 }\n\t\t\tItemSeparatorComponent={ () => (\n\t\t\t\t<TouchableWithoutFeedback accessible={ false }>\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={ styles[ 'block-types-list__row-separator' ] }\n\t\t\t\t\t/>\n\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t) }\n\t\t\tkeyExtractor={ ( item ) => item.id }\n\t\t\trenderItem={ ( { item } ) => (\n\t\t\t\t<InserterButton\n\t\t\t\t\t{ ...{\n\t\t\t\t\t\titem,\n\t\t\t\t\t\titemWidth,\n\t\t\t\t\t\tmaxWidth,\n\t\t\t\t\t\tonSelect,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ...listProps }\n\t\t\tcontentContainerStyle={ {\n\t\t\t\t...contentContainerStyle,\n\t\t\t\tpaddingBottom: Math.max(\n\t\t\t\t\tlistProps.safeAreaBottomInset,\n\t\t\t\t\tcontentContainerStyle.paddingBottom\n\t\t\t\t),\n\t\t\t} }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/block-types-list/index.native.js"],"names":["MIN_COL_NUM","BlockTypesList","name","items","onSelect","listProps","initialNumToRender","numberOfColumns","setNumberOfColumns","itemWidth","setItemWidth","maxWidth","setMaxWidth","Dimensions","addEventListener","onLayout","removeEventListener","calculateItemWidth","paddingLeft","itemPaddingLeft","paddingRight","itemPaddingRight","InserterButton","Styles","modalItem","width","modalIconWrapper","columnStyle","styles","sumLeftRightPadding","bottomSheetWidth","BottomSheet","getWidth","containerTotalWidth","itemTotalWidth","columnsFitToWidth","Math","floor","numColumns","max","updatedItemWidth","contentContainerStyle","StyleSheet","flatten","item","id","paddingBottom","safeAreaBottomInset"],"mappings":";;;;;;;;;AAcA;;;;AAXA;;AAYA;;AAKA;;AApBA;AACA;AACA;;AASA;AACA;AACA;;AAIA;AACA;AACA;AAGA,MAAMA,WAAW,GAAG,CAApB;;AAEe,SAASC,cAAT,CAAyB;AACvCC,EAAAA,IADuC;AAEvCC,EAAAA,KAFuC;AAGvCC,EAAAA,QAHuC;AAIvCC,EAAAA,SAJuC;AAKvCC,EAAAA,kBAAkB,GAAG;AALkB,CAAzB,EAMX;AACH,QAAM,CAAEC,eAAF,EAAmBC,kBAAnB,IAA0C,uBAAUR,WAAV,CAAhD;AACA,QAAM,CAAES,SAAF,EAAaC,YAAb,IAA8B,wBAApC;AACA,QAAM,CAAEC,QAAF,EAAYC,WAAZ,IAA4B,wBAAlC;AAEA,0BAAW,MAAM;AAChBC,4BAAWC,gBAAX,CAA6B,QAA7B,EAAuCC,QAAvC;;AACAA,IAAAA,QAAQ;AACR,WAAO,MAAM;AACZF,8BAAWG,mBAAX,CAAgC,QAAhC,EAA0CD,QAA1C;AACA,KAFD;AAGA,GAND,EAMG,EANH;;AAQA,WAASE,kBAAT,GAA8B;AAC7B,UAAM;AACLC,MAAAA,WAAW,EAAEC,eADR;AAELC,MAAAA,YAAY,EAAEC;AAFT,QAGFC,2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IAAI,EAAGJ,KANR;AAOC,IAAA,kBAAkB,EAAGG,kBAPtB;AAQC,IAAA,sBAAsB,EAAG,MACxB,4BAAC,qCAAD;AAA0B,MAAA,UAAU,EAAG;AAAvC,OACC,4BAAC,iBAAD;AACC,MAAA,KAAK,EAAGsB,eAAQ,iCAAR;AADT,MADD,CATF;AAeC,IAAA,YAAY,EAAKgB,IAAF,IAAYA,IAAI,CAACC,EAfjC;AAgBC,IAAA,UAAU,EAAG,CAAE;AAAED,MAAAA;AAAF,KAAF,KACZ,4BAAC,0BAAD;AAEEA,MAAAA,IAFF;AAGEnC,MAAAA,SAHF;AAIEE,MAAAA,QAJF;AAKEP,MAAAA;AALF;AAjBF,KA0BMC,SA1BN;AA2BC,IAAA,qBAAqB,EAAG,EACvB,GAAGoC,qBADoB;AAEvBK,MAAAA,aAAa,EAAEV,IAAI,CAACG,GAAL,CACdlC,SAAS,CAAC0C,mBADI,EAEdN,qBAAqB,CAACK,aAFR;AAFQ;AA3BzB,KADD;AAqCA","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tDimensions,\n\tFlatList,\n\tStyleSheet,\n\tTouchableWithoutFeedback,\n\tView,\n} from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\nimport { BottomSheet, InserterButton } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nconst MIN_COL_NUM = 3;\n\nexport default function BlockTypesList( {\n\tname,\n\titems,\n\tonSelect,\n\tlistProps,\n\tinitialNumToRender = 3,\n} ) {\n\tconst [ numberOfColumns, setNumberOfColumns ] = useState( MIN_COL_NUM );\n\tconst [ itemWidth, setItemWidth ] = useState();\n\tconst [ maxWidth, setMaxWidth ] = useState();\n\n\tuseEffect( () => {\n\t\tDimensions.addEventListener( 'change', onLayout );\n\t\tonLayout();\n\t\treturn () => {\n\t\t\tDimensions.removeEventListener( 'change', onLayout );\n\t\t};\n\t}, [] );\n\n\tfunction calculateItemWidth() {\n\t\tconst {\n\t\t\tpaddingLeft: itemPaddingLeft,\n\t\t\tpaddingRight: itemPaddingRight,\n\t\t} = InserterButton.Styles.modalItem;\n\t\tconst { width } = InserterButton.Styles.modalIconWrapper;\n\t\treturn width + itemPaddingLeft + itemPaddingRight;\n\t}\n\n\tfunction onLayout() {\n\t\tconst columnStyle = styles[ 'block-types-list__column' ];\n\t\tconst sumLeftRightPadding =\n\t\t\tcolumnStyle.paddingLeft + columnStyle.paddingRight;\n\n\t\tconst bottomSheetWidth = BottomSheet.getWidth();\n\t\tconst containerTotalWidth = bottomSheetWidth - sumLeftRightPadding;\n\t\tconst itemTotalWidth = calculateItemWidth();\n\n\t\tconst columnsFitToWidth = Math.floor(\n\t\t\tcontainerTotalWidth / itemTotalWidth\n\t\t);\n\n\t\tconst numColumns = Math.max( MIN_COL_NUM, columnsFitToWidth );\n\n\t\tsetNumberOfColumns( numColumns );\n\t\tsetMaxWidth( containerTotalWidth / numColumns );\n\n\t\tif ( columnsFitToWidth < MIN_COL_NUM ) {\n\t\t\tconst updatedItemWidth =\n\t\t\t\t( bottomSheetWidth - 2 * sumLeftRightPadding ) / MIN_COL_NUM;\n\t\t\tsetItemWidth( updatedItemWidth );\n\t\t}\n\t}\n\n\tconst contentContainerStyle = StyleSheet.flatten(\n\t\tlistProps.contentContainerStyle\n\t);\n\n\treturn (\n\t\t<FlatList\n\t\t\tonLayout={ onLayout }\n\t\t\tkey={ `InserterUI-${ name }-${ numberOfColumns }` } //re-render when numberOfColumns changes\n\t\t\ttestID={ `InserterUI-${ name }` }\n\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\tnumColumns={ numberOfColumns }\n\t\t\tdata={ items }\n\t\t\tinitialNumToRender={ initialNumToRender }\n\t\t\tItemSeparatorComponent={ () => (\n\t\t\t\t<TouchableWithoutFeedback accessible={ false }>\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={ styles[ 'block-types-list__row-separator' ] }\n\t\t\t\t\t/>\n\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t) }\n\t\t\tkeyExtractor={ ( item ) => item.id }\n\t\t\trenderItem={ ( { item } ) => (\n\t\t\t\t<InserterButton\n\t\t\t\t\t{ ...{\n\t\t\t\t\t\titem,\n\t\t\t\t\t\titemWidth,\n\t\t\t\t\t\tmaxWidth,\n\t\t\t\t\t\tonSelect,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ...listProps }\n\t\t\tcontentContainerStyle={ {\n\t\t\t\t...contentContainerStyle,\n\t\t\t\tpaddingBottom: Math.max(\n\t\t\t\t\tlistProps.safeAreaBottomInset,\n\t\t\t\t\tcontentContainerStyle.paddingBottom\n\t\t\t\t),\n\t\t\t} }\n\t\t/>\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,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GF;AANT,IADD,EASC,4BAAC,wBAAD;AACC,IAAA,SAAS,EAAC,iDADX;AAEC,IAAA,KAAK,EAAGQ,QAFT;AAGC,IAAA,GAAG,EAAGlB,uBAHP;AAIC,IAAA,GAAG,EAAGC,wBAAwB,CAAEW,IAAF,CAJ/B;AAKC,IAAA,eAAe,EAAG,CALnB;AAMC,IAAA,cAAc,EAAG,KANlB;AAOC,IAAA,QAAQ,EAAGQ,kBAPZ;AAQC,IAAA,IAAI,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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AAA,cAAc,EAAG,KANlB;AAOC,IAAA,QAAQ,EAAGQ,kBAPZ;AAQC,IAAA,IAAI,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\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,EAAqB;AACpB,SAAOA,GAAG,CACRC,IADK,CAEL,CAAEC,CAAF,EAAKC,CAAL,KACCH,GAAG,CAACI,MAAJ,CAAcC,CAAF,IAASA,CAAC,KAAKH,CAA3B,EAA+BI,MAA/B,GACAN,GAAG,CAACI,MAAJ,CAAcC,CAAF,IAASA,CAAC,KAAKF,CAA3B,EAA+BG,MAJ3B,EAMLC,GANK,EAAP;AAOA;AAED;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,SAAOX,IAAI,CAAEY,QAAF,CAAX;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,WAAT,CAAsBN,MAAM,GAAG,EAA/B,EAAoC;AAC1C;AACD;AACA;AACA;AACA;AACC,MAAK,OAAOA,MAAP,KAAkB,QAAvB,EAAkC;AACjC,WAAOA,MAAP;AACA;;AAED,QAAMO,YAAY,GAAGJ,MAAM,CAACH,MAAP,CA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,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,QAAv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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 (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"]}
@@ -95,24 +95,28 @@ function ColorGradientControlInner({
95
95
 
96
96
  return (0, _element.createElement)(_components.BaseControl, {
97
97
  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", {
98
+ }, (0, _element.createElement)("fieldset", null, (0, _element.createElement)(_components.__experimentalVStack, {
99
+ space: 3
100
+ }, (0, _element.createElement)("legend", null, (0, _element.createElement)("div", {
99
101
  className: "block-editor-color-gradient-control__color-indicator"
100
102
  }, (0, _element.createElement)(_components.BaseControl.VisualLabel, null, (0, _element.createElement)(VisualLabel, {
101
103
  currentTab: currentTab,
102
104
  label: label,
103
105
  colorValue: colorValue,
104
106
  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, {
107
+ })))), canChooseAColor && canChooseAGradient && (0, _element.createElement)(_components.__experimentalToggleGroupControl, {
108
+ value: currentTab,
109
+ onChange: setCurrentTab,
110
+ label: (0, _i18n.__)('Select color type'),
111
+ hideLabelFromVision: true,
112
+ isBlock: true
113
+ }, (0, _element.createElement)(_components.__experimentalToggleGroupControlOption, {
114
+ value: "color",
115
+ label: (0, _i18n.__)('Solid')
116
+ }), (0, _element.createElement)(_components.__experimentalToggleGroupControlOption, {
117
+ value: "gradient",
118
+ label: (0, _i18n.__)('Gradient')
119
+ })), (currentTab === 'color' || !canChooseAGradient) && (0, _element.createElement)(_components.ColorPalette, {
116
120
  value: colorValue,
117
121
  onChange: canChooseAGradient ? newColor => {
118
122
  onColorChange(newColor);
@@ -130,7 +134,7 @@ function ColorGradientControlInner({
130
134
  gradients,
131
135
  disableCustomGradients,
132
136
  clearable: clearable
133
- })));
137
+ }))));
134
138
  }
135
139
 
136
140
  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,aAAJ,CAAhC,C,CAEA;;AACA,MAAMC,0BAA0B,GAAG,cAAI,gBAAJ,CAAnC;AAEA,MAAMC,qBAAqB,GAAG,CAC7B,QAD6B,EAE7B,qBAF6B,EAG7B,WAH6B,EAI7B,wBAJ6B,CAA9B;;AAOA,SAASC,WAAT,CAAsB;AACrBC,EAAAA,MADqB;AAErBC,EAAAA,SAFqB;AAGrBC,EAAAA,KAHqB;AAIrBC,EAAAA,UAJqB;AAKrBC,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B;AACf,KAJc,GAKfD,aARL;AAUQjB,IAAAA,MAVR;AAUgBc,IAAAA,mBAVhB;AAWC,IAAA,SAAS,EAAGK;AAXb,IAhCF,EA8CG,CAAEhB,UAAU,KAAK,UAAf,IAA6B,CAAEiB,eAAjC,KACD,4BAAC,0BAAD;AACC,IAAA,KAAK,EAAGf,aADT;AAEC,IAAA,QAAQ,EACPe,eAAe,GACVI,WAAF,IAAmB;AACnBN,MAAAA,gBAAgB,CAAEM,WAAF,CAAhB;AACAP,MAAAA,aAAa;AACZ,KAJW,GAKZC,gBARL;AAUQjB,IAAAA,SAVR;AAUmBc,IAAAA,sBAVnB;AAWC,IAAA,SAAS,EAAGI;AAXb,IA/CF,CAND,CADD;AAuEA;;AAED,SAASM,0BAAT,CAAqCC,KAArC,EAA6C;AAC5C,QAAMC,qBAAqB,GAAG,EAA9B;AACAA,EAAAA,qBAAqB,CAAC3B,MAAtB,GAA+B,yBAAY,eAAZ,CAA/B;AACA2B,EAAAA,qBAAqB,CAAC1B,SAAtB,GAAkC,yBAAY,iBAAZ,CAAlC;AACA0B,EAAAA,qBAAqB,CAACb,mBAAtB,GAA4C,CAAE,yBAAY,cAAZ,CAA9C;AACAa,EAAAA,qBAAqB,CAACZ,sBAAtB,GAA+C,CAAE,yBAChD,sBADgD,CAAjD;AAIA,SACC,4BAAC,yBAAD,6BACWY,qBADX,EACqCD,KADrC,EADD;AAKA;;AAED,SAASE,oBAAT,CAA+BF,KAA/B,EAAuC;AACtC,MACC,mBAAO5B,qBAAP,EAAgC+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":["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;;AASA;;AAKA;;AACA;;AACA;;AA1BA;AACA;AACA;;AAIA;AACA;AACA;;AAaA;AACA;AACA;AAKA;AACA,MAAMA,uBAAuB,GAAG,cAAI,aAAJ,CAAhC,C,CAEA;;AACA,MAAMC,0BAA0B,GAAG,cAAI,gBAAJ,CAAnC;AAEA,MAAMC,qBAAqB,GAAG,CAC7B,QAD6B,EAE7B,qBAF6B,EAG7B,WAH6B,EAI7B,wBAJ6B,CAA9B;;AAOA,SAASC,WAAT,CAAsB;AACrBC,EAAAA,MADqB;AAErBC,EAAAA,SAFqB;AAGrBC,EAAAA,KAHqB;AAIrBC,EAAAA,UAJqB;AAKrBC,EAAAA,UALqB;AAMrBC,EAAAA;AANqB,CAAtB,EAOI;AACH,MAAIC,KAAJ,EAAWC,SAAX;;AACA,MAAKJ,UAAU,KAAK,O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A,SAAS,EAAGK;AAXb,IAhCF,EA8CG,CAAEhB,UAAU,KAAK,UAAf,IAA6B,CAAEiB,eAAjC,KACD,4BAAC,0BAAD;AACC,IAAA,KAAK,EAAGf,aADT;AAEC,IAAA,QAAQ,EACPe,eAAe,GACVI,WAAF,IAAmB;AACnBN,MAAAA,gBAAgB,CAAEM,WAAF,CAAhB;AACAP,MAAAA,aAAa;AACZ,KAJW,GAKZC,gBARL;AAUQjB,IAAAA,SAVR;AAUmBc,IAAAA,sBAVnB;AAWC,IAAA,SAAS,EAAGI;AAXb,IA/CF,CADD,CAND,CADD;AAyEA;;AAED,SAASM,0BAAT,CAAqCC,KAArC,EAA6C;AAC5C,QAAMC,qBAAqB,GAAG,EAA9B;AACAA,EAAAA,qBAAqB,CAAC3B,MAAtB,GAA+B,yBAAY,eAAZ,CAA/B;AACA2B,EAAAA,qBAAqB,CAAC1B,SAAtB,GAAkC,yBAAY,iBAAZ,CAAlC;AACA0B,EAAAA,qBAAqB,CAACb,mBAAtB,GAA4C,CAAE,yBAAY,cAAZ,CAA9C;AACAa,EAAAA,qBAAqB,CAACZ,sBAAtB,GAA+C,CAAE,yBAChD,sBADgD,CAAjD;AAIA,SACC,4BAAC,yBAAD,6BACWY,qBADX,EACqCD,KADrC,EADD;AAKA;;AAED,SAASE,oBAAT,CAA+BF,KAA/B,EAAuC;AACtC,MACC,mBAAO5B,qBAAP,EAAgC+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\t__experimentalVStack as VStack,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\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<VStack space={ 3 }>\n\t\t\t\t\t<legend>\n\t\t\t\t\t\t<div className=\"block-editor-color-gradient-control__color-indicator\">\n\t\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t\t<VisualLabel\n\t\t\t\t\t\t\t\t\tcurrentTab={ currentTab }\n\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t\tcolorValue={ colorValue }\n\t\t\t\t\t\t\t\t\tgradientValue={ gradientValue }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</legend>\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\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\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"]}
@@ -87,6 +87,7 @@ const PanelColorGradientSettingsInner = ({
87
87
  children,
88
88
  settings,
89
89
  title,
90
+ showTitle = true,
90
91
  ...props
91
92
  }) => {
92
93
  if ((0, _lodash.isEmpty)(colors) && (0, _lodash.isEmpty)(gradients) && disableCustomColors && disableCustomGradients && (0, _lodash.every)(settings, setting => (0, _lodash.isEmpty)(setting.colors) && (0, _lodash.isEmpty)(setting.gradients) && (setting.disableCustomColors === undefined || setting.disableCustomColors) && (setting.disableCustomGradients === undefined || setting.disableCustomGradients))) {
@@ -102,7 +103,7 @@ const PanelColorGradientSettingsInner = ({
102
103
  }));
103
104
  return (0, _element.createElement)(_components.PanelBody, (0, _extends2.default)({
104
105
  className: (0, _classnames.default)('block-editor-panel-color-gradient-settings', className),
105
- title: titleElement
106
+ title: showTitle ? titleElement : undefined
106
107
  }, props), settings.map((setting, index) => (0, _element.createElement)(_control.default, (0, _extends2.default)({
107
108
  key: index,
108
109
  colors,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/colors-gradients/panel-color-gradient-settings.js"],"names":["colorIndicatorAriaLabel","gradientIndicatorAriaLabel","colorsAndGradientKeys","Indicators","colors","gradients","settings","map","colorValue","gradientValue","label","availableColors","availableGradients","index","ariaLabel","colorObject","toLowerCase","name","gradientObject","PanelColorGradientSettingsInner","className","disableCustomColors","disableCustomGradients","children","title","props","setting","undefined","titleElement","PanelColorGradientSettingsSelect","colorGradientSettings","PanelColorGradientSettings","key","hasOwnProperty"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AAMA;AACA,MAAMA,uBAAuB,GAAG,cAAI,gBAAJ,CAAhC,C,CAEA;;AACA,MAAMC,0BAA0B,GAAG,cAAI,mBAAJ,CAAnC;AAEA,MAAMC,qBAAqB,GAAG,CAC7B,QAD6B,EAE7B,qBAF6B,EAG7B,WAH6B,EAI7B,wBAJ6B,CAA9B;;AAOA,MAAMC,UAAU,GAAG,CAAE;AAAEC,EAAAA,MAAF;AAAUC,EAAAA,SAAV;AAAqBC,EAAAA;AAArB,CAAF,KAAuC;AACzD,SAAOA,QAAQ,CAACC,GAAT,CACN,CACC;AACCC,IAAAA,UADD;AAECC,IAAAA,aAFD;AAGCC,IAAAA,KAHD;AAICN,IAAAA,MAAM,EAAEO,eAJT;AAKCN,IAAAA,SAAS,EAAEO;AALZ,GADD,EAQCC,KARD,KASK;AACJ,QAAK,CAAEL,UAAF,IAAgB,CAAEC,aAAvB,EAAuC;AACtC,aAAO,IAAP;AACA;;AACD,QAAIK,SAAJ;;AACA,QAAKN,UAAL,EAAkB;AACjB,YAAMO,WAAW,GAAG,wCACnBJ,eAAe,IAAIP,MADA,EAEnBI,UAFmB,CAApB;AAIAM,MAAAA,SAAS,GAAG,mBACXd,uBADW,EAEXU,KAAK,CAACM,WAAN,EAFW,EAGTD,WAAW,IAAIA,WAAW,CAACE,IAA7B,IAAuCT,UAH5B,CAAZ;AAKA,KAVD,MAUO;AACN,YAAMU,cAAc,GAAG,+DACtBN,kBAAkB,IAAIP,SADA,EAEtBG,U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KANN,GAQGnB,QAAQ,CAACC,GAAT,CAAc,CAAEmB,OAAF,EAAWb,KAAX,KACf,4BAAC,gBAAD;AACC,IAAA,GAAG,EAAGA,KADP;AAGET,IAAAA,MAHF;AAIEC,IAAAA,SAJF;AAKEgB,IAAAA,mBALF;AAMEC,IAAAA;AANF,KAOKI,OAPL,EADC,CARH,EAoBGH,QApBH,CADD;AAwBA,CAhEM;;;;AAkEP,MAAMM,gCAAgC,GAAKJ,KAAF,IAAa;AACrD,QAAMK,qBAAqB,GAAG,EAA9B;AACAA,EAAAA,qBAAqB,CAAC1B,MAAtB,GAA+B,yBAAY,eAAZ,CAA/B;AACA0B,EAAAA,qBAAqB,CAACzB,SAAtB,GAAkC,yBAAY,iBAAZ,CAAlC;AACAyB,EAAAA,qBAAqB,CAACT,mBAAtB,GAA4C,CAAE,yBAAY,cAAZ,CAA9C;AACAS,EAAAA,qBAAqB,CAACR,sBAAtB,GAA+C,CAAE,yBAChD,sBADgD,CAAjD;AAGA,SACC,4BAAC,+BAAD,6BACWQ,qBADX,EACqCL,KADrC,EADD;AAKA,CAbD;;AAeA,MAAMM,0BAA0B,GAAKN,KAAF,IAAa;AAC/C,MACC,mBAAOvB,qBAAP,EAAgC8B,GAAF,IAAWP,KAAK,CAACQ,cAAN,CAAsBD,GAAtB,CAAzC,CADD,EAEE;AACD,WAAO,4BAAC,+BAAD,EAAsCP,KAAtC,CAAP;AACA;;AACD,SAAO,4BAAC,gCAAD,EAAuCA,KAAvC,CAAP;AACA,CAPD;;eASeM,0B","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { every, isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { PanelBody, ColorIndicator } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ColorGradientControl from './control';\nimport { getColorObjectByColorValue } from '../colors';\nimport { __experimentalGetGradientObjectByGradientValue } from '../gradients';\nimport useSetting from '../use-setting';\n\n// translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)\nconst colorIndicatorAriaLabel = __( '(%s: color %s)' );\n\n// translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)\nconst gradientIndicatorAriaLabel = __( '(%s: gradient %s)' );\n\nconst colorsAndGradientKeys = [\n\t'colors',\n\t'disableCustomColors',\n\t'gradients',\n\t'disableCustomGradients',\n];\n\nconst Indicators = ( { colors, gradients, settings } ) => {\n\treturn settings.map(\n\t\t(\n\t\t\t{\n\t\t\t\tcolorValue,\n\t\t\t\tgradientValue,\n\t\t\t\tlabel,\n\t\t\t\tcolors: availableColors,\n\t\t\t\tgradients: availableGradients,\n\t\t\t},\n\t\t\tindex\n\t\t) => {\n\t\t\tif ( ! colorValue && ! gradientValue ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tlet ariaLabel;\n\t\t\tif ( colorValue ) {\n\t\t\t\tconst colorObject = getColorObjectByColorValue(\n\t\t\t\t\tavailableColors || colors,\n\t\t\t\t\tcolorValue\n\t\t\t\t);\n\t\t\t\tariaLabel = sprintf(\n\t\t\t\t\tcolorIndicatorAriaLabel,\n\t\t\t\t\tlabel.toLowerCase(),\n\t\t\t\t\t( colorObject && colorObject.name ) || colorValue\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst gradientObject = __experimentalGetGradientObjectByGradientValue(\n\t\t\t\t\tavailableGradients || gradients,\n\t\t\t\t\tcolorValue\n\t\t\t\t);\n\t\t\t\tariaLabel = sprintf(\n\t\t\t\t\tgradientIndicatorAriaLabel,\n\t\t\t\t\tlabel.toLowerCase(),\n\t\t\t\t\t( gradientObject && gradientObject.name ) || gradientValue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<ColorIndicator\n\t\t\t\t\tkey={ index }\n\t\t\t\t\tcolorValue={ colorValue || gradientValue }\n\t\t\t\t\taria-label={ ariaLabel }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t);\n};\n\nexport const PanelColorGradientSettingsInner = ( {\n\tclassName,\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\tchildren,\n\tsettings,\n\ttitle,\n\t...props\n} ) => {\n\tif (\n\t\tisEmpty( colors ) &&\n\t\tisEmpty( gradients ) &&\n\t\tdisableCustomColors &&\n\t\tdisableCustomGradients &&\n\t\tevery(\n\t\t\tsettings,\n\t\t\t( setting ) =>\n\t\t\t\tisEmpty( setting.colors ) &&\n\t\t\t\tisEmpty( setting.gradients ) &&\n\t\t\t\t( setting.disableCustomColors === undefined ||\n\t\t\t\t\tsetting.disableCustomColors ) &&\n\t\t\t\t( setting.disableCustomGradients === undefined ||\n\t\t\t\t\tsetting.disableCustomGradients )\n\t\t)\n\t) {\n\t\treturn null;\n\t}\n\n\tconst titleElement = (\n\t\t<span className=\"block-editor-panel-color-gradient-settings__panel-title\">\n\t\t\t{ title }\n\t\t\t<Indicators\n\t\t\t\tcolors={ colors }\n\t\t\t\tgradients={ gradients }\n\t\t\t\tsettings={ settings }\n\t\t\t/>\n\t\t</span>\n\t);\n\treturn (\n\t\t<PanelBody\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-panel-color-gradient-settings',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\ttitle={ titleElement }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ settings.map( ( setting, index ) => (\n\t\t\t\t<ColorGradientControl\n\t\t\t\t\tkey={ index }\n\t\t\t\t\t{ ...{\n\t\t\t\t\t\tcolors,\n\t\t\t\t\t\tgradients,\n\t\t\t\t\t\tdisableCustomColors,\n\t\t\t\t\t\tdisableCustomGradients,\n\t\t\t\t\t\t...setting,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ children }\n\t\t</PanelBody>\n\t);\n};\n\nconst PanelColorGradientSettingsSelect = ( 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\treturn (\n\t\t<PanelColorGradientSettingsInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n};\n\nconst PanelColorGradientSettings = ( props ) => {\n\tif (\n\t\tevery( colorsAndGradientKeys, ( key ) => props.hasOwnProperty( key ) )\n\t) {\n\t\treturn <PanelColorGradientSettingsInner { ...props } />;\n\t}\n\treturn <PanelColorGradientSettingsSelect { ...props } />;\n};\n\nexport default PanelColorGradientSettings;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/colors-gradients/panel-color-gradient-settings.js"],"names":["colorIndicatorAriaLabel","gradientIndicatorAriaLabel","colorsAndGradientKeys","Indicators","colors","gradients","settings","map","colorValue","gradientValue","label","availableColors","availableGradients","index","ariaLabel","colorObject","toLowerCase","name","gradientObject","PanelColorGradientSettingsInner","className","disableCustomColors","disableCustomGradients","children","title","showTitle","props","setting","undefined","titleElement","PanelColorGradientSettingsSelect","colorGradientSettings","PanelColorGradientSettings","key","hasOwnProperty"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AAMA;AACA,MAAMA,uBAAuB,GAAG,cAAI,gBAAJ,CAAhC,C,CAEA;;AACA,MAAMC,0BAA0B,GAAG,cAAI,mBAAJ,CAAnC;AAEA,MAAMC,qBAAqB,GAAG,CAC7B,QAD6B,EAE7B,qBAF6B,EAG7B,WAH6B,EAI7B,wBAJ6B,CAA9B;;AAOA,MAAMC,UAAU,GAAG,CAAE;AAAEC,EAAAA,MAAF;AAAUC,EAAAA,SAAV;AAAqBC,EAAAA;AAArB,CAAF,KAAuC;AACzD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AA+C,CAAE,yBAChD,sBADgD,CAAjD;AAGA,SACC,4BAAC,+BAAD,6BACWS,qBADX,EACqCL,KADrC,EADD;AAKA,CAbD;;AAeA,MAAMM,0BAA0B,GAAKN,KAAF,IAAa;AAC/C,MACC,mBAAOxB,qBAAP,EAAgC+B,GAAF,IAAWP,KAAK,CAACQ,cAAN,CAAsBD,GAAtB,CAAzC,CADD,EAEE;AACD,WAAO,4BAAC,+BAAD,EAAsCP,KAAtC,CAAP;AACA;;AACD,SAAO,4BAAC,gCAAD,EAAuCA,KAAvC,CAAP;AACA,CAPD;;eASeM,0B","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { every, isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { PanelBody, ColorIndicator } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ColorGradientControl from './control';\nimport { getColorObjectByColorValue } from '../colors';\nimport { __experimentalGetGradientObjectByGradientValue } from '../gradients';\nimport useSetting from '../use-setting';\n\n// translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)\nconst colorIndicatorAriaLabel = __( '(%s: color %s)' );\n\n// translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)\nconst gradientIndicatorAriaLabel = __( '(%s: gradient %s)' );\n\nconst colorsAndGradientKeys = [\n\t'colors',\n\t'disableCustomColors',\n\t'gradients',\n\t'disableCustomGradients',\n];\n\nconst Indicators = ( { colors, gradients, settings } ) => {\n\treturn settings.map(\n\t\t(\n\t\t\t{\n\t\t\t\tcolorValue,\n\t\t\t\tgradientValue,\n\t\t\t\tlabel,\n\t\t\t\tcolors: availableColors,\n\t\t\t\tgradients: availableGradients,\n\t\t\t},\n\t\t\tindex\n\t\t) => {\n\t\t\tif ( ! colorValue && ! gradientValue ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tlet ariaLabel;\n\t\t\tif ( colorValue ) {\n\t\t\t\tconst colorObject = getColorObjectByColorValue(\n\t\t\t\t\tavailableColors || colors,\n\t\t\t\t\tcolorValue\n\t\t\t\t);\n\t\t\t\tariaLabel = sprintf(\n\t\t\t\t\tcolorIndicatorAriaLabel,\n\t\t\t\t\tlabel.toLowerCase(),\n\t\t\t\t\t( colorObject && colorObject.name ) || colorValue\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst gradientObject = __experimentalGetGradientObjectByGradientValue(\n\t\t\t\t\tavailableGradients || gradients,\n\t\t\t\t\tcolorValue\n\t\t\t\t);\n\t\t\t\tariaLabel = sprintf(\n\t\t\t\t\tgradientIndicatorAriaLabel,\n\t\t\t\t\tlabel.toLowerCase(),\n\t\t\t\t\t( gradientObject && gradientObject.name ) || gradientValue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<ColorIndicator\n\t\t\t\t\tkey={ index }\n\t\t\t\t\tcolorValue={ colorValue || gradientValue }\n\t\t\t\t\taria-label={ ariaLabel }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t);\n};\n\nexport const PanelColorGradientSettingsInner = ( {\n\tclassName,\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\tchildren,\n\tsettings,\n\ttitle,\n\tshowTitle = true,\n\t...props\n} ) => {\n\tif (\n\t\tisEmpty( colors ) &&\n\t\tisEmpty( gradients ) &&\n\t\tdisableCustomColors &&\n\t\tdisableCustomGradients &&\n\t\tevery(\n\t\t\tsettings,\n\t\t\t( setting ) =>\n\t\t\t\tisEmpty( setting.colors ) &&\n\t\t\t\tisEmpty( setting.gradients ) &&\n\t\t\t\t( setting.disableCustomColors === undefined ||\n\t\t\t\t\tsetting.disableCustomColors ) &&\n\t\t\t\t( setting.disableCustomGradients === undefined ||\n\t\t\t\t\tsetting.disableCustomGradients )\n\t\t)\n\t) {\n\t\treturn null;\n\t}\n\n\tconst titleElement = (\n\t\t<span className=\"block-editor-panel-color-gradient-settings__panel-title\">\n\t\t\t{ title }\n\t\t\t<Indicators\n\t\t\t\tcolors={ colors }\n\t\t\t\tgradients={ gradients }\n\t\t\t\tsettings={ settings }\n\t\t\t/>\n\t\t</span>\n\t);\n\n\treturn (\n\t\t<PanelBody\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-panel-color-gradient-settings',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\ttitle={ showTitle ? titleElement : undefined }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ settings.map( ( setting, index ) => (\n\t\t\t\t<ColorGradientControl\n\t\t\t\t\tkey={ index }\n\t\t\t\t\t{ ...{\n\t\t\t\t\t\tcolors,\n\t\t\t\t\t\tgradients,\n\t\t\t\t\t\tdisableCustomColors,\n\t\t\t\t\t\tdisableCustomGradients,\n\t\t\t\t\t\t...setting,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ children }\n\t\t</PanelBody>\n\t);\n};\n\nconst PanelColorGradientSettingsSelect = ( 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\treturn (\n\t\t<PanelColorGradientSettingsInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n};\n\nconst PanelColorGradientSettings = ( props ) => {\n\tif (\n\t\tevery( colorsAndGradientKeys, ( key ) => props.hasOwnProperty( key ) )\n\t) {\n\t\treturn <PanelColorGradientSettingsInner { ...props } />;\n\t}\n\treturn <PanelColorGradientSettingsSelect { ...props } />;\n};\n\nexport default PanelColorGradientSettings;\n"]}
@@ -9,9 +9,13 @@ exports.default = void 0;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
12
- var _tinycolor = _interopRequireDefault(require("tinycolor2"));
12
+ var _colord = require("colord");
13
13
 
14
- var _a11y = require("@wordpress/a11y");
14
+ var _names = _interopRequireDefault(require("colord/plugins/names"));
15
+
16
+ var _a11y = _interopRequireDefault(require("colord/plugins/a11y"));
17
+
18
+ var _a11y2 = require("@wordpress/a11y");
15
19
 
16
20
  var _i18n = require("@wordpress/i18n");
17
21
 
@@ -24,19 +28,21 @@ var _components = require("@wordpress/components");
24
28
  /**
25
29
  * WordPress dependencies
26
30
  */
31
+ (0, _colord.extend)([_names.default, _a11y.default]);
32
+
27
33
  function ContrastCheckerMessage({
28
- tinyBackgroundColor,
29
- tinyTextColor,
34
+ colordBackgroundColor,
35
+ colordTextColor,
30
36
  backgroundColor,
31
37
  textColor
32
38
  }) {
33
- const msg = tinyBackgroundColor.getBrightness() < tinyTextColor.getBrightness() ? (0, _i18n.__)('This color combination may be hard for people to read. Try using a darker background color and/or a brighter text color.') : (0, _i18n.__)('This color combination may be hard for people to read. Try using a brighter background color and/or a darker text color.'); // Note: The `Notice` component can speak messages via its `spokenMessage`
39
+ const msg = colordBackgroundColor.brightness() < colordTextColor.brightness() ? (0, _i18n.__)('This color combination may be hard for people to read. Try using a darker background color and/or a brighter text color.') : (0, _i18n.__)('This color combination may be hard for people to read. Try using a brighter background color and/or a darker text color.'); // Note: The `Notice` component can speak messages via its `spokenMessage`
34
40
  // prop, but the contrast checker requires granular control over when the
35
41
  // announcements are made. Notably, the message will be re-announced if a
36
42
  // new color combination is selected and the contrast is still insufficient.
37
43
 
38
44
  (0, _element.useEffect)(() => {
39
- (0, _a11y.speak)((0, _i18n.__)('This color combination may be hard for people to read.'));
45
+ (0, _a11y2.speak)((0, _i18n.__)('This color combination may be hard for people to read.'));
40
46
  }, [backgroundColor, textColor]);
41
47
  return (0, _element.createElement)("div", {
42
48
  className: "block-editor-contrast-checker"
@@ -60,11 +66,11 @@ function ContrastChecker({
60
66
  return null;
61
67
  }
62
68
 
63
- const tinyBackgroundColor = (0, _tinycolor.default)(backgroundColor || fallbackBackgroundColor);
64
- const tinyTextColor = (0, _tinycolor.default)(textColor || fallbackTextColor);
65
- const hasTransparency = tinyBackgroundColor.getAlpha() !== 1 || tinyTextColor.getAlpha() !== 1;
69
+ const colordBackgroundColor = (0, _colord.colord)(backgroundColor || fallbackBackgroundColor);
70
+ const colordTextColor = (0, _colord.colord)(textColor || fallbackTextColor);
71
+ const hasTransparency = colordBackgroundColor.alpha() !== 1 || colordTextColor.alpha() !== 1;
66
72
 
67
- if (hasTransparency || _tinycolor.default.isReadable(tinyBackgroundColor, tinyTextColor, {
73
+ if (hasTransparency || colordTextColor.isReadable(colordBackgroundColor, {
68
74
  level: 'AA',
69
75
  size: isLargeText || isLargeText !== false && fontSize >= 24 ? 'large' : 'small'
70
76
  })) {
@@ -74,8 +80,8 @@ function ContrastChecker({
74
80
  return (0, _element.createElement)(ContrastCheckerMessage, {
75
81
  backgroundColor: backgroundColor,
76
82
  textColor: textColor,
77
- tinyBackgroundColor: tinyBackgroundColor,
78
- tinyTextColor: tinyTextColor
83
+ colordBackgroundColor: colordBackgroundColor,
84
+ colordTextColor: colordTextColor
79
85
  });
80
86
  }
81
87
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/contrast-checker/index.js"],"names":["ContrastCheckerMessage","tinyBackgroundColor","tinyTextColor","backgroundColor","textColor","msg","getBrightness","ContrastChecker","fallbackBackgroundColor","fallbackTextColor","fontSize","isLargeText","hasTransparency","getAlpha","tinycolor","isReadable","level","size"],"mappings":";;;;;;;;;AAWA;;AARA;;AAKA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAMA,SAASA,sBAAT,CAAiC;AAChCC,EAAAA,mBADgC;AAEhCC,EAAAA,aAFgC;AAGhCC,EAAAA,eAHgC;AAIhCC,EAAAA;AAJgC,CAAjC,EAKI;AACH,QAAMC,GAAG,GACRJ,mBAAmB,CAACK,aAApB,KAAsCJ,aAAa,CAACI,aAAd,EAAtC,GACG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GH,mBAHvB;AAIC,IAAA,aAAa,EAAGC;AAJjB,IADD;AAQA;;eAEcK,e","sourcesContent":["/**\n * External dependencies\n */\nimport tinycolor from 'tinycolor2';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { __ } from '@wordpress/i18n';\nimport { Notice } from '@wordpress/components';\nimport { useEffect } from '@wordpress/element';\n\nfunction ContrastCheckerMessage( {\n\ttinyBackgroundColor,\n\ttinyTextColor,\n\tbackgroundColor,\n\ttextColor,\n} ) {\n\tconst msg =\n\t\ttinyBackgroundColor.getBrightness() < tinyTextColor.getBrightness()\n\t\t\t? __(\n\t\t\t\t\t'This color combination may be hard for people to read. Try using a darker background color and/or a brighter text color.'\n\t\t\t )\n\t\t\t: __(\n\t\t\t\t\t'This color combination may be hard for people to read. Try using a brighter background color and/or a darker text color.'\n\t\t\t );\n\n\t// Note: The `Notice` component can speak messages via its `spokenMessage`\n\t// prop, but the contrast checker requires granular control over when the\n\t// announcements are made. Notably, the message will be re-announced if a\n\t// new color combination is selected and the contrast is still insufficient.\n\tuseEffect( () => {\n\t\tspeak( __( 'This color combination may be hard for people to read.' ) );\n\t}, [ backgroundColor, textColor ] );\n\n\treturn (\n\t\t<div className=\"block-editor-contrast-checker\">\n\t\t\t<Notice\n\t\t\t\tspokenMessage={ null }\n\t\t\t\tstatus=\"warning\"\n\t\t\t\tisDismissible={ false }\n\t\t\t>\n\t\t\t\t{ msg }\n\t\t\t</Notice>\n\t\t</div>\n\t);\n}\n\nfunction ContrastChecker( {\n\tbackgroundColor,\n\tfallbackBackgroundColor,\n\tfallbackTextColor,\n\tfontSize, // font size value in pixels\n\tisLargeText,\n\ttextColor,\n} ) {\n\tif (\n\t\t! ( backgroundColor || fallbackBackgroundColor ) ||\n\t\t! ( textColor || fallbackTextColor )\n\t) {\n\t\treturn null;\n\t}\n\tconst tinyBackgroundColor = tinycolor(\n\t\tbackgroundColor || fallbackBackgroundColor\n\t);\n\tconst tinyTextColor = tinycolor( textColor || fallbackTextColor );\n\tconst hasTransparency =\n\t\ttinyBackgroundColor.getAlpha() !== 1 || tinyTextColor.getAlpha() !== 1;\n\n\tif (\n\t\thasTransparency ||\n\t\ttinycolor.isReadable( tinyBackgroundColor, tinyTextColor, {\n\t\t\tlevel: 'AA',\n\t\t\tsize:\n\t\t\t\tisLargeText || ( isLargeText !== false && fontSize >= 24 )\n\t\t\t\t\t? 'large'\n\t\t\t\t\t: 'small',\n\t\t} )\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ContrastCheckerMessage\n\t\t\tbackgroundColor={ backgroundColor }\n\t\t\ttextColor={ textColor }\n\t\t\ttinyBackgroundColor={ tinyBackgroundColor }\n\t\t\ttinyTextColor={ tinyTextColor }\n\t\t/>\n\t);\n}\n\nexport default ContrastChecker;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/contrast-checker/index.js"],"names":["namesPlugin","a11yPlugin","ContrastCheckerMessage","colordBackgroundColor","colordTextColor","backgroundColor","textColor","msg","brightness","ContrastChecker","fallbackBackgroundColor","fallbackTextColor","fontSize","isLargeText","hasTransparency","alpha","isReadable","level","size"],"mappings":";;;;;;;;;AAaA;;AAVA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAZA;AACA;AACA;;AAKA;AACA;AACA;AAMA,oBAAQ,CAAEA,cAAF,EAAeC,aAAf,CAAR;;AAEA,SAASC,sBAAT,CAAiC;AAChCC,EAAAA,qBADgC;AAEhCC,EAAAA,eAFgC;AAGhCC,EAAAA,eAHgC;AAIhCC,EAAAA;AAJgC,CAAjC,EAKI;AACH,QAAMC,GAAG,GACRJ,qBAAqB,CAACK,UAAtB,KAAqCJ,eAAe,CAACI,UAAhB,EAArC,GACG,cACA,0HADA,CADH,GAIG,cACA,0HADA,CALJ,CADG,CAUH;AACA;AACA;AACA;;AACA,0BAAW,MAAM;AAChB,sBAAO,cAAI,wDAAJ,CAAP;AACA,GAFD,EAEG,CAAEH,eAAF,EAAmBC,SAAnB,CAFH;AAIA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,kBAAD;AACC,IAAA,aAAa,EAAG,IADjB;AAEC,IAAA,MAAM,EAAC,SAFR;AAGC,IAAA,aAAa,EAAG;AAHjB,KAKGC,GALH,CADD,CADD;AAWA;;AAED,SAASE,eAAT,CAA0B;AACzBJ,EAAAA,eADyB;AAEzBK,EAAAA,uBAFyB;AAGzBC,EAAAA,iBAHyB;AAIzBC,EAAAA,QAJyB;AAIf;AACVC,EAAAA,WALyB;AAMzBP,EAAAA;AANyB,CAA1B,EAOI;AACH,MACC,EAAID,eAAe,IAAIK,uBAAvB,KACA,EAAIJ,SAAS,IAAIK,iBAAjB,CAFD,EAGE;AACD,WAAO,IAAP;AACA;;AACD,QAAMR,qBAAqB,GAAG,oBAC7BE,eAAe,IAAIK,uBADU,CAA9B;AAGA,QAAMN,eAAe,GAAG,oBAAQE,SAAS,IAAIK,iBAArB,CAAxB;AACA,QAAMG,eAAe,GACpBX,qBAAqB,CAACY,KAAtB,OAAkC,CAAlC,IAAuCX,eAAe,CAACW,KAAhB,OAA4B,CADpE;;AAGA,MACCD,eAAe,IACfV,eAAe,CAACY,UAAhB,CAA4Bb,qBAA5B,EAAmD;AAClDc,IAAAA,KAAK,EAAE,IAD2C;AAElDC,IAAAA,IAAI,EACHL,WAAW,IAAMA,WAAW,KAAK,KAAhB,IAAyBD,QAAQ,IAAI,EAAtD,GACG,OADH,GAEG;AAL8C,GAAnD,CAFD,EASE;AACD,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,sBAAD;AACC,IAAA,eAAe,EAAGP,eADnB;AAEC,IAAA,SAAS,EAAGC,SAFb;AAGC,IAAA,qBAAqB,EAAGH,qBAHzB;AAIC,IAAA,eAAe,EAAGC;AAJnB,IADD;AAQA;;eAEcK,e","sourcesContent":["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { __ } from '@wordpress/i18n';\nimport { Notice } from '@wordpress/components';\nimport { useEffect } from '@wordpress/element';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\nfunction ContrastCheckerMessage( {\n\tcolordBackgroundColor,\n\tcolordTextColor,\n\tbackgroundColor,\n\ttextColor,\n} ) {\n\tconst msg =\n\t\tcolordBackgroundColor.brightness() < colordTextColor.brightness()\n\t\t\t? __(\n\t\t\t\t\t'This color combination may be hard for people to read. Try using a darker background color and/or a brighter text color.'\n\t\t\t )\n\t\t\t: __(\n\t\t\t\t\t'This color combination may be hard for people to read. Try using a brighter background color and/or a darker text color.'\n\t\t\t );\n\n\t// Note: The `Notice` component can speak messages via its `spokenMessage`\n\t// prop, but the contrast checker requires granular control over when the\n\t// announcements are made. Notably, the message will be re-announced if a\n\t// new color combination is selected and the contrast is still insufficient.\n\tuseEffect( () => {\n\t\tspeak( __( 'This color combination may be hard for people to read.' ) );\n\t}, [ backgroundColor, textColor ] );\n\n\treturn (\n\t\t<div className=\"block-editor-contrast-checker\">\n\t\t\t<Notice\n\t\t\t\tspokenMessage={ null }\n\t\t\t\tstatus=\"warning\"\n\t\t\t\tisDismissible={ false }\n\t\t\t>\n\t\t\t\t{ msg }\n\t\t\t</Notice>\n\t\t</div>\n\t);\n}\n\nfunction ContrastChecker( {\n\tbackgroundColor,\n\tfallbackBackgroundColor,\n\tfallbackTextColor,\n\tfontSize, // font size value in pixels\n\tisLargeText,\n\ttextColor,\n} ) {\n\tif (\n\t\t! ( backgroundColor || fallbackBackgroundColor ) ||\n\t\t! ( textColor || fallbackTextColor )\n\t) {\n\t\treturn null;\n\t}\n\tconst colordBackgroundColor = colord(\n\t\tbackgroundColor || fallbackBackgroundColor\n\t);\n\tconst colordTextColor = colord( textColor || fallbackTextColor );\n\tconst hasTransparency =\n\t\tcolordBackgroundColor.alpha() !== 1 || colordTextColor.alpha() !== 1;\n\n\tif (\n\t\thasTransparency ||\n\t\tcolordTextColor.isReadable( colordBackgroundColor, {\n\t\t\tlevel: 'AA',\n\t\t\tsize:\n\t\t\t\tisLargeText || ( isLargeText !== false && fontSize >= 24 )\n\t\t\t\t\t? 'large'\n\t\t\t\t\t: 'small',\n\t\t} )\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ContrastCheckerMessage\n\t\t\tbackgroundColor={ backgroundColor }\n\t\t\ttextColor={ textColor }\n\t\t\tcolordBackgroundColor={ colordBackgroundColor }\n\t\t\tcolordTextColor={ colordTextColor }\n\t\t/>\n\t);\n}\n\nexport default ContrastChecker;\n"]}