@wordpress/block-editor 10.2.0 → 10.4.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 (482) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +41 -0
  3. package/build/components/alignment-control/ui.js +1 -1
  4. package/build/components/alignment-control/ui.js.map +1 -1
  5. package/build/components/block-alignment-control/constants.js +1 -1
  6. package/build/components/block-alignment-control/constants.js.map +1 -1
  7. package/build/components/block-alignment-matrix-control/index.js +1 -1
  8. package/build/components/block-alignment-matrix-control/index.js.map +1 -1
  9. package/build/components/block-compare/index.js +1 -3
  10. package/build/components/block-compare/index.js.map +1 -1
  11. package/build/components/block-draggable/draggable-chip.js +4 -2
  12. package/build/components/block-draggable/draggable-chip.js.map +1 -1
  13. package/build/components/block-edit/index.js +4 -2
  14. package/build/components/block-edit/index.js.map +1 -1
  15. package/build/components/block-inspector/index.js +4 -4
  16. package/build/components/block-inspector/index.js.map +1 -1
  17. package/build/components/block-list/block-list-compact.native.js +1 -0
  18. package/build/components/block-list/block-list-compact.native.js.map +1 -1
  19. package/build/components/block-list/block.js +75 -15
  20. package/build/components/block-list/block.js.map +1 -1
  21. package/build/components/block-list/block.native.js +79 -12
  22. package/build/components/block-list/block.native.js.map +1 -1
  23. package/build/components/block-list/use-in-between-inserter.js +7 -23
  24. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  25. package/build/components/block-lock/modal.js +9 -6
  26. package/build/components/block-lock/modal.js.map +1 -1
  27. package/build/components/block-parent-selector/index.js +3 -3
  28. package/build/components/block-parent-selector/index.js.map +1 -1
  29. package/build/components/block-patterns-list/index.js +5 -4
  30. package/build/components/block-patterns-list/index.js.map +1 -1
  31. package/build/components/block-popover/drop-zone.js +85 -0
  32. package/build/components/block-popover/drop-zone.js.map +1 -0
  33. package/build/components/block-popover/inbetween.js +2 -1
  34. package/build/components/block-popover/inbetween.js.map +1 -1
  35. package/build/components/block-popover/index.js +4 -2
  36. package/build/components/block-popover/index.js.map +1 -1
  37. package/build/components/block-preview/auto.js +2 -2
  38. package/build/components/block-preview/auto.js.map +1 -1
  39. package/build/components/block-preview/index.js +8 -13
  40. package/build/components/block-preview/index.js.map +1 -1
  41. package/build/components/block-preview/live.js +3 -7
  42. package/build/components/block-preview/live.js.map +1 -1
  43. package/build/components/block-selection-clearer/index.js +9 -1
  44. package/build/components/block-selection-clearer/index.js.map +1 -1
  45. package/build/components/block-settings-menu/block-settings-dropdown.js +19 -19
  46. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  47. package/build/components/block-styles/index.js +18 -42
  48. package/build/components/block-styles/index.js.map +1 -1
  49. package/build/components/block-switcher/index.js +2 -8
  50. package/build/components/block-switcher/index.js.map +1 -1
  51. package/build/components/block-switcher/preview-block-popover.js +1 -1
  52. package/build/components/block-switcher/preview-block-popover.js.map +1 -1
  53. package/build/components/block-toolbar/index.js +4 -4
  54. package/build/components/block-toolbar/index.js.map +1 -1
  55. package/build/components/block-tools/back-compat.js +2 -1
  56. package/build/components/block-tools/back-compat.js.map +1 -1
  57. package/build/components/block-tools/insertion-point.js +56 -16
  58. package/build/components/block-tools/insertion-point.js.map +1 -1
  59. package/build/components/block-tools/selected-block-popover.js +15 -3
  60. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  61. package/build/components/block-vertical-alignment-control/ui.js +1 -1
  62. package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
  63. package/build/components/border-radius-control/all-input-control.js +2 -1
  64. package/build/components/border-radius-control/all-input-control.js.map +1 -1
  65. package/build/components/border-radius-control/index.js +2 -1
  66. package/build/components/border-radius-control/index.js.map +1 -1
  67. package/build/components/border-radius-control/input-controls.js +2 -1
  68. package/build/components/border-radius-control/input-controls.js.map +1 -1
  69. package/build/components/colors-gradients/control.js +1 -1
  70. package/build/components/colors-gradients/control.js.map +1 -1
  71. package/build/components/colors-gradients/panel-color-gradient-settings.js +2 -2
  72. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  73. package/build/components/duotone-control/index.js +1 -1
  74. package/build/components/duotone-control/index.js.map +1 -1
  75. package/build/components/font-sizes/fluid-utils.js +256 -0
  76. package/build/components/font-sizes/fluid-utils.js.map +1 -0
  77. package/build/components/font-sizes/index.js +8 -0
  78. package/build/components/font-sizes/index.js.map +1 -1
  79. package/build/components/font-sizes/with-font-sizes.js +1 -1
  80. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  81. package/build/components/iframe/index.js +1 -1
  82. package/build/components/iframe/index.js.map +1 -1
  83. package/build/components/image-editor/constants.js +1 -1
  84. package/build/components/image-editor/constants.js.map +1 -1
  85. package/build/components/index.js +0 -9
  86. package/build/components/index.js.map +1 -1
  87. package/build/components/inner-blocks/index.js +6 -2
  88. package/build/components/inner-blocks/index.js.map +1 -1
  89. package/build/components/inner-blocks/use-inner-block-template-sync.js +3 -2
  90. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  91. package/build/components/inserter/block-patterns-tab.js +151 -78
  92. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  93. package/build/components/inserter/hooks/use-insertion-point.js +2 -7
  94. package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
  95. package/build/components/inserter/menu.js +14 -3
  96. package/build/components/inserter/menu.js.map +1 -1
  97. package/build/components/inserter/search-items.js +23 -2
  98. package/build/components/inserter/search-items.js.map +1 -1
  99. package/build/components/inserter-draggable-blocks/index.js +4 -2
  100. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  101. package/build/components/line-height-control/index.js +2 -1
  102. package/build/components/line-height-control/index.js.map +1 -1
  103. package/build/components/list-view/drop-indicator.js +2 -1
  104. package/build/components/list-view/drop-indicator.js.map +1 -1
  105. package/build/components/list-view/use-list-view-drop-zone.js +1 -14
  106. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  107. package/build/components/media-replace-flow/index.js +1 -1
  108. package/build/components/media-replace-flow/index.js.map +1 -1
  109. package/build/components/preview-options/index.js +2 -3
  110. package/build/components/preview-options/index.js.map +1 -1
  111. package/build/components/rich-text/format-toolbar/index.js +1 -1
  112. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  113. package/build/components/rich-text/format-toolbar-container.js +1 -1
  114. package/build/components/rich-text/format-toolbar-container.js.map +1 -1
  115. package/build/components/rich-text/use-paste-handler.js +1 -1
  116. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  117. package/build/components/spacing-sizes-control/all-input-control.js +6 -2
  118. package/build/components/spacing-sizes-control/all-input-control.js.map +1 -1
  119. package/build/components/spacing-sizes-control/axial-input-controls.js +6 -2
  120. package/build/components/spacing-sizes-control/axial-input-controls.js.map +1 -1
  121. package/build/components/spacing-sizes-control/index.js +6 -2
  122. package/build/components/spacing-sizes-control/index.js.map +1 -1
  123. package/build/components/spacing-sizes-control/input-controls.js +6 -2
  124. package/build/components/spacing-sizes-control/input-controls.js.map +1 -1
  125. package/build/components/spacing-sizes-control/spacing-input-control.js +45 -8
  126. package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  127. package/build/components/url-input/index.js +1 -1
  128. package/build/components/url-input/index.js.map +1 -1
  129. package/build/components/use-block-drop-zone/index.js +98 -57
  130. package/build/components/use-block-drop-zone/index.js.map +1 -1
  131. package/build/components/use-on-block-drop/index.js +12 -12
  132. package/build/components/use-on-block-drop/index.js.map +1 -1
  133. package/build/components/use-on-block-drop/types.js +6 -0
  134. package/build/components/use-on-block-drop/types.js.map +1 -0
  135. package/build/hooks/align.js +1 -3
  136. package/build/hooks/align.js.map +1 -1
  137. package/build/hooks/align.native.js +1 -7
  138. package/build/hooks/align.native.js.map +1 -1
  139. package/build/hooks/border.js +1 -0
  140. package/build/hooks/border.js.map +1 -1
  141. package/build/hooks/dimensions.js +32 -4
  142. package/build/hooks/dimensions.js.map +1 -1
  143. package/build/hooks/font-size.js +61 -0
  144. package/build/hooks/font-size.js.map +1 -1
  145. package/build/hooks/layout.js +4 -3
  146. package/build/hooks/layout.js.map +1 -1
  147. package/build/hooks/margin.js +24 -17
  148. package/build/hooks/margin.js.map +1 -1
  149. package/build/hooks/padding.js +20 -12
  150. package/build/hooks/padding.js.map +1 -1
  151. package/build/hooks/style.js +126 -4
  152. package/build/hooks/style.js.map +1 -1
  153. package/build/hooks/use-typography-props.js +17 -3
  154. package/build/hooks/use-typography-props.js.map +1 -1
  155. package/build/hooks/utils.js +8 -7
  156. package/build/hooks/utils.js.map +1 -1
  157. package/build/layouts/constrained.js +0 -1
  158. package/build/layouts/constrained.js.map +1 -1
  159. package/build/layouts/flex.js +1 -1
  160. package/build/layouts/flex.js.map +1 -1
  161. package/build/store/actions.js +63 -45
  162. package/build/store/actions.js.map +1 -1
  163. package/build/store/array.js +1 -7
  164. package/build/store/array.js.map +1 -1
  165. package/build/store/defaults.js +3 -0
  166. package/build/store/defaults.js.map +1 -1
  167. package/build/store/reducer.js +31 -15
  168. package/build/store/reducer.js.map +1 -1
  169. package/build/store/selectors.js +46 -29
  170. package/build/store/selectors.js.map +1 -1
  171. package/build/utils/math.js +14 -0
  172. package/build/utils/math.js.map +1 -1
  173. package/build/utils/pre-parse-patterns.js +19 -2
  174. package/build/utils/pre-parse-patterns.js.map +1 -1
  175. package/build-module/components/alignment-control/ui.js +1 -1
  176. package/build-module/components/alignment-control/ui.js.map +1 -1
  177. package/build-module/components/block-alignment-control/constants.js +1 -1
  178. package/build-module/components/block-alignment-control/constants.js.map +1 -1
  179. package/build-module/components/block-alignment-matrix-control/index.js +1 -1
  180. package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
  181. package/build-module/components/block-compare/index.js +2 -3
  182. package/build-module/components/block-compare/index.js.map +1 -1
  183. package/build-module/components/block-draggable/draggable-chip.js +7 -3
  184. package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
  185. package/build-module/components/block-edit/index.js +4 -2
  186. package/build-module/components/block-edit/index.js.map +1 -1
  187. package/build-module/components/block-inspector/index.js +4 -4
  188. package/build-module/components/block-inspector/index.js.map +1 -1
  189. package/build-module/components/block-list/block-list-compact.native.js +1 -0
  190. package/build-module/components/block-list/block-list-compact.native.js.map +1 -1
  191. package/build-module/components/block-list/block.js +75 -15
  192. package/build-module/components/block-list/block.js.map +1 -1
  193. package/build-module/components/block-list/block.native.js +80 -13
  194. package/build-module/components/block-list/block.native.js.map +1 -1
  195. package/build-module/components/block-list/use-in-between-inserter.js +8 -24
  196. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  197. package/build-module/components/block-lock/modal.js +10 -8
  198. package/build-module/components/block-lock/modal.js.map +1 -1
  199. package/build-module/components/block-parent-selector/index.js +3 -3
  200. package/build-module/components/block-parent-selector/index.js.map +1 -1
  201. package/build-module/components/block-patterns-list/index.js +5 -4
  202. package/build-module/components/block-patterns-list/index.js.map +1 -1
  203. package/build-module/components/block-popover/drop-zone.js +70 -0
  204. package/build-module/components/block-popover/drop-zone.js.map +1 -0
  205. package/build-module/components/block-popover/inbetween.js +2 -1
  206. package/build-module/components/block-popover/inbetween.js.map +1 -1
  207. package/build-module/components/block-popover/index.js +4 -2
  208. package/build-module/components/block-popover/index.js.map +1 -1
  209. package/build-module/components/block-preview/auto.js +1 -1
  210. package/build-module/components/block-preview/auto.js.map +1 -1
  211. package/build-module/components/block-preview/index.js +8 -12
  212. package/build-module/components/block-preview/index.js.map +1 -1
  213. package/build-module/components/block-preview/live.js +3 -6
  214. package/build-module/components/block-preview/live.js.map +1 -1
  215. package/build-module/components/block-selection-clearer/index.js +9 -1
  216. package/build-module/components/block-selection-clearer/index.js.map +1 -1
  217. package/build-module/components/block-settings-menu/block-settings-dropdown.js +20 -19
  218. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  219. package/build-module/components/block-styles/index.js +19 -44
  220. package/build-module/components/block-styles/index.js.map +1 -1
  221. package/build-module/components/block-switcher/index.js +2 -7
  222. package/build-module/components/block-switcher/index.js.map +1 -1
  223. package/build-module/components/block-switcher/preview-block-popover.js +1 -1
  224. package/build-module/components/block-switcher/preview-block-popover.js.map +1 -1
  225. package/build-module/components/block-toolbar/index.js +4 -4
  226. package/build-module/components/block-toolbar/index.js.map +1 -1
  227. package/build-module/components/block-tools/back-compat.js +2 -1
  228. package/build-module/components/block-tools/back-compat.js.map +1 -1
  229. package/build-module/components/block-tools/insertion-point.js +54 -16
  230. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  231. package/build-module/components/block-tools/selected-block-popover.js +15 -3
  232. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  233. package/build-module/components/block-vertical-alignment-control/ui.js +1 -1
  234. package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
  235. package/build-module/components/border-radius-control/all-input-control.js +2 -1
  236. package/build-module/components/border-radius-control/all-input-control.js.map +1 -1
  237. package/build-module/components/border-radius-control/index.js +2 -1
  238. package/build-module/components/border-radius-control/index.js.map +1 -1
  239. package/build-module/components/border-radius-control/input-controls.js +2 -1
  240. package/build-module/components/border-radius-control/input-controls.js.map +1 -1
  241. package/build-module/components/colors-gradients/control.js +2 -2
  242. package/build-module/components/colors-gradients/control.js.map +1 -1
  243. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +3 -3
  244. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  245. package/build-module/components/duotone-control/index.js +1 -1
  246. package/build-module/components/duotone-control/index.js.map +1 -1
  247. package/build-module/components/font-sizes/fluid-utils.js +245 -0
  248. package/build-module/components/font-sizes/fluid-utils.js.map +1 -0
  249. package/build-module/components/font-sizes/index.js +1 -0
  250. package/build-module/components/font-sizes/index.js.map +1 -1
  251. package/build-module/components/font-sizes/with-font-sizes.js +2 -2
  252. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  253. package/build-module/components/iframe/index.js +1 -1
  254. package/build-module/components/iframe/index.js.map +1 -1
  255. package/build-module/components/image-editor/constants.js +1 -1
  256. package/build-module/components/image-editor/constants.js.map +1 -1
  257. package/build-module/components/index.js +0 -1
  258. package/build-module/components/index.js.map +1 -1
  259. package/build-module/components/inner-blocks/index.js +6 -2
  260. package/build-module/components/inner-blocks/index.js.map +1 -1
  261. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +3 -2
  262. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  263. package/build-module/components/inserter/block-patterns-tab.js +148 -81
  264. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  265. package/build-module/components/inserter/hooks/use-insertion-point.js +2 -6
  266. package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
  267. package/build-module/components/inserter/menu.js +10 -3
  268. package/build-module/components/inserter/menu.js.map +1 -1
  269. package/build-module/components/inserter/search-items.js +23 -3
  270. package/build-module/components/inserter/search-items.js.map +1 -1
  271. package/build-module/components/inserter-draggable-blocks/index.js +4 -2
  272. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  273. package/build-module/components/line-height-control/index.js +2 -1
  274. package/build-module/components/line-height-control/index.js.map +1 -1
  275. package/build-module/components/list-view/drop-indicator.js +2 -1
  276. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  277. package/build-module/components/list-view/use-list-view-drop-zone.js +1 -14
  278. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  279. package/build-module/components/media-replace-flow/index.js +1 -1
  280. package/build-module/components/media-replace-flow/index.js.map +1 -1
  281. package/build-module/components/preview-options/index.js +2 -3
  282. package/build-module/components/preview-options/index.js.map +1 -1
  283. package/build-module/components/rich-text/format-toolbar/index.js +1 -1
  284. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  285. package/build-module/components/rich-text/format-toolbar-container.js +1 -1
  286. package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
  287. package/build-module/components/rich-text/use-paste-handler.js +1 -1
  288. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  289. package/build-module/components/spacing-sizes-control/all-input-control.js +6 -2
  290. package/build-module/components/spacing-sizes-control/all-input-control.js.map +1 -1
  291. package/build-module/components/spacing-sizes-control/axial-input-controls.js +6 -2
  292. package/build-module/components/spacing-sizes-control/axial-input-controls.js.map +1 -1
  293. package/build-module/components/spacing-sizes-control/index.js +6 -2
  294. package/build-module/components/spacing-sizes-control/index.js.map +1 -1
  295. package/build-module/components/spacing-sizes-control/input-controls.js +6 -2
  296. package/build-module/components/spacing-sizes-control/input-controls.js.map +1 -1
  297. package/build-module/components/spacing-sizes-control/spacing-input-control.js +44 -8
  298. package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  299. package/build-module/components/url-input/index.js +1 -1
  300. package/build-module/components/url-input/index.js.map +1 -1
  301. package/build-module/components/use-block-drop-zone/index.js +98 -58
  302. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  303. package/build-module/components/use-on-block-drop/index.js +12 -12
  304. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  305. package/build-module/components/use-on-block-drop/types.js +2 -0
  306. package/build-module/components/use-on-block-drop/types.js.map +1 -0
  307. package/build-module/hooks/align.js +1 -2
  308. package/build-module/hooks/align.js.map +1 -1
  309. package/build-module/hooks/align.native.js +1 -6
  310. package/build-module/hooks/align.native.js.map +1 -1
  311. package/build-module/hooks/border.js +1 -0
  312. package/build-module/hooks/border.js.map +1 -1
  313. package/build-module/hooks/dimensions.js +32 -4
  314. package/build-module/hooks/dimensions.js.map +1 -1
  315. package/build-module/hooks/font-size.js +60 -1
  316. package/build-module/hooks/font-size.js.map +1 -1
  317. package/build-module/hooks/layout.js +5 -4
  318. package/build-module/hooks/layout.js.map +1 -1
  319. package/build-module/hooks/margin.js +25 -18
  320. package/build-module/hooks/margin.js.map +1 -1
  321. package/build-module/hooks/padding.js +21 -13
  322. package/build-module/hooks/padding.js.map +1 -1
  323. package/build-module/hooks/style.js +124 -3
  324. package/build-module/hooks/style.js.map +1 -1
  325. package/build-module/hooks/use-typography-props.js +17 -4
  326. package/build-module/hooks/use-typography-props.js.map +1 -1
  327. package/build-module/hooks/utils.js +8 -8
  328. package/build-module/hooks/utils.js.map +1 -1
  329. package/build-module/layouts/constrained.js +0 -1
  330. package/build-module/layouts/constrained.js.map +1 -1
  331. package/build-module/layouts/flex.js +1 -1
  332. package/build-module/layouts/flex.js.map +1 -1
  333. package/build-module/store/actions.js +59 -42
  334. package/build-module/store/actions.js.map +1 -1
  335. package/build-module/store/array.js +1 -6
  336. package/build-module/store/array.js.map +1 -1
  337. package/build-module/store/defaults.js +3 -0
  338. package/build-module/store/defaults.js.map +1 -1
  339. package/build-module/store/reducer.js +32 -16
  340. package/build-module/store/reducer.js.map +1 -1
  341. package/build-module/store/selectors.js +47 -30
  342. package/build-module/store/selectors.js.map +1 -1
  343. package/build-module/utils/math.js +12 -0
  344. package/build-module/utils/math.js.map +1 -1
  345. package/build-module/utils/pre-parse-patterns.js +19 -2
  346. package/build-module/utils/pre-parse-patterns.js.map +1 -1
  347. package/build-style/style-rtl.css +292 -206
  348. package/build-style/style.css +288 -202
  349. package/package.json +29 -28
  350. package/src/components/alignment-control/ui.js +1 -1
  351. package/src/components/block-alignment-control/constants.js +1 -1
  352. package/src/components/block-alignment-matrix-control/index.js +1 -1
  353. package/src/components/block-breadcrumb/test/__snapshots__/index.js.snap +13 -11
  354. package/src/components/block-breadcrumb/test/index.js +2 -2
  355. package/src/components/block-compare/index.js +3 -2
  356. package/src/components/block-draggable/draggable-chip.js +4 -2
  357. package/src/components/block-edit/index.js +2 -1
  358. package/src/components/block-inspector/index.js +8 -7
  359. package/src/components/block-list/block-list-compact.native.js +1 -0
  360. package/src/components/block-list/block.js +113 -7
  361. package/src/components/block-list/block.native.js +123 -9
  362. package/src/components/block-list/style.scss +93 -126
  363. package/src/components/block-list/use-in-between-inserter.js +8 -19
  364. package/src/components/block-lock/modal.js +12 -7
  365. package/src/components/block-mover/stories/index.js +1 -1
  366. package/src/components/block-mover/style.scss +35 -1
  367. package/src/components/block-parent-selector/index.js +3 -3
  368. package/src/components/block-patterns-list/index.js +9 -5
  369. package/src/components/block-patterns-list/style.scss +7 -3
  370. package/src/components/block-popover/README.md +8 -0
  371. package/src/components/block-popover/drop-zone.js +63 -0
  372. package/src/components/block-popover/inbetween.js +1 -0
  373. package/src/components/block-popover/index.js +3 -1
  374. package/src/components/block-popover/style.scss +17 -5
  375. package/src/components/block-preview/auto.js +1 -1
  376. package/src/components/block-preview/index.js +15 -11
  377. package/src/components/block-preview/live.js +2 -7
  378. package/src/components/block-preview/test/index.js +1 -7
  379. package/src/components/block-selection-clearer/index.js +7 -2
  380. package/src/components/block-selection-clearer/test/index.js +118 -0
  381. package/src/components/block-settings-menu/block-settings-dropdown.js +29 -18
  382. package/src/components/block-settings-menu/test/block-mode-toggle.js +17 -17
  383. package/src/components/block-styles/index.js +26 -49
  384. package/src/components/block-switcher/index.js +2 -7
  385. package/src/components/block-switcher/preview-block-popover.js +1 -1
  386. package/src/components/block-switcher/test/index.js +2 -2
  387. package/src/components/block-toolbar/index.js +4 -6
  388. package/src/components/block-toolbar/style.scss +38 -14
  389. package/src/components/block-tools/back-compat.js +1 -0
  390. package/src/components/block-tools/insertion-point.js +49 -15
  391. package/src/components/block-tools/selected-block-popover.js +14 -1
  392. package/src/components/block-variation-picker/README.md +1 -1
  393. package/src/components/block-vertical-alignment-control/ui.js +1 -1
  394. package/src/components/border-radius-control/all-input-control.js +1 -0
  395. package/src/components/border-radius-control/index.js +1 -0
  396. package/src/components/border-radius-control/input-controls.js +1 -0
  397. package/src/components/border-radius-control/style.scss +15 -24
  398. package/src/components/button-block-appender/style.scss +4 -2
  399. package/src/components/color-palette/test/__snapshots__/control.js.snap +86 -104
  400. package/src/components/color-palette/test/control.js +11 -15
  401. package/src/components/colors-gradients/control.js +2 -2
  402. package/src/components/colors-gradients/panel-color-gradient-settings.js +3 -4
  403. package/src/components/colors-gradients/test/control.js +49 -77
  404. package/src/components/duotone-control/index.js +1 -1
  405. package/src/components/font-sizes/fluid-utils.js +296 -0
  406. package/src/components/font-sizes/index.js +1 -0
  407. package/src/components/font-sizes/test/fluid-utils.js +168 -0
  408. package/src/components/font-sizes/with-font-sizes.js +2 -3
  409. package/src/components/iframe/index.js +1 -1
  410. package/src/components/image-editor/constants.js +1 -1
  411. package/src/components/image-size-control/test/index.js +47 -60
  412. package/src/components/index.js +0 -1
  413. package/src/components/inner-blocks/index.js +5 -1
  414. package/src/components/inner-blocks/test/index.js +4 -0
  415. package/src/components/inner-blocks/use-inner-block-template-sync.js +3 -2
  416. package/src/components/inserter/block-patterns-tab.js +232 -98
  417. package/src/components/inserter/hooks/use-insertion-point.js +3 -11
  418. package/src/components/inserter/menu.js +15 -2
  419. package/src/components/inserter/search-items.js +23 -3
  420. package/src/components/inserter/style.scss +94 -9
  421. package/src/components/inserter/test/reusable-blocks-tab.js +6 -6
  422. package/src/components/inserter/test/search-items.js +6 -0
  423. package/src/components/inserter-draggable-blocks/index.js +12 -2
  424. package/src/components/inserter-list-item/style.scss +22 -1
  425. package/src/components/letter-spacing-control/README.md +55 -0
  426. package/src/components/line-height-control/index.js +1 -0
  427. package/src/components/link-control/README.md +3 -3
  428. package/src/components/link-control/test/index.js +1 -1
  429. package/src/components/list-view/drop-indicator.js +1 -0
  430. package/src/components/list-view/style.scss +1 -36
  431. package/src/components/list-view/use-list-view-drop-zone.js +4 -18
  432. package/src/components/media-replace-flow/index.js +1 -1
  433. package/src/components/media-replace-flow/test/index.js +69 -51
  434. package/src/components/panel-color-settings/test/index.js +4 -4
  435. package/src/components/preview-options/index.js +2 -2
  436. package/src/components/preview-options/style.scss +1 -1
  437. package/src/components/provider/test/use-block-sync.js +131 -165
  438. package/src/components/responsive-block-control/test/index.js +4 -4
  439. package/src/components/rich-text/format-toolbar/index.js +1 -1
  440. package/src/components/rich-text/format-toolbar-container.js +1 -1
  441. package/src/components/rich-text/use-paste-handler.js +1 -1
  442. package/src/components/spacing-sizes-control/all-input-control.js +4 -0
  443. package/src/components/spacing-sizes-control/axial-input-controls.js +4 -0
  444. package/src/components/spacing-sizes-control/index.js +4 -0
  445. package/src/components/spacing-sizes-control/input-controls.js +4 -0
  446. package/src/components/spacing-sizes-control/spacing-input-control.js +26 -3
  447. package/src/components/spacing-sizes-control/style.scss +27 -19
  448. package/src/components/url-input/index.js +1 -1
  449. package/src/components/use-block-drop-zone/index.js +136 -79
  450. package/src/components/use-block-drop-zone/test/index.js +333 -81
  451. package/src/components/use-on-block-drop/index.js +11 -12
  452. package/src/components/use-on-block-drop/types.ts +1 -0
  453. package/src/hooks/align.js +3 -2
  454. package/src/hooks/align.native.js +5 -8
  455. package/src/hooks/border.js +1 -0
  456. package/src/hooks/dimensions.js +32 -5
  457. package/src/hooks/font-size.js +76 -0
  458. package/src/hooks/layout.js +7 -9
  459. package/src/hooks/margin.js +20 -14
  460. package/src/hooks/padding.js +20 -16
  461. package/src/hooks/style.js +122 -3
  462. package/src/hooks/test/align.js +96 -72
  463. package/src/hooks/test/style.js +206 -1
  464. package/src/hooks/test/use-typography-props.js +22 -0
  465. package/src/hooks/use-typography-props.js +18 -3
  466. package/src/hooks/utils.js +10 -7
  467. package/src/layouts/constrained.js +0 -1
  468. package/src/layouts/flex.js +1 -1
  469. package/src/store/actions.js +24 -12
  470. package/src/store/array.js +1 -6
  471. package/src/store/defaults.js +3 -0
  472. package/src/store/reducer.js +31 -24
  473. package/src/store/selectors.js +28 -21
  474. package/src/store/test/actions.js +0 -9
  475. package/src/store/test/selectors.js +1 -1
  476. package/src/utils/math.js +17 -0
  477. package/src/utils/pre-parse-patterns.js +12 -7
  478. package/build/components/inserter/pattern-panel.js +0 -87
  479. package/build/components/inserter/pattern-panel.js.map +0 -1
  480. package/build-module/components/inserter/pattern-panel.js +0 -74
  481. package/build-module/components/inserter/pattern-panel.js.map +0 -1
  482. package/src/components/inserter/pattern-panel.js +0 -93
