@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
@@ -0,0 +1,285 @@
1
+ /**
2
+ * Converts string to object { value, unit }.
3
+ *
4
+ * @param {string} cssUnit
5
+ * @return {Object} parsedUnit
6
+ */
7
+ function parseUnit(cssUnit) {
8
+ const match = cssUnit === null || cssUnit === void 0 ? void 0 : cssUnit.trim().match(/^(0?[-.]?\d+)(r?e[m|x]|v[h|w|min|max]+|p[x|t|c]|[c|m]m|%|in|ch|Q|lh)$/);
9
+
10
+ if (!isNaN(cssUnit) && !isNaN(parseFloat(cssUnit))) {
11
+ return {
12
+ value: parseFloat(cssUnit),
13
+ unit: 'px'
14
+ };
15
+ }
16
+
17
+ return match ? {
18
+ value: parseFloat(match[1]) || match[1],
19
+ unit: match[2]
20
+ } : {
21
+ value: cssUnit,
22
+ unit: undefined
23
+ };
24
+ }
25
+ /**
26
+ * Evaluate a math expression.
27
+ *
28
+ * @param {string} expression
29
+ * @return {number} evaluated expression.
30
+ */
31
+
32
+
33
+ function calculate(expression) {
34
+ return Function(`'use strict'; return (${expression})`)();
35
+ }
36
+ /**
37
+ * Calculates the css function value for the supported css functions such as max, min, clamp and calc.
38
+ *
39
+ * @param {string} functionUnitValue string should be in a particular format (for example min(12px,12px) ) no nested loops.
40
+ * @param {Object} options
41
+ * @return {string} unit containing the unit in PX.
42
+ */
43
+
44
+
45
+ function getFunctionUnitValue(functionUnitValue, options) {
46
+ const functionUnit = functionUnitValue.split(/[(),]/g).filter(Boolean);
47
+ const units = functionUnit.slice(1).map(unit => parseUnit(getPxFromCssUnit(unit, options)).value).filter(Boolean);
48
+
49
+ switch (functionUnit[0]) {
50
+ case 'min':
51
+ return Math.min(...units) + 'px';
52
+
53
+ case 'max':
54
+ return Math.max(...units) + 'px';
55
+
56
+ case 'clamp':
57
+ if (units.length !== 3) {
58
+ return null;
59
+ }
60
+
61
+ if (units[1] < units[0]) {
62
+ return units[0] + 'px';
63
+ }
64
+
65
+ if (units[1] > units[2]) {
66
+ return units[2] + 'px';
67
+ }
68
+
69
+ return units[1] + 'px';
70
+
71
+ case 'calc':
72
+ return units[0] + 'px';
73
+ }
74
+ }
75
+ /**
76
+ * Take a css function such as min, max, calc, clamp and returns parsedUnit
77
+ *
78
+ * How this works for the nested function is that it first replaces the inner function call.
79
+ * Then it tackles the outer onces.
80
+ * So for example: min( max(25px, 35px), 40px )
81
+ * in the first pass we would replace max(25px, 35px) with 35px.
82
+ * then we would try to evaluate min( 35px, 40px )
83
+ * and then finally return 35px.
84
+ *
85
+ * @param {string} cssUnit
86
+ * @return {Object} parsedUnit object.
87
+ */
88
+
89
+
90
+ function parseUnitFunction(cssUnit) {
91
+ while (true) {
92
+ const currentCssUnit = cssUnit;
93
+ const regExp = /(max|min|calc|clamp)\(([^()]*)\)/g;
94
+ const matches = regExp.exec(cssUnit) || [];
95
+
96
+ if (matches[0]) {
97
+ const functionUnitValue = getFunctionUnitValue(matches[0]);
98
+ cssUnit = cssUnit.replace(matches[0], functionUnitValue);
99
+ } // if the unit hasn't been modified or we have a single value break free.
100
+
101
+
102
+ if (cssUnit === currentCssUnit || parseFloat(cssUnit)) {
103
+ break;
104
+ }
105
+ }
106
+
107
+ return parseUnit(cssUnit);
108
+ }
109
+ /**
110
+ * Return true if we think this is a math expression.
111
+ *
112
+ * @param {string} cssUnit the cssUnit value being evaluted.
113
+ * @return {boolean} Whether the cssUnit is a math expression.
114
+ */
115
+
116
+
117
+ function isMathExpression(cssUnit) {
118
+ for (let i = 0; i < cssUnit.length; i++) {
119
+ if (['+', '-', '/', '*'].includes(cssUnit[i])) {
120
+ return true;
121
+ }
122
+ }
123
+
124
+ return false;
125
+ }
126
+ /**
127
+ * Evaluates the math expression and return a px value.
128
+ *
129
+ * @param {string} cssUnit the cssUnit value being evaluted.
130
+ * @return {string} return a converfted value to px.
131
+ */
132
+
133
+
134
+ function evalMathExpression(cssUnit) {
135
+ let errorFound = false; // Convert every part of the expression to px values.
136
+
137
+ const cssUnitsBits = cssUnit.split(/[+-/*/]/g).filter(Boolean);
138
+
139
+ for (const unit of cssUnitsBits) {
140
+ // Standardize the unit to px and extract the value.
141
+ const parsedUnit = parseUnit(getPxFromCssUnit(unit));
142
+
143
+ if (!parseFloat(parsedUnit.value)) {
144
+ errorFound = true; // end early since we are dealing with a null value.
145
+
146
+ break;
147
+ }
148
+
149
+ cssUnit = cssUnit.replace(unit, parsedUnit.value);
150
+ }
151
+
152
+ return errorFound ? null : calculate(cssUnit).toFixed(0) + 'px';
153
+ }
154
+ /**
155
+ * Convert a parsedUnit object to px value.
156
+ *
157
+ * @param {Object} parsedUnit
158
+ * @param {Object} options
159
+ * @return {string} or {null} returns the converted with in a px value format.
160
+ */
161
+
162
+
163
+ function convertParsedUnitToPx(parsedUnit, options) {
164
+ const PIXELS_PER_INCH = 96;
165
+ const ONE_PERCENT = 0.01;
166
+ const defaultProperties = {
167
+ fontSize: 16,
168
+ lineHeight: 16,
169
+ width: 375,
170
+ height: 812,
171
+ type: 'font'
172
+ };
173
+ const setOptions = Object.assign({}, defaultProperties, options);
174
+ const relativeUnits = {
175
+ em: setOptions.fontSize,
176
+ rem: setOptions.fontSize,
177
+ vh: setOptions.height * ONE_PERCENT,
178
+ vw: setOptions.width * ONE_PERCENT,
179
+ vmin: (setOptions.width < setOptions.height ? setOptions.width : setOptions.height) * ONE_PERCENT,
180
+ vmax: (setOptions.width > setOptions.height ? setOptions.width : setOptions.height) * ONE_PERCENT,
181
+ '%': (setOptions.type === 'font' ? setOptions.fontSize : setOptions.width) * ONE_PERCENT,
182
+ ch: 8,
183
+ // The advance measure (width) of the glyph "0" of the element's font. Approximate
184
+ ex: 7.15625,
185
+ // x-height of the element's font. Approximate
186
+ lh: setOptions.lineHeight
187
+ };
188
+ const absoluteUnits = {
189
+ in: PIXELS_PER_INCH,
190
+ cm: PIXELS_PER_INCH / 2.54,
191
+ mm: PIXELS_PER_INCH / 25.4,
192
+ pt: PIXELS_PER_INCH / 72,
193
+ pc: PIXELS_PER_INCH / 6,
194
+ px: 1,
195
+ Q: PIXELS_PER_INCH / 2.54 / 40
196
+ };
197
+
198
+ if (relativeUnits[parsedUnit.unit]) {
199
+ return (relativeUnits[parsedUnit.unit] * parsedUnit.value).toFixed(0) + 'px';
200
+ }
201
+
202
+ if (absoluteUnits[parsedUnit.unit]) {
203
+ return (absoluteUnits[parsedUnit.unit] * parsedUnit.value).toFixed(0) + 'px';
204
+ }
205
+
206
+ return null;
207
+ }
208
+ /**
209
+ * Returns the px value of a cssUnit.
210
+ *
211
+ * @param {string} cssUnit
212
+ * @param {Object} options
213
+ * @return {string} returns the cssUnit value in a simple px format.
214
+ */
215
+
216
+
217
+ export function getPxFromCssUnit(cssUnit, options = {}) {
218
+ if (Number.isFinite(cssUnit)) {
219
+ return cssUnit.toFixed(0) + 'px';
220
+ }
221
+
222
+ if (cssUnit === undefined) {
223
+ return null;
224
+ }
225
+
226
+ let parsedUnit = parseUnit(cssUnit);
227
+
228
+ if (!parsedUnit.unit) {
229
+ parsedUnit = parseUnitFunction(cssUnit, options);
230
+ }
231
+
232
+ if (isMathExpression(cssUnit) && !parsedUnit.unit) {
233
+ return evalMathExpression(cssUnit);
234
+ }
235
+
236
+ return convertParsedUnitToPx(parsedUnit, options);
237
+ } // Use simple cache.
238
+
239
+ const cache = {};
240
+ /**
241
+ * Returns the px value of a cssUnit. The memoized version of getPxFromCssUnit;
242
+ *
243
+ * @param {string} cssUnit
244
+ * @param {Object} options
245
+ * @return {string} returns the cssUnit value in a simple px format.
246
+ */
247
+
248
+ function memoizedGetPxFromCssUnit(cssUnit, options = {}) {
249
+ const hash = cssUnit + hashOptions(options);
250
+
251
+ if (!cache[hash]) {
252
+ cache[hash] = getPxFromCssUnit(cssUnit, options);
253
+ }
254
+
255
+ return cache[hash];
256
+ }
257
+
258
+ function hashOptions(options) {
259
+ let hash = '';
260
+
261
+ if (options.hasOwnProperty('fontSize')) {
262
+ hash = ':' + options.width;
263
+ }
264
+
265
+ if (options.hasOwnProperty('lineHeight')) {
266
+ hash = ':' + options.lineHeight;
267
+ }
268
+
269
+ if (options.hasOwnProperty('width')) {
270
+ hash = ':' + options.width;
271
+ }
272
+
273
+ if (options.hasOwnProperty('height')) {
274
+ hash = ':' + options.height;
275
+ }
276
+
277
+ if (options.hasOwnProperty('type')) {
278
+ hash = ':' + options.type;
279
+ }
280
+
281
+ return hash;
282
+ }
283
+
284
+ export default memoizedGetPxFromCssUnit;
285
+ //# sourceMappingURL=parse-css-unit-to-px.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/utils/parse-css-unit-to-px.js"],"names":["parseUnit","cssUnit","match","trim","isNaN","parseFloat","value","unit","undefined","calculate","expression","Function","getFunctionUnitValue","functionUnitValue","options","functionUnit","split","filter","Boolean","units","slice","map","getPxFromCssUnit","Math","min","max","length","parseUnitFunction","currentCssUnit","regExp","matches","exec","replace","isMathExpression","i","includes","evalMathExpression","errorFound","cssUnitsBits","parsedUnit","toFixed","convertParsedUnitToPx","PIXELS_PER_INCH","ONE_PERCENT","defaultProperties","fontSize","lineHeight","width","height","type","setOptions","Object","assign","relativeUnits","em","rem","vh","vw","vmin","vmax","ch","ex","lh","absoluteUnits","in","cm","mm","pt","pc","px","Q","Number","isFinite","cache","memoizedGetPxFromCssUnit","hash","hashOptions","hasOwnProperty"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAT,CAAoBC,OAApB,EAA8B;AAC7B,QAAMC,KAAK,GAAGD,OAAH,aAAGA,OAAH,uBAAGA,OAAO,CAClBE,IADW,GAEZD,KAFY,CAGZ,uEAHY,CAAd;;AAKA,MAAK,CAAEE,KAAK,CAAEH,OAAF,CAAP,IAAsB,CAAEG,KAAK,CAAEC,UAAU,CAAEJ,OAAF,CAAZ,CAAlC,EAA8D;AAC7D,WAAO;AAAEK,MAAAA,KAAK,EAAED,UAAU,CAAEJ,OAAF,CAAnB;AAAgCM,MAAAA,IAAI,EAAE;AAAtC,KAAP;AACA;;AACD,SAAOL,KAAK,GACT;AAAEI,IAAAA,KAAK,EAAED,UAAU,CAAEH,KAAK,CAAE,CAAF,C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AAErB,OAAF,EAAWa,OAAX,CAAhC;AACA;;AACD,SAAO2D,KAAK,CAAEE,IAAF,CAAZ;AACA;;AAED,SAASC,WAAT,CAAsB9D,OAAtB,EAAgC;AAC/B,MAAI6D,IAAI,GAAG,EAAX;;AACA,MAAK7D,OAAO,CAAC+D,cAAR,CAAwB,UAAxB,CAAL,EAA4C;AAC3CF,IAAAA,IAAI,GAAG,MAAM7D,OAAO,CAACiC,KAArB;AACA;;AACD,MAAKjC,OAAO,CAAC+D,cAAR,CAAwB,YAAxB,CAAL,EAA8C;AAC7CF,IAAAA,IAAI,GAAG,MAAM7D,OAAO,CAACgC,UAArB;AACA;;AACD,MAAKhC,OAAO,CAAC+D,cAAR,CAAwB,OAAxB,CAAL,EAAyC;AACxCF,IAAAA,IAAI,GAAG,MAAM7D,OAAO,CAACiC,KAArB;AACA;;AACD,MAAKjC,OAAO,CAAC+D,cAAR,CAAwB,QAAxB,CAAL,EAA0C;AACzCF,IAAAA,IAAI,GAAG,MAAM7D,OAAO,CAACkC,MAArB;AACA;;AACD,MAAKlC,OAAO,CAAC+D,cAAR,CAAwB,MAAxB,CAAL,EAAwC;AACvCF,IAAAA,IAAI,GAAG,MAAM7D,OAAO,CAACmC,IAArB;AACA;;AACD,SAAO0B,IAAP;AACA;;AAED,eAAeD,wBAAf","sourcesContent":["/**\n * Converts string to object { value, unit }.\n *\n * @param {string} cssUnit\n * @return {Object} parsedUnit\n */\nfunction parseUnit( cssUnit ) {\n\tconst match = cssUnit\n\t\t?.trim()\n\t\t.match(\n\t\t\t/^(0?[-.]?\\d+)(r?e[m|x]|v[h|w|min|max]+|p[x|t|c]|[c|m]m|%|in|ch|Q|lh)$/\n\t\t);\n\tif ( ! isNaN( cssUnit ) && ! isNaN( parseFloat( cssUnit ) ) ) {\n\t\treturn { value: parseFloat( cssUnit ), unit: 'px' };\n\t}\n\treturn match\n\t\t? { value: parseFloat( match[ 1 ] ) || match[ 1 ], unit: match[ 2 ] }\n\t\t: { value: cssUnit, unit: undefined };\n}\n/**\n * Evaluate a math expression.\n *\n * @param {string} expression\n * @return {number} evaluated expression.\n */\nfunction calculate( expression ) {\n\treturn Function( `'use strict'; return (${ expression })` )();\n}\n\n/**\n * Calculates the css function value for the supported css functions such as max, min, clamp and calc.\n *\n * @param {string} functionUnitValue string should be in a particular format (for example min(12px,12px) ) no nested loops.\n * @param {Object} options\n * @return {string} unit containing the unit in PX.\n */\nfunction getFunctionUnitValue( functionUnitValue, options ) {\n\tconst functionUnit = functionUnitValue.split( /[(),]/g ).filter( Boolean );\n\n\tconst units = functionUnit\n\t\t.slice( 1 )\n\t\t.map( ( unit ) => parseUnit( getPxFromCssUnit( unit, options ) ).value )\n\t\t.filter( Boolean );\n\n\tswitch ( functionUnit[ 0 ] ) {\n\t\tcase 'min':\n\t\t\treturn Math.min( ...units ) + 'px';\n\t\tcase 'max':\n\t\t\treturn Math.max( ...units ) + 'px';\n\t\tcase 'clamp':\n\t\t\tif ( units.length !== 3 ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tif ( units[ 1 ] < units[ 0 ] ) {\n\t\t\t\treturn units[ 0 ] + 'px';\n\t\t\t}\n\t\t\tif ( units[ 1 ] > units[ 2 ] ) {\n\t\t\t\treturn units[ 2 ] + 'px';\n\t\t\t}\n\t\t\treturn units[ 1 ] + 'px';\n\t\tcase 'calc':\n\t\t\treturn units[ 0 ] + 'px';\n\t}\n}\n\n/**\n * Take a css function such as min, max, calc, clamp and returns parsedUnit\n *\n * How this works for the nested function is that it first replaces the inner function call.\n * Then it tackles the outer onces.\n * So for example: min( max(25px, 35px), 40px )\n * in the first pass we would replace max(25px, 35px) with 35px.\n * then we would try to evaluate min( 35px, 40px )\n * and then finally return 35px.\n *\n * @param {string} cssUnit\n * @return {Object} parsedUnit object.\n */\nfunction parseUnitFunction( cssUnit ) {\n\twhile ( true ) {\n\t\tconst currentCssUnit = cssUnit;\n\t\tconst regExp = /(max|min|calc|clamp)\\(([^()]*)\\)/g;\n\t\tconst matches = regExp.exec( cssUnit ) || [];\n\t\tif ( matches[ 0 ] ) {\n\t\t\tconst functionUnitValue = getFunctionUnitValue( matches[ 0 ] );\n\t\t\tcssUnit = cssUnit.replace( matches[ 0 ], functionUnitValue );\n\t\t}\n\n\t\t// if the unit hasn't been modified or we have a single value break free.\n\t\tif ( cssUnit === currentCssUnit || parseFloat( cssUnit ) ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn parseUnit( cssUnit );\n}\n/**\n * Return true if we think this is a math expression.\n *\n * @param {string} cssUnit the cssUnit value being evaluted.\n * @return {boolean} Whether the cssUnit is a math expression.\n */\nfunction isMathExpression( cssUnit ) {\n\tfor ( let i = 0; i < cssUnit.length; i++ ) {\n\t\tif ( [ '+', '-', '/', '*' ].includes( cssUnit[ i ] ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n/**\n * Evaluates the math expression and return a px value.\n *\n * @param {string} cssUnit the cssUnit value being evaluted.\n * @return {string} return a converfted value to px.\n */\nfunction evalMathExpression( cssUnit ) {\n\tlet errorFound = false;\n\t// Convert every part of the expression to px values.\n\tconst cssUnitsBits = cssUnit.split( /[+-/*/]/g ).filter( Boolean );\n\tfor ( const unit of cssUnitsBits ) {\n\t\t// Standardize the unit to px and extract the value.\n\t\tconst parsedUnit = parseUnit( getPxFromCssUnit( unit ) );\n\t\tif ( ! parseFloat( parsedUnit.value ) ) {\n\t\t\terrorFound = true;\n\t\t\t// end early since we are dealing with a null value.\n\t\t\tbreak;\n\t\t}\n\t\tcssUnit = cssUnit.replace( unit, parsedUnit.value );\n\t}\n\n\treturn errorFound ? null : calculate( cssUnit ).toFixed( 0 ) + 'px';\n}\n\n/**\n * Convert a parsedUnit object to px value.\n *\n * @param {Object} parsedUnit\n * @param {Object} options\n * @return {string} or {null} returns the converted with in a px value format.\n */\nfunction convertParsedUnitToPx( parsedUnit, options ) {\n\tconst PIXELS_PER_INCH = 96;\n\tconst ONE_PERCENT = 0.01;\n\n\tconst defaultProperties = {\n\t\tfontSize: 16,\n\t\tlineHeight: 16,\n\t\twidth: 375,\n\t\theight: 812,\n\t\ttype: 'font',\n\t};\n\n\tconst setOptions = Object.assign( {}, defaultProperties, options );\n\n\tconst relativeUnits = {\n\t\tem: setOptions.fontSize,\n\t\trem: setOptions.fontSize,\n\t\tvh: setOptions.height * ONE_PERCENT,\n\t\tvw: setOptions.width * ONE_PERCENT,\n\t\tvmin:\n\t\t\t( setOptions.width < setOptions.height\n\t\t\t\t? setOptions.width\n\t\t\t\t: setOptions.height ) * ONE_PERCENT,\n\t\tvmax:\n\t\t\t( setOptions.width > setOptions.height\n\t\t\t\t? setOptions.width\n\t\t\t\t: setOptions.height ) * ONE_PERCENT,\n\t\t'%':\n\t\t\t( setOptions.type === 'font'\n\t\t\t\t? setOptions.fontSize\n\t\t\t\t: setOptions.width ) * ONE_PERCENT,\n\t\tch: 8, // The advance measure (width) of the glyph \"0\" of the element's font. Approximate\n\t\tex: 7.15625, // x-height of the element's font. Approximate\n\t\tlh: setOptions.lineHeight,\n\t};\n\n\tconst absoluteUnits = {\n\t\tin: PIXELS_PER_INCH,\n\t\tcm: PIXELS_PER_INCH / 2.54,\n\t\tmm: PIXELS_PER_INCH / 25.4,\n\t\tpt: PIXELS_PER_INCH / 72,\n\t\tpc: PIXELS_PER_INCH / 6,\n\t\tpx: 1,\n\t\tQ: PIXELS_PER_INCH / 2.54 / 40,\n\t};\n\n\tif ( relativeUnits[ parsedUnit.unit ] ) {\n\t\treturn (\n\t\t\t( relativeUnits[ parsedUnit.unit ] * parsedUnit.value ).toFixed(\n\t\t\t\t0\n\t\t\t) + 'px'\n\t\t);\n\t}\n\n\tif ( absoluteUnits[ parsedUnit.unit ] ) {\n\t\treturn (\n\t\t\t( absoluteUnits[ parsedUnit.unit ] * parsedUnit.value ).toFixed(\n\t\t\t\t0\n\t\t\t) + 'px'\n\t\t);\n\t}\n\n\treturn null;\n}\n\n/**\n * Returns the px value of a cssUnit.\n *\n * @param {string} cssUnit\n * @param {Object} options\n * @return {string} returns the cssUnit value in a simple px format.\n */\nexport function getPxFromCssUnit( cssUnit, options = {} ) {\n\tif ( Number.isFinite( cssUnit ) ) {\n\t\treturn cssUnit.toFixed( 0 ) + 'px';\n\t}\n\tif ( cssUnit === undefined ) {\n\t\treturn null;\n\t}\n\tlet parsedUnit = parseUnit( cssUnit );\n\n\tif ( ! parsedUnit.unit ) {\n\t\tparsedUnit = parseUnitFunction( cssUnit, options );\n\t}\n\n\tif ( isMathExpression( cssUnit ) && ! parsedUnit.unit ) {\n\t\treturn evalMathExpression( cssUnit );\n\t}\n\n\treturn convertParsedUnitToPx( parsedUnit, options );\n}\n\n// Use simple cache.\nconst cache = {};\n/**\n * Returns the px value of a cssUnit. The memoized version of getPxFromCssUnit;\n *\n * @param {string} cssUnit\n * @param {Object} options\n * @return {string} returns the cssUnit value in a simple px format.\n */\nfunction memoizedGetPxFromCssUnit( cssUnit, options = {} ) {\n\tconst hash = cssUnit + hashOptions( options );\n\n\tif ( ! cache[ hash ] ) {\n\t\tcache[ hash ] = getPxFromCssUnit( cssUnit, options );\n\t}\n\treturn cache[ hash ];\n}\n\nfunction hashOptions( options ) {\n\tlet hash = '';\n\tif ( options.hasOwnProperty( 'fontSize' ) ) {\n\t\thash = ':' + options.width;\n\t}\n\tif ( options.hasOwnProperty( 'lineHeight' ) ) {\n\t\thash = ':' + options.lineHeight;\n\t}\n\tif ( options.hasOwnProperty( 'width' ) ) {\n\t\thash = ':' + options.width;\n\t}\n\tif ( options.hasOwnProperty( 'height' ) ) {\n\t\thash = ':' + options.height;\n\t}\n\tif ( options.hasOwnProperty( 'type' ) ) {\n\t\thash = ':' + options.type;\n\t}\n\treturn hash;\n}\n\nexport default memoizedGetPxFromCssUnit;\n"]}
@@ -2,8 +2,24 @@
2
2
  * @constant string IS_ROOT_TAG Regex to check if the selector is a root tag selector.
3
3
  */
4
4
  const IS_ROOT_TAG = /^(body|html|:root).*$/;
5
+ /**
6
+ * Creates a callback to modify selectors so they only apply within a certain
7
+ * namespace.
8
+ *
9
+ * @param {string} namespace Namespace to prefix selectors with.
10
+ * @param {string[]} ignore Selectors to not prefix.
11
+ *
12
+ * @return {(node: Object) => Object} Callback to wrap selectors.
13
+ */
5
14
 
6
15
  const wrap = (namespace, ignore = []) => node => {
16
+ /**
17
+ * Updates selector if necessary.
18
+ *
19
+ * @param {string} selector Selector to modify.
20
+ *
21
+ * @return {string} Updated selector.
22
+ */
7
23
  const updateSelector = selector => {
8
24
  if (ignore.includes(selector.trim())) {
9
25
  return selector;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/utils/transform-styles/transforms/wrap.js"],"names":["IS_ROOT_TAG","wrap","namespace","ignore","node","updateSelector","selector","includes","trim","match","replace","type","selectors","map"],"mappings":"AAAA;AACA;AACA;AACA,MAAMA,WAAW,GAAG,uBAApB;;AAEA,MAAMC,IAAI,GAAG,CAAEC,SAAF,EAAaC,MAAM,GAAG,EAAtB,KAAgCC,IAAF,IAAY;AACtD,QAAMC,cAAc,GAAKC,QAAF,IAAgB;AACtC,QAAKH,MAAM,CAACI,QAAP,CAAiBD,QAAQ,CAACE,IAAT,EAAjB,CAAL,EAA0C;AACzC,aAAOF,QAAP;AACA,KAHqC,CAKtC;;;AACA;AACC,UAAK,CAAEA,QAAQ,CAACG,KAAT,CAAgBT,WAAhB,CAAP,EAAuC;AACtC,eAAOE,SAAS,GAAG,GAAZ,GAAkBI,QAAzB;AACA;AACD,KAVqC,CAYtC;;AACA,WAAOA,QAAQ,CAACI,OAAT,CAAkB,oBAAlB,EAAwCR,SAAxC,CAAP;AACA,GAdD;;AAgBA,MAAKE,IAAI,CAACO,IAAL,KAAc,MAAnB,EAA4B;AAC3B,WAAO,EACN,GAAGP,IADG;AAENQ,MAAAA,SAAS,EAAER,IAAI,CAACQ,SAAL,CAAeC,GAAf,CAAoBR,cAApB;AAFL,KAAP;AAIA;;AAED,SAAOD,IAAP;AACA,CAzBD;;AA2BA,eAAeH,IAAf","sourcesContent":["/**\n * @constant string IS_ROOT_TAG Regex to check if the selector is a root tag selector.\n */\nconst IS_ROOT_TAG = /^(body|html|:root).*$/;\n\nconst wrap = ( namespace, ignore = [] ) => ( node ) => {\n\tconst updateSelector = ( selector ) => {\n\t\tif ( ignore.includes( selector.trim() ) ) {\n\t\t\treturn selector;\n\t\t}\n\n\t\t// Anything other than a root tag is always prefixed.\n\t\t{\n\t\t\tif ( ! selector.match( IS_ROOT_TAG ) ) {\n\t\t\t\treturn namespace + ' ' + selector;\n\t\t\t}\n\t\t}\n\n\t\t// HTML and Body elements cannot be contained within our container so lets extract their styles.\n\t\treturn selector.replace( /^(body|html|:root)/, namespace );\n\t};\n\n\tif ( node.type === 'rule' ) {\n\t\treturn {\n\t\t\t...node,\n\t\t\tselectors: node.selectors.map( updateSelector ),\n\t\t};\n\t}\n\n\treturn node;\n};\n\nexport default wrap;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/utils/transform-styles/transforms/wrap.js"],"names":["IS_ROOT_TAG","wrap","namespace","ignore","node","updateSelector","selector","includes","trim","match","replace","type","selectors","map"],"mappings":"AAAA;AACA;AACA;AACA,MAAMA,WAAW,GAAG,uBAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,IAAI,GAAG,CAAEC,SAAF,EAAaC,MAAM,GAAG,EAAtB,KAAgCC,IAAF,IAAY;AACtD;AACD;AACA;AACA;AACA;AACA;AACA;AACC,QAAMC,cAAc,GAAKC,QAAF,IAAgB;AACtC,QAAKH,MAAM,CAACI,QAAP,CAAiBD,QAAQ,CAACE,IAAT,EAAjB,CAAL,EAA0C;AACzC,aAAOF,QAAP;AACA,KAHqC,CAKtC;;;AACA;AACC,UAAK,CAAEA,QAAQ,CAACG,KAAT,CAAgBT,WAAhB,CAAP,EAAuC;AACtC,eAAOE,SAAS,GAAG,GAAZ,GAAkBI,QAAzB;AACA;AACD,KAVqC,CAYtC;;AACA,WAAOA,QAAQ,CAACI,OAAT,CAAkB,oBAAlB,EAAwCR,SAAxC,CAAP;AACA,GAdD;;AAgBA,MAAKE,IAAI,CAACO,IAAL,KAAc,MAAnB,EAA4B;AAC3B,WAAO,EACN,GAAGP,IADG;AAENQ,MAAAA,SAAS,EAAER,IAAI,CAACQ,SAAL,CAAeC,GAAf,CAAoBR,cAApB;AAFL,KAAP;AAIA;;AAED,SAAOD,IAAP;AACA,CAhCD;;AAkCA,eAAeH,IAAf","sourcesContent":["/**\n * @constant string IS_ROOT_TAG Regex to check if the selector is a root tag selector.\n */\nconst IS_ROOT_TAG = /^(body|html|:root).*$/;\n\n/**\n * Creates a callback to modify selectors so they only apply within a certain\n * namespace.\n *\n * @param {string} namespace Namespace to prefix selectors with.\n * @param {string[]} ignore Selectors to not prefix.\n *\n * @return {(node: Object) => Object} Callback to wrap selectors.\n */\nconst wrap = ( namespace, ignore = [] ) => ( node ) => {\n\t/**\n\t * Updates selector if necessary.\n\t *\n\t * @param {string} selector Selector to modify.\n\t *\n\t * @return {string} Updated selector.\n\t */\n\tconst updateSelector = ( selector ) => {\n\t\tif ( ignore.includes( selector.trim() ) ) {\n\t\t\treturn selector;\n\t\t}\n\n\t\t// Anything other than a root tag is always prefixed.\n\t\t{\n\t\t\tif ( ! selector.match( IS_ROOT_TAG ) ) {\n\t\t\t\treturn namespace + ' ' + selector;\n\t\t\t}\n\t\t}\n\n\t\t// HTML and Body elements cannot be contained within our container so lets extract their styles.\n\t\treturn selector.replace( /^(body|html|:root)/, namespace );\n\t};\n\n\tif ( node.type === 'rule' ) {\n\t\treturn {\n\t\t\t...node,\n\t\t\tselectors: node.selectors.map( updateSelector ),\n\t\t};\n\t}\n\n\treturn node;\n};\n\nexport default wrap;\n"]}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Colors
3
+ */
4
+ /**
5
+ * Breakpoints & Media Queries
6
+ */
7
+ /**
8
+ * SCSS Variables.
9
+ *
10
+ * Please use variables from this sheet to ensure consistency across the UI.
11
+ * Don't add to this sheet unless you're pretty sure the value will be reused in many places.
12
+ * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
13
+ */
14
+ /**
15
+ * Colors
16
+ */
17
+ /**
18
+ * Fonts & basic variables.
19
+ */
20
+ /**
21
+ * Grid System.
22
+ * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
23
+ */
24
+ /**
25
+ * Dimensions.
26
+ */
27
+ /**
28
+ * Shadows.
29
+ */
30
+ /**
31
+ * Editor widths.
32
+ */
33
+ /**
34
+ * Block & Editor UI.
35
+ */
36
+ /**
37
+ * Block paddings.
38
+ */
39
+ /**
40
+ * React Native specific.
41
+ * These variables do not appear to be used anywhere else.
42
+ */
43
+ /**
44
+ * Converts a hex value into the rgb equivalent.
45
+ *
46
+ * @param {string} hex - the hexadecimal value to convert
47
+ * @return {string} comma separated rgb values
48
+ */
49
+ /**
50
+ * Breakpoint mixins
51
+ */
52
+ /**
53
+ * Long content fade mixin
54
+ *
55
+ * Creates a fading overlay to signify that the content is longer
56
+ * than the space allows.
57
+ */
58
+ /**
59
+ * Focus styles.
60
+ */
61
+ /**
62
+ * Applies editor left position to the selector passed as argument
63
+ */
64
+ /**
65
+ * Styles that are reused verbatim in a few places
66
+ */
67
+ /**
68
+ * Allows users to opt-out of animations via OS-level preferences.
69
+ */
70
+ /**
71
+ * Reset default styles for JavaScript UI based pages.
72
+ * This is a WP-admin agnostic reset
73
+ */
74
+ /**
75
+ * Reset the WP Admin page styles for Gutenberg-like pages.
76
+ */
77
+ :root {
78
+ --wp-admin-theme-color: #007cba;
79
+ --wp-admin-theme-color--rgb: 0, 124, 186;
80
+ --wp-admin-theme-color-darker-10: #006ba1;
81
+ --wp-admin-theme-color-darker-10--rgb: 0, 107, 161;
82
+ --wp-admin-theme-color-darker-20: #005a87;
83
+ --wp-admin-theme-color-darker-20--rgb: 0, 90, 135;
84
+ --wp-admin-border-width-focus: 2px;
85
+ }
86
+ @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
87
+ :root {
88
+ --wp-admin-border-width-focus: 1.5px;
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Default editor styles.
94
+ *
95
+ * These styles are shown if a theme does not register its own editor style,
96
+ * a theme.json file, or has toggled off "Use theme styles" in preferences.
97
+ */
98
+ body {
99
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
100
+ font-size: 18px;
101
+ line-height: 1.5;
102
+ --wp--style--block-gap: 2em;
103
+ }
104
+
105
+ p {
106
+ line-height: 1.8;
107
+ }
108
+
109
+ .editor-post-title__block {
110
+ margin-top: 2em;
111
+ margin-bottom: 1em;
112
+ font-size: 2.5em;
113
+ font-weight: 800;
114
+ }
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Colors
3
+ */
4
+ /**
5
+ * Breakpoints & Media Queries
6
+ */
7
+ /**
8
+ * SCSS Variables.
9
+ *
10
+ * Please use variables from this sheet to ensure consistency across the UI.
11
+ * Don't add to this sheet unless you're pretty sure the value will be reused in many places.
12
+ * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
13
+ */
14
+ /**
15
+ * Colors
16
+ */
17
+ /**
18
+ * Fonts & basic variables.
19
+ */
20
+ /**
21
+ * Grid System.
22
+ * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
23
+ */
24
+ /**
25
+ * Dimensions.
26
+ */
27
+ /**
28
+ * Shadows.
29
+ */
30
+ /**
31
+ * Editor widths.
32
+ */
33
+ /**
34
+ * Block & Editor UI.
35
+ */
36
+ /**
37
+ * Block paddings.
38
+ */
39
+ /**
40
+ * React Native specific.
41
+ * These variables do not appear to be used anywhere else.
42
+ */
43
+ /**
44
+ * Converts a hex value into the rgb equivalent.
45
+ *
46
+ * @param {string} hex - the hexadecimal value to convert
47
+ * @return {string} comma separated rgb values
48
+ */
49
+ /**
50
+ * Breakpoint mixins
51
+ */
52
+ /**
53
+ * Long content fade mixin
54
+ *
55
+ * Creates a fading overlay to signify that the content is longer
56
+ * than the space allows.
57
+ */
58
+ /**
59
+ * Focus styles.
60
+ */
61
+ /**
62
+ * Applies editor left position to the selector passed as argument
63
+ */
64
+ /**
65
+ * Styles that are reused verbatim in a few places
66
+ */
67
+ /**
68
+ * Allows users to opt-out of animations via OS-level preferences.
69
+ */
70
+ /**
71
+ * Reset default styles for JavaScript UI based pages.
72
+ * This is a WP-admin agnostic reset
73
+ */
74
+ /**
75
+ * Reset the WP Admin page styles for Gutenberg-like pages.
76
+ */
77
+ :root {
78
+ --wp-admin-theme-color: #007cba;
79
+ --wp-admin-theme-color--rgb: 0, 124, 186;
80
+ --wp-admin-theme-color-darker-10: #006ba1;
81
+ --wp-admin-theme-color-darker-10--rgb: 0, 107, 161;
82
+ --wp-admin-theme-color-darker-20: #005a87;
83
+ --wp-admin-theme-color-darker-20--rgb: 0, 90, 135;
84
+ --wp-admin-border-width-focus: 2px;
85
+ }
86
+ @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
87
+ :root {
88
+ --wp-admin-border-width-focus: 1.5px;
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Default editor styles.
94
+ *
95
+ * These styles are shown if a theme does not register its own editor style,
96
+ * a theme.json file, or has toggled off "Use theme styles" in preferences.
97
+ */
98
+ body {
99
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
100
+ font-size: 18px;
101
+ line-height: 1.5;
102
+ --wp--style--block-gap: 2em;
103
+ }
104
+
105
+ p {
106
+ line-height: 1.8;
107
+ }
108
+
109
+ .editor-post-title__block {
110
+ margin-top: 2em;
111
+ margin-bottom: 1em;
112
+ font-size: 2.5em;
113
+ font-weight: 800;
114
+ }