@wordpress/block-editor 7.0.1 → 8.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 (1017) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +47 -4
  3. package/build/components/autocomplete/index.js +1 -1
  4. package/build/components/autocomplete/index.js.map +1 -1
  5. package/build/components/block-actions/index.js +8 -4
  6. package/build/components/block-actions/index.js.map +1 -1
  7. package/build/components/block-alignment-control/ui.js +61 -14
  8. package/build/components/block-alignment-control/ui.js.map +1 -1
  9. package/build/components/block-alignment-control/use-available-alignments.js +25 -3
  10. package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
  11. package/build/components/block-content-overlay/index.js +2 -4
  12. package/build/components/block-content-overlay/index.js.map +1 -1
  13. package/build/components/block-controls/fill.js +6 -6
  14. package/build/components/block-controls/fill.js.map +1 -1
  15. package/build/components/block-controls/groups.js +3 -1
  16. package/build/components/block-controls/groups.js.map +1 -1
  17. package/build/components/block-controls/hook.js +57 -0
  18. package/build/components/block-controls/hook.js.map +1 -0
  19. package/build/components/block-edit/context.js +6 -5
  20. package/build/components/block-edit/context.js.map +1 -1
  21. package/build/components/block-edit/edit.js +1 -1
  22. package/build/components/block-edit/edit.js.map +1 -1
  23. package/build/components/block-icon/index.js +5 -1
  24. package/build/components/block-icon/index.js.map +1 -1
  25. package/build/components/block-icon/index.native.js +13 -9
  26. package/build/components/block-icon/index.native.js.map +1 -1
  27. package/build/components/block-inspector/index.js +14 -7
  28. package/build/components/block-inspector/index.js.map +1 -1
  29. package/build/components/block-list/block-html.js +5 -0
  30. package/build/components/block-list/block-html.js.map +1 -1
  31. package/build/components/block-list/block-list-item.native.js +31 -12
  32. package/build/components/block-list/block-list-item.native.js.map +1 -1
  33. package/build/components/block-list/block-selection-button.native.js +4 -4
  34. package/build/components/block-list/block-selection-button.native.js.map +1 -1
  35. package/build/components/block-list/block.js +15 -9
  36. package/build/components/block-list/block.js.map +1 -1
  37. package/build/components/block-list/block.native.js +6 -7
  38. package/build/components/block-list/block.native.js.map +1 -1
  39. package/build/components/block-list/grid-item.native.js +68 -0
  40. package/build/components/block-list/grid-item.native.js.map +1 -0
  41. package/build/components/block-list/index.js +19 -15
  42. package/build/components/block-list/index.js.map +1 -1
  43. package/build/components/block-list/index.native.js +13 -9
  44. package/build/components/block-list/index.native.js.map +1 -1
  45. package/build/components/block-list/use-block-props/index.js +6 -6
  46. package/build/components/block-list/use-block-props/index.js.map +1 -1
  47. package/build/components/block-list/use-block-props/use-block-custom-class-name.js +4 -6
  48. package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +1 -1
  49. package/build/components/block-list/use-block-props/use-block-default-class-name.js +1 -1
  50. package/build/components/block-list/use-block-props/use-block-default-class-name.js.map +1 -1
  51. package/build/components/block-list/use-block-props/use-multi-selection.js +21 -6
  52. package/build/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
  53. package/build/components/block-list/use-in-between-inserter.js +9 -1
  54. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  55. package/build/components/block-list-appender/index.js +9 -1
  56. package/build/components/block-list-appender/index.js.map +1 -1
  57. package/build/components/block-mover/index.js +4 -4
  58. package/build/components/block-mover/index.js.map +1 -1
  59. package/build/components/block-mover/index.native.js +4 -4
  60. package/build/components/block-mover/index.native.js.map +1 -1
  61. package/build/components/block-navigation/dropdown.js +0 -1
  62. package/build/components/block-navigation/dropdown.js.map +1 -1
  63. package/build/components/block-patterns-list/index.js +1 -8
  64. package/build/components/block-patterns-list/index.js.map +1 -1
  65. package/build/components/block-preview/auto.js +42 -14
  66. package/build/components/block-preview/auto.js.map +1 -1
  67. package/build/components/block-settings/container.native.js +5 -2
  68. package/build/components/block-settings/container.native.js.map +1 -1
  69. package/build/components/block-settings-menu/block-settings-dropdown.js +26 -5
  70. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  71. package/build/components/block-settings-menu-controls/index.js +10 -3
  72. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  73. package/build/components/block-styles/index.js +5 -1
  74. package/build/components/block-styles/index.js.map +1 -1
  75. package/build/components/block-styles/preview.native.js +2 -2
  76. package/build/components/block-styles/preview.native.js.map +1 -1
  77. package/build/components/block-switcher/block-styles-menu.js +1 -1
  78. package/build/components/block-switcher/block-styles-menu.js.map +1 -1
  79. package/build/components/block-switcher/index.js +10 -3
  80. package/build/components/block-switcher/index.js.map +1 -1
  81. package/build/components/block-title/index.js +3 -2
  82. package/build/components/block-title/index.js.map +1 -1
  83. package/build/components/block-toolbar/index.js +3 -0
  84. package/build/components/block-toolbar/index.js.map +1 -1
  85. package/build/components/block-tools/block-contextual-toolbar.js +1 -1
  86. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  87. package/build/components/block-tools/block-popover.js +8 -7
  88. package/build/components/block-tools/block-popover.js.map +1 -1
  89. package/build/components/block-tools/block-selection-button.js +2 -4
  90. package/build/components/block-tools/block-selection-button.js.map +1 -1
  91. package/build/components/block-tools/index.js +4 -1
  92. package/build/components/block-tools/index.js.map +1 -1
  93. package/build/components/block-tools/insertion-point.js +96 -7
  94. package/build/components/block-tools/insertion-point.js.map +1 -1
  95. package/build/components/block-types-list/index.native.js +3 -2
  96. package/build/components/block-types-list/index.native.js.map +1 -1
  97. package/build/components/border-radius-control/index.js.map +1 -1
  98. package/build/components/border-radius-control/utils.js +17 -8
  99. package/build/components/border-radius-control/utils.js.map +1 -1
  100. package/build/components/colors/utils.js +11 -3
  101. package/build/components/colors/utils.js.map +1 -1
  102. package/build/components/colors-gradients/control.js +22 -57
  103. package/build/components/colors-gradients/control.js.map +1 -1
  104. package/build/components/colors-gradients/panel-color-gradient-settings.js +83 -7
  105. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  106. package/build/components/contrast-checker/index.js +18 -12
  107. package/build/components/contrast-checker/index.js.map +1 -1
  108. package/build/components/copy-handler/index.js +9 -3
  109. package/build/components/copy-handler/index.js.map +1 -1
  110. package/build/components/default-block-appender/index.js +2 -2
  111. package/build/components/default-block-appender/index.js.map +1 -1
  112. package/build/components/duotone-control/index.js +41 -39
  113. package/build/components/duotone-control/index.js.map +1 -1
  114. package/build/components/editor-styles/index.js +9 -3
  115. package/build/components/editor-styles/index.js.map +1 -1
  116. package/build/components/font-appearance-control/index.js +44 -12
  117. package/build/components/font-appearance-control/index.js.map +1 -1
  118. package/build/components/font-sizes/index.native.js +24 -0
  119. package/build/components/font-sizes/index.native.js.map +1 -1
  120. package/build/components/iframe/index.js +46 -63
  121. package/build/components/iframe/index.js.map +1 -1
  122. package/build/components/image-editor/aspect-ratio-dropdown.js +126 -0
  123. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
  124. package/build/components/image-editor/constants.js +16 -0
  125. package/build/components/image-editor/constants.js.map +1 -0
  126. package/build/components/image-editor/context.js +59 -0
  127. package/build/components/image-editor/context.js.map +1 -0
  128. package/build/components/image-editor/cropper.js +83 -0
  129. package/build/components/image-editor/cropper.js.map +1 -0
  130. package/build/components/image-editor/form-controls.js +36 -0
  131. package/build/components/image-editor/form-controls.js.map +1 -0
  132. package/build/components/image-editor/index.js +60 -0
  133. package/build/components/image-editor/index.js.map +1 -0
  134. package/build/components/image-editor/rotation-button.js +37 -0
  135. package/build/components/image-editor/rotation-button.js.map +1 -0
  136. package/build/components/image-editor/use-save-image.js +84 -0
  137. package/build/components/image-editor/use-save-image.js.map +1 -0
  138. package/build/components/image-editor/use-transform-image.js +135 -0
  139. package/build/components/image-editor/use-transform-image.js.map +1 -0
  140. package/build/components/image-editor/zoom-dropdown.js +55 -0
  141. package/build/components/image-editor/zoom-dropdown.js.map +1 -0
  142. package/build/components/image-size-control/use-dimension-handler.js +14 -3
  143. package/build/components/image-size-control/use-dimension-handler.js.map +1 -1
  144. package/build/components/index.js +42 -37
  145. package/build/components/index.js.map +1 -1
  146. package/build/components/index.native.js +12 -7
  147. package/build/components/index.native.js.map +1 -1
  148. package/build/components/inner-blocks/button-block-appender.js +11 -1
  149. package/build/components/inner-blocks/button-block-appender.js.map +1 -1
  150. package/build/components/inner-blocks/index.js +28 -10
  151. package/build/components/inner-blocks/index.js.map +1 -1
  152. package/build/components/inner-blocks/index.native.js +42 -4
  153. package/build/components/inner-blocks/index.native.js.map +1 -1
  154. package/build/components/inner-blocks/use-nested-settings-update.js +24 -13
  155. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  156. package/build/components/inserter/block-patterns-explorer/explorer.js +62 -0
  157. package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
  158. package/build/components/inserter/block-patterns-explorer/patterns-list.js +111 -0
  159. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
  160. package/build/components/inserter/block-patterns-explorer/sidebar.js +78 -0
  161. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
  162. package/build/components/inserter/block-patterns-tab.js +74 -35
  163. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  164. package/build/components/inserter/block-types-tab.native.js +3 -6
  165. package/build/components/inserter/block-types-tab.native.js.map +1 -1
  166. package/build/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
  167. package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  168. package/build/components/inserter/hooks/use-clipboard-block.native.js +5 -4
  169. package/build/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
  170. package/build/components/inserter/index.js +12 -4
  171. package/build/components/inserter/index.js.map +1 -1
  172. package/build/components/inserter/index.native.js +1 -7
  173. package/build/components/inserter/index.native.js.map +1 -1
  174. package/build/components/inserter/library.js +2 -0
  175. package/build/components/inserter/library.js.map +1 -1
  176. package/build/components/inserter/menu.js +2 -1
  177. package/build/components/inserter/menu.js.map +1 -1
  178. package/build/components/inserter/menu.native.js +18 -17
  179. package/build/components/inserter/menu.native.js.map +1 -1
  180. package/build/components/inserter/pattern-panel.js +19 -10
  181. package/build/components/inserter/pattern-panel.js.map +1 -1
  182. package/build/components/inserter/preview-panel.js +1 -1
  183. package/build/components/inserter/preview-panel.js.map +1 -1
  184. package/build/components/inserter/quick-inserter.js +2 -1
  185. package/build/components/inserter/quick-inserter.js.map +1 -1
  186. package/build/components/inserter/reusable-blocks-tab.native.js +5 -6
  187. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  188. package/build/components/inserter/search-results.native.js +9 -2
  189. package/build/components/inserter/search-results.native.js.map +1 -1
  190. package/build/components/inserter/tabs.native.js +1 -4
  191. package/build/components/inserter/tabs.native.js.map +1 -1
  192. package/build/components/inserter/utils.native.js +44 -0
  193. package/build/components/inserter/utils.native.js.map +1 -0
  194. package/build/components/inspector-controls/block-support-slot-container.js +28 -0
  195. package/build/components/inspector-controls/block-support-slot-container.js.map +1 -0
  196. package/build/components/inspector-controls/block-support-tools-panel.js +78 -0
  197. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -0
  198. package/build/components/inspector-controls/fill.js +64 -0
  199. package/build/components/inspector-controls/fill.js.map +1 -0
  200. package/build/components/inspector-controls/{index.native.js → fill.native.js} +20 -19
  201. package/build/components/inspector-controls/fill.native.js.map +1 -0
  202. package/build/components/inspector-controls/groups.js +25 -0
  203. package/build/components/inspector-controls/groups.js.map +1 -0
  204. package/build/components/inspector-controls/index.js +22 -20
  205. package/build/components/inspector-controls/index.js.map +1 -1
  206. package/build/components/inspector-controls/slot.js +67 -0
  207. package/build/components/inspector-controls/slot.js.map +1 -0
  208. package/build/components/inspector-controls/slot.native.js +38 -0
  209. package/build/components/inspector-controls/slot.native.js.map +1 -0
  210. package/build/components/letter-spacing-control/index.js +9 -6
  211. package/build/components/letter-spacing-control/index.js.map +1 -1
  212. package/build/components/line-height-control/index.native.js +39 -0
  213. package/build/components/line-height-control/index.native.js.map +1 -0
  214. package/build/components/link-control/index.js +93 -34
  215. package/build/components/link-control/index.js.map +1 -1
  216. package/build/components/link-control/link-preview.js +45 -15
  217. package/build/components/link-control/link-preview.js.map +1 -1
  218. package/build/components/link-control/search-input.js +25 -7
  219. package/build/components/link-control/search-input.js.map +1 -1
  220. package/build/components/list-view/block-contents.js +1 -20
  221. package/build/components/list-view/block-contents.js.map +1 -1
  222. package/build/components/list-view/block.js +54 -69
  223. package/build/components/list-view/block.js.map +1 -1
  224. package/build/components/list-view/branch.js +102 -76
  225. package/build/components/list-view/branch.js.map +1 -1
  226. package/build/components/list-view/index.js +53 -23
  227. package/build/components/list-view/index.js.map +1 -1
  228. package/build/components/list-view/leaf.js +2 -2
  229. package/build/components/list-view/leaf.js.map +1 -1
  230. package/build/components/list-view/list-item.js +3 -2
  231. package/build/components/list-view/list-item.js.map +1 -1
  232. package/build/components/list-view/use-list-view-client-ids.js +13 -54
  233. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  234. package/build/components/media-placeholder/index.js +35 -21
  235. package/build/components/media-placeholder/index.js.map +1 -1
  236. package/build/components/media-placeholder/index.native.js +2 -1
  237. package/build/components/media-placeholder/index.native.js.map +1 -1
  238. package/build/components/media-replace-flow/index.js +5 -3
  239. package/build/components/media-replace-flow/index.js.map +1 -1
  240. package/build/components/navigable-toolbar/index.js +1 -4
  241. package/build/components/navigable-toolbar/index.js.map +1 -1
  242. package/build/components/observe-typing/index.js +1 -1
  243. package/build/components/observe-typing/index.js.map +1 -1
  244. package/build/components/plain-text/index.native.js +30 -1
  245. package/build/components/plain-text/index.native.js.map +1 -1
  246. package/build/components/rich-text/embed-handler-picker.native.js +66 -0
  247. package/build/components/rich-text/embed-handler-picker.native.js.map +1 -0
  248. package/build/components/rich-text/format-edit.js +28 -2
  249. package/build/components/rich-text/format-edit.js.map +1 -1
  250. package/build/components/rich-text/format-toolbar/index.js +32 -11
  251. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  252. package/build/components/rich-text/index.js +29 -7
  253. package/build/components/rich-text/index.js.map +1 -1
  254. package/build/components/rich-text/index.native.js +43 -5
  255. package/build/components/rich-text/index.native.js.map +1 -1
  256. package/build/components/rich-text/input-event.js +25 -24
  257. package/build/components/rich-text/input-event.js.map +1 -1
  258. package/build/components/rich-text/shortcut.js +23 -9
  259. package/build/components/rich-text/shortcut.js.map +1 -1
  260. package/build/components/rich-text/use-input-events.js +27 -0
  261. package/build/components/rich-text/use-input-events.js.map +1 -0
  262. package/build/components/rich-text/use-paste-handler.js +45 -10
  263. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  264. package/build/components/rich-text/use-shortcuts.js +27 -0
  265. package/build/components/rich-text/use-shortcuts.js.map +1 -0
  266. package/build/components/rich-text/utils.js +22 -0
  267. package/build/components/rich-text/utils.js.map +1 -1
  268. package/build/components/typewriter/index.js +1 -1
  269. package/build/components/typewriter/index.js.map +1 -1
  270. package/build/components/url-input/index.js +25 -11
  271. package/build/components/url-input/index.js.map +1 -1
  272. package/build/components/use-display-block-controls/index.js +5 -7
  273. package/build/components/use-display-block-controls/index.js.map +1 -1
  274. package/build/components/use-moving-animation/index.js +13 -10
  275. package/build/components/use-moving-animation/index.js.map +1 -1
  276. package/build/components/use-on-block-drop/index.js +2 -1
  277. package/build/components/use-on-block-drop/index.js.map +1 -1
  278. package/build/components/use-resize-canvas/index.js +2 -13
  279. package/build/components/use-resize-canvas/index.js.map +1 -1
  280. package/build/components/use-setting/index.js +49 -14
  281. package/build/components/use-setting/index.js.map +1 -1
  282. package/build/components/writing-flow/use-multi-selection.js +6 -0
  283. package/build/components/writing-flow/use-multi-selection.js.map +1 -1
  284. package/build/components/writing-flow/use-tab-nav.js +18 -3
  285. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  286. package/build/hooks/align.js +14 -14
  287. package/build/hooks/align.js.map +1 -1
  288. package/build/hooks/anchor.js +4 -2
  289. package/build/hooks/anchor.js.map +1 -1
  290. package/build/hooks/border-color.js +9 -5
  291. package/build/hooks/border-color.js.map +1 -1
  292. package/build/hooks/border.js +5 -5
  293. package/build/hooks/border.js.map +1 -1
  294. package/build/hooks/color-panel.js +5 -2
  295. package/build/hooks/color-panel.js.map +1 -1
  296. package/build/hooks/color.js +6 -4
  297. package/build/hooks/color.js.map +1 -1
  298. package/build/hooks/compat.js +23 -0
  299. package/build/hooks/compat.js.map +1 -0
  300. package/build/hooks/custom-class-name.js +3 -1
  301. package/build/hooks/custom-class-name.js.map +1 -1
  302. package/build/hooks/dimensions.js +63 -28
  303. package/build/hooks/dimensions.js.map +1 -1
  304. package/build/hooks/duotone.js +63 -18
  305. package/build/hooks/duotone.js.map +1 -1
  306. package/build/hooks/font-appearance.js +49 -6
  307. package/build/hooks/font-appearance.js.map +1 -1
  308. package/build/hooks/font-family.js +123 -32
  309. package/build/hooks/font-family.js.map +1 -1
  310. package/build/hooks/font-size.js +51 -9
  311. package/build/hooks/font-size.js.map +1 -1
  312. package/build/hooks/gap.js +163 -0
  313. package/build/hooks/gap.js.map +1 -0
  314. package/build/hooks/index.js +12 -0
  315. package/build/hooks/index.js.map +1 -1
  316. package/build/hooks/index.native.js +10 -0
  317. package/build/hooks/index.native.js.map +1 -1
  318. package/build/hooks/layout.js +47 -30
  319. package/build/hooks/layout.js.map +1 -1
  320. package/build/hooks/letter-spacing.js +45 -8
  321. package/build/hooks/letter-spacing.js.map +1 -1
  322. package/build/hooks/line-height.js +45 -8
  323. package/build/hooks/line-height.js.map +1 -1
  324. package/build/hooks/lock.js +43 -0
  325. package/build/hooks/lock.js.map +1 -0
  326. package/build/hooks/margin.js +6 -3
  327. package/build/hooks/margin.js.map +1 -1
  328. package/build/hooks/padding.js +6 -3
  329. package/build/hooks/padding.js.map +1 -1
  330. package/build/hooks/style.js +39 -11
  331. package/build/hooks/style.js.map +1 -1
  332. package/build/hooks/text-decoration.js +42 -6
  333. package/build/hooks/text-decoration.js.map +1 -1
  334. package/build/hooks/text-transform.js +42 -6
  335. package/build/hooks/text-transform.js.map +1 -1
  336. package/build/hooks/typography.js +109 -9
  337. package/build/hooks/typography.js.map +1 -1
  338. package/build/hooks/typography.native.js +60 -0
  339. package/build/hooks/typography.native.js.map +1 -0
  340. package/build/hooks/use-cached-truthy.js +29 -0
  341. package/build/hooks/use-cached-truthy.js.map +1 -0
  342. package/build/index.js +7 -0
  343. package/build/index.js.map +1 -1
  344. package/build/layouts/flex.js +215 -11
  345. package/build/layouts/flex.js.map +1 -1
  346. package/build/layouts/flow.js +99 -6
  347. package/build/layouts/flow.js.map +1 -1
  348. package/build/store/actions.js +331 -266
  349. package/build/store/actions.js.map +1 -1
  350. package/build/store/defaults.js +2 -0
  351. package/build/store/defaults.js.map +1 -1
  352. package/build/store/defaults.native.js +16 -1
  353. package/build/store/defaults.native.js.map +1 -1
  354. package/build/store/index.js +1 -3
  355. package/build/store/index.js.map +1 -1
  356. package/build/store/reducer.js +165 -114
  357. package/build/store/reducer.js.map +1 -1
  358. package/build/store/selectors.js +203 -115
  359. package/build/store/selectors.js.map +1 -1
  360. package/build/utils/index.js +10 -1
  361. package/build/utils/index.js.map +1 -1
  362. package/build/utils/parse-css-unit-to-px.js +295 -0
  363. package/build/utils/parse-css-unit-to-px.js.map +1 -0
  364. package/build/utils/transform-styles/transforms/wrap.js +16 -0
  365. package/build/utils/transform-styles/transforms/wrap.js.map +1 -1
  366. package/build-module/components/autocomplete/index.js +2 -2
  367. package/build-module/components/autocomplete/index.js.map +1 -1
  368. package/build-module/components/block-actions/index.js +8 -4
  369. package/build-module/components/block-actions/index.js.map +1 -1
  370. package/build-module/components/block-alignment-control/ui.js +64 -17
  371. package/build-module/components/block-alignment-control/ui.js.map +1 -1
  372. package/build-module/components/block-alignment-control/use-available-alignments.js +25 -3
  373. package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
  374. package/build-module/components/block-content-overlay/index.js +2 -4
  375. package/build-module/components/block-content-overlay/index.js.map +1 -1
  376. package/build-module/components/block-controls/fill.js +6 -5
  377. package/build-module/components/block-controls/fill.js.map +1 -1
  378. package/build-module/components/block-controls/groups.js +3 -1
  379. package/build-module/components/block-controls/groups.js.map +1 -1
  380. package/build-module/components/block-controls/hook.js +42 -0
  381. package/build-module/components/block-controls/hook.js.map +1 -0
  382. package/build-module/components/block-edit/context.js +4 -4
  383. package/build-module/components/block-edit/context.js.map +1 -1
  384. package/build-module/components/block-edit/edit.js +1 -1
  385. package/build-module/components/block-edit/edit.js.map +1 -1
  386. package/build-module/components/block-icon/index.js +5 -1
  387. package/build-module/components/block-icon/index.js.map +1 -1
  388. package/build-module/components/block-icon/index.native.js +14 -9
  389. package/build-module/components/block-icon/index.native.js.map +1 -1
  390. package/build-module/components/block-inspector/index.js +12 -6
  391. package/build-module/components/block-inspector/index.js.map +1 -1
  392. package/build-module/components/block-list/block-html.js +5 -0
  393. package/build-module/components/block-list/block-html.js.map +1 -1
  394. package/build-module/components/block-list/block-list-item.native.js +30 -12
  395. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  396. package/build-module/components/block-list/block-selection-button.native.js +3 -4
  397. package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
  398. package/build-module/components/block-list/block.js +16 -10
  399. package/build-module/components/block-list/block.js.map +1 -1
  400. package/build-module/components/block-list/block.native.js +6 -7
  401. package/build-module/components/block-list/block.native.js.map +1 -1
  402. package/build-module/components/block-list/grid-item.native.js +57 -0
  403. package/build-module/components/block-list/grid-item.native.js.map +1 -0
  404. package/build-module/components/block-list/index.js +17 -14
  405. package/build-module/components/block-list/index.js.map +1 -1
  406. package/build-module/components/block-list/index.native.js +13 -9
  407. package/build-module/components/block-list/index.native.js.map +1 -1
  408. package/build-module/components/block-list/use-block-props/index.js +7 -7
  409. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  410. package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js +5 -7
  411. package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +1 -1
  412. package/build-module/components/block-list/use-block-props/use-block-default-class-name.js +2 -2
  413. package/build-module/components/block-list/use-block-props/use-block-default-class-name.js.map +1 -1
  414. package/build-module/components/block-list/use-block-props/use-multi-selection.js +21 -6
  415. package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
  416. package/build-module/components/block-list/use-in-between-inserter.js +9 -1
  417. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  418. package/build-module/components/block-list-appender/index.js +9 -1
  419. package/build-module/components/block-list-appender/index.js.map +1 -1
  420. package/build-module/components/block-mover/index.js +4 -4
  421. package/build-module/components/block-mover/index.js.map +1 -1
  422. package/build-module/components/block-mover/index.native.js +4 -4
  423. package/build-module/components/block-mover/index.native.js.map +1 -1
  424. package/build-module/components/block-navigation/dropdown.js +0 -1
  425. package/build-module/components/block-navigation/dropdown.js.map +1 -1
  426. package/build-module/components/block-patterns-list/index.js +1 -6
  427. package/build-module/components/block-patterns-list/index.js.map +1 -1
  428. package/build-module/components/block-preview/auto.js +40 -16
  429. package/build-module/components/block-preview/auto.js.map +1 -1
  430. package/build-module/components/block-settings/container.native.js +6 -3
  431. package/build-module/components/block-settings/container.native.js.map +1 -1
  432. package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -7
  433. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  434. package/build-module/components/block-settings-menu-controls/index.js +10 -3
  435. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  436. package/build-module/components/block-styles/index.js +5 -1
  437. package/build-module/components/block-styles/index.js.map +1 -1
  438. package/build-module/components/block-styles/preview.native.js +2 -2
  439. package/build-module/components/block-styles/preview.native.js.map +1 -1
  440. package/build-module/components/block-switcher/block-styles-menu.js +1 -1
  441. package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
  442. package/build-module/components/block-switcher/index.js +10 -3
  443. package/build-module/components/block-switcher/index.js.map +1 -1
  444. package/build-module/components/block-title/index.js +3 -2
  445. package/build-module/components/block-title/index.js.map +1 -1
  446. package/build-module/components/block-toolbar/index.js +3 -0
  447. package/build-module/components/block-toolbar/index.js.map +1 -1
  448. package/build-module/components/block-tools/block-contextual-toolbar.js +1 -1
  449. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  450. package/build-module/components/block-tools/block-popover.js +9 -8
  451. package/build-module/components/block-tools/block-popover.js.map +1 -1
  452. package/build-module/components/block-tools/block-selection-button.js +2 -4
  453. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  454. package/build-module/components/block-tools/index.js +4 -1
  455. package/build-module/components/block-tools/index.js.map +1 -1
  456. package/build-module/components/block-tools/insertion-point.js +96 -8
  457. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  458. package/build-module/components/block-types-list/index.native.js +3 -2
  459. package/build-module/components/block-types-list/index.native.js.map +1 -1
  460. package/build-module/components/border-radius-control/index.js.map +1 -1
  461. package/build-module/components/border-radius-control/utils.js +16 -9
  462. package/build-module/components/border-radius-control/utils.js.map +1 -1
  463. package/build-module/components/colors/utils.js +9 -3
  464. package/build-module/components/colors/utils.js.map +1 -1
  465. package/build-module/components/colors-gradients/control.js +26 -63
  466. package/build-module/components/colors-gradients/control.js.map +1 -1
  467. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +84 -7
  468. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  469. package/build-module/components/contrast-checker/index.js +13 -10
  470. package/build-module/components/contrast-checker/index.js.map +1 -1
  471. package/build-module/components/copy-handler/index.js +9 -3
  472. package/build-module/components/copy-handler/index.js.map +1 -1
  473. package/build-module/components/default-block-appender/index.js +2 -2
  474. package/build-module/components/default-block-appender/index.js.map +1 -1
  475. package/build-module/components/duotone-control/index.js +43 -39
  476. package/build-module/components/duotone-control/index.js.map +1 -1
  477. package/build-module/components/editor-styles/index.js +7 -3
  478. package/build-module/components/editor-styles/index.js.map +1 -1
  479. package/build-module/components/font-appearance-control/index.js +40 -12
  480. package/build-module/components/font-appearance-control/index.js.map +1 -1
  481. package/build-module/components/font-sizes/index.native.js +3 -1
  482. package/build-module/components/font-sizes/index.native.js.map +1 -1
  483. package/build-module/components/iframe/index.js +47 -65
  484. package/build-module/components/iframe/index.js.map +1 -1
  485. package/build-module/components/image-editor/aspect-ratio-dropdown.js +115 -0
  486. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
  487. package/build-module/components/image-editor/constants.js +7 -0
  488. package/build-module/components/image-editor/constants.js.map +1 -0
  489. package/build-module/components/image-editor/context.js +44 -0
  490. package/build-module/components/image-editor/context.js.map +1 -0
  491. package/build-module/components/image-editor/cropper.js +69 -0
  492. package/build-module/components/image-editor/cropper.js.map +1 -0
  493. package/build-module/components/image-editor/form-controls.js +26 -0
  494. package/build-module/components/image-editor/form-controls.js.map +1 -0
  495. package/build-module/components/image-editor/index.js +37 -0
  496. package/build-module/components/image-editor/index.js.map +1 -0
  497. package/build-module/components/image-editor/rotation-button.js +26 -0
  498. package/build-module/components/image-editor/rotation-button.js.map +1 -0
  499. package/build-module/components/image-editor/use-save-image.js +70 -0
  500. package/build-module/components/image-editor/use-save-image.js.map +1 -0
  501. package/build-module/components/image-editor/use-transform-image.js +127 -0
  502. package/build-module/components/image-editor/use-transform-image.js.map +1 -0
  503. package/build-module/components/image-editor/zoom-dropdown.js +43 -0
  504. package/build-module/components/image-editor/zoom-dropdown.js.map +1 -0
  505. package/build-module/components/image-size-control/use-dimension-handler.js +13 -2
  506. package/build-module/components/image-size-control/use-dimension-handler.js.map +1 -1
  507. package/build-module/components/index.js +5 -6
  508. package/build-module/components/index.js.map +1 -1
  509. package/build-module/components/index.native.js +2 -3
  510. package/build-module/components/index.native.js.map +1 -1
  511. package/build-module/components/inner-blocks/button-block-appender.js +10 -1
  512. package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
  513. package/build-module/components/inner-blocks/index.js +29 -11
  514. package/build-module/components/inner-blocks/index.js.map +1 -1
  515. package/build-module/components/inner-blocks/index.native.js +41 -5
  516. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  517. package/build-module/components/inner-blocks/use-nested-settings-update.js +24 -13
  518. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  519. package/build-module/components/inserter/block-patterns-explorer/explorer.js +50 -0
  520. package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
  521. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +92 -0
  522. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
  523. package/build-module/components/inserter/block-patterns-explorer/sidebar.js +69 -0
  524. package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
  525. package/build-module/components/inserter/block-patterns-tab.js +75 -36
  526. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  527. package/build-module/components/inserter/block-types-tab.native.js +2 -5
  528. package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
  529. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
  530. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  531. package/build-module/components/inserter/hooks/use-clipboard-block.native.js +5 -4
  532. package/build-module/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
  533. package/build-module/components/inserter/index.js +12 -4
  534. package/build-module/components/inserter/index.js.map +1 -1
  535. package/build-module/components/inserter/index.native.js +1 -7
  536. package/build-module/components/inserter/index.native.js.map +1 -1
  537. package/build-module/components/inserter/library.js +2 -0
  538. package/build-module/components/inserter/library.js.map +1 -1
  539. package/build-module/components/inserter/menu.js +2 -1
  540. package/build-module/components/inserter/menu.js.map +1 -1
  541. package/build-module/components/inserter/menu.native.js +17 -17
  542. package/build-module/components/inserter/menu.native.js.map +1 -1
  543. package/build-module/components/inserter/pattern-panel.js +21 -13
  544. package/build-module/components/inserter/pattern-panel.js.map +1 -1
  545. package/build-module/components/inserter/preview-panel.js +1 -1
  546. package/build-module/components/inserter/preview-panel.js.map +1 -1
  547. package/build-module/components/inserter/quick-inserter.js +2 -1
  548. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  549. package/build-module/components/inserter/reusable-blocks-tab.native.js +4 -5
  550. package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  551. package/build-module/components/inserter/search-results.native.js +8 -2
  552. package/build-module/components/inserter/search-results.native.js.map +1 -1
  553. package/build-module/components/inserter/tabs.native.js +1 -4
  554. package/build-module/components/inserter/tabs.native.js.map +1 -1
  555. package/build-module/components/inserter/utils.native.js +35 -0
  556. package/build-module/components/inserter/utils.native.js.map +1 -0
  557. package/build-module/components/inspector-controls/block-support-slot-container.js +18 -0
  558. package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -0
  559. package/build-module/components/inspector-controls/block-support-tools-panel.js +67 -0
  560. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -0
  561. package/build-module/components/inspector-controls/fill.js +50 -0
  562. package/build-module/components/inspector-controls/fill.js.map +1 -0
  563. package/build-module/components/inspector-controls/{index.native.js → fill.native.js} +16 -18
  564. package/build-module/components/inspector-controls/fill.native.js.map +1 -0
  565. package/build-module/components/inspector-controls/groups.js +16 -0
  566. package/build-module/components/inspector-controls/groups.js.map +1 -0
  567. package/build-module/components/inspector-controls/index.js +16 -17
  568. package/build-module/components/inspector-controls/index.js.map +1 -1
  569. package/build-module/components/inspector-controls/slot.js +52 -0
  570. package/build-module/components/inspector-controls/slot.js.map +1 -0
  571. package/build-module/components/inspector-controls/slot.native.js +27 -0
  572. package/build-module/components/inspector-controls/slot.native.js.map +1 -0
  573. package/build-module/components/letter-spacing-control/index.js +9 -6
  574. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  575. package/build-module/components/line-height-control/index.native.js +29 -0
  576. package/build-module/components/line-height-control/index.native.js.map +1 -0
  577. package/build-module/components/link-control/index.js +93 -35
  578. package/build-module/components/link-control/index.js.map +1 -1
  579. package/build-module/components/link-control/link-preview.js +46 -17
  580. package/build-module/components/link-control/link-preview.js.map +1 -1
  581. package/build-module/components/link-control/search-input.js +24 -7
  582. package/build-module/components/link-control/search-input.js.map +1 -1
  583. package/build-module/components/list-view/block-contents.js +1 -18
  584. package/build-module/components/list-view/block-contents.js.map +1 -1
  585. package/build-module/components/list-view/block.js +56 -71
  586. package/build-module/components/list-view/block.js.map +1 -1
  587. package/build-module/components/list-view/branch.js +102 -78
  588. package/build-module/components/list-view/branch.js.map +1 -1
  589. package/build-module/components/list-view/index.js +55 -27
  590. package/build-module/components/list-view/index.js.map +1 -1
  591. package/build-module/components/list-view/leaf.js +2 -2
  592. package/build-module/components/list-view/leaf.js.map +1 -1
  593. package/build-module/components/list-view/list-item.js +3 -2
  594. package/build-module/components/list-view/list-item.js.map +1 -1
  595. package/build-module/components/list-view/use-list-view-client-ids.js +13 -54
  596. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  597. package/build-module/components/media-placeholder/index.js +35 -21
  598. package/build-module/components/media-placeholder/index.js.map +1 -1
  599. package/build-module/components/media-placeholder/index.native.js +2 -1
  600. package/build-module/components/media-placeholder/index.native.js.map +1 -1
  601. package/build-module/components/media-replace-flow/index.js +5 -3
  602. package/build-module/components/media-replace-flow/index.js.map +1 -1
  603. package/build-module/components/navigable-toolbar/index.js +1 -4
  604. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  605. package/build-module/components/observe-typing/index.js +1 -1
  606. package/build-module/components/observe-typing/index.js.map +1 -1
  607. package/build-module/components/plain-text/index.native.js +29 -2
  608. package/build-module/components/plain-text/index.native.js.map +1 -1
  609. package/build-module/components/rich-text/embed-handler-picker.native.js +54 -0
  610. package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -0
  611. package/build-module/components/rich-text/format-edit.js +28 -3
  612. package/build-module/components/rich-text/format-edit.js.map +1 -1
  613. package/build-module/components/rich-text/format-toolbar/index.js +29 -11
  614. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  615. package/build-module/components/rich-text/index.js +22 -6
  616. package/build-module/components/rich-text/index.js.map +1 -1
  617. package/build-module/components/rich-text/index.native.js +43 -6
  618. package/build-module/components/rich-text/index.native.js.map +1 -1
  619. package/build-module/components/rich-text/input-event.js +24 -22
  620. package/build-module/components/rich-text/input-event.js.map +1 -1
  621. package/build-module/components/rich-text/shortcut.js +22 -9
  622. package/build-module/components/rich-text/shortcut.js.map +1 -1
  623. package/build-module/components/rich-text/use-input-events.js +19 -0
  624. package/build-module/components/rich-text/use-input-events.js.map +1 -0
  625. package/build-module/components/rich-text/use-paste-handler.js +44 -10
  626. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  627. package/build-module/components/rich-text/use-shortcuts.js +19 -0
  628. package/build-module/components/rich-text/use-shortcuts.js.map +1 -0
  629. package/build-module/components/rich-text/utils.js +20 -0
  630. package/build-module/components/rich-text/utils.js.map +1 -1
  631. package/build-module/components/typewriter/index.js +1 -1
  632. package/build-module/components/typewriter/index.js.map +1 -1
  633. package/build-module/components/url-input/index.js +25 -11
  634. package/build-module/components/url-input/index.js.map +1 -1
  635. package/build-module/components/use-display-block-controls/index.js +5 -7
  636. package/build-module/components/use-display-block-controls/index.js.map +1 -1
  637. package/build-module/components/use-moving-animation/index.js +13 -10
  638. package/build-module/components/use-moving-animation/index.js.map +1 -1
  639. package/build-module/components/use-on-block-drop/index.js +3 -2
  640. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  641. package/build-module/components/use-resize-canvas/index.js +2 -10
  642. package/build-module/components/use-resize-canvas/index.js.map +1 -1
  643. package/build-module/components/use-setting/index.js +48 -14
  644. package/build-module/components/use-setting/index.js.map +1 -1
  645. package/build-module/components/writing-flow/use-multi-selection.js +6 -0
  646. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  647. package/build-module/components/writing-flow/use-tab-nav.js +18 -3
  648. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  649. package/build-module/hooks/align.js +15 -15
  650. package/build-module/hooks/align.js.map +1 -1
  651. package/build-module/hooks/anchor.js +5 -3
  652. package/build-module/hooks/anchor.js.map +1 -1
  653. package/build-module/hooks/border-color.js +10 -5
  654. package/build-module/hooks/border-color.js.map +1 -1
  655. package/build-module/hooks/border.js +5 -5
  656. package/build-module/hooks/border.js.map +1 -1
  657. package/build-module/hooks/color-panel.js +6 -3
  658. package/build-module/hooks/color-panel.js.map +1 -1
  659. package/build-module/hooks/color.js +6 -4
  660. package/build-module/hooks/color.js.map +1 -1
  661. package/build-module/hooks/compat.js +20 -0
  662. package/build-module/hooks/compat.js.map +1 -0
  663. package/build-module/hooks/custom-class-name.js +4 -2
  664. package/build-module/hooks/custom-class-name.js.map +1 -1
  665. package/build-module/hooks/dimensions.js +57 -26
  666. package/build-module/hooks/dimensions.js.map +1 -1
  667. package/build-module/hooks/duotone.js +62 -18
  668. package/build-module/hooks/duotone.js.map +1 -1
  669. package/build-module/hooks/font-appearance.js +45 -6
  670. package/build-module/hooks/font-appearance.js.map +1 -1
  671. package/build-module/hooks/font-family.js +117 -33
  672. package/build-module/hooks/font-family.js.map +1 -1
  673. package/build-module/hooks/font-size.js +47 -9
  674. package/build-module/hooks/font-size.js.map +1 -1
  675. package/build-module/hooks/gap.js +140 -0
  676. package/build-module/hooks/gap.js.map +1 -0
  677. package/build-module/hooks/index.js +3 -0
  678. package/build-module/hooks/index.js.map +1 -1
  679. package/build-module/hooks/index.native.js +2 -0
  680. package/build-module/hooks/index.native.js.map +1 -1
  681. package/build-module/hooks/layout.js +47 -30
  682. package/build-module/hooks/layout.js.map +1 -1
  683. package/build-module/hooks/letter-spacing.js +41 -8
  684. package/build-module/hooks/letter-spacing.js.map +1 -1
  685. package/build-module/hooks/line-height.js +41 -8
  686. package/build-module/hooks/line-height.js.map +1 -1
  687. package/build-module/hooks/lock.js +33 -0
  688. package/build-module/hooks/lock.js.map +1 -0
  689. package/build-module/hooks/margin.js +7 -4
  690. package/build-module/hooks/margin.js.map +1 -1
  691. package/build-module/hooks/padding.js +7 -4
  692. package/build-module/hooks/padding.js.map +1 -1
  693. package/build-module/hooks/style.js +39 -11
  694. package/build-module/hooks/style.js.map +1 -1
  695. package/build-module/hooks/text-decoration.js +38 -6
  696. package/build-module/hooks/text-decoration.js.map +1 -1
  697. package/build-module/hooks/text-transform.js +38 -6
  698. package/build-module/hooks/text-transform.js.map +1 -1
  699. package/build-module/hooks/typography.js +118 -19
  700. package/build-module/hooks/typography.js.map +1 -1
  701. package/build-module/hooks/typography.native.js +41 -0
  702. package/build-module/hooks/typography.native.js.map +1 -0
  703. package/build-module/hooks/use-cached-truthy.js +21 -0
  704. package/build-module/hooks/use-cached-truthy.js.map +1 -0
  705. package/build-module/index.js +1 -1
  706. package/build-module/index.js.map +1 -1
  707. package/build-module/layouts/flex.js +210 -12
  708. package/build-module/layouts/flex.js.map +1 -1
  709. package/build-module/layouts/flow.js +99 -7
  710. package/build-module/layouts/flow.js.map +1 -1
  711. package/build-module/store/actions.js +294 -242
  712. package/build-module/store/actions.js.map +1 -1
  713. package/build-module/store/defaults.js +2 -0
  714. package/build-module/store/defaults.js.map +1 -1
  715. package/build-module/store/defaults.native.js +15 -1
  716. package/build-module/store/defaults.native.js.map +1 -1
  717. package/build-module/store/index.js +1 -2
  718. package/build-module/store/index.js.map +1 -1
  719. package/build-module/store/reducer.js +167 -115
  720. package/build-module/store/reducer.js.map +1 -1
  721. package/build-module/store/selectors.js +189 -104
  722. package/build-module/store/selectors.js.map +1 -1
  723. package/build-module/utils/index.js +1 -0
  724. package/build-module/utils/index.js.map +1 -1
  725. package/build-module/utils/parse-css-unit-to-px.js +285 -0
  726. package/build-module/utils/parse-css-unit-to-px.js.map +1 -0
  727. package/build-module/utils/transform-styles/transforms/wrap.js +16 -0
  728. package/build-module/utils/transform-styles/transforms/wrap.js.map +1 -1
  729. package/build-style/default-editor-styles-rtl.css +114 -0
  730. package/build-style/default-editor-styles.css +114 -0
  731. package/build-style/style-rtl.css +292 -181
  732. package/build-style/style.css +292 -181
  733. package/build-types/components/block-context/index.d.ts +1 -1
  734. package/build-types/components/block-context/index.d.ts.map +1 -1
  735. package/package.json +28 -27
  736. package/src/components/autocomplete/index.js +5 -2
  737. package/src/components/block-actions/index.js +9 -5
  738. package/src/components/block-alignment-control/style.scss +5 -0
  739. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +15 -1
  740. package/src/components/block-alignment-control/test/index.native.js +37 -0
  741. package/src/components/block-alignment-control/ui.js +98 -27
  742. package/src/components/block-alignment-control/use-available-alignments.js +31 -10
  743. package/src/components/block-content-overlay/index.js +3 -6
  744. package/src/components/block-content-overlay/style.scss +9 -21
  745. package/src/components/block-controls/fill.js +7 -4
  746. package/src/components/block-controls/groups.js +2 -0
  747. package/src/components/block-controls/hook.js +44 -0
  748. package/src/components/block-draggable/style.scss +19 -4
  749. package/src/components/block-edit/context.js +4 -3
  750. package/src/components/block-edit/edit.js +1 -4
  751. package/src/components/block-icon/index.js +4 -1
  752. package/src/components/block-icon/index.native.js +11 -12
  753. package/src/components/block-inspector/index.js +19 -9
  754. package/src/components/block-list/block-html.js +5 -0
  755. package/src/components/block-list/block-list-item.native.js +34 -11
  756. package/src/components/block-list/block-list-item.native.scss +4 -0
  757. package/src/components/block-list/block-selection-button.native.js +8 -5
  758. package/src/components/block-list/block.js +13 -9
  759. package/src/components/block-list/block.native.js +7 -5
  760. package/src/components/block-list/grid-item.native.js +58 -0
  761. package/src/components/block-list/index.js +33 -27
  762. package/src/components/block-list/index.native.js +10 -4
  763. package/src/components/block-list/style.native.scss +0 -1
  764. package/src/components/block-list/style.scss +15 -0
  765. package/src/components/block-list/use-block-props/index.js +4 -7
  766. package/src/components/block-list/use-block-props/use-block-custom-class-name.js +5 -7
  767. package/src/components/block-list/use-block-props/use-block-default-class-name.js +2 -8
  768. package/src/components/block-list/use-block-props/use-multi-selection.js +30 -4
  769. package/src/components/block-list/use-in-between-inserter.js +9 -0
  770. package/src/components/block-list-appender/index.js +8 -0
  771. package/src/components/block-mover/index.js +4 -4
  772. package/src/components/block-mover/index.native.js +4 -4
  773. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +10 -6
  774. package/src/components/block-mover/test/index.native.js +26 -28
  775. package/src/components/block-navigation/dropdown.js +0 -1
  776. package/src/components/block-patterns-list/index.js +1 -8
  777. package/src/components/block-patterns-list/style.scss +22 -12
  778. package/src/components/block-preview/README.md +1 -1
  779. package/src/components/block-preview/auto.js +36 -18
  780. package/src/components/block-preview/style.scss +0 -20
  781. package/src/components/block-settings/container.native.js +7 -0
  782. package/src/components/block-settings-menu/block-settings-dropdown.js +26 -13
  783. package/src/components/block-settings-menu-controls/index.js +9 -6
  784. package/src/components/block-styles/index.js +6 -1
  785. package/src/components/block-styles/preview.native.js +2 -2
  786. package/src/components/block-switcher/block-styles-menu.js +1 -1
  787. package/src/components/block-switcher/index.js +7 -3
  788. package/src/components/block-switcher/test/__snapshots__/index.js.snap +1 -1
  789. package/src/components/block-switcher/test/index.js +3 -0
  790. package/src/components/block-title/index.js +5 -2
  791. package/src/components/block-toolbar/index.js +4 -0
  792. package/src/components/block-tools/block-contextual-toolbar.js +7 -5
  793. package/src/components/block-tools/block-popover.js +8 -8
  794. package/src/components/block-tools/block-selection-button.js +2 -4
  795. package/src/components/block-tools/index.js +5 -2
  796. package/src/components/block-tools/insertion-point.js +97 -9
  797. package/src/components/block-tools/style.scss +4 -35
  798. package/src/components/block-types-list/index.native.js +8 -2
  799. package/src/components/block-types-list/style.scss +0 -3
  800. package/src/components/block-variation-picker/README.md +47 -14
  801. package/src/components/block-variation-picker/style.native.scss +4 -0
  802. package/src/components/border-radius-control/index.js +1 -0
  803. package/src/components/border-radius-control/test/utils.js +216 -0
  804. package/src/components/border-radius-control/utils.js +18 -10
  805. package/src/components/color-palette/test/__snapshots__/control.js.snap +128 -71
  806. package/src/components/colors/test/utils.js +41 -0
  807. package/src/components/colors/utils.js +9 -5
  808. package/src/components/colors-gradients/control.js +70 -110
  809. package/src/components/colors-gradients/panel-color-gradient-settings.js +79 -7
  810. package/src/components/colors-gradients/style.scss +10 -18
  811. package/src/components/colors-gradients/test/control.js +41 -66
  812. package/src/components/contrast-checker/index.js +14 -10
  813. package/src/components/copy-handler/index.js +6 -1
  814. package/src/components/default-block-appender/index.js +2 -2
  815. package/src/components/default-block-appender/test/__snapshots__/index.js.snap +3 -3
  816. package/src/components/duotone-control/index.js +49 -41
  817. package/src/components/duotone-control/style.scss +27 -12
  818. package/src/components/editor-styles/index.js +8 -4
  819. package/src/components/font-appearance-control/index.js +62 -24
  820. package/src/components/font-appearance-control/style.scss +1 -1
  821. package/src/components/font-sizes/index.native.js +7 -1
  822. package/src/components/iframe/index.js +64 -75
  823. package/src/components/image-editor/aspect-ratio-dropdown.js +129 -0
  824. package/src/components/image-editor/constants.js +6 -0
  825. package/src/components/image-editor/context.js +56 -0
  826. package/src/components/image-editor/cropper.js +74 -0
  827. package/src/components/image-editor/form-controls.js +22 -0
  828. package/src/components/image-editor/index.js +52 -0
  829. package/src/components/image-editor/rotation-button.js +24 -0
  830. package/src/components/image-editor/use-save-image.js +97 -0
  831. package/src/components/image-editor/use-transform-image.js +162 -0
  832. package/src/components/image-editor/zoom-dropdown.js +40 -0
  833. package/src/components/image-size-control/use-dimension-handler.js +18 -1
  834. package/src/components/index.js +10 -8
  835. package/src/components/index.native.js +5 -3
  836. package/src/components/inner-blocks/button-block-appender.js +9 -0
  837. package/src/components/inner-blocks/index.js +43 -14
  838. package/src/components/inner-blocks/index.native.js +48 -4
  839. package/src/components/inner-blocks/use-nested-settings-update.js +26 -11
  840. package/src/components/inserter/block-patterns-explorer/explorer.js +50 -0
  841. package/src/components/inserter/block-patterns-explorer/patterns-list.js +122 -0
  842. package/src/components/inserter/block-patterns-explorer/sidebar.js +73 -0
  843. package/src/components/inserter/block-patterns-tab.js +107 -73
  844. package/src/components/inserter/block-types-tab.native.js +3 -6
  845. package/src/components/inserter/hooks/use-block-type-impressions.native.js +14 -21
  846. package/src/components/inserter/hooks/use-clipboard-block.native.js +3 -2
  847. package/src/components/inserter/index.js +15 -3
  848. package/src/components/inserter/index.native.js +2 -19
  849. package/src/components/inserter/library.js +2 -0
  850. package/src/components/inserter/menu.js +4 -1
  851. package/src/components/inserter/menu.native.js +18 -15
  852. package/src/components/inserter/pattern-panel.js +33 -16
  853. package/src/components/inserter/preview-panel.js +1 -1
  854. package/src/components/inserter/quick-inserter.js +1 -1
  855. package/src/components/inserter/reusable-blocks-tab.native.js +4 -6
  856. package/src/components/inserter/search-results.native.js +8 -1
  857. package/src/components/inserter/style.native.scss +8 -5
  858. package/src/components/inserter/style.scss +80 -16
  859. package/src/components/inserter/tabs.native.js +1 -7
  860. package/src/components/inserter/test/block-types-tab.native.js +3 -2
  861. package/src/components/inserter/test/fixtures/index.native.js +12 -0
  862. package/src/components/inserter/utils.native.js +35 -0
  863. package/src/components/inserter-list-item/style.scss +4 -2
  864. package/src/components/inspector-controls/README.md +43 -198
  865. package/src/components/inspector-controls/block-support-slot-container.js +10 -0
  866. package/src/components/inspector-controls/block-support-tools-panel.js +60 -0
  867. package/src/components/inspector-controls/fill.js +53 -0
  868. package/src/components/inspector-controls/{index.native.js → fill.native.js} +14 -14
  869. package/src/components/inspector-controls/groups.js +22 -0
  870. package/src/components/inspector-controls/index.js +16 -18
  871. package/src/components/inspector-controls/slot.js +45 -0
  872. package/src/components/inspector-controls/slot.native.js +22 -0
  873. package/src/components/letter-spacing-control/index.js +12 -6
  874. package/src/components/line-height-control/index.native.js +25 -0
  875. package/src/components/link-control/README.md +47 -14
  876. package/src/components/link-control/index.js +102 -31
  877. package/src/components/link-control/link-preview.js +53 -20
  878. package/src/components/link-control/search-input.js +21 -7
  879. package/src/components/link-control/style.scss +66 -19
  880. package/src/components/link-control/test/index.js +311 -4
  881. package/src/components/list-view/block-contents.js +17 -38
  882. package/src/components/list-view/block.js +73 -84
  883. package/src/components/list-view/branch.js +123 -94
  884. package/src/components/list-view/index.js +95 -37
  885. package/src/components/list-view/leaf.js +2 -2
  886. package/src/components/list-view/list-item.js +5 -4
  887. package/src/components/list-view/style.scss +70 -33
  888. package/src/components/list-view/use-list-view-client-ids.js +9 -68
  889. package/src/components/media-placeholder/README.md +9 -0
  890. package/src/components/media-placeholder/index.js +31 -20
  891. package/src/components/media-placeholder/index.native.js +2 -1
  892. package/src/components/media-placeholder/style.scss +2 -0
  893. package/src/components/media-replace-flow/README.md +7 -0
  894. package/src/components/media-replace-flow/index.js +4 -1
  895. package/src/components/media-replace-flow/style.scss +11 -12
  896. package/src/components/media-upload/README.md +1 -1
  897. package/src/components/navigable-toolbar/index.js +1 -4
  898. package/src/components/observe-typing/index.js +3 -2
  899. package/src/components/plain-text/index.native.js +26 -4
  900. package/src/components/rich-text/embed-handler-picker.native.js +68 -0
  901. package/src/components/rich-text/format-edit.js +36 -2
  902. package/src/components/rich-text/format-toolbar/index.js +25 -6
  903. package/src/components/rich-text/index.js +38 -12
  904. package/src/components/rich-text/index.native.js +37 -4
  905. package/src/components/rich-text/input-event.js +21 -20
  906. package/src/components/rich-text/shortcut.js +24 -9
  907. package/src/components/rich-text/style.scss +7 -5
  908. package/src/components/rich-text/use-input-events.js +19 -0
  909. package/src/components/rich-text/use-paste-handler.js +47 -12
  910. package/src/components/rich-text/use-shortcuts.js +19 -0
  911. package/src/components/rich-text/utils.js +16 -0
  912. package/src/components/skip-to-selected-block/README.md +39 -0
  913. package/src/components/tool-selector/style.scss +5 -5
  914. package/src/components/typewriter/index.js +3 -2
  915. package/src/components/url-input/index.js +26 -10
  916. package/src/components/use-display-block-controls/index.js +7 -10
  917. package/src/components/use-moving-animation/index.js +9 -8
  918. package/src/components/use-on-block-drop/index.js +5 -1
  919. package/src/components/use-resize-canvas/index.js +2 -17
  920. package/src/components/use-setting/index.js +48 -16
  921. package/src/components/writing-flow/use-multi-selection.js +6 -0
  922. package/src/components/writing-flow/use-tab-nav.js +21 -11
  923. package/src/default-editor-styles.scss +24 -0
  924. package/src/hooks/align.js +28 -20
  925. package/src/hooks/anchor.js +5 -5
  926. package/src/hooks/border-color.js +12 -1
  927. package/src/hooks/border.js +8 -11
  928. package/src/hooks/color-panel.js +4 -1
  929. package/src/hooks/color.js +11 -4
  930. package/src/hooks/compat.js +23 -0
  931. package/src/hooks/custom-class-name.js +3 -3
  932. package/src/hooks/dimensions.js +94 -50
  933. package/src/hooks/duotone.js +70 -21
  934. package/src/hooks/font-appearance.js +38 -7
  935. package/src/hooks/font-family.js +129 -33
  936. package/src/hooks/font-size.js +42 -6
  937. package/src/hooks/gap.js +146 -0
  938. package/src/hooks/index.js +3 -0
  939. package/src/hooks/index.native.js +2 -0
  940. package/src/hooks/layout.js +82 -56
  941. package/src/hooks/layout.scss +8 -0
  942. package/src/hooks/letter-spacing.js +37 -8
  943. package/src/hooks/line-height.js +37 -9
  944. package/src/hooks/lock.js +34 -0
  945. package/src/hooks/margin.js +13 -3
  946. package/src/hooks/padding.js +13 -3
  947. package/src/hooks/style.js +57 -18
  948. package/src/hooks/test/style.js +4 -0
  949. package/src/hooks/text-decoration.js +34 -6
  950. package/src/hooks/text-transform.js +34 -6
  951. package/src/hooks/typography.js +167 -21
  952. package/src/hooks/typography.native.js +64 -0
  953. package/src/hooks/typography.scss +16 -0
  954. package/src/hooks/use-cached-truthy.js +20 -0
  955. package/src/index.js +1 -0
  956. package/src/layouts/flex.js +237 -14
  957. package/src/layouts/flow.js +81 -14
  958. package/src/store/actions.js +248 -378
  959. package/src/store/defaults.js +2 -0
  960. package/src/store/defaults.native.js +15 -0
  961. package/src/store/index.js +1 -2
  962. package/src/store/reducer.js +248 -145
  963. package/src/store/selectors.js +212 -158
  964. package/src/store/test/actions.js +407 -705
  965. package/src/store/test/reducer.js +184 -146
  966. package/src/store/test/selectors.js +197 -177
  967. package/src/style.scss +2 -15
  968. package/src/utils/index.js +1 -0
  969. package/src/utils/parse-css-unit-to-px.js +272 -0
  970. package/src/utils/test/parse-css-unit-to-px.js +166 -0
  971. package/src/utils/transform-styles/transforms/test/wrap.js +1 -1
  972. package/src/utils/transform-styles/transforms/wrap.js +16 -0
  973. package/tsconfig.tsbuildinfo +1 -466
  974. package/build/components/block-list/head.js +0 -27
  975. package/build/components/block-list/head.js.map +0 -1
  976. package/build/components/duotone-control/duotone-picker-popover.js +0 -44
  977. package/build/components/duotone-control/duotone-picker-popover.js.map +0 -1
  978. package/build/components/inspector-advanced-controls/index.js +0 -46
  979. package/build/components/inspector-advanced-controls/index.js.map +0 -1
  980. package/build/components/inspector-controls/index.native.js.map +0 -1
  981. package/build/components/list-view/block-slot.js +0 -121
  982. package/build/components/list-view/block-slot.js.map +0 -1
  983. package/build/components/list-view/editor.js +0 -35
  984. package/build/components/list-view/editor.js.map +0 -1
  985. package/build/components/text-decoration-and-transform/index.js +0 -39
  986. package/build/components/text-decoration-and-transform/index.js.map +0 -1
  987. package/build/components/use-simulated-media-query/index.js +0 -137
  988. package/build/components/use-simulated-media-query/index.js.map +0 -1
  989. package/build/store/controls.js +0 -44
  990. package/build/store/controls.js.map +0 -1
  991. package/build-module/components/block-list/head.js +0 -19
  992. package/build-module/components/block-list/head.js.map +0 -1
  993. package/build-module/components/duotone-control/duotone-picker-popover.js +0 -35
  994. package/build-module/components/duotone-control/duotone-picker-popover.js.map +0 -1
  995. package/build-module/components/inspector-advanced-controls/index.js +0 -36
  996. package/build-module/components/inspector-advanced-controls/index.js.map +0 -1
  997. package/build-module/components/inspector-controls/index.native.js.map +0 -1
  998. package/build-module/components/list-view/block-slot.js +0 -96
  999. package/build-module/components/list-view/block-slot.js.map +0 -1
  1000. package/build-module/components/list-view/editor.js +0 -25
  1001. package/build-module/components/list-view/editor.js.map +0 -1
  1002. package/build-module/components/text-decoration-and-transform/index.js +0 -30
  1003. package/build-module/components/text-decoration-and-transform/index.js.map +0 -1
  1004. package/build-module/components/use-simulated-media-query/index.js +0 -126
  1005. package/build-module/components/use-simulated-media-query/index.js.map +0 -1
  1006. package/build-module/store/controls.js +0 -32
  1007. package/build-module/store/controls.js.map +0 -1
  1008. package/src/components/block-list/head.js +0 -18
  1009. package/src/components/duotone-control/duotone-picker-popover.js +0 -36
  1010. package/src/components/inspector-advanced-controls/README.md +0 -72
  1011. package/src/components/inspector-advanced-controls/index.js +0 -32
  1012. package/src/components/list-view/block-slot.js +0 -120
  1013. package/src/components/list-view/editor.js +0 -29
  1014. package/src/components/text-decoration-and-transform/index.js +0 -36
  1015. package/src/components/text-decoration-and-transform/style.scss +0 -3
  1016. package/src/components/use-simulated-media-query/index.js +0 -144
  1017. package/src/store/controls.js +0 -39