@@ -0,0 +1,296 @@
1
+ /**
2
+ * The fluid utilities must match the backend equivalent.
3
+ * See: gutenberg_get_typography_font_size_value() in lib/block-supports/typography.php
4
+ * ---------------------------------------------------------------
5
+ */
6
+
7
+ // Defaults.
8
+ const DEFAULT_MAXIMUM_VIEWPORT_WIDTH = '1600px';
9
+ const DEFAULT_MINIMUM_VIEWPORT_WIDTH = '768px';
10
+ const DEFAULT_SCALE_FACTOR = 1;
11
+ const DEFAULT_MINIMUM_FONT_SIZE_FACTOR = 0.75;
12
+ const DEFAULT_MAXIMUM_FONT_SIZE_FACTOR = 1.5;
13
+ const DEFAULT_MINIMUM_FONT_SIZE_LIMIT = '14px';
14
+
15
+ /**
16
+ * Computes a fluid font-size value that uses clamp(). A minimum and maxinmum
17
+ * font size OR a single font size can be specified.
18
+ *
19
+ * If a single font size is specified, it is scaled up and down by
20
+ * minimumFontSizeFactor and maximumFontSizeFactor to arrive at the minimum and
21
+ * maximum sizes.
22
+ *
23
+ * @example
24
+ * ```js
25
+ * // Calculate fluid font-size value from a minimum and maximum value.
26
+ * const fontSize = getComputedFluidTypographyValue( {
27
+ * minimumFontSize: '20px',
28
+ * maximumFontSize: '45px'
29
+ * } );
30
+ * // Calculate fluid font-size value from a single font size.
31
+ * const fontSize = getComputedFluidTypographyValue( {
32
+ * fontSize: '30px',
33
+ * } );
34
+ * ```
35
+ *
36
+ * @param {Object} args
37
+ * @param {?string} args.minimumViewPortWidth Minimum viewport size from which type will have fluidity. Optional if fontSize is specified.
38
+ * @param {?string} args.maximumViewPortWidth Maximum size up to which type will have fluidity. Optional if fontSize is specified.
39
+ * @param {string|number} [args.fontSize] Size to derive maximumFontSize and minimumFontSize from, if necessary. Optional if minimumFontSize and maximumFontSize are specified.
40
+ * @param {?string} args.maximumFontSize Maximum font size for any clamp() calculation. Optional.
41
+ * @param {?string} args.minimumFontSize Minimum font size for any clamp() calculation. Optional.
42
+ * @param {?number} args.scaleFactor A scale factor to determine how fast a font scales within boundaries. Optional.
43
+ * @param {?number} args.minimumFontSizeFactor How much to scale defaultFontSize by to derive minimumFontSize. Optional.
44
+ * @param {?number} args.maximumFontSizeFactor How much to scale defaultFontSize by to derive maximumFontSize. Optional.
45
+ *
46
+ * @return {string|null} A font-size value using clamp().
47
+ */
48
+ export function getComputedFluidTypographyValue( {
49
+ minimumFontSize,
50
+ maximumFontSize,
51
+ fontSize,
52
+ minimumViewPortWidth = DEFAULT_MINIMUM_VIEWPORT_WIDTH,
53
+ maximumViewPortWidth = DEFAULT_MAXIMUM_VIEWPORT_WIDTH,
54
+ scaleFactor = DEFAULT_SCALE_FACTOR,
55
+ minimumFontSizeFactor = DEFAULT_MINIMUM_FONT_SIZE_FACTOR,
56
+ maximumFontSizeFactor = DEFAULT_MAXIMUM_FONT_SIZE_FACTOR,
57
+ minimumFontSizeLimit = DEFAULT_MINIMUM_FONT_SIZE_LIMIT,
58
+ } ) {
59
+ /*
60
+ * Caches minimumFontSize in minimumFontSizeValue
61
+ * so we can check if minimumFontSize exists later.
62
+ */
63
+ let minimumFontSizeValue = minimumFontSize;
64
+
65
+ /*
66
+ * Calculates missing minimumFontSize and maximumFontSize from
67
+ * defaultFontSize if provided.
68
+ */
69
+ if ( fontSize ) {
70
+ // Parses default font size.
71
+ const fontSizeParsed = getTypographyValueAndUnit( fontSize );
72
+
73
+ // Protect against invalid units.
74
+ if ( ! fontSizeParsed?.unit ) {
75
+ return null;
76
+ }
77
+
78
+ // If no minimumFontSize is provided, derive using min scale factor.
79
+ if ( ! minimumFontSizeValue ) {
80
+ minimumFontSizeValue =
81
+ roundToPrecision(
82
+ fontSizeParsed.value * minimumFontSizeFactor,
83
+ 3
84
+ ) + fontSizeParsed.unit;
85
+ }
86
+
87
+ // Parses the minimum font size limit, so we can perform checks using it.
88
+ const minimumFontSizeLimitParsed = getTypographyValueAndUnit(
89
+ minimumFontSizeLimit,
90
+ {
91
+ coerceTo: fontSizeParsed.unit,
92
+ }
93
+ );
94
+
95
+ if ( !! minimumFontSizeLimitParsed?.value ) {
96
+ /*
97
+ * If a minimum size was not passed to this function
98
+ * and the user-defined font size is lower than `minimumFontSizeLimit`,
99
+ * then uses the user-defined font size as the minimum font-size.
100
+ */
101
+ if (
102
+ ! minimumFontSize &&
103
+ fontSizeParsed?.value < minimumFontSizeLimitParsed?.value
104
+ ) {
105
+ minimumFontSizeValue = `${ fontSizeParsed.value }${ fontSizeParsed.unit }`;
106
+ } else {
107
+ const minimumFontSizeParsed = getTypographyValueAndUnit(
108
+ minimumFontSizeValue,
109
+ {
110
+ coerceTo: fontSizeParsed.unit,
111
+ }
112
+ );
113
+
114
+ /*
115
+ * Otherwise, if the passed or calculated minimum font size is lower than `minimumFontSizeLimit`
116
+ * use `minimumFontSizeLimit` instead.
117
+ */
118
+ if (
119
+ !! minimumFontSizeParsed?.value &&
120
+ minimumFontSizeParsed.value <
121
+ minimumFontSizeLimitParsed.value
122
+ ) {
123
+ minimumFontSizeValue = `${ minimumFontSizeLimitParsed.value }${ minimumFontSizeLimitParsed.unit }`;
124
+ }
125
+ }
126
+ }
127
+
128
+ // If no maximumFontSize is provided, derive using max scale factor.
129
+ if ( ! maximumFontSize ) {
130
+ maximumFontSize =
131
+ roundToPrecision(
132
+ fontSizeParsed.value * maximumFontSizeFactor,
133
+ 3
134
+ ) + fontSizeParsed.unit;
135
+ }
136
+ }
137
+
138
+ // Return early if one of the provided inputs is not provided.
139
+ if ( ! minimumFontSizeValue || ! maximumFontSize ) {
140
+ return null;
141
+ }
142
+
143
+ // Grab the minimum font size and normalize it in order to use the value for calculations.
144
+ const minimumFontSizeParsed =
145
+ getTypographyValueAndUnit( minimumFontSizeValue );
146
+
147
+ // We get a 'preferred' unit to keep units consistent when calculating,
148
+ // otherwise the result will not be accurate.
149
+ const fontSizeUnit = minimumFontSizeParsed?.unit || 'rem';
150
+
151
+ // Grabs the maximum font size and normalize it in order to use the value for calculations.
152
+ const maximumFontSizeParsed = getTypographyValueAndUnit( maximumFontSize, {
153
+ coerceTo: fontSizeUnit,
154
+ } );
155
+
156
+ // Checks for mandatory min and max sizes, and protects against unsupported units.
157
+ if ( ! minimumFontSizeParsed || ! maximumFontSizeParsed ) {
158
+ return null;
159
+ }
160
+
161
+ // Uses rem for accessible fluid target font scaling.
162
+ const minimumFontSizeRem = getTypographyValueAndUnit(
163
+ minimumFontSizeValue,
164
+ {
165
+ coerceTo: 'rem',
166
+ }
167
+ );
168
+
169
+ // Viewport widths defined for fluid typography. Normalize units
170
+ const maximumViewPortWidthParsed = getTypographyValueAndUnit(
171
+ maximumViewPortWidth,
172
+ { coerceTo: fontSizeUnit }
173
+ );
174
+ const minumumViewPortWidthParsed = getTypographyValueAndUnit(
175
+ minimumViewPortWidth,
176
+ { coerceTo: fontSizeUnit }
177
+ );
178
+
179
+ // Protect against unsupported units.
180
+ if (
181
+ ! maximumViewPortWidthParsed ||
182
+ ! minumumViewPortWidthParsed ||
183
+ ! minimumFontSizeRem
184
+ ) {
185
+ return null;
186
+ }
187
+
188
+ // Build CSS rule.
189
+ // Borrowed from https://websemantics.uk/tools/responsive-font-calculator/.
190
+ const minViewPortWidthOffsetValue = roundToPrecision(
191
+ minumumViewPortWidthParsed.value / 100,
192
+ 3
193
+ );
194
+
195
+ const viewPortWidthOffset =
196
+ roundToPrecision( minViewPortWidthOffsetValue, 3 ) + fontSizeUnit;
197
+ const linearFactor =
198
+ 100 *
199
+ ( ( maximumFontSizeParsed.value - minimumFontSizeParsed.value ) /
200
+ ( maximumViewPortWidthParsed.value -
201
+ minumumViewPortWidthParsed.value ) );
202
+ const linearFactorScaled = roundToPrecision(
203
+ ( linearFactor || 1 ) * scaleFactor,
204
+ 3
205
+ );
206
+ const fluidTargetFontSize = `${ minimumFontSizeRem.value }${ minimumFontSizeRem.unit } + ((1vw - ${ viewPortWidthOffset }) * ${ linearFactorScaled })`;
207
+
208
+ return `clamp(${ minimumFontSizeValue }, ${ fluidTargetFontSize }, ${ maximumFontSize })`;
209
+ }
210
+
211
+ /**
212
+ * Internal method that checks a string for a unit and value and returns an array consisting of `'value'` and `'unit'`, e.g., [ '42', 'rem' ].
213
+ * A raw font size of `value + unit` is expected. If the value is an integer, it will convert to `value + 'px'`.
214
+ *
215
+ * @param {string|number} rawValue Raw size value from theme.json.
216
+ * @param {Object|undefined} options Calculation options.
217
+ *
218
+ * @return {{ unit: string, value: number }|null} An object consisting of `'value'` and `'unit'` properties.
219
+ */
220
+ export function getTypographyValueAndUnit( rawValue, options = {} ) {
221
+ if ( typeof rawValue !== 'string' && typeof rawValue !== 'number' ) {
222
+ return null;
223
+ }
224
+
225
+ // Converts numeric values to pixel values by default.
226
+ if ( isFinite( rawValue ) ) {
227
+ rawValue = `${ rawValue }px`;
228
+ }
229
+
230
+ const { coerceTo, rootSizeValue, acceptableUnits } = {
231
+ coerceTo: '',
232
+ // Default browser font size. Later we could inject some JS to compute this `getComputedStyle( document.querySelector( "html" ) ).fontSize`.
233
+ rootSizeValue: 16,
234
+ acceptableUnits: [ 'rem', 'px', 'em' ],
235
+ ...options,
236
+ };
237
+
238
+ const acceptableUnitsGroup = acceptableUnits?.join( '|' );
239
+ const regexUnits = new RegExp(
240
+ `^(\\d*\\.?\\d+)(${ acceptableUnitsGroup }){1,1}$`
241
+ );
242
+
243
+ const matches = rawValue.match( regexUnits );
244
+
245
+ // We need a number value and a unit.
246
+ if ( ! matches || matches.length < 3 ) {
247
+ return null;
248
+ }
249
+
250
+ let [ , value, unit ] = matches;
251
+
252
+ let returnValue = parseFloat( value );
253
+
254
+ if ( 'px' === coerceTo && ( 'em' === unit || 'rem' === unit ) ) {
255
+ returnValue = returnValue * rootSizeValue;
256
+ unit = coerceTo;
257
+ }
258
+
259
+ if ( 'px' === unit && ( 'em' === coerceTo || 'rem' === coerceTo ) ) {
260
+ returnValue = returnValue / rootSizeValue;
261
+ unit = coerceTo;
262
+ }
263
+
264
+ /*
265
+ * No calculation is required if swapping between em and rem yet,
266
+ * since we assume a root size value. Later we might like to differentiate between
267
+ * :root font size (rem) and parent element font size (em) relativity.
268
+ */
269
+ if (
270
+ ( 'em' === coerceTo || 'rem' === coerceTo ) &&
271
+ ( 'em' === unit || 'rem' === unit )
272
+ ) {
273
+ unit = coerceTo;
274
+ }
275
+
276
+ return {
277
+ value: roundToPrecision( returnValue, 3 ),
278
+ unit,
279
+ };
280
+ }
281
+
282
+ /**
283
+ * Returns a value rounded to defined precision.
284
+ * Returns `undefined` if the value is not a valid finite number.
285
+ *
286
+ * @param {number} value Raw value.
287
+ * @param {number} digits The number of digits to appear after the decimal point
288
+ *
289
+ * @return {number|undefined} Value rounded to standard precision.
290
+ */
291
+ export function roundToPrecision( value, digits = 3 ) {
292
+ const base = Math.pow( 10, digits );
293
+ return Number.isFinite( value )
294
+ ? parseFloat( Math.round( value * base ) / base )
295
+ : undefined;
296
+ }
@@ -3,5 +3,6 @@ export {
3
3
  getFontSizeClass,
4
4
  getFontSizeObjectByValue,
5
5
  } from './utils';
