@wordpress/block-editor 10.4.0 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (638) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +0 -1
  3. package/build/autocompleters/block.js +2 -6
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/autocompleters/link.js +2 -0
  6. package/build/autocompleters/link.js.map +1 -1
  7. package/build/components/block-card/index.js +51 -3
  8. package/build/components/block-card/index.js.map +1 -1
  9. package/build/components/block-draggable/index.native.js +46 -39
  10. package/build/components/block-draggable/index.native.js.map +1 -1
  11. package/build/components/block-edit/edit.js +4 -3
  12. package/build/components/block-edit/edit.js.map +1 -1
  13. package/build/components/block-edit/edit.native.js +4 -7
  14. package/build/components/block-edit/edit.native.js.map +1 -1
  15. package/build/components/block-inspector/index.js +35 -33
  16. package/build/components/block-inspector/index.js.map +1 -1
  17. package/build/components/block-list/block-list-context.native.js +5 -8
  18. package/build/components/block-list/block-list-context.native.js.map +1 -1
  19. package/build/components/block-list/block.js +55 -24
  20. package/build/components/block-list/block.js.map +1 -1
  21. package/build/components/block-list/block.native.js +61 -28
  22. package/build/components/block-list/block.native.js.map +1 -1
  23. package/build/components/block-lock/menu-item.js +1 -1
  24. package/build/components/block-lock/menu-item.js.map +1 -1
  25. package/build/components/block-lock/modal.js +16 -9
  26. package/build/components/block-lock/modal.js.map +1 -1
  27. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +12 -4
  28. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  29. package/build/components/block-pattern-setup/index.js +3 -2
  30. package/build/components/block-pattern-setup/index.js.map +1 -1
  31. package/build/components/block-patterns-list/index.js +33 -11
  32. package/build/components/block-patterns-list/index.js.map +1 -1
  33. package/build/components/block-preview/auto.js +9 -3
  34. package/build/components/block-preview/auto.js.map +1 -1
  35. package/build/components/block-preview/index.js +5 -9
  36. package/build/components/block-preview/index.js.map +1 -1
  37. package/build/components/block-settings-menu/block-settings-dropdown.js +5 -2
  38. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  39. package/build/components/block-styles/utils.js +3 -3
  40. package/build/components/block-styles/utils.js.map +1 -1
  41. package/build/components/block-switcher/index.js +19 -4
  42. package/build/components/block-switcher/index.js.map +1 -1
  43. package/build/components/block-toolbar/index.js +5 -1
  44. package/build/components/block-toolbar/index.js.map +1 -1
  45. package/build/components/block-tools/insertion-point.js +8 -49
  46. package/build/components/block-tools/insertion-point.js.map +1 -1
  47. package/build/components/block-tools/selected-block-popover.js +27 -4
  48. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  49. package/build/components/block-variation-picker/index.js +1 -2
  50. package/build/components/block-variation-picker/index.js.map +1 -1
  51. package/build/components/colors/with-colors.js +4 -3
  52. package/build/components/colors/with-colors.js.map +1 -1
  53. package/build/components/font-sizes/fluid-utils.js +24 -40
  54. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  55. package/build/components/font-sizes/with-font-sizes.js +7 -5
  56. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  57. package/build/components/height-control/index.js +115 -0
  58. package/build/components/height-control/index.js.map +1 -0
  59. package/build/components/iframe/index.js +11 -8
  60. package/build/components/iframe/index.js.map +1 -1
  61. package/build/components/image-editor/use-save-image.js +2 -0
  62. package/build/components/image-editor/use-save-image.js.map +1 -1
  63. package/build/components/image-editor/zoom-dropdown.js +1 -0
  64. package/build/components/image-editor/zoom-dropdown.js.map +1 -1
  65. package/build/components/index.js +18 -0
  66. package/build/components/index.js.map +1 -1
  67. package/build/components/inner-blocks/index.js +25 -9
  68. package/build/components/inner-blocks/index.js.map +1 -1
  69. package/build/components/inner-blocks/use-inner-block-template-sync.js +25 -10
  70. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  71. package/build/components/inserter/block-patterns-explorer/sidebar.js +1 -0
  72. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  73. package/build/components/inserter/block-patterns-tab.js +25 -46
  74. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  75. package/build/components/inserter/block-types-tab.js +3 -1
  76. package/build/components/inserter/block-types-tab.js.map +1 -1
  77. package/build/components/inserter/hooks/use-debounced-input.js +27 -0
  78. package/build/components/inserter/hooks/use-debounced-input.js.map +1 -0
  79. package/build/components/inserter/index.js +8 -3
  80. package/build/components/inserter/index.js.map +1 -1
  81. package/build/components/inserter/index.native.js +3 -4
  82. package/build/components/inserter/index.native.js.map +1 -1
  83. package/build/components/inserter/media-tab/hooks.js +103 -0
  84. package/build/components/inserter/media-tab/hooks.js.map +1 -0
  85. package/build/components/inserter/media-tab/index.js +32 -0
  86. package/build/components/inserter/media-tab/index.js.map +1 -0
  87. package/build/components/inserter/media-tab/media-list.js +100 -0
  88. package/build/components/inserter/media-tab/media-list.js.map +1 -0
  89. package/build/components/inserter/media-tab/media-panel.js +96 -0
  90. package/build/components/inserter/media-tab/media-panel.js.map +1 -0
  91. package/build/components/inserter/media-tab/media-tab.js +120 -0
  92. package/build/components/inserter/media-tab/media-tab.js.map +1 -0
  93. package/build/components/inserter/media-tab/utils.js +54 -0
  94. package/build/components/inserter/media-tab/utils.js.map +1 -0
  95. package/build/components/inserter/menu.js +35 -12
  96. package/build/components/inserter/menu.js.map +1 -1
  97. package/build/components/inserter/mobile-tab-navigation.js +70 -0
  98. package/build/components/inserter/mobile-tab-navigation.js.map +1 -0
  99. package/build/components/inserter/quick-inserter.js +1 -0
  100. package/build/components/inserter/quick-inserter.js.map +1 -1
  101. package/build/components/inserter/reusable-blocks-tab.js +4 -1
  102. package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
  103. package/build/components/inserter/search-results.js +3 -1
  104. package/build/components/inserter/search-results.js.map +1 -1
  105. package/build/components/inserter/tabs.js +16 -2
  106. package/build/components/inserter/tabs.js.map +1 -1
  107. package/build/components/inserter-list-item/index.js +4 -1
  108. package/build/components/inserter-list-item/index.js.map +1 -1
  109. package/build/components/inspector-controls/groups.js +2 -0
  110. package/build/components/inspector-controls/groups.js.map +1 -1
  111. package/build/components/inspector-controls-tabs/advanced-controls-panel.js +46 -0
  112. package/build/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -0
  113. package/build/components/inspector-controls-tabs/index.js +71 -0
  114. package/build/components/inspector-controls-tabs/index.js.map +1 -0
  115. package/build/components/inspector-controls-tabs/settings-tab.js +28 -0
  116. package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -0
  117. package/build/components/inspector-controls-tabs/styles-tab.js +61 -0
  118. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -0
  119. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +97 -0
  120. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -0
  121. package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +18 -0
  122. package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -0
  123. package/build/components/inspector-controls-tabs/utils.js +37 -0
  124. package/build/components/inspector-controls-tabs/utils.js.map +1 -0
  125. package/build/components/link-control/index.js +19 -34
  126. package/build/components/link-control/index.js.map +1 -1
  127. package/build/components/link-control/search-input.js +1 -2
  128. package/build/components/link-control/search-input.js.map +1 -1
  129. package/build/components/link-control/use-internal-input-value.js +26 -0
  130. package/build/components/link-control/use-internal-input-value.js.map +1 -0
  131. package/build/components/list-view/block.js +10 -5
  132. package/build/components/list-view/block.js.map +1 -1
  133. package/build/components/list-view/branch.js +22 -15
  134. package/build/components/list-view/branch.js.map +1 -1
  135. package/build/components/media-upload/index.native.js +2 -3
  136. package/build/components/media-upload/index.native.js.map +1 -1
  137. package/build/components/off-canvas-editor/appender.js +104 -0
  138. package/build/components/off-canvas-editor/appender.js.map +1 -0
  139. package/build/components/off-canvas-editor/block-contents.js +100 -0
  140. package/build/components/off-canvas-editor/block-contents.js.map +1 -0
  141. package/build/components/off-canvas-editor/block-edit-button.js +50 -0
  142. package/build/components/off-canvas-editor/block-edit-button.js.map +1 -0
  143. package/build/components/off-canvas-editor/block-select-button.js +119 -0
  144. package/build/components/off-canvas-editor/block-select-button.js.map +1 -0
  145. package/build/components/off-canvas-editor/block.js +324 -0
  146. package/build/components/off-canvas-editor/block.js.map +1 -0
  147. package/build/components/off-canvas-editor/branch.js +179 -0
  148. package/build/components/off-canvas-editor/branch.js.map +1 -0
  149. package/build/components/off-canvas-editor/context.js +19 -0
  150. package/build/components/off-canvas-editor/context.js.map +1 -0
  151. package/build/components/off-canvas-editor/drop-indicator.js +118 -0
  152. package/build/components/off-canvas-editor/drop-indicator.js.map +1 -0
  153. package/build/components/off-canvas-editor/expander.js +41 -0
  154. package/build/components/off-canvas-editor/expander.js.map +1 -0
  155. package/build/components/off-canvas-editor/index.js +213 -0
  156. package/build/components/off-canvas-editor/index.js.map +1 -0
  157. package/build/components/off-canvas-editor/leaf.js +60 -0
  158. package/build/components/off-canvas-editor/leaf.js.map +1 -0
  159. package/build/components/off-canvas-editor/link-ui.js +185 -0
  160. package/build/components/off-canvas-editor/link-ui.js.map +1 -0
  161. package/build/components/off-canvas-editor/update-attributes.js +108 -0
  162. package/build/components/off-canvas-editor/update-attributes.js.map +1 -0
  163. package/build/components/off-canvas-editor/use-block-selection.js +139 -0
  164. package/build/components/off-canvas-editor/use-block-selection.js.map +1 -0
  165. package/build/components/off-canvas-editor/use-list-view-client-ids.js +33 -0
  166. package/build/components/off-canvas-editor/use-list-view-client-ids.js.map +1 -0
  167. package/build/components/off-canvas-editor/use-list-view-drop-zone.js +235 -0
  168. package/build/components/off-canvas-editor/use-list-view-drop-zone.js.map +1 -0
  169. package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js +60 -0
  170. package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +1 -0
  171. package/build/components/off-canvas-editor/utils.js +60 -0
  172. package/build/components/off-canvas-editor/utils.js.map +1 -0
  173. package/build/components/rich-text/format-toolbar/index.js +8 -4
  174. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  175. package/build/components/rich-text/index.js +3 -3
  176. package/build/components/rich-text/index.js.map +1 -1
  177. package/build/components/rich-text/index.native.js +0 -2
  178. package/build/components/rich-text/index.native.js.map +1 -1
  179. package/build/components/rich-text/use-insert-replacement-text.js +43 -0
  180. package/build/components/rich-text/use-insert-replacement-text.js.map +1 -0
  181. package/build/components/rich-text/use-undo-automatic-change.js +9 -1
  182. package/build/components/rich-text/use-undo-automatic-change.js.map +1 -1
  183. package/build/components/rich-text/utils.js +1 -19
  184. package/build/components/rich-text/utils.js.map +1 -1
  185. package/build/components/spacing-sizes-control/spacing-input-control.js +12 -3
  186. package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  187. package/build/components/ungroup-button/index.native.js +4 -2
  188. package/build/components/ungroup-button/index.native.js.map +1 -1
  189. package/build/components/url-input/index.js +46 -43
  190. package/build/components/url-input/index.js.map +1 -1
  191. package/build/components/url-popover/index.js +31 -2
  192. package/build/components/url-popover/index.js.map +1 -1
  193. package/build/components/use-block-display-information/index.js +8 -4
  194. package/build/components/use-block-display-information/index.js.map +1 -1
  195. package/build/components/use-setting/index.js +10 -2
  196. package/build/components/use-setting/index.js.map +1 -1
  197. package/build/hooks/child-layout.js +209 -0
  198. package/build/hooks/child-layout.js.map +1 -0
  199. package/build/hooks/color-panel.js +17 -1
  200. package/build/hooks/color-panel.js.map +1 -1
  201. package/build/hooks/color.js +1 -1
  202. package/build/hooks/color.js.map +1 -1
  203. package/build/hooks/content-lock-ui.js +14 -7
  204. package/build/hooks/content-lock-ui.js.map +1 -1
  205. package/build/hooks/dimensions.js +65 -16
  206. package/build/hooks/dimensions.js.map +1 -1
  207. package/build/hooks/layout.js +59 -3
  208. package/build/hooks/layout.js.map +1 -1
  209. package/build/hooks/margin.js +4 -2
  210. package/build/hooks/margin.js.map +1 -1
  211. package/build/hooks/min-height.js +139 -0
  212. package/build/hooks/min-height.js.map +1 -0
  213. package/build/hooks/padding.js +4 -2
  214. package/build/hooks/padding.js.map +1 -1
  215. package/build/hooks/style.js +3 -2
  216. package/build/hooks/style.js.map +1 -1
  217. package/build/layouts/flex.js +22 -21
  218. package/build/layouts/flex.js.map +1 -1
  219. package/build/store/actions.js +26 -0
  220. package/build/store/actions.js.map +1 -1
  221. package/build/store/reducer.js +420 -265
  222. package/build/store/reducer.js.map +1 -1
  223. package/build/store/selectors.js +73 -49
  224. package/build/store/selectors.js.map +1 -1
  225. package/build/utils/sorting.js +63 -0
  226. package/build/utils/sorting.js.map +1 -0
  227. package/build-module/autocompleters/block.js +2 -6
  228. package/build-module/autocompleters/block.js.map +1 -1
  229. package/build-module/autocompleters/link.js +2 -0
  230. package/build-module/autocompleters/link.js.map +1 -1
  231. package/build-module/components/block-card/index.js +45 -3
  232. package/build-module/components/block-card/index.js.map +1 -1
  233. package/build-module/components/block-draggable/index.native.js +40 -31
  234. package/build-module/components/block-draggable/index.native.js.map +1 -1
  235. package/build-module/components/block-edit/edit.js +4 -2
  236. package/build-module/components/block-edit/edit.js.map +1 -1
  237. package/build-module/components/block-edit/edit.native.js +4 -6
  238. package/build-module/components/block-edit/edit.native.js.map +1 -1
  239. package/build-module/components/block-inspector/index.js +32 -30
  240. package/build-module/components/block-inspector/index.js.map +1 -1
  241. package/build-module/components/block-list/block-list-context.native.js +5 -8
  242. package/build-module/components/block-list/block-list-context.native.js.map +1 -1
  243. package/build-module/components/block-list/block.js +55 -25
  244. package/build-module/components/block-list/block.js.map +1 -1
  245. package/build-module/components/block-list/block.native.js +61 -28
  246. package/build-module/components/block-list/block.native.js.map +1 -1
  247. package/build-module/components/block-lock/menu-item.js +2 -2
  248. package/build-module/components/block-lock/menu-item.js.map +1 -1
  249. package/build-module/components/block-lock/modal.js +17 -10
  250. package/build-module/components/block-lock/modal.js.map +1 -1
  251. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +13 -6
  252. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  253. package/build-module/components/block-pattern-setup/index.js +3 -2
  254. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  255. package/build-module/components/block-patterns-list/index.js +35 -13
  256. package/build-module/components/block-patterns-list/index.js.map +1 -1
  257. package/build-module/components/block-preview/auto.js +9 -3
  258. package/build-module/components/block-preview/auto.js.map +1 -1
  259. package/build-module/components/block-preview/index.js +5 -8
  260. package/build-module/components/block-preview/index.js.map +1 -1
  261. package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -2
  262. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  263. package/build-module/components/block-styles/utils.js +3 -3
  264. package/build-module/components/block-styles/utils.js.map +1 -1
  265. package/build-module/components/block-switcher/index.js +19 -4
  266. package/build-module/components/block-switcher/index.js.map +1 -1
  267. package/build-module/components/block-toolbar/index.js +6 -2
  268. package/build-module/components/block-toolbar/index.js.map +1 -1
  269. package/build-module/components/block-tools/insertion-point.js +8 -49
  270. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  271. package/build-module/components/block-tools/selected-block-popover.js +27 -5
  272. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  273. package/build-module/components/block-variation-picker/index.js +1 -2
  274. package/build-module/components/block-variation-picker/index.js.map +1 -1
  275. package/build-module/components/colors/with-colors.js +5 -4
  276. package/build-module/components/colors/with-colors.js.map +1 -1
  277. package/build-module/components/font-sizes/fluid-utils.js +24 -40
  278. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  279. package/build-module/components/font-sizes/with-font-sizes.js +8 -6
  280. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  281. package/build-module/components/height-control/index.js +103 -0
  282. package/build-module/components/height-control/index.js.map +1 -0
  283. package/build-module/components/iframe/index.js +11 -8
  284. package/build-module/components/iframe/index.js.map +1 -1
  285. package/build-module/components/image-editor/use-save-image.js +2 -0
  286. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  287. package/build-module/components/image-editor/zoom-dropdown.js +1 -0
  288. package/build-module/components/image-editor/zoom-dropdown.js.map +1 -1
  289. package/build-module/components/index.js +2 -0
  290. package/build-module/components/index.js.map +1 -1
  291. package/build-module/components/inner-blocks/index.js +27 -11
  292. package/build-module/components/inner-blocks/index.js.map +1 -1
  293. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +23 -10
  294. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  295. package/build-module/components/inserter/block-patterns-explorer/sidebar.js +1 -0
  296. package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  297. package/build-module/components/inserter/block-patterns-tab.js +27 -49
  298. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  299. package/build-module/components/inserter/block-types-tab.js +3 -2
  300. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  301. package/build-module/components/inserter/hooks/use-debounced-input.js +18 -0
  302. package/build-module/components/inserter/hooks/use-debounced-input.js.map +1 -0
  303. package/build-module/components/inserter/index.js +8 -3
  304. package/build-module/components/inserter/index.js.map +1 -1
  305. package/build-module/components/inserter/index.native.js +3 -5
  306. package/build-module/components/inserter/index.native.js.map +1 -1
  307. package/build-module/components/inserter/media-tab/hooks.js +89 -0
  308. package/build-module/components/inserter/media-tab/hooks.js.map +1 -0
  309. package/build-module/components/inserter/media-tab/index.js +4 -0
  310. package/build-module/components/inserter/media-tab/index.js.map +1 -0
  311. package/build-module/components/inserter/media-tab/media-list.js +86 -0
  312. package/build-module/components/inserter/media-tab/media-list.js.map +1 -0
  313. package/build-module/components/inserter/media-tab/media-panel.js +77 -0
  314. package/build-module/components/inserter/media-tab/media-panel.js.map +1 -0
  315. package/build-module/components/inserter/media-tab/media-tab.js +100 -0
  316. package/build-module/components/inserter/media-tab/media-tab.js.map +1 -0
  317. package/build-module/components/inserter/media-tab/utils.js +45 -0
  318. package/build-module/components/inserter/media-tab/utils.js.map +1 -0
  319. package/build-module/components/inserter/menu.js +33 -12
  320. package/build-module/components/inserter/menu.js.map +1 -1
  321. package/build-module/components/inserter/mobile-tab-navigation.js +61 -0
  322. package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -0
  323. package/build-module/components/inserter/quick-inserter.js +1 -0
  324. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  325. package/build-module/components/inserter/reusable-blocks-tab.js +3 -1
  326. package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
  327. package/build-module/components/inserter/search-results.js +3 -2
  328. package/build-module/components/inserter/search-results.js.map +1 -1
  329. package/build-module/components/inserter/tabs.js +15 -2
  330. package/build-module/components/inserter/tabs.js.map +1 -1
  331. package/build-module/components/inserter-list-item/index.js +5 -2
  332. package/build-module/components/inserter-list-item/index.js.map +1 -1
  333. package/build-module/components/inspector-controls/groups.js +2 -0
  334. package/build-module/components/inspector-controls/groups.js.map +1 -1
  335. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js +32 -0
  336. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -0
  337. package/build-module/components/inspector-controls-tabs/index.js +56 -0
  338. package/build-module/components/inspector-controls-tabs/index.js.map +1 -0
  339. package/build-module/components/inspector-controls-tabs/settings-tab.js +17 -0
  340. package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -0
  341. package/build-module/components/inspector-controls-tabs/styles-tab.js +46 -0
  342. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -0
  343. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +81 -0
  344. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -0
  345. package/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +8 -0
  346. package/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -0
  347. package/build-module/components/inspector-controls-tabs/utils.js +26 -0
  348. package/build-module/components/inspector-controls-tabs/utils.js.map +1 -0
  349. package/build-module/components/link-control/index.js +18 -34
  350. package/build-module/components/link-control/index.js.map +1 -1
  351. package/build-module/components/link-control/search-input.js +1 -2
  352. package/build-module/components/link-control/search-input.js.map +1 -1
  353. package/build-module/components/link-control/use-internal-input-value.js +18 -0
  354. package/build-module/components/link-control/use-internal-input-value.js.map +1 -0
  355. package/build-module/components/list-view/block.js +10 -5
  356. package/build-module/components/list-view/block.js.map +1 -1
  357. package/build-module/components/list-view/branch.js +21 -14
  358. package/build-module/components/list-view/branch.js.map +1 -1
  359. package/build-module/components/media-upload/index.native.js +2 -4
  360. package/build-module/components/media-upload/index.native.js.map +1 -1
  361. package/build-module/components/off-canvas-editor/appender.js +89 -0
  362. package/build-module/components/off-canvas-editor/appender.js.map +1 -0
  363. package/build-module/components/off-canvas-editor/block-contents.js +85 -0
  364. package/build-module/components/off-canvas-editor/block-contents.js.map +1 -0
  365. package/build-module/components/off-canvas-editor/block-edit-button.js +35 -0
  366. package/build-module/components/off-canvas-editor/block-edit-button.js.map +1 -0
  367. package/build-module/components/off-canvas-editor/block-select-button.js +101 -0
  368. package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -0
  369. package/build-module/components/off-canvas-editor/block.js +298 -0
  370. package/build-module/components/off-canvas-editor/block.js.map +1 -0
  371. package/build-module/components/off-canvas-editor/branch.js +164 -0
  372. package/build-module/components/off-canvas-editor/branch.js.map +1 -0
  373. package/build-module/components/off-canvas-editor/context.js +7 -0
  374. package/build-module/components/off-canvas-editor/context.js.map +1 -0
  375. package/build-module/components/off-canvas-editor/drop-indicator.js +111 -0
  376. package/build-module/components/off-canvas-editor/drop-indicator.js.map +1 -0
  377. package/build-module/components/off-canvas-editor/expander.js +32 -0
  378. package/build-module/components/off-canvas-editor/expander.js.map +1 -0
  379. package/build-module/components/off-canvas-editor/index.js +189 -0
  380. package/build-module/components/off-canvas-editor/index.js.map +1 -0
  381. package/build-module/components/off-canvas-editor/leaf.js +45 -0
  382. package/build-module/components/off-canvas-editor/leaf.js.map +1 -0
  383. package/build-module/components/off-canvas-editor/link-ui.js +165 -0
  384. package/build-module/components/off-canvas-editor/link-ui.js.map +1 -0
  385. package/build-module/components/off-canvas-editor/update-attributes.js +97 -0
  386. package/build-module/components/off-canvas-editor/update-attributes.js.map +1 -0
  387. package/build-module/components/off-canvas-editor/use-block-selection.js +124 -0
  388. package/build-module/components/off-canvas-editor/use-block-selection.js.map +1 -0
  389. package/build-module/components/off-canvas-editor/use-list-view-client-ids.js +24 -0
  390. package/build-module/components/off-canvas-editor/use-list-view-client-ids.js.map +1 -0
  391. package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js +220 -0
  392. package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js.map +1 -0
  393. package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js +50 -0
  394. package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +1 -0
  395. package/build-module/components/off-canvas-editor/utils.js +44 -0
  396. package/build-module/components/off-canvas-editor/utils.js.map +1 -0
  397. package/build-module/components/rich-text/format-toolbar/index.js +6 -2
  398. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  399. package/build-module/components/rich-text/index.js +2 -3
  400. package/build-module/components/rich-text/index.js.map +1 -1
  401. package/build-module/components/rich-text/index.native.js +0 -2
  402. package/build-module/components/rich-text/index.native.js.map +1 -1
  403. package/build-module/components/rich-text/use-insert-replacement-text.js +33 -0
  404. package/build-module/components/rich-text/use-insert-replacement-text.js.map +1 -0
  405. package/build-module/components/rich-text/use-undo-automatic-change.js +9 -1
  406. package/build-module/components/rich-text/use-undo-automatic-change.js.map +1 -1
  407. package/build-module/components/rich-text/utils.js +1 -16
  408. package/build-module/components/rich-text/utils.js.map +1 -1
  409. package/build-module/components/spacing-sizes-control/spacing-input-control.js +12 -3
  410. package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  411. package/build-module/components/ungroup-button/index.native.js +3 -2
  412. package/build-module/components/ungroup-button/index.native.js.map +1 -1
  413. package/build-module/components/url-input/index.js +46 -43
  414. package/build-module/components/url-input/index.js.map +1 -1
  415. package/build-module/components/url-popover/index.js +30 -3
  416. package/build-module/components/url-popover/index.js.map +1 -1
  417. package/build-module/components/use-block-display-information/index.js +9 -5
  418. package/build-module/components/use-block-display-information/index.js.map +1 -1
  419. package/build-module/components/use-setting/index.js +9 -2
  420. package/build-module/components/use-setting/index.js.map +1 -1
  421. package/build-module/hooks/child-layout.js +189 -0
  422. package/build-module/hooks/child-layout.js.map +1 -0
  423. package/build-module/hooks/color-panel.js +17 -1
  424. package/build-module/hooks/color-panel.js.map +1 -1
  425. package/build-module/hooks/color.js +1 -1
  426. package/build-module/hooks/color.js.map +1 -1
  427. package/build-module/hooks/content-lock-ui.js +16 -9
  428. package/build-module/hooks/content-lock-ui.js.map +1 -1
  429. package/build-module/hooks/dimensions.js +60 -16
  430. package/build-module/hooks/dimensions.js.map +1 -1
  431. package/build-module/hooks/layout.js +57 -2
  432. package/build-module/hooks/layout.js.map +1 -1
  433. package/build-module/hooks/margin.js +4 -2
  434. package/build-module/hooks/margin.js.map +1 -1
  435. package/build-module/hooks/min-height.js +116 -0
  436. package/build-module/hooks/min-height.js.map +1 -0
  437. package/build-module/hooks/padding.js +4 -2
  438. package/build-module/hooks/padding.js.map +1 -1
  439. package/build-module/hooks/style.js +4 -3
  440. package/build-module/hooks/style.js.map +1 -1
  441. package/build-module/layouts/flex.js +23 -22
  442. package/build-module/layouts/flex.js.map +1 -1
  443. package/build-module/store/actions.js +22 -0
  444. package/build-module/store/actions.js.map +1 -1
  445. package/build-module/store/reducer.js +415 -265
  446. package/build-module/store/reducer.js.map +1 -1
  447. package/build-module/store/selectors.js +66 -48
  448. package/build-module/store/selectors.js.map +1 -1
  449. package/build-module/utils/sorting.js +56 -0
  450. package/build-module/utils/sorting.js.map +1 -0
  451. package/build-style/content-rtl.css +701 -0
  452. package/build-style/content.css +701 -0
  453. package/build-style/default-editor-styles-rtl.css +14 -0
  454. package/build-style/default-editor-styles.css +14 -0
  455. package/build-style/style-rtl.css +305 -668
  456. package/build-style/style.css +305 -668
  457. package/package.json +32 -30
  458. package/src/autocompleters/block.js +2 -6
  459. package/src/autocompleters/link.js +2 -0
  460. package/src/components/alignment-control/README.md +1 -1
  461. package/src/components/alignment-control/test/index.js +4 -1
  462. package/src/components/block-alignment-control/test/index.js +4 -1
  463. package/src/components/block-alignment-control/test/index.native.js +4 -4
  464. package/src/components/block-card/index.js +46 -2
  465. package/src/components/block-card/style.scss +4 -0
  466. package/src/components/block-content-overlay/{style.scss → content.scss} +7 -1
  467. package/src/components/block-draggable/content.scss +20 -0
  468. package/src/components/block-draggable/index.native.js +54 -40
  469. package/src/components/block-draggable/style.scss +0 -21
  470. package/src/components/block-draggable/test/helpers.native.js +7 -9
  471. package/src/components/block-draggable/test/index.native.js +35 -45
  472. package/src/components/block-edit/edit.js +5 -2
  473. package/src/components/block-edit/edit.native.js +5 -6
  474. package/src/components/block-inspector/index.js +96 -81
  475. package/src/components/block-inspector/style.scss +9 -1
  476. package/src/components/block-list/block-list-context.native.js +5 -8
  477. package/src/components/block-list/block.js +74 -23
  478. package/src/components/block-list/block.native.js +78 -23
  479. package/src/components/block-list/{style.scss → content.scss} +11 -20
  480. package/src/components/block-list-appender/{style.scss → content.scss} +0 -0
  481. package/src/components/block-lock/menu-item.js +5 -2
  482. package/src/components/block-lock/modal.js +19 -36
  483. package/src/components/block-lock/style.scss +8 -17
  484. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +24 -6
  485. package/src/components/block-mover/style.scss +0 -1
  486. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +0 -2
  487. package/src/components/block-pattern-setup/index.js +2 -1
  488. package/src/components/block-patterns-list/index.js +47 -24
  489. package/src/components/block-popover/style.scss +1 -1
  490. package/src/components/block-preview/README.md +15 -10
  491. package/src/components/block-preview/auto.js +7 -1
  492. package/src/components/block-preview/content.scss +4 -0
  493. package/src/components/block-preview/index.js +7 -12
  494. package/src/components/block-preview/style.scss +0 -7
  495. package/src/components/block-preview/test/index.js +18 -35
  496. package/src/components/block-selection-clearer/test/index.js +12 -12
  497. package/src/components/block-settings-menu/block-settings-dropdown.js +32 -20
  498. package/src/components/block-styles/utils.js +3 -3
  499. package/src/components/block-switcher/index.js +19 -4
  500. package/src/components/block-switcher/test/index.js +4 -0
  501. package/src/components/block-toolbar/index.js +12 -5
  502. package/src/components/block-toolbar/style.scss +10 -0
  503. package/src/components/block-tools/insertion-point.js +3 -47
  504. package/src/components/block-tools/selected-block-popover.js +80 -34
  505. package/src/components/block-tools/style.scss +27 -5
  506. package/src/components/block-variation-picker/index.js +1 -4
  507. package/src/components/block-vertical-alignment-control/test/index.js +4 -1
  508. package/src/components/colors/with-colors.js +13 -23
  509. package/src/components/default-block-appender/{style.scss → content.scss} +1 -0
  510. package/src/components/font-sizes/fluid-utils.js +37 -64
  511. package/src/components/font-sizes/test/fluid-utils.js +5 -5
  512. package/src/components/font-sizes/with-font-sizes.js +14 -11
  513. package/src/components/height-control/index.js +123 -0
  514. package/src/components/height-control/stories/index.js +21 -0
  515. package/src/components/height-control/style.scss +5 -0
  516. package/src/components/iframe/index.js +25 -18
  517. package/src/components/image-editor/use-save-image.js +2 -0
  518. package/src/components/image-editor/zoom-dropdown.js +1 -0
  519. package/src/components/index.js +2 -0
  520. package/src/components/inner-blocks/{style.scss → content.scss} +0 -0
  521. package/src/components/inner-blocks/index.js +30 -10
  522. package/src/components/inner-blocks/use-inner-block-template-sync.js +28 -10
  523. package/src/components/inserter/block-patterns-explorer/sidebar.js +1 -0
  524. package/src/components/inserter/block-patterns-tab.js +28 -71
  525. package/src/components/inserter/block-types-tab.js +3 -2
  526. package/src/components/inserter/hooks/use-debounced-input.js +17 -0
  527. package/src/components/inserter/index.js +10 -2
  528. package/src/components/inserter/index.native.js +1 -1
  529. package/src/components/inserter/media-tab/hooks.js +88 -0
  530. package/src/components/inserter/media-tab/index.js +3 -0
  531. package/src/components/inserter/media-tab/media-list.js +93 -0
  532. package/src/components/inserter/media-tab/media-panel.js +83 -0
  533. package/src/components/inserter/media-tab/media-tab.js +135 -0
  534. package/src/components/inserter/media-tab/utils.js +37 -0
  535. package/src/components/inserter/menu.js +55 -13
  536. package/src/components/inserter/mobile-tab-navigation.js +85 -0
  537. package/src/components/inserter/quick-inserter.js +1 -0
  538. package/src/components/inserter/reusable-blocks-tab.js +4 -2
  539. package/src/components/inserter/search-results.js +3 -2
  540. package/src/components/inserter/stories/index.js +1 -1
  541. package/src/components/inserter/stories/{fixtures.js → utils/fixtures.js} +0 -0
  542. package/src/components/inserter/style.scss +184 -18
  543. package/src/components/inserter/tabs.js +12 -1
  544. package/src/components/inserter/test/reusable-blocks-tab.js +14 -57
  545. package/src/components/inserter-list-item/index.js +11 -1
  546. package/src/components/inserter-list-item/style.scss +26 -0
  547. package/src/components/inspector-controls/groups.js +2 -0
  548. package/src/components/inspector-controls-tabs/advanced-controls-panel.js +37 -0
  549. package/src/components/inspector-controls-tabs/index.js +62 -0
  550. package/src/components/inspector-controls-tabs/settings-tab.js +18 -0
  551. package/src/components/inspector-controls-tabs/styles-tab.js +51 -0
  552. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +89 -0
  553. package/src/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +9 -0
  554. package/src/components/inspector-controls-tabs/utils.js +28 -0
  555. package/src/components/line-height-control/test/index.js +5 -5
  556. package/src/components/link-control/README.md +1 -1
  557. package/src/components/link-control/index.js +24 -39
  558. package/src/components/link-control/search-input.js +1 -2
  559. package/src/components/link-control/test/index.js +400 -582
  560. package/src/components/link-control/use-internal-input-value.js +22 -0
  561. package/src/components/list-view/block.js +7 -3
  562. package/src/components/list-view/branch.js +21 -14
  563. package/src/components/list-view/style.scss +20 -9
  564. package/src/components/media-placeholder/{style.scss → content.scss} +0 -0
  565. package/src/components/media-replace-flow/test/index.js +37 -9
  566. package/src/components/media-upload/test/index.native.js +2 -0
  567. package/src/components/off-canvas-editor/README.md +5 -0
  568. package/src/components/off-canvas-editor/appender.js +93 -0
  569. package/src/components/off-canvas-editor/block-contents.js +89 -0
  570. package/src/components/off-canvas-editor/block-edit-button.js +27 -0
  571. package/src/components/off-canvas-editor/block-select-button.js +113 -0
  572. package/src/components/off-canvas-editor/block.js +401 -0
  573. package/src/components/off-canvas-editor/branch.js +208 -0
  574. package/src/components/off-canvas-editor/context.js +8 -0
  575. package/src/components/off-canvas-editor/drop-indicator.js +126 -0
  576. package/src/components/off-canvas-editor/expander.js +26 -0
  577. package/src/components/off-canvas-editor/index.js +242 -0
  578. package/src/components/off-canvas-editor/leaf.js +52 -0
  579. package/src/components/off-canvas-editor/link-ui.js +166 -0
  580. package/src/components/off-canvas-editor/style.scss +26 -0
  581. package/src/components/off-canvas-editor/test/utils.js +50 -0
  582. package/src/components/off-canvas-editor/update-attributes.js +99 -0
  583. package/src/components/off-canvas-editor/use-block-selection.js +169 -0
  584. package/src/components/off-canvas-editor/use-list-view-client-ids.js +29 -0
  585. package/src/components/off-canvas-editor/use-list-view-drop-zone.js +260 -0
  586. package/src/components/off-canvas-editor/use-list-view-expand-selected-item.js +58 -0
  587. package/src/components/off-canvas-editor/utils.js +58 -0
  588. package/src/components/plain-text/{style.scss → content.scss} +0 -0
  589. package/src/components/recursion-provider/test/index.js +27 -29
  590. package/src/components/responsive-block-control/test/index.js +69 -92
  591. package/src/components/rich-text/content.scss +42 -0
  592. package/src/components/rich-text/format-toolbar/index.js +6 -4
  593. package/src/components/rich-text/index.js +2 -2
  594. package/src/components/rich-text/index.native.js +0 -2
  595. package/src/components/rich-text/style.scss +0 -43
  596. package/src/components/rich-text/use-insert-replacement-text.js +31 -0
  597. package/src/components/rich-text/use-undo-automatic-change.js +7 -1
  598. package/src/components/rich-text/utils.js +2 -21
  599. package/src/components/spacing-sizes-control/spacing-input-control.js +9 -0
  600. package/src/components/ungroup-button/index.native.js +6 -2
  601. package/src/components/url-input/index.js +57 -73
  602. package/src/components/url-popover/README.md +12 -3
  603. package/src/components/url-popover/index.js +33 -3
  604. package/src/components/url-popover/test/__snapshots__/index.js.snap +8 -6
  605. package/src/components/url-popover/test/index.js +21 -9
  606. package/src/components/use-block-display-information/index.js +14 -5
  607. package/src/components/use-setting/index.js +20 -2
  608. package/src/components/use-setting/test/index.js +99 -0
  609. package/src/content.scss +10 -0
  610. package/src/hooks/child-layout.js +190 -0
  611. package/src/hooks/color-panel.js +13 -1
  612. package/src/hooks/color.js +2 -0
  613. package/src/hooks/content-lock-ui.js +47 -35
  614. package/src/hooks/dimensions.js +119 -21
  615. package/src/hooks/layout.js +62 -3
  616. package/src/hooks/margin.js +4 -3
  617. package/src/hooks/min-height.js +104 -0
  618. package/src/hooks/padding.js +4 -3
  619. package/src/hooks/style.js +10 -2
  620. package/src/hooks/test/style.js +4 -0
  621. package/src/hooks/test/use-typography-props.js +1 -1
  622. package/src/layouts/flex.js +43 -38
  623. package/src/store/actions.js +22 -0
  624. package/src/store/reducer.js +480 -434
  625. package/src/store/selectors.js +70 -64
  626. package/src/store/test/actions.js +18 -0
  627. package/src/store/test/performance.js +71 -0
  628. package/src/store/test/reducer.js +662 -490
  629. package/src/store/test/selectors.js +1839 -1306
  630. package/src/style.scss +4 -7
  631. package/src/utils/sorting.js +54 -0
  632. package/src/utils/test/sorting.js +49 -0
  633. package/tsconfig.tsbuildinfo +1 -1
  634. package/build/components/block-preview/live.js +0 -30
  635. package/build/components/block-preview/live.js.map +0 -1
  636. package/build-module/components/block-preview/live.js +0 -20
  637. package/build-module/components/block-preview/live.js.map +0 -1
  638. package/src/components/block-preview/live.js +0 -19
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/color.js"],"names":["classnames","addFilter","getBlockSupport","__","useRef","useEffect","useMemo","Platform","createHigherOrderComponent","getColorClassName","getColorObjectByColorValue","getColorObjectByAttributeValues","__experimentalGetGradientClass","getGradientValueBySlug","getGradientSlugByValue","cleanEmptyObject","transformStyles","immutableSet","shouldSkipSerialization","ColorPanel","useSetting","COLOR_SUPPORT_KEY","hasColorSupport","blockType","colorSupport","link","gradient","background","text","hasLinkColorSupport","OS","hasGradientSupport","gradients","hasBackgroundColorSupport","hasTextColorSupport","clearColorFromStyles","path","style","undefined","resetAllTextFilter","attributes","textColor","resetAllLinkFilter","clearBackgroundAndGradient","backgroundColor","color","addAttributes","settings","Object","assign","type","addSaveProps","props","hasGradient","shouldSerialize","feature","textClass","gradientClass","backgroundClass","serializeHasBackground","hasBackground","newClassName","className","elements","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","getLinkColorFromAttributeValue","colors","value","attributeParsed","exec","ColorEdit","name","blockName","userPalette","themePalette","defaultPalette","allSolids","userGradientPalette","themeGradientPalette","defaultGradientPalette","allGradients","areCustomSolidsEnabled","areCustomGradientsEnabled","isBackgroundEnabled","isLinkEnabled","isTextEnabled","solidsEnabled","length","gradientsEnabled","localAttributes","current","hasLinkColor","hasTextColor","hasBackgroundColor","hasGradientColor","gradientValue","onChangeColor","colorObject","attributeName","newStyle","slug","newNamedColor","newAttributes","setAttributes","onChangeGradient","onChangeLinkColor","newLinkColorValue","defaultColorControls","enableContrastChecking","clientId","label","onColorChange","colorValue","isShownByDefault","resetAllFilter","onGradientChange","clearable","withColorPaletteStyles","BlockListBlock","extraStyles","wrapperProps","MIGRATION_PATHS","linkColor","addTransforms","result","source","index","results","destinationBlockType","activeSupports"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,SAAjB,EAA4BC,OAA5B,EAAqCC,QAArC,QAAqD,oBAArD;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AAEA;AACA;AACA;;AACA,SACCC,iBADD,EAECC,0BAFD,EAGCC,+BAHD,QAIO,sBAJP;AAKA,SACCC,8BADD,EAECC,sBAFD,EAGCC,sBAHD,QAIO,yBAJP;AAKA,SACCC,gBADD,EAECC,eAFD,EAGCC,YAHD,EAICC,uBAJD,QAKO,SALP;AAMA,OAAOC,UAAP,MAAuB,eAAvB;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AA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AG;AACtBP,IAAAA,SAAS,EAAE/F,mBAAmB,CAAEqG,oBAAF,CADR;AAEtBzF,IAAAA,SAAS,EAAEP,mBAAmB,CAAEgG,oBAAF,CAFR;AAGtBtF,IAAAA,eAAe,EAAEX,yBAAyB,CAAEiG,oBAAF,CAHpB;AAItBxG,IAAAA,QAAQ,EAAEK,kBAAkB,CAAEmG,oBAAF;AAJN,GAAvB;AAMA,SAAOlH,eAAe,CACrBmH,cADqB,EAErBR,eAFqB,EAGrBG,MAHqB,EAIrBC,MAJqB,EAKrBC,KALqB,EAMrBC,OANqB,CAAtB;AAQA;AAEDhI,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGR6C,aAHQ,CAAT;AAMA7C,SAAS,CACR,kCADQ,EAER,yBAFQ,EAGRkD,YAHQ,CAAT;AAMAlD,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGR+D,YAHQ,CAAT;AAMA/D,SAAS,CACR,uBADQ,EAER,sCAFQ,EAGRsH,sBAHQ,CAAT;AAMAtH,SAAS,CACR,2CADQ,EAER,0BAFQ,EAGR4H,aAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useEffect, useMemo, Platform } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n} from '../components/colors';\nimport {\n\t__experimentalGetGradientClass,\n\tgetGradientValueBySlug,\n\tgetGradientSlugByValue,\n} from '../components/gradients';\nimport {\n\tcleanEmptyObject,\n\ttransformStyles,\n\timmutableSet,\n\tshouldSkipSerialization,\n} from './utils';\nimport ColorPanel from './color-panel';\nimport useSetting from '../components/use-setting';\n\nexport const COLOR_SUPPORT_KEY = 'color';\n\nconst hasColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\treturn (\n\t\tcolorSupport &&\n\t\t( colorSupport.link === true ||\n\t\t\tcolorSupport.gradient === true ||\n\t\t\tcolorSupport.background !== false ||\n\t\t\tcolorSupport.text !== false )\n\t);\n};\n\nconst hasLinkColorSupport = ( blockType ) => {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn (\n\t\tcolorSupport !== null &&\n\t\ttypeof colorSupport === 'object' &&\n\t\t!! colorSupport.link\n\t);\n};\n\nconst hasGradientSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn (\n\t\tcolorSupport !== null &&\n\t\ttypeof colorSupport === 'object' &&\n\t\t!! colorSupport.gradients\n\t);\n};\n\nconst hasBackgroundColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.background !== false;\n};\n\nconst hasTextColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.text !== false;\n};\n\n/**\n * Clears a single color property from a style object.\n *\n * @param {Array} path Path to color property to clear within styles object.\n * @param {Object} style Block attributes style object.\n * @return {Object} Styles with the color property omitted.\n */\nconst clearColorFromStyles = ( path, style ) =>\n\tcleanEmptyObject( immutableSet( style, path, undefined ) );\n\n/**\n * Clears text color related properties from supplied attributes.\n *\n * @param {Object} attributes Block attributes.\n * @return {Object} Update block attributes with text color properties omitted.\n */\nconst resetAllTextFilter = ( attributes ) => ( {\n\ttextColor: undefined,\n\tstyle: clearColorFromStyles( [ 'color', 'text' ], attributes.style ),\n} );\n\n/**\n * Clears link color related properties from supplied attributes.\n *\n * @param {Object} attributes Block attributes.\n * @return {Object} Update block attributes with link color properties omitted.\n */\nconst resetAllLinkFilter = ( attributes ) => ( {\n\tstyle: clearColorFromStyles(\n\t\t[ 'elements', 'link', 'color', 'text' ],\n\t\tattributes.style\n\t),\n} );\n\n/**\n * Clears all background color related properties including gradients from\n * supplied block attributes.\n *\n * @param {Object} attributes Block attributes.\n * @return {Object} Block attributes with background and gradient omitted.\n */\nconst clearBackgroundAndGradient = ( attributes ) => ( {\n\tbackgroundColor: undefined,\n\tgradient: undefined,\n\tstyle: {\n\t\t...attributes.style,\n\t\tcolor: {\n\t\t\t...attributes.style?.color,\n\t\t\tbackground: undefined,\n\t\t\tgradient: undefined,\n\t\t},\n\t},\n} );\n\n/**\n * Filters registered block settings, extending attributes to include\n * `backgroundColor` and `textColor` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasColorSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( ! settings.attributes.backgroundColor ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tbackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\tif ( ! settings.attributes.textColor ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\ttextColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( hasGradientSupport( settings ) && ! settings.attributes.gradient ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tgradient: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject colors classnames.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( props, blockType, attributes ) {\n\tif (\n\t\t! hasColorSupport( blockType ) ||\n\t\tshouldSkipSerialization( blockType, COLOR_SUPPORT_KEY )\n\t) {\n\t\treturn props;\n\t}\n\n\tconst hasGradient = hasGradientSupport( blockType );\n\n\t// I'd have preferred to avoid the \"style\" attribute usage here\n\tconst { backgroundColor, textColor, gradient, style } = attributes;\n\n\tconst shouldSerialize = ( feature ) =>\n\t\t! shouldSkipSerialization( blockType, COLOR_SUPPORT_KEY, feature );\n\n\t// Primary color classes must come before the `has-text-color`,\n\t// `has-background` and `has-link-color` classes to maintain backwards\n\t// compatibility and avoid block invalidations.\n\tconst textClass = shouldSerialize( 'text' )\n\t\t? getColorClassName( 'color', textColor )\n\t\t: undefined;\n\n\tconst gradientClass = shouldSerialize( 'gradients' )\n\t\t? __experimentalGetGradientClass( gradient )\n\t\t: undefined;\n\n\tconst backgroundClass = shouldSerialize( 'background' )\n\t\t? getColorClassName( 'background-color', backgroundColor )\n\t\t: undefined;\n\n\tconst serializeHasBackground =\n\t\tshouldSerialize( 'background' ) || shouldSerialize( 'gradients' );\n\tconst hasBackground =\n\t\tbackgroundColor ||\n\t\tstyle?.color?.background ||\n\t\t( hasGradient && ( gradient || style?.color?.gradient ) );\n\n\tconst newClassName = classnames(\n\t\tprops.className,\n\t\ttextClass,\n\t\tgradientClass,\n\t\t{\n\t\t\t// Don't apply the background class if there's a custom gradient.\n\t\t\t[ backgroundClass ]:\n\t\t\t\t( ! hasGradient || ! style?.color?.gradient ) &&\n\t\t\t\t!! backgroundClass,\n\t\t\t'has-text-color':\n\t\t\t\tshouldSerialize( 'text' ) &&\n\t\t\t\t( textColor || style?.color?.text ),\n\t\t\t'has-background': serializeHasBackground && hasBackground,\n\t\t\t'has-link-color':\n\t\t\t\tshouldSerialize( 'link' ) && style?.elements?.link?.color,\n\t\t}\n\t);\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to extend the block edit wrapper\n * to apply the desired styles and classnames properly.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addEditProps( settings ) {\n\tif (\n\t\t! hasColorSupport( settings ) ||\n\t\tshouldSkipSerialization( settings, COLOR_SUPPORT_KEY )\n\t) {\n\t\treturn settings;\n\t}\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\t\treturn addSaveProps( props, settings, attributes );\n\t};\n\n\treturn settings;\n}\n\nconst getLinkColorFromAttributeValue = ( colors, value ) => {\n\tconst attributeParsed = /var:preset\\|color\\|(.+)/.exec( value );\n\tif ( attributeParsed && attributeParsed[ 1 ] ) {\n\t\treturn getColorObjectByAttributeValues( colors, attributeParsed[ 1 ] )\n\t\t\t.color;\n\t}\n\treturn value;\n};\n\n/**\n * Inspector control panel containing the color related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Color edit element.\n */\nexport function ColorEdit( props ) {\n\tconst { name: blockName, attributes } = props;\n\t// Some color settings have a special handling for deprecated flags in `useSetting`,\n\t// so we can't unwrap them by doing const { ... } = useSetting('color')\n\t// until https://github.com/WordPress/gutenberg/issues/37094 is fixed.\n\tconst userPalette = useSetting( 'color.palette.custom' );\n\tconst themePalette = useSetting( 'color.palette.theme' );\n\tconst defaultPalette = useSetting( 'color.palette.default' );\n\tconst allSolids = useMemo(\n\t\t() => [\n\t\t\t...( userPalette || [] ),\n\t\t\t...( themePalette || [] ),\n\t\t\t...( defaultPalette || [] ),\n\t\t],\n\t\t[ userPalette, themePalette, defaultPalette ]\n\t);\n\tconst userGradientPalette = useSetting( 'color.gradients.custom' );\n\tconst themeGradientPalette = useSetting( 'color.gradients.theme' );\n\tconst defaultGradientPalette = useSetting( 'color.gradients.default' );\n\tconst allGradients = useMemo(\n\t\t() => [\n\t\t\t...( userGradientPalette || [] ),\n\t\t\t...( themeGradientPalette || [] ),\n\t\t\t...( defaultGradientPalette || [] ),\n\t\t],\n\t\t[ userGradientPalette, themeGradientPalette, defaultGradientPalette ]\n\t);\n\tconst areCustomSolidsEnabled = useSetting( 'color.custom' );\n\tconst areCustomGradientsEnabled = useSetting( 'color.customGradient' );\n\tconst isBackgroundEnabled = useSetting( 'color.background' );\n\tconst isLinkEnabled = useSetting( 'color.link' );\n\tconst isTextEnabled = useSetting( 'color.text' );\n\n\tconst solidsEnabled =\n\t\tareCustomSolidsEnabled || ! themePalette || themePalette?.length > 0;\n\n\tconst gradientsEnabled =\n\t\tareCustomGradientsEnabled ||\n\t\t! themeGradientPalette ||\n\t\tthemeGradientPalette?.length > 0;\n\n\t// Shouldn't be needed but right now the ColorGradientsPanel\n\t// can trigger both onChangeColor and onChangeBackground\n\t// synchronously causing our two callbacks to override changes\n\t// from each other.\n\tconst localAttributes = useRef( attributes );\n\tuseEffect( () => {\n\t\tlocalAttributes.current = attributes;\n\t}, [ attributes ] );\n\n\tif ( ! hasColorSupport( blockName ) ) {\n\t\treturn null;\n\t}\n\n\tconst hasLinkColor =\n\t\thasLinkColorSupport( blockName ) && isLinkEnabled && solidsEnabled;\n\tconst hasTextColor =\n\t\thasTextColorSupport( blockName ) && isTextEnabled && solidsEnabled;\n\tconst hasBackgroundColor =\n\t\thasBackgroundColorSupport( blockName ) &&\n\t\tisBackgroundEnabled &&\n\t\tsolidsEnabled;\n\tconst hasGradientColor =\n\t\thasGradientSupport( blockName ) && gradientsEnabled;\n\n\tif (\n\t\t! hasLinkColor &&\n\t\t! hasTextColor &&\n\t\t! hasBackgroundColor &&\n\t\t! hasGradientColor\n\t) {\n\t\treturn null;\n\t}\n\n\tconst { style, textColor, backgroundColor, gradient } = attributes;\n\tlet gradientValue;\n\tif ( hasGradientColor && gradient ) {\n\t\tgradientValue = getGradientValueBySlug( allGradients, gradient );\n\t} else if ( hasGradientColor ) {\n\t\tgradientValue = style?.color?.gradient;\n\t}\n\n\tconst onChangeColor = ( name ) => ( value ) => {\n\t\tconst colorObject = getColorObjectByColorValue( allSolids, value );\n\t\tconst attributeName = name + 'Color';\n\t\tconst newStyle = {\n\t\t\t...localAttributes.current.style,\n\t\t\tcolor: {\n\t\t\t\t...localAttributes.current?.style?.color,\n\t\t\t\t[ name ]: colorObject?.slug ? undefined : value,\n\t\t\t},\n\t\t};\n\n\t\tconst newNamedColor = colorObject?.slug ? colorObject.slug : undefined;\n\t\tconst newAttributes = {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t[ attributeName ]: newNamedColor,\n\t\t};\n\n\t\tprops.setAttributes( newAttributes );\n\t\tlocalAttributes.current = {\n\t\t\t...localAttributes.current,\n\t\t\t...newAttributes,\n\t\t};\n\t};\n\n\tconst onChangeGradient = ( value ) => {\n\t\tconst slug = getGradientSlugByValue( allGradients, value );\n\t\tlet newAttributes;\n\t\tif ( slug ) {\n\t\t\tconst newStyle = {\n\t\t\t\t...localAttributes.current?.style,\n\t\t\t\tcolor: {\n\t\t\t\t\t...localAttributes.current?.style?.color,\n\t\t\t\t\tgradient: undefined,\n\t\t\t\t},\n\t\t\t};\n\t\t\tnewAttributes = {\n\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t\tgradient: slug,\n\t\t\t};\n\t\t} else {\n\t\t\tconst newStyle = {\n\t\t\t\t...localAttributes.current?.style,\n\t\t\t\tcolor: {\n\t\t\t\t\t...localAttributes.current?.style?.color,\n\t\t\t\t\tgradient: value,\n\t\t\t\t},\n\t\t\t};\n\t\t\tnewAttributes = {\n\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t\tgradient: undefined,\n\t\t\t};\n\t\t}\n\t\tprops.setAttributes( newAttributes );\n\t\tlocalAttributes.current = {\n\t\t\t...localAttributes.current,\n\t\t\t...newAttributes,\n\t\t};\n\t};\n\n\tconst onChangeLinkColor = ( value ) => {\n\t\tconst colorObject = getColorObjectByColorValue( allSolids, value );\n\t\tconst newLinkColorValue = colorObject?.slug\n\t\t\t? `var:preset|color|${ colorObject.slug }`\n\t\t\t: value;\n\n\t\tconst newStyle = cleanEmptyObject(\n\t\t\timmutableSet(\n\t\t\t\tlocalAttributes.current?.style,\n\t\t\t\t[ 'elements', 'link', 'color', 'text' ],\n\t\t\t\tnewLinkColorValue\n\t\t\t)\n\t\t);\n\t\tprops.setAttributes( { style: newStyle } );\n\t\tlocalAttributes.current = {\n\t\t\t...localAttributes.current,\n\t\t\t...{ style: newStyle },\n\t\t};\n\t};\n\n\tconst defaultColorControls = getBlockSupport( props.name, [\n\t\tCOLOR_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\tconst enableContrastChecking =\n\t\tPlatform.OS === 'web' &&\n\t\t! gradient &&\n\t\t! style?.color?.gradient &&\n\t\t// Contrast checking is enabled by default.\n\t\t// Deactivating it requires `enableContrastChecker` to have\n\t\t// an explicit value of `false`.\n\t\tfalse !==\n\t\t\tgetBlockSupport( props.name, [\n\t\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\t\t'enableContrastChecker',\n\t\t\t] );\n\n\treturn (\n\t\t<ColorPanel\n\t\t\tenableContrastChecking={ enableContrastChecking }\n\t\t\tclientId={ props.clientId }\n\t\t\tenableAlpha={ true }\n\t\t\tsettings={ [\n\t\t\t\t...( hasTextColor\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Text' ),\n\t\t\t\t\t\t\t\tonColorChange: onChangeColor( 'text' ),\n\t\t\t\t\t\t\t\tcolorValue: getColorObjectByAttributeValues(\n\t\t\t\t\t\t\t\t\tallSolids,\n\t\t\t\t\t\t\t\t\ttextColor,\n\t\t\t\t\t\t\t\t\tstyle?.color?.text\n\t\t\t\t\t\t\t\t).color,\n\t\t\t\t\t\t\t\tisShownByDefault: defaultColorControls?.text,\n\t\t\t\t\t\t\t\tresetAllFilter: resetAllTextFilter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [] ),\n\t\t\t\t...( hasBackgroundColor || hasGradientColor\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Background' ),\n\t\t\t\t\t\t\t\tonColorChange: hasBackgroundColor\n\t\t\t\t\t\t\t\t\t? onChangeColor( 'background' )\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\tcolorValue: getColorObjectByAttributeValues(\n\t\t\t\t\t\t\t\t\tallSolids,\n\t\t\t\t\t\t\t\t\tbackgroundColor,\n\t\t\t\t\t\t\t\t\tstyle?.color?.background\n\t\t\t\t\t\t\t\t).color,\n\t\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\t\tonGradientChange: hasGradientColor\n\t\t\t\t\t\t\t\t\t? onChangeGradient\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\tisShownByDefault:\n\t\t\t\t\t\t\t\t\tdefaultColorControls?.background,\n\t\t\t\t\t\t\t\tresetAllFilter: clearBackgroundAndGradient,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [] ),\n\t\t\t\t...( hasLinkColor\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Link' ),\n\t\t\t\t\t\t\t\tonColorChange: onChangeLinkColor,\n\t\t\t\t\t\t\t\tcolorValue: getLinkColorFromAttributeValue(\n\t\t\t\t\t\t\t\t\tallSolids,\n\t\t\t\t\t\t\t\t\tstyle?.elements?.link?.color?.text\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tclearable:\n\t\t\t\t\t\t\t\t\t!! style?.elements?.link?.color?.text,\n\t\t\t\t\t\t\t\tisShownByDefault: defaultColorControls?.link,\n\t\t\t\t\t\t\t\tresetAllFilter: resetAllLinkFilter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [] ),\n\t\t\t] }\n\t\t/>\n\t);\n}\n\n/**\n * This adds inline styles for color palette colors.\n * Ideally, this is not needed and themes should load their palettes on the editor.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withColorPaletteStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst { backgroundColor, textColor } = attributes;\n\t\tconst userPalette = useSetting( 'color.palette.custom' ) || [];\n\t\tconst themePalette = useSetting( 'color.palette.theme' ) || [];\n\t\tconst defaultPalette = useSetting( 'color.palette.default' ) || [];\n\t\tconst colors = useMemo(\n\t\t\t() => [\n\t\t\t\t...( userPalette || [] ),\n\t\t\t\t...( themePalette || [] ),\n\t\t\t\t...( defaultPalette || [] ),\n\t\t\t],\n\t\t\t[ userPalette, themePalette, defaultPalette ]\n\t\t);\n\t\tif (\n\t\t\t! hasColorSupport( name ) ||\n\t\t\tshouldSkipSerialization( name, COLOR_SUPPORT_KEY )\n\t\t) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\t\tconst extraStyles = {};\n\n\t\tif (\n\t\t\ttextColor &&\n\t\t\t! shouldSkipSerialization( name, COLOR_SUPPORT_KEY, 'text' )\n\t\t) {\n\t\t\textraStyles.color = getColorObjectByAttributeValues(\n\t\t\t\tcolors,\n\t\t\t\ttextColor\n\t\t\t)?.color;\n\t\t}\n\t\tif (\n\t\t\tbackgroundColor &&\n\t\t\t! shouldSkipSerialization( name, COLOR_SUPPORT_KEY, 'background' )\n\t\t) {\n\t\t\textraStyles.backgroundColor = getColorObjectByAttributeValues(\n\t\t\t\tcolors,\n\t\t\t\tbackgroundColor\n\t\t\t)?.color;\n\t\t}\n\n\t\tlet wrapperProps = props.wrapperProps;\n\t\twrapperProps = {\n\t\t\t...props.wrapperProps,\n\t\t\tstyle: {\n\t\t\t\t...extraStyles,\n\t\t\t\t...props.wrapperProps?.style,\n\t\t\t},\n\t\t};\n\n\t\treturn <BlockListBlock { ...props } wrapperProps={ wrapperProps } />;\n\t}\n);\n\nconst MIGRATION_PATHS = {\n\tlinkColor: [ [ 'style', 'elements', 'link', 'color', 'text' ] ],\n\ttextColor: [ [ 'textColor' ], [ 'style', 'color', 'text' ] ],\n\tbackgroundColor: [\n\t\t[ 'backgroundColor' ],\n\t\t[ 'style', 'color', 'background' ],\n\t],\n\tgradient: [ [ 'gradient' ], [ 'style', 'color', 'gradient' ] ],\n};\n\nexport function addTransforms( result, source, index, results ) {\n\tconst destinationBlockType = result.name;\n\tconst activeSupports = {\n\t\tlinkColor: hasLinkColorSupport( destinationBlockType ),\n\t\ttextColor: hasTextColorSupport( destinationBlockType ),\n\t\tbackgroundColor: hasBackgroundColorSupport( destinationBlockType ),\n\t\tgradient: hasGradientSupport( destinationBlockType ),\n\t};\n\treturn transformStyles(\n\t\tactiveSupports,\n\t\tMIGRATION_PATHS,\n\t\tresult,\n\t\tsource,\n\t\tindex,\n\t\tresults\n\t);\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/color/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/color/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/color/addEditProps',\n\taddEditProps\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/color/with-color-palette-styles',\n\twithColorPaletteStyles\n);\n\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/color/addTransforms',\n\taddTransforms\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/color.js"],"names":["classnames","addFilter","getBlockSupport","__","useRef","useEffect","useMemo","Platform","createHigherOrderComponent","getColorClassName","getColorObjectByColorValue","getColorObjectByAttributeValues","__experimentalGetGradientClass","getGradientValueBySlug","getGradientSlugByValue","cleanEmptyObject","transformStyles","immutableSet","shouldSkipSerialization","ColorPanel","useSetting","COLOR_SUPPORT_KEY","hasColorSupport","blockType","colorSupport","link","gradient","background","text","hasLinkColorSupport","OS","hasGradientSupport","gradients","hasBackgroundColorSupport","hasTextColorSupport","clearColorFromStyles","path","style","undefined","resetAllTextFilter","attributes","textColor","resetAllLinkFilter","clearBackgroundAndGradient","backgroundColor","color","addAttributes","settings","Object","assign","type","addSaveProps","props","hasGradient","shouldSerialize","feature","textClass","gradientClass","backgroundClass","serializeHasBackground","hasBackground","newClassName","className","elements","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","getLinkColorFromAttributeValue","colors","value","attributeParsed","exec","ColorEdit","name","blockName","userPalette","themePalette","defaultPalette","allSolids","userGradientPalette","themeGradientPalette","defaultGradientPalette","allGradients","areCustomSolidsEnabled","areCustomGradientsEnabled","isBackgroundEnabled","isLinkEnabled","isTextEnabled","solidsEnabled","length","gradientsEnabled","localAttributes","current","hasLinkColor","hasTextColor","hasBackgroundColor","hasGradientColor","gradientValue","onChangeColor","colorObject","attributeName","newStyle","slug","newNamedColor","newAttributes","setAttributes","onChangeGradient","onChangeLinkColor","newLinkColorValue","defaultColorControls","enableContrastChecking","clientId","label","onColorChange","colorValue","isShownByDefault","resetAllFilter","onGradientChange","clearable","withColorPaletteStyles","BlockListBlock","extraStyles","wrapperProps","MIGRATION_PATHS","linkColor","addTransforms","result","source","index","results","destinationBlockType","activeSupports"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,SAAjB,EAA4BC,OAA5B,EAAqCC,QAArC,QAAqD,oBAArD;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AAEA;AACA;AACA;;AACA,SACCC,iBADD,EAECC,0BAFD,EAGCC,+BAHD,QAIO,sBAJP;AAKA,SACCC,8BADD,EAECC,sBAFD,EAGCC,sBAHD,QAIO,yBAJP;AAKA,SACCC,gBADD,EAECC,eAFD,EAGCC,YAHD,EAICC,uBAJD,QAKO,SALP;AAMA,OAAOC,UAAP,MAAuB,eAA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A/C,EAAyD;AAC/D,QAAMC,oBAAoB,GAAGJ,MAAM,CAACrD,IAApC;AACA,QAAM0D,cAAc,GAAG;AACtBP,IAAAA,SAAS,EAAE/F,mBAAmB,CAAEqG,oBAAF,CADR;AAEtBzF,IAAAA,SAAS,EAAEP,mBAAmB,CAAEgG,oBAAF,CAFR;AAGtBtF,IAAAA,eAAe,EAAEX,yBAAyB,CAAEiG,oBAAF,CAHpB;AAItBxG,IAAAA,QAAQ,EAAEK,kBAAkB,CAAEmG,oBAAF;AAJN,GAAvB;AAMA,SAAOlH,eAAe,CACrBmH,cADqB,EAErBR,eAFqB,EAGrBG,MAHqB,EAIrBC,MAJqB,EAKrBC,KALqB,EAMrBC,OANqB,CAAtB;AAQA;AAEDhI,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGR6C,aAHQ,CAAT;AAMA7C,SAAS,CACR,kCADQ,EAER,yBAFQ,EAGRkD,YAHQ,CAAT;AAMAlD,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGR+D,YAHQ,CAAT;AAMA/D,SAAS,CACR,uBADQ,EAER,sCAFQ,EAGRsH,sBAHQ,CAAT;AAMAtH,SAAS,CACR,2CADQ,EAER,0BAFQ,EAGR4H,aAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useEffect, useMemo, Platform } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n} from '../components/colors';\nimport {\n\t__experimentalGetGradientClass,\n\tgetGradientValueBySlug,\n\tgetGradientSlugByValue,\n} from '../components/gradients';\nimport {\n\tcleanEmptyObject,\n\ttransformStyles,\n\timmutableSet,\n\tshouldSkipSerialization,\n} from './utils';\nimport ColorPanel from './color-panel';\nimport useSetting from '../components/use-setting';\n\nexport const COLOR_SUPPORT_KEY = 'color';\n\nconst hasColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\treturn (\n\t\tcolorSupport &&\n\t\t( colorSupport.link === true ||\n\t\t\tcolorSupport.gradient === true ||\n\t\t\tcolorSupport.background !== false ||\n\t\t\tcolorSupport.text !== false )\n\t);\n};\n\nconst hasLinkColorSupport = ( blockType ) => {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn (\n\t\tcolorSupport !== null &&\n\t\ttypeof colorSupport === 'object' &&\n\t\t!! colorSupport.link\n\t);\n};\n\nconst hasGradientSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn (\n\t\tcolorSupport !== null &&\n\t\ttypeof colorSupport === 'object' &&\n\t\t!! colorSupport.gradients\n\t);\n};\n\nconst hasBackgroundColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.background !== false;\n};\n\nconst hasTextColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.text !== false;\n};\n\n/**\n * Clears a single color property from a style object.\n *\n * @param {Array} path Path to color property to clear within styles object.\n * @param {Object} style Block attributes style object.\n * @return {Object} Styles with the color property omitted.\n */\nconst clearColorFromStyles = ( path, style ) =>\n\tcleanEmptyObject( immutableSet( style, path, undefined ) );\n\n/**\n * Clears text color related properties from supplied attributes.\n *\n * @param {Object} attributes Block attributes.\n * @return {Object} Update block attributes with text color properties omitted.\n */\nconst resetAllTextFilter = ( attributes ) => ( {\n\ttextColor: undefined,\n\tstyle: clearColorFromStyles( [ 'color', 'text' ], attributes.style ),\n} );\n\n/**\n * Clears link color related properties from supplied attributes.\n *\n * @param {Object} attributes Block attributes.\n * @return {Object} Update block attributes with link color properties omitted.\n */\nconst resetAllLinkFilter = ( attributes ) => ( {\n\tstyle: clearColorFromStyles(\n\t\t[ 'elements', 'link', 'color', 'text' ],\n\t\tattributes.style\n\t),\n} );\n\n/**\n * Clears all background color related properties including gradients from\n * supplied block attributes.\n *\n * @param {Object} attributes Block attributes.\n * @return {Object} Block attributes with background and gradient omitted.\n */\nconst clearBackgroundAndGradient = ( attributes ) => ( {\n\tbackgroundColor: undefined,\n\tgradient: undefined,\n\tstyle: {\n\t\t...attributes.style,\n\t\tcolor: {\n\t\t\t...attributes.style?.color,\n\t\t\tbackground: undefined,\n\t\t\tgradient: undefined,\n\t\t},\n\t},\n} );\n\n/**\n * Filters registered block settings, extending attributes to include\n * `backgroundColor` and `textColor` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasColorSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( ! settings.attributes.backgroundColor ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tbackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\tif ( ! settings.attributes.textColor ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\ttextColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( hasGradientSupport( settings ) && ! settings.attributes.gradient ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tgradient: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject colors classnames.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( props, blockType, attributes ) {\n\tif (\n\t\t! hasColorSupport( blockType ) ||\n\t\tshouldSkipSerialization( blockType, COLOR_SUPPORT_KEY )\n\t) {\n\t\treturn props;\n\t}\n\n\tconst hasGradient = hasGradientSupport( blockType );\n\n\t// I'd have preferred to avoid the \"style\" attribute usage here\n\tconst { backgroundColor, textColor, gradient, style } = attributes;\n\n\tconst shouldSerialize = ( feature ) =>\n\t\t! shouldSkipSerialization( blockType, COLOR_SUPPORT_KEY, feature );\n\n\t// Primary color classes must come before the `has-text-color`,\n\t// `has-background` and `has-link-color` classes to maintain backwards\n\t// compatibility and avoid block invalidations.\n\tconst textClass = shouldSerialize( 'text' )\n\t\t? getColorClassName( 'color', textColor )\n\t\t: undefined;\n\n\tconst gradientClass = shouldSerialize( 'gradients' )\n\t\t? __experimentalGetGradientClass( gradient )\n\t\t: undefined;\n\n\tconst backgroundClass = shouldSerialize( 'background' )\n\t\t? getColorClassName( 'background-color', backgroundColor )\n\t\t: undefined;\n\n\tconst serializeHasBackground =\n\t\tshouldSerialize( 'background' ) || shouldSerialize( 'gradients' );\n\tconst hasBackground =\n\t\tbackgroundColor ||\n\t\tstyle?.color?.background ||\n\t\t( hasGradient && ( gradient || style?.color?.gradient ) );\n\n\tconst newClassName = classnames(\n\t\tprops.className,\n\t\ttextClass,\n\t\tgradientClass,\n\t\t{\n\t\t\t// Don't apply the background class if there's a custom gradient.\n\t\t\t[ backgroundClass ]:\n\t\t\t\t( ! hasGradient || ! style?.color?.gradient ) &&\n\t\t\t\t!! backgroundClass,\n\t\t\t'has-text-color':\n\t\t\t\tshouldSerialize( 'text' ) &&\n\t\t\t\t( textColor || style?.color?.text ),\n\t\t\t'has-background': serializeHasBackground && hasBackground,\n\t\t\t'has-link-color':\n\t\t\t\tshouldSerialize( 'link' ) && style?.elements?.link?.color,\n\t\t}\n\t);\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to extend the block edit wrapper\n * to apply the desired styles and classnames properly.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addEditProps( settings ) {\n\tif (\n\t\t! hasColorSupport( settings ) ||\n\t\tshouldSkipSerialization( settings, COLOR_SUPPORT_KEY )\n\t) {\n\t\treturn settings;\n\t}\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\t\treturn addSaveProps( props, settings, attributes );\n\t};\n\n\treturn settings;\n}\n\nconst getLinkColorFromAttributeValue = ( colors, value ) => {\n\tconst attributeParsed = /var:preset\\|color\\|(.+)/.exec( value );\n\tif ( attributeParsed && attributeParsed[ 1 ] ) {\n\t\treturn getColorObjectByAttributeValues( colors, attributeParsed[ 1 ] )\n\t\t\t.color;\n\t}\n\treturn value;\n};\n\n/**\n * Inspector control panel containing the color related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Color edit element.\n */\nexport function ColorEdit( props ) {\n\tconst { name: blockName, attributes } = props;\n\t// Some color settings have a special handling for deprecated flags in `useSetting`,\n\t// so we can't unwrap them by doing const { ... } = useSetting('color')\n\t// until https://github.com/WordPress/gutenberg/issues/37094 is fixed.\n\tconst userPalette = useSetting( 'color.palette.custom' );\n\tconst themePalette = useSetting( 'color.palette.theme' );\n\tconst defaultPalette = useSetting( 'color.palette.default' );\n\tconst allSolids = useMemo(\n\t\t() => [\n\t\t\t...( userPalette || [] ),\n\t\t\t...( themePalette || [] ),\n\t\t\t...( defaultPalette || [] ),\n\t\t],\n\t\t[ userPalette, themePalette, defaultPalette ]\n\t);\n\tconst userGradientPalette = useSetting( 'color.gradients.custom' );\n\tconst themeGradientPalette = useSetting( 'color.gradients.theme' );\n\tconst defaultGradientPalette = useSetting( 'color.gradients.default' );\n\tconst allGradients = useMemo(\n\t\t() => [\n\t\t\t...( userGradientPalette || [] ),\n\t\t\t...( themeGradientPalette || [] ),\n\t\t\t...( defaultGradientPalette || [] ),\n\t\t],\n\t\t[ userGradientPalette, themeGradientPalette, defaultGradientPalette ]\n\t);\n\tconst areCustomSolidsEnabled = useSetting( 'color.custom' );\n\tconst areCustomGradientsEnabled = useSetting( 'color.customGradient' );\n\tconst isBackgroundEnabled = useSetting( 'color.background' );\n\tconst isLinkEnabled = useSetting( 'color.link' );\n\tconst isTextEnabled = useSetting( 'color.text' );\n\n\tconst solidsEnabled =\n\t\tareCustomSolidsEnabled || ! themePalette || themePalette?.length > 0;\n\n\tconst gradientsEnabled =\n\t\tareCustomGradientsEnabled ||\n\t\t! themeGradientPalette ||\n\t\tthemeGradientPalette?.length > 0;\n\n\t// Shouldn't be needed but right now the ColorGradientsPanel\n\t// can trigger both onChangeColor and onChangeBackground\n\t// synchronously causing our two callbacks to override changes\n\t// from each other.\n\tconst localAttributes = useRef( attributes );\n\tuseEffect( () => {\n\t\tlocalAttributes.current = attributes;\n\t}, [ attributes ] );\n\n\tif ( ! hasColorSupport( blockName ) ) {\n\t\treturn null;\n\t}\n\n\tconst hasLinkColor =\n\t\thasLinkColorSupport( blockName ) && isLinkEnabled && solidsEnabled;\n\tconst hasTextColor =\n\t\thasTextColorSupport( blockName ) && isTextEnabled && solidsEnabled;\n\tconst hasBackgroundColor =\n\t\thasBackgroundColorSupport( blockName ) &&\n\t\tisBackgroundEnabled &&\n\t\tsolidsEnabled;\n\tconst hasGradientColor =\n\t\thasGradientSupport( blockName ) && gradientsEnabled;\n\n\tif (\n\t\t! hasLinkColor &&\n\t\t! hasTextColor &&\n\t\t! hasBackgroundColor &&\n\t\t! hasGradientColor\n\t) {\n\t\treturn null;\n\t}\n\n\tconst { style, textColor, backgroundColor, gradient } = attributes;\n\tlet gradientValue;\n\tif ( hasGradientColor && gradient ) {\n\t\tgradientValue = getGradientValueBySlug( allGradients, gradient );\n\t} else if ( hasGradientColor ) {\n\t\tgradientValue = style?.color?.gradient;\n\t}\n\n\tconst onChangeColor = ( name ) => ( value ) => {\n\t\tconst colorObject = getColorObjectByColorValue( allSolids, value );\n\t\tconst attributeName = name + 'Color';\n\t\tconst newStyle = {\n\t\t\t...localAttributes.current.style,\n\t\t\tcolor: {\n\t\t\t\t...localAttributes.current?.style?.color,\n\t\t\t\t[ name ]: colorObject?.slug ? undefined : value,\n\t\t\t},\n\t\t};\n\n\t\tconst newNamedColor = colorObject?.slug ? colorObject.slug : undefined;\n\t\tconst newAttributes = {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t[ attributeName ]: newNamedColor,\n\t\t};\n\n\t\tprops.setAttributes( newAttributes );\n\t\tlocalAttributes.current = {\n\t\t\t...localAttributes.current,\n\t\t\t...newAttributes,\n\t\t};\n\t};\n\n\tconst onChangeGradient = ( value ) => {\n\t\tconst slug = getGradientSlugByValue( allGradients, value );\n\t\tlet newAttributes;\n\t\tif ( slug ) {\n\t\t\tconst newStyle = {\n\t\t\t\t...localAttributes.current?.style,\n\t\t\t\tcolor: {\n\t\t\t\t\t...localAttributes.current?.style?.color,\n\t\t\t\t\tgradient: undefined,\n\t\t\t\t},\n\t\t\t};\n\t\t\tnewAttributes = {\n\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t\tgradient: slug,\n\t\t\t};\n\t\t} else {\n\t\t\tconst newStyle = {\n\t\t\t\t...localAttributes.current?.style,\n\t\t\t\tcolor: {\n\t\t\t\t\t...localAttributes.current?.style?.color,\n\t\t\t\t\tgradient: value,\n\t\t\t\t},\n\t\t\t};\n\t\t\tnewAttributes = {\n\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t\tgradient: undefined,\n\t\t\t};\n\t\t}\n\t\tprops.setAttributes( newAttributes );\n\t\tlocalAttributes.current = {\n\t\t\t...localAttributes.current,\n\t\t\t...newAttributes,\n\t\t};\n\t};\n\n\tconst onChangeLinkColor = ( value ) => {\n\t\tconst colorObject = getColorObjectByColorValue( allSolids, value );\n\t\tconst newLinkColorValue = colorObject?.slug\n\t\t\t? `var:preset|color|${ colorObject.slug }`\n\t\t\t: value;\n\n\t\tconst newStyle = cleanEmptyObject(\n\t\t\timmutableSet(\n\t\t\t\tlocalAttributes.current?.style,\n\t\t\t\t[ 'elements', 'link', 'color', 'text' ],\n\t\t\t\tnewLinkColorValue\n\t\t\t)\n\t\t);\n\t\tprops.setAttributes( { style: newStyle } );\n\t\tlocalAttributes.current = {\n\t\t\t...localAttributes.current,\n\t\t\t...{ style: newStyle },\n\t\t};\n\t};\n\n\tconst defaultColorControls = getBlockSupport( props.name, [\n\t\tCOLOR_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\tconst enableContrastChecking =\n\t\tPlatform.OS === 'web' &&\n\t\t! gradient &&\n\t\t! style?.color?.gradient &&\n\t\thasBackgroundColor &&\n\t\t( hasLinkColor || hasTextColor ) &&\n\t\t// Contrast checking is enabled by default.\n\t\t// Deactivating it requires `enableContrastChecker` to have\n\t\t// an explicit value of `false`.\n\t\tfalse !==\n\t\t\tgetBlockSupport( props.name, [\n\t\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\t\t'enableContrastChecker',\n\t\t\t] );\n\n\treturn (\n\t\t<ColorPanel\n\t\t\tenableContrastChecking={ enableContrastChecking }\n\t\t\tclientId={ props.clientId }\n\t\t\tenableAlpha={ true }\n\t\t\tsettings={ [\n\t\t\t\t...( hasTextColor\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Text' ),\n\t\t\t\t\t\t\t\tonColorChange: onChangeColor( 'text' ),\n\t\t\t\t\t\t\t\tcolorValue: getColorObjectByAttributeValues(\n\t\t\t\t\t\t\t\t\tallSolids,\n\t\t\t\t\t\t\t\t\ttextColor,\n\t\t\t\t\t\t\t\t\tstyle?.color?.text\n\t\t\t\t\t\t\t\t).color,\n\t\t\t\t\t\t\t\tisShownByDefault: defaultColorControls?.text,\n\t\t\t\t\t\t\t\tresetAllFilter: resetAllTextFilter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [] ),\n\t\t\t\t...( hasBackgroundColor || hasGradientColor\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Background' ),\n\t\t\t\t\t\t\t\tonColorChange: hasBackgroundColor\n\t\t\t\t\t\t\t\t\t? onChangeColor( 'background' )\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\tcolorValue: getColorObjectByAttributeValues(\n\t\t\t\t\t\t\t\t\tallSolids,\n\t\t\t\t\t\t\t\t\tbackgroundColor,\n\t\t\t\t\t\t\t\t\tstyle?.color?.background\n\t\t\t\t\t\t\t\t).color,\n\t\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\t\tonGradientChange: hasGradientColor\n\t\t\t\t\t\t\t\t\t? onChangeGradient\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\tisShownByDefault:\n\t\t\t\t\t\t\t\t\tdefaultColorControls?.background,\n\t\t\t\t\t\t\t\tresetAllFilter: clearBackgroundAndGradient,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [] ),\n\t\t\t\t...( hasLinkColor\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Link' ),\n\t\t\t\t\t\t\t\tonColorChange: onChangeLinkColor,\n\t\t\t\t\t\t\t\tcolorValue: getLinkColorFromAttributeValue(\n\t\t\t\t\t\t\t\t\tallSolids,\n\t\t\t\t\t\t\t\t\tstyle?.elements?.link?.color?.text\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tclearable:\n\t\t\t\t\t\t\t\t\t!! style?.elements?.link?.color?.text,\n\t\t\t\t\t\t\t\tisShownByDefault: defaultColorControls?.link,\n\t\t\t\t\t\t\t\tresetAllFilter: resetAllLinkFilter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t ]\n\t\t\t\t\t: [] ),\n\t\t\t] }\n\t\t/>\n\t);\n}\n\n/**\n * This adds inline styles for color palette colors.\n * Ideally, this is not needed and themes should load their palettes on the editor.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withColorPaletteStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst { backgroundColor, textColor } = attributes;\n\t\tconst userPalette = useSetting( 'color.palette.custom' ) || [];\n\t\tconst themePalette = useSetting( 'color.palette.theme' ) || [];\n\t\tconst defaultPalette = useSetting( 'color.palette.default' ) || [];\n\t\tconst colors = useMemo(\n\t\t\t() => [\n\t\t\t\t...( userPalette || [] ),\n\t\t\t\t...( themePalette || [] ),\n\t\t\t\t...( defaultPalette || [] ),\n\t\t\t],\n\t\t\t[ userPalette, themePalette, defaultPalette ]\n\t\t);\n\t\tif (\n\t\t\t! hasColorSupport( name ) ||\n\t\t\tshouldSkipSerialization( name, COLOR_SUPPORT_KEY )\n\t\t) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\t\tconst extraStyles = {};\n\n\t\tif (\n\t\t\ttextColor &&\n\t\t\t! shouldSkipSerialization( name, COLOR_SUPPORT_KEY, 'text' )\n\t\t) {\n\t\t\textraStyles.color = getColorObjectByAttributeValues(\n\t\t\t\tcolors,\n\t\t\t\ttextColor\n\t\t\t)?.color;\n\t\t}\n\t\tif (\n\t\t\tbackgroundColor &&\n\t\t\t! shouldSkipSerialization( name, COLOR_SUPPORT_KEY, 'background' )\n\t\t) {\n\t\t\textraStyles.backgroundColor = getColorObjectByAttributeValues(\n\t\t\t\tcolors,\n\t\t\t\tbackgroundColor\n\t\t\t)?.color;\n\t\t}\n\n\t\tlet wrapperProps = props.wrapperProps;\n\t\twrapperProps = {\n\t\t\t...props.wrapperProps,\n\t\t\tstyle: {\n\t\t\t\t...extraStyles,\n\t\t\t\t...props.wrapperProps?.style,\n\t\t\t},\n\t\t};\n\n\t\treturn <BlockListBlock { ...props } wrapperProps={ wrapperProps } />;\n\t}\n);\n\nconst MIGRATION_PATHS = {\n\tlinkColor: [ [ 'style', 'elements', 'link', 'color', 'text' ] ],\n\ttextColor: [ [ 'textColor' ], [ 'style', 'color', 'text' ] ],\n\tbackgroundColor: [\n\t\t[ 'backgroundColor' ],\n\t\t[ 'style', 'color', 'background' ],\n\t],\n\tgradient: [ [ 'gradient' ], [ 'style', 'color', 'gradient' ] ],\n};\n\nexport function addTransforms( result, source, index, results ) {\n\tconst destinationBlockType = result.name;\n\tconst activeSupports = {\n\t\tlinkColor: hasLinkColorSupport( destinationBlockType ),\n\t\ttextColor: hasTextColorSupport( destinationBlockType ),\n\t\tbackgroundColor: hasBackgroundColorSupport( destinationBlockType ),\n\t\tgradient: hasGradientSupport( destinationBlockType ),\n\t};\n\treturn transformStyles(\n\t\tactiveSupports,\n\t\tMIGRATION_PATHS,\n\t\tresult,\n\t\tsource,\n\t\tindex,\n\t\tresults\n\t);\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/color/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/color/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/color/addEditProps',\n\taddEditProps\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/color/with-color-palette-styles',\n\twithColorPaletteStyles\n);\n\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/color/addTransforms',\n\taddTransforms\n);\n"]}
@@ -4,7 +4,7 @@ import { createElement, Fragment } from "@wordpress/element";
4
4
  /**
5
5
  * WordPress dependencies
6
6
  */
7
- import { ToolbarButton } from '@wordpress/components';
7
+ import { ToolbarButton, MenuItem } from '@wordpress/components';
8
8
  import { createHigherOrderComponent } from '@wordpress/compose';
9
9
  import { useDispatch, useSelect } from '@wordpress/data';
10
10
  import { addFilter } from '@wordpress/hooks';
@@ -15,7 +15,7 @@ import { useEffect, useRef, useCallback } from '@wordpress/element';
15
15
  */
16
16
 
17
17
  import { store as blockEditorStore } from '../store';
18
- import { BlockControls } from '../components';
18
+ import { BlockControls, BlockSettingsMenuControls } from '../components';
19
19
  /**
20
20
  * External dependencies
21
21
  */
@@ -94,16 +94,21 @@ export const withBlockControls = createHigherOrderComponent(BlockEdit => props =
94
94
  return createElement(BlockEdit, props);
95
95
  }
96
96
 
97
- return createElement(Fragment, null, isEditingAsBlocks && !isContentLocked && createElement(StopEditingAsBlocksOnOutsideSelect, {
97
+ return createElement(Fragment, null, isEditingAsBlocks && !isContentLocked && createElement(Fragment, null, createElement(StopEditingAsBlocksOnOutsideSelect, {
98
98
  clientId: props.clientId,
99
99
  stopEditingAsBlock: stopEditingAsBlock
100
100
  }), createElement(BlockControls, {
101
101
  group: "other"
102
102
  }, createElement(ToolbarButton, {
103
103
  onClick: () => {
104
- if (isEditingAsBlocks && !isContentLocked) {
105
- stopEditingAsBlock();
106
- } else {
104
+ stopEditingAsBlock();
105
+ }
106
+ }, __('Done')))), !isEditingAsBlocks && isContentLocked && props.isSelected && createElement(BlockSettingsMenuControls, null, _ref2 => {
107
+ let {
108
+ onClose
109
+ } = _ref2;
110
+ return createElement(MenuItem, {
111
+ onClick: () => {
107
112
  __unstableMarkNextChangeAsNotPersistent();
108
113
 
109
114
  updateBlockAttributes(props.clientId, {
@@ -118,11 +123,13 @@ export const withBlockControls = createHigherOrderComponent(BlockEdit => props =
118
123
  });
119
124
 
120
125
  __unstableSetTemporarilyEditingAsBlocks(props.clientId);
126
+
127
+ onClose();
121
128
  }
122
- }
123
- }, isEditingAsBlocks && !isContentLocked ? __('Done') : __('Modify'))), createElement(BlockEdit, _extends({}, props, {
129
+ }, __('Modify'));
130
+ }), createElement(BlockEdit, _extends({}, props, {
124
131
  className: classnames(props.className, isEditingAsBlocks && 'is-content-locked-editing-as-blocks')
125
132
  })));
126
133
  }, 'withToolbarControls');
127
- addFilter('editor.BlockEdit', 'core/style/with-block-controls', withBlockControls);
134
+ addFilter('editor.BlockEdit', 'core/content-lock-ui/with-block-controls', withBlockControls);
128
135
  //# sourceMappingURL=content-lock-ui.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/content-lock-ui.js"],"names":["ToolbarButton","createHigherOrderComponent","useDispatch","useSelect","addFilter","__","useEffect","useRef","useCallback","store","blockEditorStore","BlockControls","classnames","StopEditingAsBlocksOnOutsideSelect","clientId","stopEditingAsBlock","isBlockOrDescendantSelected","select","isBlockSelected","hasSelectedInnerBlock","withBlockControls","BlockEdit","props","getBlockListSettings","getSettings","focusModeToRevert","templateLock","isLockedByParent","isEditingAsBlocks","__unstableGetContentLockingParent","getTemplateLock","__unstableGetTemporarilyEditingAsBlocks","updateSettings","updateBlockListSettings","__unstableSetTemporarilyEditingAsBlocks","isContentLocked","__unstableMarkNextChangeAsNotPersistent","updateBlockAttributes","focusMode","current","undefined","className"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,aAAT,QAA8B,uBAA9B;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,EAAoBC,MAApB,EAA4BC,WAA5B,QAA+C,oBAA/C;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AACA,SAASC,aAAT,QAA8B,eAA9B;AACA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,YAAvB;;AAEA,SAASC,kCAAT,OAGI;AAAA,MAHyC;AAC5CC,IAAAA,QAD4C;AAE5CC,IAAAA;AAF4C,GAGzC;AACH,QAAMC,2BAA2B,GAAGb,SAAS,CAC1Cc,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,eAAF;AAAmBC,MAAAA;AAAnB,QACLF,M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AlB,CAArB;AAGAP,QAAAA,uBAAuB,CAAEX,KAAK,CAACR,QAAR,EAAkB,EACxC,GAAGS,oBAAoB,CAAED,KAAK,CAACR,QAAR,CADiB;AAExCY,UAAAA,YAAY,EAAE;AAF0B,SAAlB,CAAvB;AAIAD,QAAAA,iBAAiB,CAACc,OAAlB,GACCf,WAAW,GAAGc,SADf;AAEAN,QAAAA,cAAc,CAAE;AAAEM,UAAAA,SAAS,EAAE;AAAb,SAAF,CAAd;;AACAJ,QAAAA,uCAAuC,CACtCZ,KAAK,CAACR,QADgC,CAAvC;AAGA;AACD;AApBF,KAsBGc,iBAAiB,IAAI,CAAEO,eAAvB,GACC9B,EAAE,CAAE,MAAF,CADH,GAECA,EAAE,CAAE,QAAF,CAxBN,CADD,CAPD,EAmCC,cAAC,SAAD,eACMiB,KADN;AAEC,IAAA,SAAS,EAAGV,UAAU,CACrBU,KAAK,CAACmB,SADe,EAErBb,iBAAiB,IAChB,qCAHoB;AAFvB,KAnCD,CADD;AA8CA,CA7GyD,EA8G1D,qBA9G0D,CAApD;AAiHPxB,SAAS,CACR,kBADQ,EAER,gCAFQ,EAGRgB,iBAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useRef, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { BlockControls } from '../components';\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\nfunction StopEditingAsBlocksOnOutsideSelect( {\n\tclientId,\n\tstopEditingAsBlock,\n} ) {\n\tconst isBlockOrDescendantSelected = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isBlockSelected, hasSelectedInnerBlock } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\tisBlockSelected( clientId ) ||\n\t\t\t\thasSelectedInnerBlock( clientId, true )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tuseEffect( () => {\n\t\tif ( ! isBlockOrDescendantSelected ) {\n\t\t\tstopEditingAsBlock();\n\t\t}\n\t}, [ isBlockOrDescendantSelected ] );\n\treturn null;\n}\n\nexport const withBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { getBlockListSettings, getSettings } =\n\t\t\tuseSelect( blockEditorStore );\n\t\tconst focusModeToRevert = useRef();\n\t\tconst { templateLock, isLockedByParent, isEditingAsBlocks } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\t__unstableGetContentLockingParent,\n\t\t\t\t\tgetTemplateLock,\n\t\t\t\t\t__unstableGetTemporarilyEditingAsBlocks,\n\t\t\t\t} = select( blockEditorStore );\n\t\t\t\treturn {\n\t\t\t\t\ttemplateLock: getTemplateLock( props.clientId ),\n\t\t\t\t\tisLockedByParent: !! __unstableGetContentLockingParent(\n\t\t\t\t\t\tprops.clientId\n\t\t\t\t\t),\n\t\t\t\t\tisEditingAsBlocks:\n\t\t\t\t\t\t__unstableGetTemporarilyEditingAsBlocks() ===\n\t\t\t\t\t\tprops.clientId,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ props.clientId ]\n\t\t);\n\n\t\tconst {\n\t\t\tupdateSettings,\n\t\t\tupdateBlockListSettings,\n\t\t\t__unstableSetTemporarilyEditingAsBlocks,\n\t\t} = useDispatch( blockEditorStore );\n\t\tconst isContentLocked =\n\t\t\t! isLockedByParent && templateLock === 'contentOnly';\n\t\tconst {\n\t\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\t\tupdateBlockAttributes,\n\t\t} = useDispatch( blockEditorStore );\n\n\t\tconst stopEditingAsBlock = useCallback( () => {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateBlockAttributes( props.clientId, {\n\t\t\t\ttemplateLock: 'contentOnly',\n\t\t\t} );\n\t\t\tupdateBlockListSettings( props.clientId, {\n\t\t\t\t...getBlockListSettings( props.clientId ),\n\t\t\t\ttemplateLock: 'contentOnly',\n\t\t\t} );\n\t\t\tupdateSettings( { focusMode: focusModeToRevert.current } );\n\t\t\t__unstableSetTemporarilyEditingAsBlocks();\n\t\t}, [\n\t\t\tprops.clientId,\n\t\t\tfocusModeToRevert,\n\t\t\tupdateSettings,\n\t\t\tupdateBlockListSettings,\n\t\t\tgetBlockListSettings,\n\t\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\t\tupdateBlockAttributes,\n\t\t\t__unstableSetTemporarilyEditingAsBlocks,\n\t\t] );\n\n\t\tif ( ! isContentLocked && ! isEditingAsBlocks ) {\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ isEditingAsBlocks && ! isContentLocked && (\n\t\t\t\t\t<StopEditingAsBlocksOnOutsideSelect\n\t\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\t\tstopEditingAsBlock={ stopEditingAsBlock }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( isEditingAsBlocks && ! isContentLocked ) {\n\t\t\t\t\t\t\t\tstopEditingAsBlock();\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tupdateBlockAttributes( props.clientId, {\n\t\t\t\t\t\t\t\t\ttemplateLock: undefined,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\tupdateBlockListSettings( props.clientId, {\n\t\t\t\t\t\t\t\t\t...getBlockListSettings( props.clientId ),\n\t\t\t\t\t\t\t\t\ttemplateLock: false,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\tfocusModeToRevert.current =\n\t\t\t\t\t\t\t\t\tgetSettings().focusMode;\n\t\t\t\t\t\t\t\tupdateSettings( { focusMode: true } );\n\t\t\t\t\t\t\t\t__unstableSetTemporarilyEditingAsBlocks(\n\t\t\t\t\t\t\t\t\tprops.clientId\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isEditingAsBlocks && ! isContentLocked\n\t\t\t\t\t\t\t? __( 'Done' )\n\t\t\t\t\t\t\t: __( 'Modify' ) }\n\t\t\t\t\t</ToolbarButton>\n\t\t\t\t</BlockControls>\n\t\t\t\t<BlockEdit\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\tprops.className,\n\t\t\t\t\t\tisEditingAsBlocks &&\n\t\t\t\t\t\t\t'is-content-locked-editing-as-blocks'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/style/with-block-controls',\n\twithBlockControls\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/content-lock-ui.js"],"names":["ToolbarButton","MenuItem","createHigherOrderComponent","useDispatch","useSelect","addFilter","__","useEffect","useRef","useCallback","store","blockEditorStore","BlockControls","BlockSettingsMenuControls","classnames","StopEditingAsBlocksOnOutsideSelect","clientId","stopEditingAsBlock","isBlockOrDescendantSelected","select","isBlockSelected","hasSelectedInnerBlock","withBlockControls","BlockEdit","props","getBlockListSettings","getSettings","focusModeToRevert","templateLock","isLockedByParent","isEditingAsBlocks","__unstableGetContentLockingParent","getTemplateLock","__unstableGetTemporarilyEditingAsBlocks","updateSettings","updateBlockListSettings","__unstableSetTemporarilyEditingAsBlocks","isContentLocked","__unstableMarkNextChangeAsNotPersistent","updateBlockAttributes","focusMode","current","isSelected","onClose","undefined","className"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,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AnBF,EA+CC,cAAC,SAAD,eACMkB,KADN;AAEC,IAAA,SAAS,EAAGV,UAAU,CACrBU,KAAK,CAACqB,SADe,EAErBf,iBAAiB,IAChB,qCAHoB;AAFvB,KA/CD,CADD;AA0DA,CAzHyD,EA0H1D,qBA1H0D,CAApD;AA6HPzB,SAAS,CACR,kBADQ,EAER,0CAFQ,EAGRiB,iBAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToolbarButton, MenuItem } from '@wordpress/components';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useRef, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { BlockControls, BlockSettingsMenuControls } from '../components';\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\nfunction StopEditingAsBlocksOnOutsideSelect( {\n\tclientId,\n\tstopEditingAsBlock,\n} ) {\n\tconst isBlockOrDescendantSelected = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isBlockSelected, hasSelectedInnerBlock } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\tisBlockSelected( clientId ) ||\n\t\t\t\thasSelectedInnerBlock( clientId, true )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tuseEffect( () => {\n\t\tif ( ! isBlockOrDescendantSelected ) {\n\t\t\tstopEditingAsBlock();\n\t\t}\n\t}, [ isBlockOrDescendantSelected ] );\n\treturn null;\n}\n\nexport const withBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { getBlockListSettings, getSettings } =\n\t\t\tuseSelect( blockEditorStore );\n\t\tconst focusModeToRevert = useRef();\n\t\tconst { templateLock, isLockedByParent, isEditingAsBlocks } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\t__unstableGetContentLockingParent,\n\t\t\t\t\tgetTemplateLock,\n\t\t\t\t\t__unstableGetTemporarilyEditingAsBlocks,\n\t\t\t\t} = select( blockEditorStore );\n\t\t\t\treturn {\n\t\t\t\t\ttemplateLock: getTemplateLock( props.clientId ),\n\t\t\t\t\tisLockedByParent: !! __unstableGetContentLockingParent(\n\t\t\t\t\t\tprops.clientId\n\t\t\t\t\t),\n\t\t\t\t\tisEditingAsBlocks:\n\t\t\t\t\t\t__unstableGetTemporarilyEditingAsBlocks() ===\n\t\t\t\t\t\tprops.clientId,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ props.clientId ]\n\t\t);\n\n\t\tconst {\n\t\t\tupdateSettings,\n\t\t\tupdateBlockListSettings,\n\t\t\t__unstableSetTemporarilyEditingAsBlocks,\n\t\t} = useDispatch( blockEditorStore );\n\t\tconst isContentLocked =\n\t\t\t! isLockedByParent && templateLock === 'contentOnly';\n\t\tconst {\n\t\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\t\tupdateBlockAttributes,\n\t\t} = useDispatch( blockEditorStore );\n\n\t\tconst stopEditingAsBlock = useCallback( () => {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateBlockAttributes( props.clientId, {\n\t\t\t\ttemplateLock: 'contentOnly',\n\t\t\t} );\n\t\t\tupdateBlockListSettings( props.clientId, {\n\t\t\t\t...getBlockListSettings( props.clientId ),\n\t\t\t\ttemplateLock: 'contentOnly',\n\t\t\t} );\n\t\t\tupdateSettings( { focusMode: focusModeToRevert.current } );\n\t\t\t__unstableSetTemporarilyEditingAsBlocks();\n\t\t}, [\n\t\t\tprops.clientId,\n\t\t\tfocusModeToRevert,\n\t\t\tupdateSettings,\n\t\t\tupdateBlockListSettings,\n\t\t\tgetBlockListSettings,\n\t\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\t\tupdateBlockAttributes,\n\t\t\t__unstableSetTemporarilyEditingAsBlocks,\n\t\t] );\n\n\t\tif ( ! isContentLocked && ! isEditingAsBlocks ) {\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ isEditingAsBlocks && ! isContentLocked && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<StopEditingAsBlocksOnOutsideSelect\n\t\t\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\t\t\tstopEditingAsBlock={ stopEditingAsBlock }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tstopEditingAsBlock();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Done' ) }\n\t\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t\t</BlockControls>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t{ ! isEditingAsBlocks && isContentLocked && props.isSelected && (\n\t\t\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\t\tupdateBlockAttributes( props.clientId, {\n\t\t\t\t\t\t\t\t\t\ttemplateLock: undefined,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\tupdateBlockListSettings( props.clientId, {\n\t\t\t\t\t\t\t\t\t\t...getBlockListSettings(\n\t\t\t\t\t\t\t\t\t\t\tprops.clientId\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\ttemplateLock: false,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\tfocusModeToRevert.current =\n\t\t\t\t\t\t\t\t\t\tgetSettings().focusMode;\n\t\t\t\t\t\t\t\t\tupdateSettings( { focusMode: true } );\n\t\t\t\t\t\t\t\t\t__unstableSetTemporarilyEditingAsBlocks(\n\t\t\t\t\t\t\t\t\t\tprops.clientId\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Modify' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</BlockSettingsMenuControls>\n\t\t\t\t) }\n\t\t\t\t<BlockEdit\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\tprops.className,\n\t\t\t\t\t\tisEditingAsBlocks &&\n\t\t\t\t\t\t\t'is-content-locked-editing-as-blocks'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/content-lock-ui/with-block-controls',\n\twithBlockControls\n);\n"]}
@@ -9,10 +9,11 @@ import classnames from 'classnames';
9
9
  * WordPress dependencies
10
10
  */
11
11
 
12
- import { __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';
12
+ import { __experimentalToolsPanelItem as ToolsPanelItem, __experimentalVStack as VStack } from '@wordpress/components';
13
13
  import { Platform, useState } from '@wordpress/element';
14
14
  import { __ } from '@wordpress/i18n';
15
15
  import { getBlockSupport } from '@wordpress/blocks';
16
+ import { useDispatch } from '@wordpress/data';
16
17
  /**
17
18
  * Internal dependencies
18
19
  */
@@ -20,18 +21,34 @@ import { getBlockSupport } from '@wordpress/blocks';
20
21
  import InspectorControls from '../components/inspector-controls';
21
22
  import { GapEdit, hasGapSupport, hasGapValue, resetGap, useIsGapDisabled } from './gap';
22
23
  import { MarginEdit, MarginVisualizer, hasMarginSupport, hasMarginValue, resetMargin, useIsMarginDisabled } from './margin';
24
+ import { MinHeightEdit, hasMinHeightSupport, hasMinHeightValue, resetMinHeight, useIsMinHeightDisabled } from './min-height';
23
25
  import { PaddingEdit, PaddingVisualizer, hasPaddingSupport, hasPaddingValue, resetPadding, useIsPaddingDisabled } from './padding';
26
+ import { ChildLayoutEdit, hasChildLayoutSupport, hasChildLayoutValue, resetChildLayout, useIsChildLayoutDisabled, childLayoutOrientation } from './child-layout';
24
27
  import useSetting from '../components/use-setting';
28
+ import { store as blockEditorStore } from '../store';
29
+ export const DIMENSIONS_SUPPORT_KEY = 'dimensions';
25
30
  export const SPACING_SUPPORT_KEY = 'spacing';
26
31
  export const ALL_SIDES = ['top', 'right', 'bottom', 'left'];
27
32
  export const AXIAL_SIDES = ['vertical', 'horizontal'];
28
33
 
29
34
  function useVisualizerMouseOver() {
30
35
  const [isMouseOver, setIsMouseOver] = useState(false);
36
+ const {
37
+ __experimentalHideBlockInterface: hideBlockInterface,
38
+ __experimentalShowBlockInterface: showBlockInterface
39
+ } = useDispatch(blockEditorStore);
40
+
41
+ const onMouseOver = e => {
42
+ e.stopPropagation();
43
+ hideBlockInterface();
44
+ setIsMouseOver(true);
45
+ };
31
46
 
32
- const onMouseOver = () => setIsMouseOver(true);
33
-
34
- const onMouseOut = () => setIsMouseOver(false);
47
+ const onMouseOut = e => {
48
+ e.stopPropagation();
49
+ showBlockInterface();
50
+ setIsMouseOver(false);
51
+ };
35
52
 
36
53
  return {
37
54
  isMouseOver,
@@ -44,7 +61,7 @@ function useVisualizerMouseOver() {
44
61
  *
45
62
  * @param {Object} props Block props.
46
63
  *
47
- * @return {WPElement} Inspector controls for spacing support features.
64
+ * @return {WPElement} Inspector controls for dimensions and spacing support features.
48
65
  */
49
66
 
50
67
 
@@ -52,8 +69,10 @@ export function DimensionsPanel(props) {
52
69
  const isGapDisabled = useIsGapDisabled(props);
53
70
  const isPaddingDisabled = useIsPaddingDisabled(props);
54
71
  const isMarginDisabled = useIsMarginDisabled(props);
72
+ const isMinHeightDisabled = useIsMinHeightDisabled(props);
73
+ const isChildLayoutDisabled = useIsChildLayoutDisabled(props);
55
74
  const isDisabled = useIsDimensionsDisabled(props);
56
- const isSupported = hasDimensionsSupport(props.name);
75
+ const isSupported = hasDimensionsSupport(props);
57
76
  const spacingSizes = useSetting('spacing.spacingSizes');
58
77
  const paddingMouseOver = useVisualizerMouseOver();
59
78
  const marginMouseOver = useVisualizerMouseOver();
@@ -62,14 +81,15 @@ export function DimensionsPanel(props) {
62
81
  return null;
63
82
  }
64
83
 
84
+ const defaultDimensionsControls = getBlockSupport(props.name, [DIMENSIONS_SUPPORT_KEY, '__experimentalDefaultControls']);
65
85
  const defaultSpacingControls = getBlockSupport(props.name, [SPACING_SUPPORT_KEY, '__experimentalDefaultControls']);
66
86
 
67
- const createResetAllFilter = attribute => newAttributes => {
87
+ const createResetAllFilter = (attribute, featureSet) => newAttributes => {
68
88
  var _newAttributes$style;
69
89
 
70
90
  return { ...newAttributes,
71
91
  style: { ...newAttributes.style,
72
- spacing: { ...((_newAttributes$style = newAttributes.style) === null || _newAttributes$style === void 0 ? void 0 : _newAttributes$style.spacing),
92
+ [featureSet]: { ...((_newAttributes$style = newAttributes.style) === null || _newAttributes$style === void 0 ? void 0 : _newAttributes$style[featureSet]),
73
93
  [attribute]: undefined
74
94
  }
75
95
  }
@@ -79,6 +99,9 @@ export function DimensionsPanel(props) {
79
99
  const spacingClassnames = classnames({
80
100
  'tools-panel-item-spacing': spacingSizes && spacingSizes.length > 0
81
101
  });
102
+ const {
103
+ __unstableParentLayout: parentLayout
104
+ } = props;
82
105
  return createElement(Fragment, null, createElement(InspectorControls, {
83
106
  __experimentalGroup: "dimensions"
84
107
  }, !isPaddingDisabled && createElement(ToolsPanelItem, {
@@ -86,7 +109,7 @@ export function DimensionsPanel(props) {
86
109
  hasValue: () => hasPaddingValue(props),
87
110
  label: __('Padding'),
88
111
  onDeselect: () => resetPadding(props),
89
- resetAllFilter: createResetAllFilter('padding'),
112
+ resetAllFilter: createResetAllFilter('padding', 'spacing'),
90
113
  isShownByDefault: defaultSpacingControls === null || defaultSpacingControls === void 0 ? void 0 : defaultSpacingControls.padding,
91
114
  panelId: props.clientId
92
115
  }, createElement(PaddingEdit, _extends({
@@ -97,7 +120,7 @@ export function DimensionsPanel(props) {
97
120
  hasValue: () => hasMarginValue(props),
98
121
  label: __('Margin'),
99
122
  onDeselect: () => resetMargin(props),
100
- resetAllFilter: createResetAllFilter('margin'),
123
+ resetAllFilter: createResetAllFilter('margin', 'spacing'),
101
124
  isShownByDefault: defaultSpacingControls === null || defaultSpacingControls === void 0 ? void 0 : defaultSpacingControls.margin,
102
125
  panelId: props.clientId
103
126
  }, createElement(MarginEdit, _extends({
@@ -108,10 +131,26 @@ export function DimensionsPanel(props) {
108
131
  hasValue: () => hasGapValue(props),
109
132
  label: __('Block spacing'),
110
133
  onDeselect: () => resetGap(props),
111
- resetAllFilter: createResetAllFilter('blockGap'),
134
+ resetAllFilter: createResetAllFilter('blockGap', 'spacing'),
112
135
  isShownByDefault: defaultSpacingControls === null || defaultSpacingControls === void 0 ? void 0 : defaultSpacingControls.blockGap,
113
136
  panelId: props.clientId
114
- }, createElement(GapEdit, props))), !isPaddingDisabled && createElement(PaddingVisualizer, _extends({
137
+ }, createElement(GapEdit, props)), !isMinHeightDisabled && createElement(ToolsPanelItem, {
138
+ hasValue: () => hasMinHeightValue(props),
139
+ label: __('Min. height'),
140
+ onDeselect: () => resetMinHeight(props),
141
+ resetAllFilter: createResetAllFilter('minHeight', 'dimensions'),
142
+ isShownByDefault: defaultDimensionsControls === null || defaultDimensionsControls === void 0 ? void 0 : defaultDimensionsControls.minHeight,
143
+ panelId: props.clientId
144
+ }, createElement(MinHeightEdit, props)), !isChildLayoutDisabled && createElement(VStack, {
145
+ as: ToolsPanelItem,
146
+ spacing: 2,
147
+ hasValue: () => hasChildLayoutValue(props),
148
+ label: childLayoutOrientation(parentLayout),
149
+ onDeselect: () => resetChildLayout(props),
150
+ resetAllFilter: createResetAllFilter('selfStretch', 'layout'),
151
+ isShownByDefault: false,
152
+ panelId: props.clientId
153
+ }, createElement(ChildLayoutEdit, props))), !isPaddingDisabled && createElement(PaddingVisualizer, _extends({
115
154
  forceShow: paddingMouseOver.isMouseOver
116
155
  }, props)), !isMarginDisabled && createElement(MarginVisualizer, _extends({
117
156
  forceShow: marginMouseOver.isMouseOver
@@ -120,17 +159,20 @@ export function DimensionsPanel(props) {
120
159
  /**
121
160
  * Determine whether there is dimensions related block support.
122
161
  *
123
- * @param {string} blockName Block name.
162
+ * @param {Object} props Block props.
124
163
  *
125
164
  * @return {boolean} Whether there is support.
126
165
  */
127
166
 
128
- export function hasDimensionsSupport(blockName) {
167
+ export function hasDimensionsSupport(props) {
129
168
  if (Platform.OS !== 'web') {
130
169
  return false;
131
170
  }
132
171
 
133
- return hasGapSupport(blockName) || hasPaddingSupport(blockName) || hasMarginSupport(blockName);
172
+ const {
173
+ name: blockName
174
+ } = props;
175
+ return hasGapSupport(blockName) || hasMinHeightSupport(blockName) || hasPaddingSupport(blockName) || hasMarginSupport(blockName) || hasChildLayoutSupport(props);
134
176
  }
135
177
  /**
136
178
  * Determines whether dimensions support has been disabled.
@@ -143,9 +185,11 @@ export function hasDimensionsSupport(blockName) {
143
185
  const useIsDimensionsDisabled = function () {
144
186
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
145
187
  const gapDisabled = useIsGapDisabled(props);
188
+ const minHeightDisabled = useIsMinHeightDisabled(props);
146
189
  const paddingDisabled = useIsPaddingDisabled(props);
147
190
  const marginDisabled = useIsMarginDisabled(props);
148
- return gapDisabled && paddingDisabled && marginDisabled;
191
+ const childLayoutDisabled = useIsChildLayoutDisabled(props);
192
+ return gapDisabled && minHeightDisabled && paddingDisabled && marginDisabled && childLayoutDisabled;
149
193
  };
150
194
  /**
151
195
  * Custom hook to retrieve which padding/margin/blockGap is supported
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/dimensions.js"],"names":["classnames","__experimentalToolsPanelItem","ToolsPanelItem","Platform","useState","__","getBlockSupport","InspectorControls","GapEdit","hasGapSupport","hasGapValue","resetGap","useIsGapDisabled","MarginEdit","MarginVisualizer","hasMarginSupport","hasMarginValue","resetMargin","useIsMarginDisabled","PaddingEdit","PaddingVisualizer","hasPaddingSupport","hasPaddingValue","resetPadding","useIsPaddingDisabled","useSetting","SPACING_SUPPORT_KEY","ALL_SIDES","AXIAL_SIDES","useVisualizerMouseOver","isMouseOver","setIsMouseOver","onMouseOver","onMouseOut","DimensionsPanel","props","isGapDisabled","isPaddingDisabled","isMarginDisabled","isDisabled","useIsDimensionsDisabled","isSupported","hasDimensionsSupport","name","spacingSizes","paddingMouseOver","marginMouseOver","defaultSpacingControls","createResetAllFilter","attribute","newAttributes","style","spacing","undefined","spacingClassnames","length","padding","clientId","margin","blockGap","blockName","OS","gapDisabled","paddingDisabled","marginDisabled","useCustomSides","feature","support","Array","isArray","sides","useIsDimensionsSupportValid","some","side","includes","console","warn"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,4BAA4B,IAAIC,cAAzC,QAA+D,uBAA/D;AACA,SAASC,QAAT,EAAmBC,QAAnB,QAAmC,oBAAnC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,mBAAhC;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,SACCC,OADD,EAECC,aAFD,EAGCC,WAHD,EAICC,QAJD,EAKCC,gBALD,QAMO,OANP;AAOA,SACCC,UADD,EAECC,gBAFD,EAGCC,gBAHD,EAICC,cAJD,EAKCC,WALD,EAMCC,mBAND,QAOO,UAPP;AAQA,SACCC,WADD,EAECC,iBAFD,EAGCC,iBAHD,EAICC,eAJD,EAKCC,YALD,EAMCC,oBAND,QAOO,WAPP;AAQA,OAAOC,UAAP,MAAuB,2BAAvB;AAEA,OAAO,MAAMC,mBAAmB,GAAG,SAA5B;AACP,OAAO,MAAMC,SAAS,GAAG,CAAE,KAAF,E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IAAY7C,WAAW,CAAC8C,QAAZ,CAAsBD,IAAtB,CAAxB,CAHD,EAIE;AACD;AACAE,IAAAA,OAAO,CAACC,IAAR,CACE,OAAOV,OAAS,qBAAqBN,SAAW,0EADlD;AAGA,WAAO,KAAP;AACA;;AAED,SAAO,IAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';\nimport { Platform, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { getBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport {\n\tGapEdit,\n\thasGapSupport,\n\thasGapValue,\n\tresetGap,\n\tuseIsGapDisabled,\n} from './gap';\nimport {\n\tMarginEdit,\n\tMarginVisualizer,\n\thasMarginSupport,\n\thasMarginValue,\n\tresetMargin,\n\tuseIsMarginDisabled,\n} from './margin';\nimport {\n\tPaddingEdit,\n\tPaddingVisualizer,\n\thasPaddingSupport,\n\thasPaddingValue,\n\tresetPadding,\n\tuseIsPaddingDisabled,\n} from './padding';\nimport useSetting from '../components/use-setting';\n\nexport const SPACING_SUPPORT_KEY = 'spacing';\nexport const ALL_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nexport const AXIAL_SIDES = [ 'vertical', 'horizontal' ];\n\nfunction useVisualizerMouseOver() {\n\tconst [ isMouseOver, setIsMouseOver ] = useState( false );\n\tconst onMouseOver = () => setIsMouseOver( true );\n\tconst onMouseOut = () => setIsMouseOver( false );\n\treturn { isMouseOver, onMouseOver, onMouseOut };\n}\n\n/**\n * Inspector controls for dimensions support.\n *\n * @param {Object} props Block props.\n *\n * @return {WPElement} Inspector controls for spacing support features.\n */\nexport function DimensionsPanel( props ) {\n\tconst isGapDisabled = useIsGapDisabled( props );\n\tconst isPaddingDisabled = useIsPaddingDisabled( props );\n\tconst isMarginDisabled = useIsMarginDisabled( props );\n\tconst isDisabled = useIsDimensionsDisabled( props );\n\tconst isSupported = hasDimensionsSupport( props.name );\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\tconst paddingMouseOver = useVisualizerMouseOver();\n\tconst marginMouseOver = useVisualizerMouseOver();\n\n\tif ( isDisabled || ! isSupported ) {\n\t\treturn null;\n\t}\n\n\tconst defaultSpacingControls = getBlockSupport( props.name, [\n\t\tSPACING_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\tconst createResetAllFilter = ( attribute ) => ( newAttributes ) => ( {\n\t\t...newAttributes,\n\t\tstyle: {\n\t\t\t...newAttributes.style,\n\t\t\tspacing: {\n\t\t\t\t...newAttributes.style?.spacing,\n\t\t\t\t[ attribute ]: undefined,\n\t\t\t},\n\t\t},\n\t} );\n\n\tconst spacingClassnames = classnames( {\n\t\t'tools-panel-item-spacing': spacingSizes && spacingSizes.length > 0,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls __experimentalGroup=\"dimensions\">\n\t\t\t\t{ ! isPaddingDisabled && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tclassName={ spacingClassnames }\n\t\t\t\t\t\thasValue={ () => hasPaddingValue( props ) }\n\t\t\t\t\t\tlabel={ __( 'Padding' ) }\n\t\t\t\t\t\tonDeselect={ () => resetPadding( props ) }\n\t\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'padding' ) }\n\t\t\t\t\t\tisShownByDefault={ defaultSpacingControls?.padding }\n\t\t\t\t\t\tpanelId={ props.clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PaddingEdit\n\t\t\t\t\t\t\tonMouseOver={ paddingMouseOver.onMouseOver }\n\t\t\t\t\t\t\tonMouseOut={ paddingMouseOver.onMouseOut }\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t\t{ ! isMarginDisabled && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tclassName={ spacingClassnames }\n\t\t\t\t\t\thasValue={ () => hasMarginValue( props ) }\n\t\t\t\t\t\tlabel={ __( 'Margin' ) }\n\t\t\t\t\t\tonDeselect={ () => resetMargin( props ) }\n\t\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'margin' ) }\n\t\t\t\t\t\tisShownByDefault={ defaultSpacingControls?.margin }\n\t\t\t\t\t\tpanelId={ props.clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<MarginEdit\n\t\t\t\t\t\t\tonMouseOver={ marginMouseOver.onMouseOver }\n\t\t\t\t\t\t\tonMouseOut={ marginMouseOver.onMouseOut }\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t\t{ ! isGapDisabled && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tclassName={ spacingClassnames }\n\t\t\t\t\t\thasValue={ () => hasGapValue( props ) }\n\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\tonDeselect={ () => resetGap( props ) }\n\t\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'blockGap' ) }\n\t\t\t\t\t\tisShownByDefault={ defaultSpacingControls?.blockGap }\n\t\t\t\t\t\tpanelId={ props.clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<GapEdit { ...props } />\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ ! isPaddingDisabled && (\n\t\t\t\t<PaddingVisualizer\n\t\t\t\t\tforceShow={ paddingMouseOver.isMouseOver }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! isMarginDisabled && (\n\t\t\t\t<MarginVisualizer\n\t\t\t\t\tforceShow={ marginMouseOver.isMouseOver }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n/**\n * Determine whether there is dimensions related block support.\n *\n * @param {string} blockName Block name.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasDimensionsSupport( blockName ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\thasGapSupport( blockName ) ||\n\t\thasPaddingSupport( blockName ) ||\n\t\thasMarginSupport( blockName )\n\t);\n}\n\n/**\n * Determines whether dimensions support has been disabled.\n *\n * @param {Object} props Block properties.\n *\n * @return {boolean} If spacing support is completely disabled.\n */\nconst useIsDimensionsDisabled = ( props = {} ) => {\n\tconst gapDisabled = useIsGapDisabled( props );\n\tconst paddingDisabled = useIsPaddingDisabled( props );\n\tconst marginDisabled = useIsMarginDisabled( props );\n\n\treturn gapDisabled && paddingDisabled && marginDisabled;\n};\n\n/**\n * Custom hook to retrieve which padding/margin/blockGap is supported\n * e.g. top, right, bottom or left.\n *\n * Sides are opted into by default. It is only if a specific side is set to\n * false that it is omitted.\n *\n * @param {string} blockName Block name.\n * @param {string} feature The feature custom sides relate to e.g. padding or margins.\n *\n * @return {?string[]} Strings representing the custom sides available.\n */\nexport function useCustomSides( blockName, feature ) {\n\tconst support = getBlockSupport( blockName, SPACING_SUPPORT_KEY );\n\n\t// Skip when setting is boolean as theme isn't setting arbitrary sides.\n\tif ( ! support || typeof support[ feature ] === 'boolean' ) {\n\t\treturn;\n\t}\n\n\t// Return if the setting is an array of sides (e.g. `[ 'top', 'bottom' ]`).\n\tif ( Array.isArray( support[ feature ] ) ) {\n\t\treturn support[ feature ];\n\t}\n\n\t// Finally, attempt to return `.sides` if the setting is an object.\n\tif ( support[ feature ]?.sides ) {\n\t\treturn support[ feature ].sides;\n\t}\n}\n\n/**\n * Custom hook to determine whether the sides configured in the\n * block support are valid. A dimension property cannot declare\n * support for a mix of axial and individual sides.\n *\n * @param {string} blockName Block name.\n * @param {string} feature The feature custom sides relate to e.g. padding or margins.\n *\n * @return {boolean} If the feature has a valid configuration of sides.\n */\nexport function useIsDimensionsSupportValid( blockName, feature ) {\n\tconst sides = useCustomSides( blockName, feature );\n\n\tif (\n\t\tsides &&\n\t\tsides.some( ( side ) => ALL_SIDES.includes( side ) ) &&\n\t\tsides.some( ( side ) => AXIAL_SIDES.includes( side ) )\n\t) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t`The ${ feature } support for the \"${ blockName }\" block can not be configured to support both axial and arbitrary sides.`\n\t\t);\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/dimensions.js"],"names":["classnames","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalVStack","VStack","Platform","useState","__","getBlockSupport","useDispatch","InspectorControls","GapEdit","hasGapSupport","hasGapValue","resetGap","useIsGapDisabled","MarginEdit","MarginVisualizer","hasMarginSupport","hasMarginValue","resetMargin","useIsMarginDisabled","MinHeightEdit","hasMinHeightSupport","hasMinHeightValue","resetMinHeight","useIsMinHeightDisabled","PaddingEdit","PaddingVisualizer","hasPaddingSupport","hasPaddingValue","resetPadding","useIsPaddingDisabled","ChildLayoutEdit","hasChildLayoutSupport","hasChildLayoutValue","resetChildLayout","useIsChildLayoutDisabled","childLayoutOrientation","useSetting","store","blockEditorStore","DIMENSIONS_SUPPORT_KEY","SPACING_SUPPORT_KEY","ALL_SIDES","AXIAL_SIDES","useVisualizerMouseOver","isMouseOver","setIsMouseOver","__experimentalHideBlockInterface","hideBlockInterface","__experimentalShowBlockInterface","showBlockInterface","onMouseOver","e","stopPropagation","onMouseOut","DimensionsPanel","props","isGapDisabled","isPaddingDisabled","isMarginDisabled","isMinHeightDisabled","isChildLayoutDisabled","isDisabled","useIsDimensionsDisabled","isSupported","hasDimensionsSupport","spacingSizes","paddingMouseOver","marginMouseOver","defaultDimensionsControls","name","defaultSpacingControls","createResetAllFilter","attribute","featureSet","newAttributes","style","undefined","spacingClassnames","length","__unstableParentLayout","parentLayout","padding","clientId","margin","blockGap","minHeight","OS","blockName","gapDisabled","minHeightDisabled","paddingDisabled","marginDisabled","childLayoutDisabled","useCustomSides","feature","support","Array","isArray","sides","useIsDimensionsSupportValid","some","side","includes","console","warn"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,4BAA4B,IAAIC,cADjC,EAECC,oBAAoB,IAAIC,MAFzB,QAGO,uBAHP;AAIA,SAASC,QAAT,EAAmBC,QAAnB,QAAmC,oBAAnC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,WAAT,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,SACCC,OADD,EAECC,aAFD,EAGCC,WAHD,EAICC,QAJD,EAKCC,gBALD,QAMO,OANP;AAOA,SACCC,UADD,EAECC,gBAFD,EAGCC,gBAHD,EAICC,cAJD,EAKCC,WALD,EAMCC,mBAND,QAOO,UAPP;AAQA,SACCC,aADD,EAECC,mBAFD,EAGCC,iBAHD,EAICC,cAJD,EAKCC,sBALD,QAMO,cANP;AAOA,SACCC,WADD,EAECC,iBAFD,EAGCC,iBAHD,EAICC,eAJD,EAKCC,YALD,EAMCC,oBAND,QAOO,WAPP;AAQA,SACCC,eADD,EAECC,qBAFD,EAGCC,mBAHD,EAICC,gBAJD,EAKCC,wBALD,EAMCC,sBAND,QAOO,gBAPP;AAQA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AAEA,OAAO,MAAMC,sBAAsB,GAAG,YAA/B;AACP,OAAO,MAAMC,mBAAmB,GAAG,SAA5B;AACP,OAAO,MAAMC,SAAS,GAAG,CAAE,KAAF,EAAS,OAAT,EAAkB,QAAlB,EAA4B,MAA5B,CAAlB;AACP,OAAO,MAAMC,WAAW,GAAG,CAAE,UAAF,EAAc,YAAd,CAApB;;A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ED,OAAF,CAAtB,CAAL,EAA2C;AAC1C,WAAOC,OAAO,CAAED,OAAF,CAAd;AACA,GAXmD,CAapD;;;AACA,0BAAKC,OAAO,CAAED,OAAF,CAAZ,6CAAK,iBAAoBI,KAAzB,EAAiC;AAChC,WAAOH,OAAO,CAAED,OAAF,CAAP,CAAmBI,KAA1B;AACA;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,2BAAT,CAAsCZ,SAAtC,EAAiDO,OAAjD,EAA2D;AACjE,QAAMI,KAAK,GAAGL,cAAc,CAAEN,SAAF,EAAaO,OAAb,CAA5B;;AAEA,MACCI,KAAK,IACLA,KAAK,CAACE,IAAN,CAAcC,IAAF,IAAY5D,SAAS,CAAC6D,QAAV,CAAoBD,IAApB,CAAxB,CADA,IAEAH,KAAK,CAACE,IAAN,CAAcC,IAAF,IAAY3D,WAAW,CAAC4D,QAAZ,CAAsBD,IAAtB,CAAxB,CAHD,EAIE;AACD;AACAE,IAAAA,OAAO,CAACC,IAAR,CACE,OAAOV,OAAS,qBAAqBP,SAAW,0EADlD;AAGA,WAAO,KAAP;AACA;;AAED,SAAO,IAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { Platform, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport {\n\tGapEdit,\n\thasGapSupport,\n\thasGapValue,\n\tresetGap,\n\tuseIsGapDisabled,\n} from './gap';\nimport {\n\tMarginEdit,\n\tMarginVisualizer,\n\thasMarginSupport,\n\thasMarginValue,\n\tresetMargin,\n\tuseIsMarginDisabled,\n} from './margin';\nimport {\n\tMinHeightEdit,\n\thasMinHeightSupport,\n\thasMinHeightValue,\n\tresetMinHeight,\n\tuseIsMinHeightDisabled,\n} from './min-height';\nimport {\n\tPaddingEdit,\n\tPaddingVisualizer,\n\thasPaddingSupport,\n\thasPaddingValue,\n\tresetPadding,\n\tuseIsPaddingDisabled,\n} from './padding';\nimport {\n\tChildLayoutEdit,\n\thasChildLayoutSupport,\n\thasChildLayoutValue,\n\tresetChildLayout,\n\tuseIsChildLayoutDisabled,\n\tchildLayoutOrientation,\n} from './child-layout';\nimport useSetting from '../components/use-setting';\nimport { store as blockEditorStore } from '../store';\n\nexport const DIMENSIONS_SUPPORT_KEY = 'dimensions';\nexport const SPACING_SUPPORT_KEY = 'spacing';\nexport const ALL_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nexport const AXIAL_SIDES = [ 'vertical', 'horizontal' ];\n\nfunction useVisualizerMouseOver() {\n\tconst [ isMouseOver, setIsMouseOver ] = useState( false );\n\tconst {\n\t\t__experimentalHideBlockInterface: hideBlockInterface,\n\t\t__experimentalShowBlockInterface: showBlockInterface,\n\t} = useDispatch( blockEditorStore );\n\tconst onMouseOver = ( e ) => {\n\t\te.stopPropagation();\n\t\thideBlockInterface();\n\t\tsetIsMouseOver( true );\n\t};\n\tconst onMouseOut = ( e ) => {\n\t\te.stopPropagation();\n\t\tshowBlockInterface();\n\t\tsetIsMouseOver( false );\n\t};\n\treturn { isMouseOver, onMouseOver, onMouseOut };\n}\n\n/**\n * Inspector controls for dimensions support.\n *\n * @param {Object} props Block props.\n *\n * @return {WPElement} Inspector controls for dimensions and spacing support features.\n */\nexport function DimensionsPanel( props ) {\n\tconst isGapDisabled = useIsGapDisabled( props );\n\tconst isPaddingDisabled = useIsPaddingDisabled( props );\n\tconst isMarginDisabled = useIsMarginDisabled( props );\n\tconst isMinHeightDisabled = useIsMinHeightDisabled( props );\n\tconst isChildLayoutDisabled = useIsChildLayoutDisabled( props );\n\tconst isDisabled = useIsDimensionsDisabled( props );\n\tconst isSupported = hasDimensionsSupport( props );\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\tconst paddingMouseOver = useVisualizerMouseOver();\n\tconst marginMouseOver = useVisualizerMouseOver();\n\n\tif ( isDisabled || ! isSupported ) {\n\t\treturn null;\n\t}\n\n\tconst defaultDimensionsControls = getBlockSupport( props.name, [\n\t\tDIMENSIONS_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\tconst defaultSpacingControls = getBlockSupport( props.name, [\n\t\tSPACING_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\tconst createResetAllFilter =\n\t\t( attribute, featureSet ) => ( newAttributes ) => ( {\n\t\t\t...newAttributes,\n\t\t\tstyle: {\n\t\t\t\t...newAttributes.style,\n\t\t\t\t[ featureSet ]: {\n\t\t\t\t\t...newAttributes.style?.[ featureSet ],\n\t\t\t\t\t[ attribute ]: undefined,\n\t\t\t\t},\n\t\t\t},\n\t\t} );\n\n\tconst spacingClassnames = classnames( {\n\t\t'tools-panel-item-spacing': spacingSizes && spacingSizes.length > 0,\n\t} );\n\n\tconst { __unstableParentLayout: parentLayout } = props;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls __experimentalGroup=\"dimensions\">\n\t\t\t\t{ ! isPaddingDisabled && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tclassName={ spacingClassnames }\n\t\t\t\t\t\thasValue={ () => hasPaddingValue( props ) }\n\t\t\t\t\t\tlabel={ __( 'Padding' ) }\n\t\t\t\t\t\tonDeselect={ () => resetPadding( props ) }\n\t\t\t\t\t\tresetAllFilter={ createResetAllFilter(\n\t\t\t\t\t\t\t'padding',\n\t\t\t\t\t\t\t'spacing'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tisShownByDefault={ defaultSpacingControls?.padding }\n\t\t\t\t\t\tpanelId={ props.clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PaddingEdit\n\t\t\t\t\t\t\tonMouseOver={ paddingMouseOver.onMouseOver }\n\t\t\t\t\t\t\tonMouseOut={ paddingMouseOver.onMouseOut }\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t\t{ ! isMarginDisabled && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tclassName={ spacingClassnames }\n\t\t\t\t\t\thasValue={ () => hasMarginValue( props ) }\n\t\t\t\t\t\tlabel={ __( 'Margin' ) }\n\t\t\t\t\t\tonDeselect={ () => resetMargin( props ) }\n\t\t\t\t\t\tresetAllFilter={ createResetAllFilter(\n\t\t\t\t\t\t\t'margin',\n\t\t\t\t\t\t\t'spacing'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tisShownByDefault={ defaultSpacingControls?.margin }\n\t\t\t\t\t\tpanelId={ props.clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<MarginEdit\n\t\t\t\t\t\t\tonMouseOver={ marginMouseOver.onMouseOver }\n\t\t\t\t\t\t\tonMouseOut={ marginMouseOver.onMouseOut }\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t\t{ ! isGapDisabled && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tclassName={ spacingClassnames }\n\t\t\t\t\t\thasValue={ () => hasGapValue( props ) }\n\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\tonDeselect={ () => resetGap( props ) }\n\t\t\t\t\t\tresetAllFilter={ createResetAllFilter(\n\t\t\t\t\t\t\t'blockGap',\n\t\t\t\t\t\t\t'spacing'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tisShownByDefault={ defaultSpacingControls?.blockGap }\n\t\t\t\t\t\tpanelId={ props.clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<GapEdit { ...props } />\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t\t{ ! isMinHeightDisabled && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => hasMinHeightValue( props ) }\n\t\t\t\t\t\tlabel={ __( 'Min. height' ) }\n\t\t\t\t\t\tonDeselect={ () => resetMinHeight( props ) }\n\t\t\t\t\t\tresetAllFilter={ createResetAllFilter(\n\t\t\t\t\t\t\t'minHeight',\n\t\t\t\t\t\t\t'dimensions'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tisShownByDefault={\n\t\t\t\t\t\t\tdefaultDimensionsControls?.minHeight\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpanelId={ props.clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<MinHeightEdit { ...props } />\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t\t{ ! isChildLayoutDisabled && (\n\t\t\t\t\t<VStack\n\t\t\t\t\t\tas={ ToolsPanelItem }\n\t\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\t\thasValue={ () => hasChildLayoutValue( props ) }\n\t\t\t\t\t\tlabel={ childLayoutOrientation( parentLayout ) }\n\t\t\t\t\t\tonDeselect={ () => resetChildLayout( props ) }\n\t\t\t\t\t\tresetAllFilter={ createResetAllFilter(\n\t\t\t\t\t\t\t'selfStretch',\n\t\t\t\t\t\t\t'layout'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tisShownByDefault={ false }\n\t\t\t\t\t\tpanelId={ props.clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ChildLayoutEdit { ...props } />\n\t\t\t\t\t</VStack>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ ! isPaddingDisabled && (\n\t\t\t\t<PaddingVisualizer\n\t\t\t\t\tforceShow={ paddingMouseOver.isMouseOver }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! isMarginDisabled && (\n\t\t\t\t<MarginVisualizer\n\t\t\t\t\tforceShow={ marginMouseOver.isMouseOver }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n/**\n * Determine whether there is dimensions related block support.\n *\n * @param {Object} props Block props.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasDimensionsSupport( props ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst { name: blockName } = props;\n\n\treturn (\n\t\thasGapSupport( blockName ) ||\n\t\thasMinHeightSupport( blockName ) ||\n\t\thasPaddingSupport( blockName ) ||\n\t\thasMarginSupport( blockName ) ||\n\t\thasChildLayoutSupport( props )\n\t);\n}\n\n/**\n * Determines whether dimensions support has been disabled.\n *\n * @param {Object} props Block properties.\n *\n * @return {boolean} If spacing support is completely disabled.\n */\nconst useIsDimensionsDisabled = ( props = {} ) => {\n\tconst gapDisabled = useIsGapDisabled( props );\n\tconst minHeightDisabled = useIsMinHeightDisabled( props );\n\tconst paddingDisabled = useIsPaddingDisabled( props );\n\tconst marginDisabled = useIsMarginDisabled( props );\n\tconst childLayoutDisabled = useIsChildLayoutDisabled( props );\n\n\treturn (\n\t\tgapDisabled &&\n\t\tminHeightDisabled &&\n\t\tpaddingDisabled &&\n\t\tmarginDisabled &&\n\t\tchildLayoutDisabled\n\t);\n};\n\n/**\n * Custom hook to retrieve which padding/margin/blockGap is supported\n * e.g. top, right, bottom or left.\n *\n * Sides are opted into by default. It is only if a specific side is set to\n * false that it is omitted.\n *\n * @param {string} blockName Block name.\n * @param {string} feature The feature custom sides relate to e.g. padding or margins.\n *\n * @return {?string[]} Strings representing the custom sides available.\n */\nexport function useCustomSides( blockName, feature ) {\n\tconst support = getBlockSupport( blockName, SPACING_SUPPORT_KEY );\n\n\t// Skip when setting is boolean as theme isn't setting arbitrary sides.\n\tif ( ! support || typeof support[ feature ] === 'boolean' ) {\n\t\treturn;\n\t}\n\n\t// Return if the setting is an array of sides (e.g. `[ 'top', 'bottom' ]`).\n\tif ( Array.isArray( support[ feature ] ) ) {\n\t\treturn support[ feature ];\n\t}\n\n\t// Finally, attempt to return `.sides` if the setting is an object.\n\tif ( support[ feature ]?.sides ) {\n\t\treturn support[ feature ].sides;\n\t}\n}\n\n/**\n * Custom hook to determine whether the sides configured in the\n * block support are valid. A dimension property cannot declare\n * support for a mix of axial and individual sides.\n *\n * @param {string} blockName Block name.\n * @param {string} feature The feature custom sides relate to e.g. padding or margins.\n *\n * @return {boolean} If the feature has a valid configuration of sides.\n */\nexport function useIsDimensionsSupportValid( blockName, feature ) {\n\tconst sides = useCustomSides( blockName, feature );\n\n\tif (\n\t\tsides &&\n\t\tsides.some( ( side ) => ALL_SIDES.includes( side ) ) &&\n\t\tsides.some( ( side ) => AXIAL_SIDES.includes( side ) )\n\t) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t`The ${ feature } support for the \"${ blockName }\" block can not be configured to support both axial and arbitrary sides.`\n\t\t);\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n"]}