@@ -3,69 +3,124 @@ import { createElement } from "@wordpress/element";
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
- import { find } from 'lodash';
6
+ import { find, kebabCase } from 'lodash';
7
7
  /**
8
8
  * WordPress dependencies
9
9
  */
10
10
 
11
+ import { addFilter } from '@wordpress/hooks';
11
12
  import { hasBlockSupport } from '@wordpress/blocks';
13
+ import TokenList from '@wordpress/token-list';
12
14
  /**
13
15
  * Internal dependencies
14
16
  */
15
17
 
16
- import { cleanEmptyObject } from './utils';
17
18
  import useSetting from '../components/use-setting';
18
19
  import FontFamilyControl from '../components/font-family';
19
20
  export const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';
21
+ /**
22
+ * Filters registered block settings, extending attributes to include
23
+ * the `fontFamily` attribute.
24
+ *
25
+ * @param {Object} settings Original block settings
26
+ * @return {Object} Filtered block settings
27
+ */
20
28
 
21
- const getFontFamilyFromAttributeValue = (fontFamilies, value) => {
22
- const attributeParsed = /var:preset\|font-family\|(.+)/.exec(value);
29
+ function addAttributes(settings) {
30
+ if (!hasBlockSupport(settings, FONT_FAMILY_SUPPORT_KEY)) {
31
+ return settings;
32
+ } // Allow blocks to specify a default value if needed.
23
33
 
24
- if (attributeParsed && attributeParsed[1]) {
25
- const fontFamilyObject = find(fontFamilies, ({
26
- slug
27
- }) => {
28
- return slug === attributeParsed[1];
34
+
35
+ if (!settings.attributes.fontFamily) {
36
+ Object.assign(settings.attributes, {
37
+ fontFamily: {
38
+ type: 'string'
39
+ }
29
40
  });
41
+ }
30
42
 
31
- if (fontFamilyObject) {
32
- return fontFamilyObject.fontFamily;
33
- }
43
+ return settings;
44
+ }
45
+ /**
46
+ * Override props assigned to save component to inject font family.
47
+ *
48
+ * @param {Object} props Additional props applied to save element
49
+ * @param {Object} blockType Block type
50
+ * @param {Object} attributes Block attributes
51
+ * @return {Object} Filtered props applied to save element
52
+ */
53
+
54
+
55
+ function addSaveProps(props, blockType, attributes) {
56
+ if (!hasBlockSupport(blockType, FONT_FAMILY_SUPPORT_KEY)) {
57
+ return props;
34
58
  }
35
59
 
36
- return value;
37
- };
60
+ if (hasBlockSupport(blockType, 'typography.__experimentalSkipSerialization')) {
61
+ return props;
62
+ }
63
+
64
+ if (!(attributes !== null && attributes !== void 0 && attributes.fontFamily)) {
65
+ return props;
66
+ } // Use TokenList to dedupe classes.
67
+
68
+
69
+ const classes = new TokenList(props.className);
70
+ classes.add(`has-${kebabCase(attributes === null || attributes === void 0 ? void 0 : attributes.fontFamily)}-font-family`);
71
+ const newClassName = classes.value;
72
+ props.className = newClassName ? newClassName : undefined;
73
+ return props;
74
+ }
75
+ /**
76
+ * Filters registered block settings to expand the block edit wrapper
77
+ * by applying the desired styles and classnames.
78
+ *
79
+ * @param {Object} settings Original block settings.
80
+ *
81
+ * @return {Object} Filtered block settings.
82
+ */
83
+
84
+
85
+ function addEditProps(settings) {
86
+ if (!hasBlockSupport(settings, FONT_FAMILY_SUPPORT_KEY)) {
87
+ return settings;
88
+ }
89
+
90
+ const existingGetEditWrapperProps = settings.getEditWrapperProps;
91
+
92
+ settings.getEditWrapperProps = attributes => {
93
+ let props = {};
94
+
95
+ if (existingGetEditWrapperProps) {
96
+ props = existingGetEditWrapperProps(attributes);
97
+ }
98
+
99
+ return addSaveProps(props, settings, attributes);
100
+ };
101
+
102
+ return settings;
103
+ }
38
104
 
39
105
  export function FontFamilyEdit({
40
- name,
41
106
  setAttributes,
42
107
  attributes: {
43
- style = {}
108
+ fontFamily
44
109
  }
45
110
  }) {
46
- var _style$typography;
111
+ var _find;
47
112
 
48
113
  const fontFamilies = useSetting('typography.fontFamilies');
49
- const isDisable = useIsFontFamilyDisabled({
50
- name
51
- });
52
-
53
- if (isDisable) {
54
- return null;
55
- }
56
-
57
- const value = getFontFamilyFromAttributeValue(fontFamilies, (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.fontFamily);
114
+ const value = (_find = find(fontFamilies, ({
115
+ slug
116
+ }) => fontFamily === slug)) === null || _find === void 0 ? void 0 : _find.fontFamily;
58
117
 
59
118
  function onChange(newValue) {
60
119
  const predefinedFontFamily = find(fontFamilies, ({
61
- fontFamily
62
- }) => fontFamily === newValue);
120
+ fontFamily: f
121
+ }) => f === newValue);
63
122
  setAttributes({
64
- style: cleanEmptyObject({ ...style,
65
- typography: { ...(style.typography || {}),
66
- fontFamily: predefinedFontFamily ? `var:preset|font-family|${predefinedFontFamily.slug}` : newValue || undefined
67
- }
68
- })
123
+ fontFamily: predefinedFontFamily === null || predefinedFontFamily === void 0 ? void 0 : predefinedFontFamily.slug
69
124
  });
70
125
  }
71
126
 
@@ -89,4 +144,33 @@ export function useIsFontFamilyDisabled({
89
144
  const fontFamilies = useSetting('typography.fontFamilies');
90
145
  return !fontFamilies || fontFamilies.length === 0 || !hasBlockSupport(name, FONT_FAMILY_SUPPORT_KEY);
91
146
  }
147
+ /**
148
+ * Checks if there is a current value set for the font family block support.
149
+ *
150
+ * @param {Object} props Block props.
151
+ * @return {boolean} Whether or not the block has a font family value set.
152
+ */
153
+
154
+ export function hasFontFamilyValue(props) {
155
+ return !!props.attributes.fontFamily;
156
+ }
157
+ /**
158
+ * Resets the font family block support attribute. This can be used when
159
+ * disabling the font family support controls for a block via a progressive
160
+ * discovery panel.
161
+ *
162
+ * @param {Object} props Block props.
163
+ * @param {Object} props.setAttributes Function to set block's attributes.
164
+ */
165
+
166
+ export function resetFontFamily({
167
+ setAttributes
168
+ }) {
169
+ setAttributes({
170
+ fontFamily: undefined
171
+ });
172
+ }
173
+ addFilter('blocks.registerBlockType', 'core/fontFamily/addAttribute', addAttributes);
174
+ addFilter('blocks.getSaveContent.extraProps', 'core/fontFamily/addSaveProps', addSaveProps);
175
+ addFilter('blocks.registerBlockType', 'core/fontFamily/addEditProps', addEditProps);
92
176
  //# sourceMappingURL=font-family.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/font-family.js"],"names":["find","hasBlockSupport","cleanEmptyObject","useSetting","FontFamilyControl","FONT_FAMILY_SUPPORT_KEY","getFontFamilyFromAttributeValue","fontFamilies","value","attributeParsed","exec","fontFamilyObject","slug","fontFamily","FontFamilyEdit","name","setAttributes","attributes","style","isDisable","useIsFontFamilyDisabled","typography","onChange","newValue","predefinedFontFamily","undefined","length"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,mBAAhC;AAEA;AACA;AACA;;AACA,SAASC,gBAAT,QAAiC,SAAjC;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,OAAOC,iBAAP,MAA8B,2BAA9B;AAEA,OAAO,MAAMC,uBAAuB,GAAG,qCAAhC;;AAEP,MAAMC,+BAA+B,GAAG,CAAEC,YAAF,EAAgBC,KAAhB,KAA2B;AAClE,QAAMC,eAAe,GAAG,gCAAgCC,IAAhC,CAAsCF,KAAtC,CAAxB;;AACA,MAAKC,eAAe,IAAIA,eAAe,CAAE,CAAF,CAAvC,EAA+C;AAC9C,UAAME,gBAAgB,GAAGX,IAAI,CAAEO,YAAF,EAAgB,CAAE;AAAEK,MAAAA;AAAF,KAAF,KAAgB;AAC5D,aAAOA,IAAI,KAAKH,eAAe,CAAE,CAAF,CAA/B;AACA,KAF4B,CAA7B;;AAGA,QAAKE,gBAAL,EAAwB;AACvB,aAAOA,gBAAgB,CAACE,UAAxB;AACA;AACD;;AACD,SAAOL,KAAP;AACA,CAXD;;AAaA,OAAO,SAASM,cAAT,CAAyB;AAC/BC,EAAAA,IAD+B;AAE/BC,EAAAA,aAF+B;AAG/BC,EAAAA,UAAU,EAAE;AAAEC,IAAAA,KAAK,GAAG;AAAV;AAHmB,CAAzB,EAIH;AAAA;;AACH,QAAMX,YAAY,GAAGJ,UAAU,CAAE,yBAAF,CAA/B;AACA,QAAMgB,SAAS,GAAGC,uBAAuB,CAAE;AAAEL,IAAAA;AAAF,GAAF,CAAzC;;AAEA,MAAKI,SAAL,EAAiB;AAChB,WAAO,IAAP;AACA;;AAED,QAAMX,KAAK,GAAGF,+BAA+B,CAC5CC,YAD4C,uBAE5CW,KAAK,CAACG,UAFsC,sDAE5C,kBAAkBR,UAF0B,CAA7C;;AAKA,WAASS,QAAT,CAAmBC,QAAnB,EAA8B;AAC7B,UAAMC,oBAAoB,GAAGxB,IAAI,CAChCO,YADgC,EAEhC,CAAE;AAAEM,MAAAA;AAAF,KAAF,KAAsBA,UAAU,KAAKU,QAFL,CAAjC;AAIAP,IAAAA,aAAa,CAAE;AACdE,MAAAA,KAAK,EAAEhB,gBAAgB,CAAE,EACxB,GAAGgB,KADqB;AAExBG,QAAAA,UAAU,EAAE,EACX,IAAKH,KAAK,CAACG,UAAN,IAAoB,EAAzB,CADW;AAEXR,UAAAA,UAAU,EAAEW,oBAAoB,GAC5B,0BAA0BA,oBAAoB,CAACZ,IAAM,EADzB,GAE7BW,QAAQ,IAAIE;AAJJ;AAFY,OAAF;AADT,KAAF,CAAb;AAWA;;AAED,SACC,cAAC,iBAAD;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,YAAY,EAAGlB,YAFhB;AAGC,IAAA,KAAK,EAAGC,KAHT;AAIC,IAAA,QAAQ,EAAGc;AAJZ,IADD;AAQA;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASF,uBAAT,CAAkC;AAAEL,EAAAA;AAAF,CAAlC,EAA6C;AACnD,QAAMR,YAAY,GAAGJ,UAAU,CAAE,yBAAF,CAA/B;AACA,SACC,CAAEI,YAAF,IACAA,YAAY,CAACmB,MAAb,KAAwB,CADxB,IAEA,CAAEzB,eAAe,CAAEc,IAAF,EAAQV,uBAAR,CAHlB;AAKA","sourcesContent":["/**\n * External dependencies\n */\nimport { find } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { cleanEmptyObject } from './utils';\nimport useSetting from '../components/use-setting';\nimport FontFamilyControl from '../components/font-family';\n\nexport const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';\n\nconst getFontFamilyFromAttributeValue = ( fontFamilies, value ) => {\n\tconst attributeParsed = /var:preset\\|font-family\\|(.+)/.exec( value );\n\tif ( attributeParsed && attributeParsed[ 1 ] ) {\n\t\tconst fontFamilyObject = find( fontFamilies, ( { slug } ) => {\n\t\t\treturn slug === attributeParsed[ 1 ];\n\t\t} );\n\t\tif ( fontFamilyObject ) {\n\t\t\treturn fontFamilyObject.fontFamily;\n\t\t}\n\t}\n\treturn value;\n};\n\nexport function FontFamilyEdit( {\n\tname,\n\tsetAttributes,\n\tattributes: { style = {} },\n} ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\tconst isDisable = useIsFontFamilyDisabled( { name } );\n\n\tif ( isDisable ) {\n\t\treturn null;\n\t}\n\n\tconst value = getFontFamilyFromAttributeValue(\n\t\tfontFamilies,\n\t\tstyle.typography?.fontFamily\n\t);\n\n\tfunction onChange( newValue ) {\n\t\tconst predefinedFontFamily = find(\n\t\t\tfontFamilies,\n\t\t\t( { fontFamily } ) => fontFamily === newValue\n\t\t);\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\ttypography: {\n\t\t\t\t\t...( style.typography || {} ),\n\t\t\t\t\tfontFamily: predefinedFontFamily\n\t\t\t\t\t\t? `var:preset|font-family|${ predefinedFontFamily.slug }`\n\t\t\t\t\t\t: newValue || undefined,\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t}\n\n\treturn (\n\t\t<FontFamilyControl\n\t\t\tclassName=\"block-editor-hooks-font-family-control\"\n\t\t\tfontFamilies={ fontFamilies }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\n/**\n * Custom hook that checks if font-family functionality is disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsFontFamilyDisabled( { name } ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\treturn (\n\t\t! fontFamilies ||\n\t\tfontFamilies.length === 0 ||\n\t\t! hasBlockSupport( name, FONT_FAMILY_SUPPORT_KEY )\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/font-family.js"],"names":["find","kebabCase","addFilter","hasBlockSupport","TokenList","useSetting","FontFamilyControl","FONT_FAMILY_SUPPORT_KEY","addAttributes","settings","attributes","fontFamily","Object","assign","type","addSaveProps","props","blockType","classes","className","add","newClassName","value","undefined","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","FontFamilyEdit","setAttributes","fontFamilies","slug","onChange","newValue","predefinedFontFamily","f","useIsFontFamilyDisabled","name","length","hasFontFamilyValue","resetFontFamily"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,SAAf,QAAgC,QAAhC;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,OAAOC,SAAP,MAAsB,uBAAtB;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,OAAOC,iBAAP,MAA8B,2BAA9B;AAEA,OAAO,MAAMC,uBAAuB,GAAG,qCAAhC;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,aAAT,CAAwBC,QAAxB,EAAmC;AAClC,MAAK,CAAEN,eAAe,CAAEM,QAAF,EAAYF,uBAAZ,CAAtB,EAA8D;AAC7D,WAAOE,QAAP;AACA,GAHiC,CAKlC;;;AACA,MAAK,CAAEA,QAAQ,CAACC,UAAT,CAAoBC,UAA3B,EAAwC;AACvCC,IAAAA,MAAM,CAACC,MAAP,CAAeJ,QAAQ,CAACC,UAAxB,EAAoC;AACnCC,MAAAA,UAAU,EAAE;AACXG,QAAAA,IAAI,EAAE;AADK;AADuB,KAApC;AAKA;;AAED,SAAOL,QAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASM,YAAT,CA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SAAS4B,eAAT,CAA0B;AAAEX,EAAAA;AAAF,CAA1B,EAA8C;AACpDA,EAAAA,aAAa,CAAE;AAAEjB,IAAAA,UAAU,EAAEY;AAAd,GAAF,CAAb;AACA;AAEDrB,SAAS,CACR,0BADQ,EAER,8BAFQ,EAGRM,aAHQ,CAAT;AAMAN,SAAS,CACR,kCADQ,EAER,8BAFQ,EAGRa,YAHQ,CAAT;AAMAb,SAAS,CACR,0BADQ,EAER,8BAFQ,EAGRsB,YAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport { find, kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport TokenList from '@wordpress/token-list';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../components/use-setting';\nimport FontFamilyControl from '../components/font-family';\n\nexport const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `fontFamily` attribute.\n *\n * @param {Object} settings Original block settings\n * @return {Object} Filtered block settings\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_FAMILY_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify a default value if needed.\n\tif ( ! settings.attributes.fontFamily ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tfontFamily: {\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 font family.\n *\n * @param {Object} props Additional props applied to save element\n * @param {Object} blockType Block type\n * @param {Object} attributes Block attributes\n * @return {Object} Filtered props applied to save element\n */\nfunction addSaveProps( props, blockType, attributes ) {\n\tif ( ! hasBlockSupport( blockType, FONT_FAMILY_SUPPORT_KEY ) ) {\n\t\treturn props;\n\t}\n\n\tif (\n\t\thasBlockSupport(\n\t\t\tblockType,\n\t\t\t'typography.__experimentalSkipSerialization'\n\t\t)\n\t) {\n\t\treturn props;\n\t}\n\n\tif ( ! attributes?.fontFamily ) {\n\t\treturn props;\n\t}\n\n\t// Use TokenList to dedupe classes.\n\tconst classes = new TokenList( props.className );\n\tclasses.add( `has-${ kebabCase( attributes?.fontFamily ) }-font-family` );\n\tconst newClassName = classes.value;\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to expand the block edit wrapper\n * by applying the desired styles and classnames.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addEditProps( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_FAMILY_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\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\nexport function FontFamilyEdit( {\n\tsetAttributes,\n\tattributes: { fontFamily },\n} ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\n\tconst value = find( fontFamilies, ( { slug } ) => fontFamily === slug )\n\t\t?.fontFamily;\n\n\tfunction onChange( newValue ) {\n\t\tconst predefinedFontFamily = find(\n\t\t\tfontFamilies,\n\t\t\t( { fontFamily: f } ) => f === newValue\n\t\t);\n\t\tsetAttributes( {\n\t\t\tfontFamily: predefinedFontFamily?.slug,\n\t\t} );\n\t}\n\n\treturn (\n\t\t<FontFamilyControl\n\t\t\tclassName=\"block-editor-hooks-font-family-control\"\n\t\t\tfontFamilies={ fontFamilies }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\n/**\n * Custom hook that checks if font-family functionality is disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsFontFamilyDisabled( { name } ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\treturn (\n\t\t! fontFamilies ||\n\t\tfontFamilies.length === 0 ||\n\t\t! hasBlockSupport( name, FONT_FAMILY_SUPPORT_KEY )\n\t);\n}\n\n/**\n * Checks if there is a current value set for the font family block support.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a font family value set.\n */\nexport function hasFontFamilyValue( props ) {\n\treturn !! props.attributes.fontFamily;\n}\n\n/**\n * Resets the font family block support attribute. This can be used when\n * disabling the font family support controls for a block via a progressive\n * discovery panel.\n *\n * @param {Object} props Block props.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetFontFamily( { setAttributes } ) {\n\tsetAttributes( { fontFamily: undefined } );\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/fontFamily/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/fontFamily/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/fontFamily/addEditProps',\n\taddEditProps\n);\n"]}
@@ -115,7 +115,6 @@ export function FontSizeEdit(props) {
115
115
  },
116
116
  setAttributes
117
117
  } = props;
118
- const isDisabled = useIsFontSizeDisabled(props);
119
118
  const fontSizes = useSetting('typography.fontSizes');
120
119
 
121
120
  const onChange = value => {
@@ -130,15 +129,54 @@ export function FontSizeEdit(props) {
130
129
  });
131
130
  };
132
131
 
133
- if (isDisabled) {
134
- return null;
135
- }
136
-
137
132
  const fontSizeObject = getFontSize(fontSizes, fontSize, style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.fontSize);
138
133
  const fontSizeValue = (fontSizeObject === null || fontSizeObject === void 0 ? void 0 : fontSizeObject.size) || (style === null || style === void 0 ? void 0 : (_style$typography2 = style.typography) === null || _style$typography2 === void 0 ? void 0 : _style$typography2.fontSize) || fontSize;
139
134
  return createElement(FontSizePicker, {
140
135
  onChange: onChange,
141
- value: fontSizeValue
136
+ value: fontSizeValue,
137
+ withReset: false
138
+ });
139
+ }
140
+ /**
141
+ * Checks if there is a current value set for the font size block support.
142
+ *
143
+ * @param {Object} props Block props.
144
+ * @return {boolean} Whether or not the block has a font size value set.
145
+ */
146
+
147
+ export function hasFontSizeValue(props) {
148
+ var _style$typography3;
149
+
150
+ const {
151
+ fontSize,
152
+ style
153
+ } = props.attributes;
154
+ return !!fontSize || !!(style !== null && style !== void 0 && (_style$typography3 = style.typography) !== null && _style$typography3 !== void 0 && _style$typography3.fontSize);
155
+ }
156
+ /**
157
+ * Resets the font size block support attribute. This can be used when
158
+ * disabling the font size support controls for a block via a progressive
159
+ * discovery panel.
160
+ *
161
+ * @param {Object} props Block props.
162
+ * @param {Object} props.attributes Block's attributes.
163
+ * @param {Object} props.setAttributes Function to set block's attributes.
164
+ */
165
+
166
+ export function resetFontSize({
167
+ attributes = {},
168
+ setAttributes
169
+ }) {
170
+ const {
171
+ style
172
+ } = attributes;
173
+ setAttributes({
174
+ fontSize: undefined,
175
+ style: cleanEmptyObject({ ...style,
176
+ typography: { ...(style === null || style === void 0 ? void 0 : style.typography),
177
+ fontSize: undefined
178
+ }
179
+ })
142
180
  });
143
181
  }