6
+ export { getComputedFluidTypographyValue } from './fluid-utils';
6
7
  export { default as FontSizePicker } from './font-size-picker';
7
8
  export { default as withFontSizes } from './with-font-sizes';
@@ -0,0 +1,168 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { logged } from '@wordpress/deprecated';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import {
10
+ getComputedFluidTypographyValue,
11
+ getTypographyValueAndUnit,
12
+ } from '../fluid-utils';
13
+
14
+ describe( 'getComputedFluidTypographyValue()', () => {
15
+ afterEach( () => {
16
+ for ( const key in logged ) {
17
+ delete logged[ key ];
18
+ }
19
+ } );
20
+
21
+ it( 'should return a fluid font size when given a min and max font size', () => {
22
+ const fluidTypographyValues = getComputedFluidTypographyValue( {
23
+ minimumFontSize: '20px',
24
+ maximumFontSize: '45px',
25
+ } );
26
+ expect( fluidTypographyValues ).toBe(
27
+ 'clamp(20px, 1.25rem + ((1vw - 7.68px) * 3.005), 45px)'
28
+ );
29
+ } );
30
+
31
+ it( 'should return a fluid font size when given a font size', () => {
32
+ const fluidTypographyValues = getComputedFluidTypographyValue( {
33
+ fontSize: '30px',
34
+ } );
35
+ expect( fluidTypographyValues ).toBe(
36
+ 'clamp(22.5px, 1.406rem + ((1vw - 7.68px) * 2.704), 45px)'
37
+ );
38
+ } );
39
+
40
+ it( 'should return a fluid font size based on px when given a numerical font size', () => {
41
+ const fluidTypographyValues = getComputedFluidTypographyValue( {
42
+ fontSize: '30px',
43
+ } );
44
+ expect( fluidTypographyValues ).toBe(
45
+ 'clamp(22.5px, 1.406rem + ((1vw - 7.68px) * 2.704), 45px)'
46
+ );
47
+ } );
48
+
49
+ it( 'should return a fluid font size when given a min and max viewport width', () => {
50
+ const fluidTypographyValues = getComputedFluidTypographyValue( {
51
+ fontSize: '30px',
52
+ minimumViewPortWidth: '500px',
53
+ maximumViewPortWidth: '1000px',
54
+ } );
55
+ expect( fluidTypographyValues ).toBe(
56
+ 'clamp(22.5px, 1.406rem + ((1vw - 5px) * 4.5), 45px)'
57
+ );
58
+ } );
59
+
60
+ it( 'should return a fluid font size when given a scale factor', () => {
61
+ const fluidTypographyValues = getComputedFluidTypographyValue( {
62
+ fontSize: '30px',
63
+ scaleFactor: '2',
64
+ } );
65
+ expect( fluidTypographyValues ).toBe(
66
+ 'clamp(22.5px, 1.406rem + ((1vw - 7.68px) * 5.409), 45px)'
67
+ );
68
+ } );
69
+
70
+ it( 'should return a fluid font size when given a min and max font size factor', () => {
71
+ const fluidTypographyValues = getComputedFluidTypographyValue( {
72
+ fontSize: '30px',
73
+ minimumFontSizeFactor: '0.5',
74
+ maximumFontSizeFactor: '2',
75
+ } );
76
+ expect( fluidTypographyValues ).toBe(
77
+ 'clamp(15px, 0.938rem + ((1vw - 7.68px) * 5.409), 60px)'
78
+ );
79
+ } );
80
+
81
+ describe( 'getTypographyValueAndUnit', () => {
82
+ it( 'should return the expected return values', () => {
83
+ [
84
+ {
85
+ value: null,
86
+ expected: null,
87
+ },
88
+ {
89
+ value: false,
90
+ expected: null,
91
+ },
92
+ {
93
+ value: true,
94
+ expected: null,
95
+ },
96
+ {
97
+ value: [ '10' ],
98
+ expected: null,
99
+ },
100
+ {
101
+ value: '10vh',
102
+ expected: null,
103
+ },
104
+ {
105
+ value: 'calc(2 * 10px)',
106
+ expected: null,
107
+ },
108
+ {
109
+ value: 'clamp(15px, 0.9375rem + ((1vw - 7.68px) * 5.409), 60px)',
110
+ expected: null,
111
+ },
112
+ {
113
+ value: '10',
114
+ expected: {
115
+ value: 10,
116
+ unit: 'px',
117
+ },
118
+ },
119
+ {
120
+ value: 11,
121
+ expected: {
122
+ value: 11,
123
+ unit: 'px',
124
+ },
125
+ },
126
+ {
127
+ value: 11.234,
128
+ expected: {
129
+ value: 11.234,
130
+ unit: 'px',
131
+ },
132
+ },
133
+ {
134
+ value: '12rem',
135
+ expected: {
136
+ value: 12,
137
+ unit: 'rem',
138
+ },
139
+ },
140
+ {
141
+ value: '12px',
142
+ expected: {
143
+ value: 12,
144
+ unit: 'px',
145
+ },
146
+ },
147
+ {
148
+ value: '12em',
149
+ expected: {
150
+ value: 12,
151
+ unit: 'em',
152
+ },
153
+ },
154
+ {
155
+ value: '12.74em',
156
+ expected: {
157
+ value: 12.74,
158
+ unit: 'em',
159
+ },
160
+ },
161
+ ].forEach( ( { value, expected } ) => {
162
+ expect( getTypographyValueAndUnit( value ) ).toEqual(
163
+ expected
164
+ );
165
+ } );
166
+ } );
167
+ } );
168
+ } );
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { find, pickBy, reduce, some } from 'lodash';
4
+ import { find, pickBy, reduce } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -152,8 +152,7 @@ export default ( ...fontSizeNames ) => {
152
152
  };
153
153
 
154
154
  if (
155
- ! some(
156
- fontSizeAttributeNames,
155
+ ! Object.values( fontSizeAttributeNames ).some(
157
156
  didAttributesChange
158
157
  )
159
158
  ) {
@@ -282,7 +282,7 @@ function Iframe(
282
282
 
283
283
  head = (
284
284
  <>
285
- <style>{ 'body{margin:0}' }</style>
285
+ <style>{ 'html{height:auto!important;}body{margin:0}' }</style>
286
286
  { styles.map(
287
287
  ( { tagName, href, id, rel, media, textContent } ) => {
288
288
  const TagName = tagName.toLowerCase();
@@ -2,5 +2,5 @@ export const MIN_ZOOM = 100;
2
2
  export const MAX_ZOOM = 300;
3
3
  export const POPOVER_PROPS = {
4
4
  position: 'bottom right',
5
- isAlternate: true,
5
+ variant: 'toolbar',
6
6
  };