144
182
  /**
@@ -166,7 +204,7 @@ export function useIsFontSizeDisabled({
166
204
  */
167
205
 
168
206
  const withFontSizeInlineStyles = createHigherOrderComponent(BlockListBlock => props => {
169
- var _style$typography3, _style$typography4;
207
+ var _style$typography4, _style$typography5;
170
208
 
171
209
  const fontSizes = useSetting('typography.fontSizes');
172
210
  const {
@@ -181,11 +219,11 @@ const withFontSizeInlineStyles = createHigherOrderComponent(BlockListBlock => pr
181
219
  // doesn't already have an inline font size,
182
220
  // and does have a class to extract the font size from.
183
221
 
184
- if (!hasBlockSupport(blockName, FONT_SIZE_SUPPORT_KEY) || hasBlockSupport(blockName, 'typography.__experimentalSkipSerialization') || !fontSize || style !== null && style !== void 0 && (_style$typography3 = style.typography) !== null && _style$typography3 !== void 0 && _style$typography3.fontSize) {
222
+ if (!hasBlockSupport(blockName, FONT_SIZE_SUPPORT_KEY) || hasBlockSupport(blockName, 'typography.__experimentalSkipSerialization') || !fontSize || style !== null && style !== void 0 && (_style$typography4 = style.typography) !== null && _style$typography4 !== void 0 && _style$typography4.fontSize) {
185
223
  return createElement(BlockListBlock, props);
186
224
  }
187
225
 
188
- const fontSizeValue = getFontSize(fontSizes, fontSize, style === null || style === void 0 ? void 0 : (_style$typography4 = style.typography) === null || _style$typography4 === void 0 ? void 0 : _style$typography4.fontSize).size;
226
+ const fontSizeValue = getFontSize(fontSizes, fontSize, style === null || style === void 0 ? void 0 : (_style$typography5 = style.typography) === null || _style$typography5 === void 0 ? void 0 : _style$typography5.fontSize).size;
189
227
  const newProps = { ...props,
190
228
  wrapperProps: { ...wrapperProps,
191
229
  style: {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/font-size.js"],"names":["addFilter","hasBlockSupport","TokenList","createHigherOrderComponent","getFontSize","getFontSizeClass","getFontSizeObjectByValue","FontSizePicker","cleanEmptyObject","useSetting","FONT_SIZE_SUPPORT_KEY","addAttributes","settings","attributes","fontSize","Object","assign","type","addSaveProps","props","blockType","classes","className","add","newClassName","value","undefined","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","FontSizeEdit","style","setAttributes","isDisabled","useIsFontSizeDisabled","fontSizes","onChange","fontSizeSlug","slug","typography","fontSizeObject","fontSizeValue","size","name","blockName","hasFontSizes","length","withFontSizeInlineStyles","BlockListBlock","wrapperProps","newProps"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,kBAA1B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,OAAOC,SAAP,MAAsB,uBAAtB;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AAEA;AACA;AACA;;AACA,SACCC,WADD,EAECC,gBAFD,EAGCC,wBAHD,EAICC,cAJD,QAKO,0BALP;AAMA,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AjB,IACAT,eAAe,CACd2C,SADc,EAEd,4CAFc,CADf,IAKA,CAAE9B,QALF,IAMAiB,KANA,aAMAA,KANA,qCAMAA,KAAK,CAAEQ,UANP,+CAMA,mBAAmBzB,QAPpB,EAQE;AACD,WAAO,cAAC,cAAD,EAAqBK,KAArB,CAAP;AACA;;AAED,QAAMsB,aAAa,GAAGrC,WAAW,CAChC+B,SADgC,EAEhCrB,QAFgC,EAGhCiB,KAHgC,aAGhCA,KAHgC,6CAGhCA,KAAK,CAAEQ,UAHyB,uDAGhC,mBAAmBzB,QAHa,CAAX,CAIpB4B,IAJF;AAMA,QAAMQ,QAAQ,GAAG,EAChB,GAAG/B,KADa;AAEhB8B,IAAAA,YAAY,EAAE,EACb,GAAGA,YADU;AAEblB,MAAAA,KAAK,EAAE;AACNjB,QAAAA,QAAQ,EAAE2B,aADJ;AAEN,YAAGQ,YAAH,aAAGA,YAAH,uBAAGA,YAAY,CAAElB,KAAjB;AAFM;AAFM;AAFE,GAAjB;AAWA,SAAO,cAAC,cAAD,EAAqBmB,QAArB,CAAP;AACA,CA3CyD,EA4C1D,0BA5C0D,CAA3D;AA+CAlD,SAAS,CACR,0BADQ,EAER,wBAFQ,EAGRW,aAHQ,CAAT;AAMAX,SAAS,CACR,kCADQ,EAER,wBAFQ,EAGRkB,YAHQ,CAAT;AAMAlB,SAAS,CAAE,0BAAF,EAA8B,wBAA9B,EAAwD2B,YAAxD,CAAT;AAEA3B,SAAS,CACR,uBADQ,EAER,6CAFQ,EAGR+C,wBAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport TokenList from '@wordpress/token-list';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetFontSize,\n\tgetFontSizeClass,\n\tgetFontSizeObjectByValue,\n\tFontSizePicker,\n} from '../components/font-sizes';\nimport { cleanEmptyObject } from './utils';\nimport useSetting from '../components/use-setting';\n\nexport const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize';\n\n/**\n * Filters registered block settings, extending attributes to include\n * `fontSize` and `fontWeight` attributes.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify a default value if needed.\n\tif ( ! settings.attributes.fontSize ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tfontSize: {\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 font size.\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 */\nfunction addSaveProps( props, blockType, attributes ) {\n\tif ( ! hasBlockSupport( blockType, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn props;\n\t}\n\n\tif (\n\t\thasBlockSupport(\n\t\t\tblockType,\n\t\t\t'typography.__experimentalSkipSerialization'\n\t\t)\n\t) {\n\t\treturn props;\n\t}\n\n\t// Use TokenList to dedupe classes.\n\tconst classes = new TokenList( props.className );\n\tclasses.add( getFontSizeClass( attributes.fontSize ) );\n\tconst newClassName = classes.value;\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to expand the block edit wrapper\n * by applying the desired styles and classnames.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addEditProps( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\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\n/**\n * Inspector control panel containing the font size related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Font size edit element.\n */\nexport function FontSizeEdit( props ) {\n\tconst {\n\t\tattributes: { fontSize, style },\n\t\tsetAttributes,\n\t} = props;\n\tconst isDisabled = useIsFontSizeDisabled( props );\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\n\tconst onChange = ( value ) => {\n\t\tconst fontSizeSlug = getFontSizeObjectByValue( fontSizes, value ).slug;\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\ttypography: {\n\t\t\t\t\t...style?.typography,\n\t\t\t\t\tfontSize: fontSizeSlug ? undefined : value,\n\t\t\t\t},\n\t\t\t} ),\n\t\t\tfontSize: fontSizeSlug,\n\t\t} );\n\t};\n\n\tif ( isDisabled ) {\n\t\treturn null;\n\t}\n\n\tconst fontSizeObject = getFontSize(\n\t\tfontSizes,\n\t\tfontSize,\n\t\tstyle?.typography?.fontSize\n\t);\n\n\tconst fontSizeValue =\n\t\tfontSizeObject?.size || style?.typography?.fontSize || fontSize;\n\n\treturn <FontSizePicker onChange={ onChange } value={ fontSizeValue } />;\n}\n\n/**\n * Custom hook that checks if font-size settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsFontSizeDisabled( { name: blockName } = {} ) {\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\tconst hasFontSizes = !! fontSizes?.length;\n\n\treturn (\n\t\t! hasBlockSupport( blockName, FONT_SIZE_SUPPORT_KEY ) || ! hasFontSizes\n\t);\n}\n\n/**\n * Add inline styles for font sizes.\n * Ideally, this is not needed and themes load the font-size classes on the\n * editor.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withFontSizeInlineStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\t\tconst {\n\t\t\tname: blockName,\n\t\t\tattributes: { fontSize, style },\n\t\t\twrapperProps,\n\t\t} = props;\n\n\t\t// Only add inline styles if the block supports font sizes,\n\t\t// doesn't skip serialization of font sizes,\n\t\t// doesn't already have an inline font size,\n\t\t// and does have a class to extract the font size from.\n\t\tif (\n\t\t\t! hasBlockSupport( blockName, FONT_SIZE_SUPPORT_KEY ) ||\n\t\t\thasBlockSupport(\n\t\t\t\tblockName,\n\t\t\t\t'typography.__experimentalSkipSerialization'\n\t\t\t) ||\n\t\t\t! fontSize ||\n\t\t\tstyle?.typography?.fontSize\n\t\t) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\tconst fontSizeValue = getFontSize(\n\t\t\tfontSizes,\n\t\t\tfontSize,\n\t\t\tstyle?.typography?.fontSize\n\t\t).size;\n\n\t\tconst newProps = {\n\t\t\t...props,\n\t\t\twrapperProps: {\n\t\t\t\t...wrapperProps,\n\t\t\t\tstyle: {\n\t\t\t\t\tfontSize: fontSizeValue,\n\t\t\t\t\t...wrapperProps?.style,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\t\treturn <BlockListBlock { ...newProps } />;\n\t},\n\t'withFontSizeInlineStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/font/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/font/addSaveProps',\n\taddSaveProps\n);\n\naddFilter( 'blocks.registerBlockType', 'core/font/addEditProps', addEditProps );\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/font-size/with-font-size-inline-styles',\n\twithFontSizeInlineStyles\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/font-size.js"],"names":["addFilter","hasBlockSupport","TokenList","createHigherOrderComponent","getFontSize","getFontSizeClass","getFontSizeObjectByValue","FontSizePicker","cleanEmptyObject","useSetting","FONT_SIZE_SUPPORT_KEY","addAttributes","settings","attributes","fontSize","Object","assign","type","addSaveProps","props","blockType","classes","className","add","newClassName","value","undefined","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","FontSizeEdit","style","setAttributes","fontSizes","onChange","fontSizeSlug","slug","typography","fontSizeObject","fontSizeValue","size","hasFontSizeValue","resetFontSize","useIsFontSizeDisabled","name","blockName","hasFontSizes","length","withFontSizeInlineStyles","BlockListBlock","wrapperProps","newProps"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,kBAA1B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,OAAOC,SAAP,MAAsB,uBAAtB;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AAEA;AACA;AACA;;AACA,SACCC,WADD,EAECC,gBAFD,EAGCC,wBAHD,EAICC,cAJD,QAKO,0BALP;AAMA,SAASC,gBAAT,QAAiC,SAAjC;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AAEA,OAAO,MAAMC,qBAAqB,GAAG,qBAA9B;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,aAAT,CAAwBC,QAAxB,EAAmC;AAClC,MAAK,CAAEX,eAAe,CAAEW,QAAF,EAAYF,qBAAZ,CAAtB,EAA4D;AAC3D,WAAOE,QAAP;AACA,GAHiC,CAKlC;;;AACA,MAAK,CAAEA,QAAQ,CAACC,UAAT,CAAoBC,QAA3B,EAAsC;AACrCC,IAAAA,MAAM,CAACC,MAAP,CAAeJ,QAAQ,CAACC,UAAxB,EAAoC;AACnCC,MAAAA,QAAQ,EAAE;AACTG,QAAAA,IAAI,EAAE;AADG;AADyB,KAApC;AAKA;;AAED,SAAOL,QAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASM,YAAT,CAAuBC,KAAvB,EAA8BC,SAA9B,EAAyCP,UAAzC,EAAsD;AACrD,MAAK,CAAEZ,eAAe,CAA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AAE4C,SAAF,EAAanC,qBAAb,CAAjB,IACAT,eAAe,CACd4C,SADc,EAEd,4CAFc,CADf,IAKA,CAAE/B,QALF,IAMAiB,KANA,aAMAA,KANA,qCAMAA,KAAK,CAAEM,UANP,+CAMA,mBAAmBvB,QAPpB,EAQE;AACD,WAAO,cAAC,cAAD,EAAqBK,KAArB,CAAP;AACA;;AAED,QAAMoB,aAAa,GAAGnC,WAAW,CAChC6B,SADgC,EAEhCnB,QAFgC,EAGhCiB,KAHgC,aAGhCA,KAHgC,6CAGhCA,KAAK,CAAEM,UAHyB,uDAGhC,mBAAmBvB,QAHa,CAAX,CAIpB0B,IAJF;AAMA,QAAMW,QAAQ,GAAG,EAChB,GAAGhC,KADa;AAEhB+B,IAAAA,YAAY,EAAE,EACb,GAAGA,YADU;AAEbnB,MAAAA,KAAK,EAAE;AACNjB,QAAAA,QAAQ,EAAEyB,aADJ;AAEN,YAAGW,YAAH,aAAGA,YAAH,uBAAGA,YAAY,CAAEnB,KAAjB;AAFM;AAFM;AAFE,GAAjB;AAWA,SAAO,cAAC,cAAD,EAAqBoB,QAArB,CAAP;AACA,CA3CyD,EA4C1D,0BA5C0D,CAA3D;AA+CAnD,SAAS,CACR,0BADQ,EAER,wBAFQ,EAGRW,aAHQ,CAAT;AAMAX,SAAS,CACR,kCADQ,EAER,wBAFQ,EAGRkB,YAHQ,CAAT;AAMAlB,SAAS,CAAE,0BAAF,EAA8B,wBAA9B,EAAwD2B,YAAxD,CAAT;AAEA3B,SAAS,CACR,uBADQ,EAER,6CAFQ,EAGRgD,wBAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport TokenList from '@wordpress/token-list';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetFontSize,\n\tgetFontSizeClass,\n\tgetFontSizeObjectByValue,\n\tFontSizePicker,\n} from '../components/font-sizes';\nimport { cleanEmptyObject } from './utils';\nimport useSetting from '../components/use-setting';\n\nexport const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize';\n\n/**\n * Filters registered block settings, extending attributes to include\n * `fontSize` and `fontWeight` attributes.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify a default value if needed.\n\tif ( ! settings.attributes.fontSize ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tfontSize: {\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 font size.\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 */\nfunction addSaveProps( props, blockType, attributes ) {\n\tif ( ! hasBlockSupport( blockType, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn props;\n\t}\n\n\tif (\n\t\thasBlockSupport(\n\t\t\tblockType,\n\t\t\t'typography.__experimentalSkipSerialization'\n\t\t)\n\t) {\n\t\treturn props;\n\t}\n\n\t// Use TokenList to dedupe classes.\n\tconst classes = new TokenList( props.className );\n\tclasses.add( getFontSizeClass( attributes.fontSize ) );\n\tconst newClassName = classes.value;\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to expand the block edit wrapper\n * by applying the desired styles and classnames.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addEditProps( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\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\n/**\n * Inspector control panel containing the font size related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Font size edit element.\n */\nexport function FontSizeEdit( props ) {\n\tconst {\n\t\tattributes: { fontSize, style },\n\t\tsetAttributes,\n\t} = props;\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\n\tconst onChange = ( value ) => {\n\t\tconst fontSizeSlug = getFontSizeObjectByValue( fontSizes, value ).slug;\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\ttypography: {\n\t\t\t\t\t...style?.typography,\n\t\t\t\t\tfontSize: fontSizeSlug ? undefined : value,\n\t\t\t\t},\n\t\t\t} ),\n\t\t\tfontSize: fontSizeSlug,\n\t\t} );\n\t};\n\n\tconst fontSizeObject = getFontSize(\n\t\tfontSizes,\n\t\tfontSize,\n\t\tstyle?.typography?.fontSize\n\t);\n\n\tconst fontSizeValue =\n\t\tfontSizeObject?.size || style?.typography?.fontSize || fontSize;\n\n\treturn (\n\t\t<FontSizePicker\n\t\t\tonChange={ onChange }\n\t\t\tvalue={ fontSizeValue }\n\t\t\twithReset={ false }\n\t\t/>\n\t);\n}\n\n/**\n * Checks if there is a current value set for the font size block support.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a font size value set.\n */\nexport function hasFontSizeValue( props ) {\n\tconst { fontSize, style } = props.attributes;\n\treturn !! fontSize || !! style?.typography?.fontSize;\n}\n\n/**\n * Resets the font size block support attribute. This can be used when\n * disabling the font size support controls for a block via a progressive\n * discovery panel.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetFontSize( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\n\tsetAttributes( {\n\t\tfontSize: undefined,\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\ttypography: {\n\t\t\t\t...style?.typography,\n\t\t\t\tfontSize: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if font-size settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsFontSizeDisabled( { name: blockName } = {} ) {\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\tconst hasFontSizes = !! fontSizes?.length;\n\n\treturn (\n\t\t! hasBlockSupport( blockName, FONT_SIZE_SUPPORT_KEY ) || ! hasFontSizes\n\t);\n}\n\n/**\n * Add inline styles for font sizes.\n * Ideally, this is not needed and themes load the font-size classes on the\n * editor.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withFontSizeInlineStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\t\tconst {\n\t\t\tname: blockName,\n\t\t\tattributes: { fontSize, style },\n\t\t\twrapperProps,\n\t\t} = props;\n\n\t\t// Only add inline styles if the block supports font sizes,\n\t\t// doesn't skip serialization of font sizes,\n\t\t// doesn't already have an inline font size,\n\t\t// and does have a class to extract the font size from.\n\t\tif (\n\t\t\t! hasBlockSupport( blockName, FONT_SIZE_SUPPORT_KEY ) ||\n\t\t\thasBlockSupport(\n\t\t\t\tblockName,\n\t\t\t\t'typography.__experimentalSkipSerialization'\n\t\t\t) ||\n\t\t\t! fontSize ||\n\t\t\tstyle?.typography?.fontSize\n\t\t) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\tconst fontSizeValue = getFontSize(\n\t\t\tfontSizes,\n\t\t\tfontSize,\n\t\t\tstyle?.typography?.fontSize\n\t\t).size;\n\n\t\tconst newProps = {\n\t\t\t...props,\n\t\t\twrapperProps: {\n\t\t\t\t...wrapperProps,\n\t\t\t\tstyle: {\n\t\t\t\t\tfontSize: fontSizeValue,\n\t\t\t\t\t...wrapperProps?.style,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\t\treturn <BlockListBlock { ...newProps } />;\n\t},\n\t'withFontSizeInlineStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/font/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/font/addSaveProps',\n\taddSaveProps\n);\n\naddFilter( 'blocks.registerBlockType', 'core/font/addEditProps', addEditProps );\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/font-size/with-font-size-inline-styles',\n\twithFontSizeInlineStyles\n);\n"]}
@@ -0,0 +1,140 @@
1
+ import { createElement, Fragment } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { __ } from '@wordpress/i18n';
7
+ import { Platform } from '@wordpress/element';
8
+ import { getBlockSupport } from '@wordpress/blocks';
9
+ import { __experimentalUseCustomUnits as useCustomUnits, __experimentalUnitControl as UnitControl } from '@wordpress/components';
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+
14
+ import { __unstableUseBlockRef as useBlockRef } from '../components/block-list/use-block-props/use-block-refs';
15
+ import useSetting from '../components/use-setting';
16
+ import { SPACING_SUPPORT_KEY } from './dimensions';
17
+ import { cleanEmptyObject } from './utils';
18
+ /**
19
+ * Determines if there is gap support.
20
+ *
21
+ * @param {string|Object} blockType Block name or Block Type object.
22
+ * @return {boolean} Whether there is support.
23
+ */
24
+
25
+ export function hasGapSupport(blockType) {
26
+ const support = getBlockSupport(blockType, SPACING_SUPPORT_KEY);
27
+ return !!(true === support || support !== null && support !== void 0 && support.blockGap);
28
+ }
29
+ /**
30
+ * Checks if there is a current value in the gap block support attributes.
31
+ *
32
+ * @param {Object} props Block props.
33
+ * @return {boolean} Whether or not the block has a gap value set.
34
+ */
35
+
36
+ export function hasGapValue(props) {
37
+ var _props$attributes$sty, _props$attributes$sty2;
38
+
39
+ return ((_props$attributes$sty = props.attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : (_props$attributes$sty2 = _props$attributes$sty.spacing) === null || _props$attributes$sty2 === void 0 ? void 0 : _props$attributes$sty2.blockGap) !== undefined;
40
+ }
41
+ /**
42
+ * Resets the gap block support attribute. This can be used when disabling
43
+ * the gap support controls for a block via a progressive discovery panel.
44
+ *
45
+ * @param {Object} props Block props.
46
+ * @param {Object} props.attributes Block's attributes.
47
+ * @param {Object} props.setAttributes Function to set block's attributes.
48
+ */
49
+
50
+ export function resetGap({
51
+ attributes = {},
52
+ setAttributes
53
+ }) {
54
+ const {
55
+ style
56
+ } = attributes;
57
+ setAttributes({
58
+ style: { ...style,
59
+ spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing),
60
+ blockGap: undefined
61
+ }
62
+ }
63
+ });
64
+ }
65
+ /**
66
+ * Custom hook that checks if gap settings have been disabled.
67
+ *
68
+ * @param {string} name The name of the block.
69
+ * @return {boolean} Whether the gap setting is disabled.
70
+ */
71
+
72
+ export function useIsGapDisabled({
73
+ name: blockName
74
+ } = {}) {
75
+ const isDisabled = !useSetting('spacing.blockGap');
76
+ return !hasGapSupport(blockName) || isDisabled;
77
+ }
78
+ /**
79
+ * Inspector control panel containing the gap related configuration
80
+ *
81
+ * @param {Object} props
82
+ *
83
+ * @return {WPElement} Gap edit element.
84
+ */
85
+
86
+ export function GapEdit(props) {
87
+ var _style$spacing;
88
+
89
+ const {
90
+ clientId,
91
+ attributes: {
92
+ style
93
+ },
94
+ setAttributes
95
+ } = props;
96
+ const units = useCustomUnits({
97
+ availableUnits: useSetting('spacing.units') || ['%', 'px', 'em', 'rem', 'vw']
98
+ });
99
+ const ref = useBlockRef(clientId);
100
+
101
+ if (useIsGapDisabled(props)) {
102
+ return null;
103
+ }
104
+
105
+ const onChange = next => {
106
+ var _window;
107
+
108
+ const newStyle = { ...style,
109
+ spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing),
110
+ blockGap: next
111
+ }
112
+ };
113
+ setAttributes({
114
+ style: cleanEmptyObject(newStyle)
115
+ }); // In Safari, changing the `gap` CSS value on its own will not trigger the layout
116
+ // to be recalculated / re-rendered. To force the updated gap to re-render, here
117
+ // we replace the block's node with itself.
118
+
119
+ const isSafari = ((_window = window) === null || _window === void 0 ? void 0 : _window.navigator.userAgent) && window.navigator.userAgent.includes('Safari') && !window.navigator.userAgent.includes('Chrome ') && !window.navigator.userAgent.includes('Chromium ');
120
+
121
+ if (ref.current && isSafari) {
122
+ var _ref$current$parentNo;
123
+
124
+ (_ref$current$parentNo = ref.current.parentNode) === null || _ref$current$parentNo === void 0 ? void 0 : _ref$current$parentNo.replaceChild(ref.current, ref.current);
125
+ }
126
+ };
127
+
128
+ return Platform.select({
129
+ web: createElement(Fragment, null, createElement(UnitControl, {
130
+ label: __('Block spacing'),
131
+ __unstableInputWidth: "80px",
132
+ min: 0,
133
+ onChange: onChange,
134
+ units: units,
135
+ value: style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.blockGap
136
+ })),
137
+ native: null
138
+ });
139
+ }
140
+ //# sourceMappingURL=gap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/gap.js"],"names":["__","Platform","getBlockSupport","__experimentalUseCustomUnits","useCustomUnits","__experimentalUnitControl","UnitControl","__unstableUseBlockRef","useBlockRef","useSetting","SPACING_SUPPORT_KEY","cleanEmptyObject","hasGapSupport","blockType","support","blockGap","hasGapValue","props","attributes","style","spacing","undefined","resetGap","setAttributes","useIsGapDisabled","name","blockName","isDisabled","GapEdit","clientId","units","availableUnits","ref","onChange","next","newStyle","isSafari","window","navigator","userAgent","includes","current","parentNode","replaceChild","select","web","native"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SACCC,4BAA4B,IA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2BC,QAA3B,CAAqC,WAArC,CAJH;;AAMA,QAAKR,GAAG,CAACS,OAAJ,IAAeL,QAApB,EAA+B;AAAA;;AAC9B,+BAAAJ,GAAG,CAACS,OAAJ,CAAYC,UAAZ,gFAAwBC,YAAxB,CAAsCX,GAAG,CAACS,OAA1C,EAAmDT,GAAG,CAACS,OAAvD;AACA;AACD,GAzBD;;AA2BA,SAAOxC,QAAQ,CAAC2C,MAAT,CAAiB;AACvBC,IAAAA,GAAG,EACF,8BACC,cAAC,WAAD;AACC,MAAA,KAAK,EAAG7C,EAAE,CAAE,eAAF,CADX;AAEC,MAAA,oBAAoB,EAAC,MAFtB;AAGC,MAAA,GAAG,EAAG,CAHP;AAIC,MAAA,QAAQ,EAAGiC,QAJZ;AAKC,MAAA,KAAK,EAAGH,KALT;AAMC,MAAA,KAAK,EAAGX,KAAH,aAAGA,KAAH,yCAAGA,KAAK,CAAEC,OAAV,mDAAG,eAAgBL;AANzB,MADD,CAFsB;AAavB+B,IAAAA,MAAM,EAAE;AAbe,GAAjB,CAAP;AAeA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Platform } from '@wordpress/element';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { __unstableUseBlockRef as useBlockRef } from '../components/block-list/use-block-props/use-block-refs';\nimport useSetting from '../components/use-setting';\nimport { SPACING_SUPPORT_KEY } from './dimensions';\nimport { cleanEmptyObject } from './utils';\n\n/**\n * Determines if there is gap support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n * @return {boolean} Whether there is support.\n */\nexport function hasGapSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, SPACING_SUPPORT_KEY );\n\treturn !! ( true === support || support?.blockGap );\n}\n\n/**\n * Checks if there is a current value in the gap block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a gap value set.\n */\nexport function hasGapValue( props ) {\n\treturn props.attributes.style?.spacing?.blockGap !== undefined;\n}\n\n/**\n * Resets the gap block support attribute. This can be used when disabling\n * the gap support controls for a block via a progressive discovery panel.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetGap( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: {\n\t\t\t...style,\n\t\t\tspacing: {\n\t\t\t\t...style?.spacing,\n\t\t\t\tblockGap: undefined,\n\t\t\t},\n\t\t},\n\t} );\n}\n\n/**\n * Custom hook that checks if gap settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether the gap setting is disabled.\n */\nexport function useIsGapDisabled( { name: blockName } = {} ) {\n\tconst isDisabled = ! useSetting( 'spacing.blockGap' );\n\treturn ! hasGapSupport( blockName ) || isDisabled;\n}\n\n/**\n * Inspector control panel containing the gap related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Gap edit element.\n */\nexport function GapEdit( props ) {\n\tconst {\n\t\tclientId,\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t} = props;\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t],\n\t} );\n\n\tconst ref = useBlockRef( clientId );\n\n\tif ( useIsGapDisabled( props ) ) {\n\t\treturn null;\n\t}\n\n\tconst onChange = ( next ) => {\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tspacing: {\n\t\t\t\t...style?.spacing,\n\t\t\t\tblockGap: next,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\n\t\t// In Safari, changing the `gap` CSS value on its own will not trigger the layout\n\t\t// to be recalculated / re-rendered. To force the updated gap to re-render, here\n\t\t// we replace the block's node with itself.\n\t\tconst isSafari =\n\t\t\twindow?.navigator.userAgent &&\n\t\t\twindow.navigator.userAgent.includes( 'Safari' ) &&\n\t\t\t! window.navigator.userAgent.includes( 'Chrome ' ) &&\n\t\t\t! window.navigator.userAgent.includes( 'Chromium ' );\n\n\t\tif ( ref.current && isSafari ) {\n\t\t\tref.current.parentNode?.replaceChild( ref.current, ref.current );\n\t\t}\n\t};\n\n\treturn Platform.select( {\n\t\tweb: (\n\t\t\t<>\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tunits={ units }\n\t\t\t\t\tvalue={ style?.spacing?.blockGap }\n\t\t\t\t/>\n\t\t\t</>\n\t\t),\n\t\tnative: null,\n\t} );\n}\n"]}
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
+ import './compat';
4
5
  import './align';
6
+ import './lock';
5
7
  import './anchor';
6
8
  import './custom-class-name';
7
9
  import './generated-class-name';
@@ -15,4 +17,5 @@ export { useCustomSides } from './dimensions';
15
17
  export { getBorderClassesAndStyles, useBorderProps } from './use-border-props';
16
18
  export { getColorClassesAndStyles, useColorProps } from './use-color-props';
17
19
  export { getSpacingClassesAndStyles } from './use-spacing-props';
20
+ export { useCachedTruthy } from './use-cached-truthy';
18
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/index.js"],"names":["useCustomSides","getBorderClassesAndStyles","useBorderProps","getColorClassesAndStyles","useColorProps","getSpacingClassesAndStyles"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,SAAP;AACA,OAAO,UAAP;AACA,OAAO,qBAAP;AACA,OAAO,wBAAP;AACA,OAAO,SAAP;AACA,OAAO,SAAP;AACA,OAAO,WAAP;AACA,OAAO,aAAP;AACA,OAAO,gBAAP;AACA,OAAO,UAAP;AAEA,SAASA,cAAT,QAA+B,cAA/B;AACA,SAASC,yBAAT,EAAoCC,cAApC,QAA0D,oBAA1D;AACA,SAASC,wBAAT,EAAmCC,aAAnC,QAAwD,mBAAxD;AACA,SAASC,0BAAT,QAA2C,qBAA3C","sourcesContent":["/**\n * Internal dependencies\n */\nimport './align';\nimport './anchor';\nimport './custom-class-name';\nimport './generated-class-name';\nimport './style';\nimport './color';\nimport './duotone';\nimport './font-size';\nimport './border-color';\nimport './layout';\n\nexport { useCustomSides } from './dimensions';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/index.js"],"names":["useCustomSides","getBorderClassesAndStyles","useBorderProps","getColorClassesAndStyles","useColorProps","getSpacingClassesAndStyles","useCachedTruthy"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,UAAP;AACA,OAAO,SAAP;AACA,OAAO,QAAP;AACA,OAAO,UAAP;AACA,OAAO,qBAAP;AACA,OAAO,wBAAP;AACA,OAAO,SAAP;AACA,OAAO,SAAP;AACA,OAAO,WAAP;AACA,OAAO,aAAP;AACA,OAAO,gBAAP;AACA,OAAO,UAAP;AAEA,SAASA,cAAT,QAA+B,cAA/B;AACA,SAASC,yBAAT,EAAoCC,cAApC,QAA0D,oBAA1D;AACA,SAASC,wBAAT,EAAmCC,aAAnC,QAAwD,mBAAxD;AACA,SAASC,0BAAT,QAA2C,qBAA3C;AACA,SAASC,eAAT,QAAgC,qBAAhC","sourcesContent":["/**\n * Internal dependencies\n */\nimport './compat';\nimport './align';\nimport './lock';\nimport './anchor';\nimport './custom-class-name';\nimport './generated-class-name';\nimport './style';\nimport './color';\nimport './duotone';\nimport './font-size';\nimport './border-color';\nimport './layout';\n\nexport { useCustomSides } from './dimensions';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { useCachedTruthy } from './use-cached-truthy';\n"]}
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
+ import './compat';
4
5
  import './align';
5
6
  import './anchor';
6
7
  import './custom-class-name';
@@ -11,4 +12,5 @@ import './font-size';
11
12
  export { getBorderClassesAndStyles, useBorderProps } from './use-border-props';
12
13
  export { getColorClassesAndStyles, useColorProps } from './use-color-props';
13
14
  export { getSpacingClassesAndStyles } from './use-spacing-props';
15
+ export { useCachedTruthy } from './use-cached-truthy';
14
16
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/index.native.js"],"names":["getBorderClassesAndStyles","useBorderProps","getColorClassesAndStyles","useColorProps","getSpacingClassesAndStyles"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,SAAP;AACA,OAAO,UAAP;AACA,OAAO,qBAAP;AACA,OAAO,wBAAP;AACA,OAAO,SAAP;AACA,OAAO,SAAP;AACA,OAAO,aAAP;AAEA,SAASA,yBAAT,EAAoCC,cAApC,QAA0D,oBAA1D;AACA,SAASC,wBAAT,EAAmCC,aAAnC,QAAwD,mBAAxD;AACA,SAASC,0BAAT,QAA2C,qBAA3C","sourcesContent":["/**\n * Internal dependencies\n */\nimport './align';\nimport './anchor';\nimport './custom-class-name';\nimport './generated-class-name';\nimport './style';\nimport './color';\nimport './font-size';\n\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/index.native.js"],"names":["getBorderClassesAndStyles","useBorderProps","getColorClassesAndStyles","useColorProps","getSpacingClassesAndStyles","useCachedTruthy"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,UAAP;AACA,OAAO,SAAP;AACA,OAAO,UAAP;AACA,OAAO,qBAAP;AACA,OAAO,wBAAP;AACA,OAAO,SAAP;AACA,OAAO,SAAP;AACA,OAAO,aAAP;AAEA,SAASA,yBAAT,EAAoCC,cAApC,QAA0D,oBAA1D;AACA,SAASC,wBAAT,EAAmCC,aAAnC,QAAwD,mBAAxD;AACA,SAASC,0BAAT,QAA2C,qBAA3C;AACA,SAASC,eAAT,QAAgC,qBAAhC","sourcesContent":["/**\n * Internal dependencies\n */\nimport './compat';\nimport './align';\nimport './anchor';\nimport './custom-class-name';\nimport './generated-class-name';\nimport './style';\nimport './color';\nimport './font-size';\n\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { useCachedTruthy } from './use-cached-truthy';\n"]}