@wordpress/block-editor 12.15.0 → 12.16.1-next.79a6196f.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 (927) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +12 -10
  4. package/build/components/block-canvas/index.js +21 -7
  5. package/build/components/block-canvas/index.js.map +1 -1
  6. package/build/components/block-card/index.js +2 -2
  7. package/build/components/block-card/index.js.map +1 -1
  8. package/build/components/block-controls/hook.js +3 -23
  9. package/build/components/block-controls/hook.js.map +1 -1
  10. package/build/components/block-draggable/draggable-chip.js +6 -1
  11. package/build/components/block-draggable/draggable-chip.js.map +1 -1
  12. package/build/components/block-draggable/index.js +76 -6
  13. package/build/components/block-draggable/index.js.map +1 -1
  14. package/build/components/block-draggable/index.native.js +0 -6
  15. package/build/components/block-draggable/index.native.js.map +1 -1
  16. package/build/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  17. package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
  18. package/build/components/block-edit/context.js +5 -1
  19. package/build/components/block-edit/context.js.map +1 -1
  20. package/build/components/block-edit/index.js +18 -9
  21. package/build/components/block-edit/index.js.map +1 -1
  22. package/build/components/block-editing-mode/index.js +2 -3
  23. package/build/components/block-editing-mode/index.js.map +1 -1
  24. package/build/components/block-info-slot-fill/index.js +3 -4
  25. package/build/components/block-info-slot-fill/index.js.map +1 -1
  26. package/build/components/block-inspector/index.js +1 -1
  27. package/build/components/block-inspector/index.js.map +1 -1
  28. package/build/components/block-list/block-list-item-cell.native.js +1 -0
  29. package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
  30. package/build/components/block-list/block.js +257 -95
  31. package/build/components/block-list/block.js.map +1 -1
  32. package/build/components/block-list/block.native.js +58 -23
  33. package/build/components/block-list/block.native.js.map +1 -1
  34. package/build/components/block-list/index.native.js +3 -5
  35. package/build/components/block-list/index.native.js.map +1 -1
  36. package/build/components/block-list/private-block-context.js +14 -0
  37. package/build/components/block-list/private-block-context.js.map +1 -0
  38. package/build/components/block-list/use-block-props/index.js +49 -69
  39. package/build/components/block-list/use-block-props/index.js.map +1 -1
  40. package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -29
  41. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  42. package/build/components/block-list/use-block-props/use-is-hovered.js +4 -14
  43. package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  44. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
  45. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  46. package/build/components/block-list/use-in-between-inserter.js +3 -2
  47. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  48. package/build/components/block-list/use-scroll-upon-insertion.native.js +41 -0
  49. package/build/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
  50. package/build/components/block-lock/toolbar.js +21 -27
  51. package/build/components/block-lock/toolbar.js.map +1 -1
  52. package/build/components/block-mover/index.js +2 -1
  53. package/build/components/block-mover/index.js.map +1 -1
  54. package/build/components/block-patterns-list/index.js +5 -5
  55. package/build/components/block-patterns-list/index.js.map +1 -1
  56. package/build/components/block-removal-warning-modal/index.js +2 -9
  57. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  58. package/build/components/block-rename/modal.js +3 -0
  59. package/build/components/block-rename/modal.js.map +1 -1
  60. package/build/components/block-settings/container.native.js +6 -4
  61. package/build/components/block-settings/container.native.js.map +1 -1
  62. package/build/components/block-styles/index.js +1 -1
  63. package/build/components/block-styles/index.js.map +1 -1
  64. package/build/components/block-styles/index.native.js +3 -2
  65. package/build/components/block-styles/index.native.js.map +1 -1
  66. package/build/components/block-switcher/index.js +4 -4
  67. package/build/components/block-switcher/index.js.map +1 -1
  68. package/build/components/block-toolbar/index.js +90 -29
  69. package/build/components/block-toolbar/index.js.map +1 -1
  70. package/build/components/block-tools/block-toolbar-breadcrumb.js +49 -0
  71. package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
  72. package/build/components/block-tools/block-toolbar-popover.js +84 -0
  73. package/build/components/block-tools/block-toolbar-popover.js.map +1 -0
  74. package/build/components/block-tools/index.js +27 -24
  75. package/build/components/block-tools/index.js.map +1 -1
  76. package/build/components/block-types-list/index.native.js +4 -3
  77. package/build/components/block-types-list/index.native.js.map +1 -1
  78. package/build/components/block-variation-picker/index.native.js +2 -1
  79. package/build/components/block-variation-picker/index.native.js.map +1 -1
  80. package/build/components/block-variation-transforms/index.js +29 -2
  81. package/build/components/block-variation-transforms/index.js.map +1 -1
  82. package/build/components/border-radius-control/linked-button.js +1 -1
  83. package/build/components/border-radius-control/linked-button.js.map +1 -1
  84. package/build/components/colors/utils.js +10 -2
  85. package/build/components/colors/utils.js.map +1 -1
  86. package/build/components/colors/with-colors.js +6 -2
  87. package/build/components/colors/with-colors.js.map +1 -1
  88. package/build/components/colors-gradients/control.js +28 -17
  89. package/build/components/colors-gradients/control.js.map +1 -1
  90. package/build/components/duotone-control/index.js +1 -4
  91. package/build/components/duotone-control/index.js.map +1 -1
  92. package/build/components/font-sizes/utils.js +10 -2
  93. package/build/components/font-sizes/utils.js.map +1 -1
  94. package/build/components/global-styles/border-panel.js +2 -1
  95. package/build/components/global-styles/border-panel.js.map +1 -1
  96. package/build/components/global-styles/color-panel.js +24 -21
  97. package/build/components/global-styles/color-panel.js.map +1 -1
  98. package/build/components/global-styles/dimensions-panel.js +4 -3
  99. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  100. package/build/components/global-styles/effects-panel.js +2 -1
  101. package/build/components/global-styles/effects-panel.js.map +1 -1
  102. package/build/components/global-styles/filters-panel.js +6 -3
  103. package/build/components/global-styles/filters-panel.js.map +1 -1
  104. package/build/components/global-styles/get-global-styles-changes.js +192 -0
  105. package/build/components/global-styles/get-global-styles-changes.js.map +1 -0
  106. package/build/components/global-styles/hooks.js +3 -2
  107. package/build/components/global-styles/hooks.js.map +1 -1
  108. package/build/components/global-styles/image-settings-panel.js +7 -1
  109. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  110. package/build/components/global-styles/index.js +7 -0
  111. package/build/components/global-styles/index.js.map +1 -1
  112. package/build/components/global-styles/typography-panel.js +43 -36
  113. package/build/components/global-styles/typography-panel.js.map +1 -1
  114. package/build/components/global-styles/use-global-styles-output.js +22 -8
  115. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  116. package/build/components/global-styles/utils.js +8 -1
  117. package/build/components/global-styles/utils.js.map +1 -1
  118. package/build/components/height-control/index.js +6 -2
  119. package/build/components/height-control/index.js.map +1 -1
  120. package/build/components/image-link-destinations/index.native.js +118 -0
  121. package/build/components/image-link-destinations/index.native.js.map +1 -0
  122. package/build/components/image-size-control/index.js +2 -2
  123. package/build/components/image-size-control/index.js.map +1 -1
  124. package/build/components/index.native.js +14 -5
  125. package/build/components/index.native.js.map +1 -1
  126. package/build/components/inner-blocks/index.js +61 -22
  127. package/build/components/inner-blocks/index.js.map +1 -1
  128. package/build/components/inner-blocks/index.native.js +18 -4
  129. package/build/components/inner-blocks/index.native.js.map +1 -1
  130. package/build/components/inner-blocks/use-inner-block-template-sync.js +5 -6
  131. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  132. package/build/components/inner-blocks/use-nested-settings-update.js +5 -9
  133. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  134. package/build/components/inserter/block-patterns-explorer/pattern-list.js +1 -1
  135. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  136. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +10 -9
  137. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  138. package/build/components/inserter/block-patterns-tab/patterns-filter.js +10 -10
  139. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  140. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +9 -9
  141. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  142. package/build/components/inserter/block-patterns-tab/utils.js +10 -14
  143. package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
  144. package/build/components/inserter/hooks/use-block-types-state.js +4 -14
  145. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  146. package/build/components/inserter/hooks/use-patterns-state.js +1 -1
  147. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  148. package/build/components/inserter/index.js +1 -2
  149. package/build/components/inserter/index.js.map +1 -1
  150. package/build/components/inserter/library.js +3 -7
  151. package/build/components/inserter/library.js.map +1 -1
  152. package/build/components/inserter/media-tab/media-panel.js +2 -2
  153. package/build/components/inserter/media-tab/media-panel.js.map +1 -1
  154. package/build/components/inserter/menu.js +26 -33
  155. package/build/components/inserter/menu.js.map +1 -1
  156. package/build/components/inserter/preview-panel.js +2 -2
  157. package/build/components/inserter/preview-panel.js.map +1 -1
  158. package/build/components/inserter/tabs.js +21 -21
  159. package/build/components/inserter/tabs.js.map +1 -1
  160. package/build/components/inserter-button/index.native.js +98 -0
  161. package/build/components/inserter-button/index.native.js.map +1 -0
  162. package/build/components/inserter-button/sparkles.js +23 -0
  163. package/build/components/inserter-button/sparkles.js.map +1 -0
  164. package/build/components/inserter-draggable-blocks/index.js +8 -4
  165. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  166. package/build/components/inserter-list-item/index.js +2 -4
  167. package/build/components/inserter-list-item/index.js.map +1 -1
  168. package/build/components/inspector-controls/block-support-tools-panel.js +3 -1
  169. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  170. package/build/components/inspector-controls/fill.js +3 -3
  171. package/build/components/inspector-controls/fill.js.map +1 -1
  172. package/build/components/inspector-controls/fill.native.js +3 -3
  173. package/build/components/inspector-controls/fill.native.js.map +1 -1
  174. package/build/components/inspector-controls-tabs/index.js +34 -23
  175. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  176. package/build/components/list-view/block-select-button.js +4 -0
  177. package/build/components/list-view/block-select-button.js.map +1 -1
  178. package/build/components/list-view/block.js +57 -3
  179. package/build/components/list-view/block.js.map +1 -1
  180. package/build/components/media-upload-progress/constants.js +19 -0
  181. package/build/components/media-upload-progress/constants.js.map +1 -0
  182. package/build/components/media-upload-progress/index.native.js +42 -17
  183. package/build/components/media-upload-progress/index.native.js.map +1 -1
  184. package/build/components/navigable-toolbar/index.js +11 -16
  185. package/build/components/navigable-toolbar/index.js.map +1 -1
  186. package/build/components/plain-text/index.native.js +8 -3
  187. package/build/components/plain-text/index.native.js.map +1 -1
  188. package/build/components/preview-options/index.js +6 -62
  189. package/build/components/preview-options/index.js.map +1 -1
  190. package/build/components/provider/index.js +3 -1
  191. package/build/components/provider/index.js.map +1 -1
  192. package/build/components/provider/use-block-sync.js +7 -1
  193. package/build/components/provider/use-block-sync.js.map +1 -1
  194. package/build/components/rich-text/content.js +26 -23
  195. package/build/components/rich-text/content.js.map +1 -1
  196. package/build/components/rich-text/get-rich-text-values.js +2 -1
  197. package/build/components/rich-text/get-rich-text-values.js.map +1 -1
  198. package/build/components/rich-text/index.js +19 -37
  199. package/build/components/rich-text/index.js.map +1 -1
  200. package/build/components/rich-text/index.native.js +9 -16
  201. package/build/components/rich-text/index.native.js.map +1 -1
  202. package/build/components/rich-text/native/get-format-colors.native.js +22 -24
  203. package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
  204. package/build/components/rich-text/native/index.native.js +22 -57
  205. package/build/components/rich-text/native/index.native.js.map +1 -1
  206. package/build/components/rich-text/use-input-rules.js +7 -3
  207. package/build/components/rich-text/use-input-rules.js.map +1 -1
  208. package/build/components/rich-text/use-mark-persistent.js +1 -1
  209. package/build/components/rich-text/use-mark-persistent.js.map +1 -1
  210. package/build/components/rich-text/with-deprecations.js +50 -0
  211. package/build/components/rich-text/with-deprecations.js.map +1 -0
  212. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  213. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  214. package/build/components/url-input/index.js +9 -6
  215. package/build/components/url-input/index.js.map +1 -1
  216. package/build/components/use-block-commands/index.js +14 -18
  217. package/build/components/use-block-commands/index.js.map +1 -1
  218. package/build/components/use-block-drop-zone/index.js +108 -17
  219. package/build/components/use-block-drop-zone/index.js.map +1 -1
  220. package/build/components/use-moving-animation/index.js +100 -92
  221. package/build/components/use-moving-animation/index.js.map +1 -1
  222. package/build/components/use-on-block-drop/index.js +9 -12
  223. package/build/components/use-on-block-drop/index.js.map +1 -1
  224. package/build/components/use-resize-canvas/index.js +4 -1
  225. package/build/components/use-resize-canvas/index.js.map +1 -1
  226. package/build/components/use-settings/index.js +14 -0
  227. package/build/components/use-settings/index.js.map +1 -1
  228. package/build/components/writing-flow/index.js +0 -1
  229. package/build/components/writing-flow/index.js.map +1 -1
  230. package/build/components/writing-flow/use-drag-selection.js +15 -4
  231. package/build/components/writing-flow/use-drag-selection.js.map +1 -1
  232. package/build/components/writing-flow/use-selection-observer.js +73 -27
  233. package/build/components/writing-flow/use-selection-observer.js.map +1 -1
  234. package/build/components/writing-flow/use-tab-nav.js +7 -4
  235. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  236. package/build/hooks/align.js +21 -69
  237. package/build/hooks/align.js.map +1 -1
  238. package/build/hooks/align.native.js +11 -1
  239. package/build/hooks/align.native.js.map +1 -1
  240. package/build/hooks/anchor.js +14 -30
  241. package/build/hooks/anchor.js.map +1 -1
  242. package/build/hooks/aria-label.js +9 -1
  243. package/build/hooks/aria-label.js.map +1 -1
  244. package/build/hooks/background.js +198 -36
  245. package/build/hooks/background.js.map +1 -1
  246. package/build/hooks/block-hooks.js +24 -32
  247. package/build/hooks/block-hooks.js.map +1 -1
  248. package/build/hooks/block-renaming.js +18 -22
  249. package/build/hooks/block-renaming.js.map +1 -1
  250. package/build/hooks/border.js +53 -80
  251. package/build/hooks/border.js.map +1 -1
  252. package/build/hooks/color.js +79 -90
  253. package/build/hooks/color.js.map +1 -1
  254. package/build/hooks/content-lock-ui.js +29 -29
  255. package/build/hooks/content-lock-ui.js.map +1 -1
  256. package/build/hooks/custom-class-name.js +13 -30
  257. package/build/hooks/custom-class-name.js.map +1 -1
  258. package/build/hooks/custom-class-name.native.js +9 -1
  259. package/build/hooks/custom-class-name.native.js.map +1 -1
  260. package/build/hooks/dimensions.js +13 -14
  261. package/build/hooks/dimensions.js.map +1 -1
  262. package/build/hooks/duotone.js +31 -61
  263. package/build/hooks/duotone.js.map +1 -1
  264. package/build/hooks/font-family.js +23 -28
  265. package/build/hooks/font-family.js.map +1 -1
  266. package/build/hooks/font-size.js +52 -120
  267. package/build/hooks/font-size.js.map +1 -1
  268. package/build/hooks/index.js +27 -16
  269. package/build/hooks/index.js.map +1 -1
  270. package/build/hooks/index.native.js +15 -6
  271. package/build/hooks/index.native.js.map +1 -1
  272. package/build/hooks/layout-child.js +68 -0
  273. package/build/hooks/layout-child.js.map +1 -0
  274. package/build/hooks/layout.js +25 -104
  275. package/build/hooks/layout.js.map +1 -1
  276. package/build/hooks/padding.js +2 -2
  277. package/build/hooks/padding.js.map +1 -1
  278. package/build/hooks/position.js +40 -62
  279. package/build/hooks/position.js.map +1 -1
  280. package/build/hooks/style.js +52 -89
  281. package/build/hooks/style.js.map +1 -1
  282. package/build/hooks/typography.js +25 -10
  283. package/build/hooks/typography.js.map +1 -1
  284. package/build/hooks/typography.native.js +43 -18
  285. package/build/hooks/typography.native.js.map +1 -1
  286. package/build/hooks/use-typography-props.js +10 -2
  287. package/build/hooks/use-typography-props.js.map +1 -1
  288. package/build/hooks/utils.js +200 -10
  289. package/build/hooks/utils.js.map +1 -1
  290. package/build/private-apis.js +2 -6
  291. package/build/private-apis.js.map +1 -1
  292. package/build/private-apis.native.js +0 -2
  293. package/build/private-apis.native.js.map +1 -1
  294. package/build/store/actions.js +0 -16
  295. package/build/store/actions.js.map +1 -1
  296. package/build/store/private-actions.js +54 -0
  297. package/build/store/private-actions.js.map +1 -1
  298. package/build/store/private-selectors.js +46 -0
  299. package/build/store/private-selectors.js.map +1 -1
  300. package/build/store/reducer.js +18 -2
  301. package/build/store/reducer.js.map +1 -1
  302. package/build/store/selectors.js +11 -73
  303. package/build/store/selectors.js.map +1 -1
  304. package/build/store/undo-ignore.js +12 -0
  305. package/build/store/undo-ignore.js.map +1 -0
  306. package/build/store/utils.js +66 -0
  307. package/build/store/utils.js.map +1 -0
  308. package/build/utils/get-px-from-css-unit.js +16 -0
  309. package/build/utils/get-px-from-css-unit.js.map +1 -0
  310. package/build/utils/index.js +2 -2
  311. package/build/utils/index.js.map +1 -1
  312. package/build/utils/object.js +38 -99
  313. package/build/utils/object.js.map +1 -1
  314. package/build/utils/selection.js +9 -1
  315. package/build/utils/selection.js.map +1 -1
  316. package/build/utils/use-can-block-toolbar-be-focused.js +46 -0
  317. package/build/utils/use-can-block-toolbar-be-focused.js.map +1 -0
  318. package/build-module/components/block-canvas/index.js +22 -8
  319. package/build-module/components/block-canvas/index.js.map +1 -1
  320. package/build-module/components/block-card/index.js +2 -2
  321. package/build-module/components/block-card/index.js.map +1 -1
  322. package/build-module/components/block-controls/hook.js +4 -24
  323. package/build-module/components/block-controls/hook.js.map +1 -1
  324. package/build-module/components/block-draggable/draggable-chip.js +6 -1
  325. package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
  326. package/build-module/components/block-draggable/index.js +76 -6
  327. package/build-module/components/block-draggable/index.js.map +1 -1
  328. package/build-module/components/block-draggable/index.native.js +1 -7
  329. package/build-module/components/block-draggable/index.native.js.map +1 -1
  330. package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  331. package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
  332. package/build-module/components/block-edit/context.js +2 -0
  333. package/build-module/components/block-edit/context.js.map +1 -1
  334. package/build-module/components/block-edit/index.js +19 -10
  335. package/build-module/components/block-edit/index.js.map +1 -1
  336. package/build-module/components/block-editing-mode/index.js +3 -4
  337. package/build-module/components/block-editing-mode/index.js.map +1 -1
  338. package/build-module/components/block-info-slot-fill/index.js +3 -3
  339. package/build-module/components/block-info-slot-fill/index.js.map +1 -1
  340. package/build-module/components/block-inspector/index.js +1 -1
  341. package/build-module/components/block-inspector/index.js.map +1 -1
  342. package/build-module/components/block-list/block-list-item-cell.native.js +1 -0
  343. package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
  344. package/build-module/components/block-list/block.js +261 -99
  345. package/build-module/components/block-list/block.js.map +1 -1
  346. package/build-module/components/block-list/block.native.js +60 -25
  347. package/build-module/components/block-list/block.native.js.map +1 -1
  348. package/build-module/components/block-list/index.native.js +3 -5
  349. package/build-module/components/block-list/index.native.js.map +1 -1
  350. package/build-module/components/block-list/private-block-context.js +6 -0
  351. package/build-module/components/block-list/private-block-context.js.map +1 -0
  352. package/build-module/components/block-list/use-block-props/index.js +50 -70
  353. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  354. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -29
  355. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  356. package/build-module/components/block-list/use-block-props/use-is-hovered.js +4 -14
  357. package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  358. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
  359. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  360. package/build-module/components/block-list/use-in-between-inserter.js +3 -2
  361. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  362. package/build-module/components/block-list/use-scroll-upon-insertion.native.js +33 -0
  363. package/build-module/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
  364. package/build-module/components/block-lock/toolbar.js +22 -28
  365. package/build-module/components/block-lock/toolbar.js.map +1 -1
  366. package/build-module/components/block-mover/index.js +2 -1
  367. package/build-module/components/block-mover/index.js.map +1 -1
  368. package/build-module/components/block-patterns-list/index.js +6 -6
  369. package/build-module/components/block-patterns-list/index.js.map +1 -1
  370. package/build-module/components/block-removal-warning-modal/index.js +3 -10
  371. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  372. package/build-module/components/block-rename/modal.js +3 -0
  373. package/build-module/components/block-rename/modal.js.map +1 -1
  374. package/build-module/components/block-settings/container.native.js +4 -2
  375. package/build-module/components/block-settings/container.native.js.map +1 -1
  376. package/build-module/components/block-styles/index.js +1 -1
  377. package/build-module/components/block-styles/index.js.map +1 -1
  378. package/build-module/components/block-styles/index.native.js +3 -2
  379. package/build-module/components/block-styles/index.native.js.map +1 -1
  380. package/build-module/components/block-switcher/index.js +4 -4
  381. package/build-module/components/block-switcher/index.js.map +1 -1
  382. package/build-module/components/block-toolbar/index.js +89 -27
  383. package/build-module/components/block-toolbar/index.js.map +1 -1
  384. package/build-module/components/block-tools/block-toolbar-breadcrumb.js +41 -0
  385. package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
  386. package/build-module/components/block-tools/block-toolbar-popover.js +74 -0
  387. package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -0
  388. package/build-module/components/block-tools/index.js +27 -24
  389. package/build-module/components/block-tools/index.js.map +1 -1
  390. package/build-module/components/block-types-list/index.native.js +2 -1
  391. package/build-module/components/block-types-list/index.native.js.map +1 -1
  392. package/build-module/components/block-variation-picker/index.native.js +2 -1
  393. package/build-module/components/block-variation-picker/index.native.js.map +1 -1
  394. package/build-module/components/block-variation-transforms/index.js +30 -3
  395. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  396. package/build-module/components/border-radius-control/linked-button.js +1 -1
  397. package/build-module/components/border-radius-control/linked-button.js.map +1 -1
  398. package/build-module/components/colors/utils.js +9 -1
  399. package/build-module/components/colors/utils.js.map +1 -1
  400. package/build-module/components/colors/with-colors.js +5 -1
  401. package/build-module/components/colors/with-colors.js.map +1 -1
  402. package/build-module/components/colors-gradients/control.js +29 -18
  403. package/build-module/components/colors-gradients/control.js.map +1 -1
  404. package/build-module/components/duotone-control/index.js +1 -4
  405. package/build-module/components/duotone-control/index.js.map +1 -1
  406. package/build-module/components/font-sizes/utils.js +9 -1
  407. package/build-module/components/font-sizes/utils.js.map +1 -1
  408. package/build-module/components/global-styles/border-panel.js +3 -2
  409. package/build-module/components/global-styles/border-panel.js.map +1 -1
  410. package/build-module/components/global-styles/color-panel.js +26 -23
  411. package/build-module/components/global-styles/color-panel.js.map +1 -1
  412. package/build-module/components/global-styles/dimensions-panel.js +5 -4
  413. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  414. package/build-module/components/global-styles/effects-panel.js +3 -2
  415. package/build-module/components/global-styles/effects-panel.js.map +1 -1
  416. package/build-module/components/global-styles/filters-panel.js +8 -5
  417. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  418. package/build-module/components/global-styles/get-global-styles-changes.js +184 -0
  419. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -0
  420. package/build-module/components/global-styles/hooks.js +3 -2
  421. package/build-module/components/global-styles/hooks.js.map +1 -1
  422. package/build-module/components/global-styles/image-settings-panel.js +7 -1
  423. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  424. package/build-module/components/global-styles/index.js +1 -0
  425. package/build-module/components/global-styles/index.js.map +1 -1
  426. package/build-module/components/global-styles/typography-panel.js +45 -38
  427. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  428. package/build-module/components/global-styles/use-global-styles-output.js +15 -1
  429. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  430. package/build-module/components/global-styles/utils.js +7 -0
  431. package/build-module/components/global-styles/utils.js.map +1 -1
  432. package/build-module/components/height-control/index.js +6 -2
  433. package/build-module/components/height-control/index.js.map +1 -1
  434. package/build-module/components/image-link-destinations/index.native.js +109 -0
  435. package/build-module/components/image-link-destinations/index.native.js.map +1 -0
  436. package/build-module/components/image-size-control/index.js +2 -2
  437. package/build-module/components/image-size-control/index.js.map +1 -1
  438. package/build-module/components/index.native.js +3 -1
  439. package/build-module/components/index.native.js.map +1 -1
  440. package/build-module/components/inner-blocks/index.js +62 -23
  441. package/build-module/components/inner-blocks/index.js.map +1 -1
  442. package/build-module/components/inner-blocks/index.native.js +18 -4
  443. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  444. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +5 -6
  445. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  446. package/build-module/components/inner-blocks/use-nested-settings-update.js +6 -10
  447. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  448. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  449. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  450. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +11 -10
  451. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  452. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +11 -11
  453. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  454. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +11 -11
  455. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  456. package/build-module/components/inserter/block-patterns-tab/utils.js +7 -11
  457. package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
  458. package/build-module/components/inserter/hooks/use-block-types-state.js +4 -14
  459. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  460. package/build-module/components/inserter/hooks/use-patterns-state.js +2 -2
  461. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  462. package/build-module/components/inserter/index.js +1 -2
  463. package/build-module/components/inserter/index.js.map +1 -1
  464. package/build-module/components/inserter/library.js +3 -7
  465. package/build-module/components/inserter/library.js.map +1 -1
  466. package/build-module/components/inserter/media-tab/media-panel.js +1 -1
  467. package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
  468. package/build-module/components/inserter/menu.js +26 -33
  469. package/build-module/components/inserter/menu.js.map +1 -1
  470. package/build-module/components/inserter/preview-panel.js +2 -2
  471. package/build-module/components/inserter/preview-panel.js.map +1 -1
  472. package/build-module/components/inserter/tabs.js +22 -22
  473. package/build-module/components/inserter/tabs.js.map +1 -1
  474. package/build-module/components/inserter-button/index.native.js +89 -0
  475. package/build-module/components/inserter-button/index.native.js.map +1 -0
  476. package/build-module/components/inserter-button/sparkles.js +15 -0
  477. package/build-module/components/inserter-button/sparkles.js.map +1 -0
  478. package/build-module/components/inserter-draggable-blocks/index.js +9 -5
  479. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  480. package/build-module/components/inserter-list-item/index.js +2 -4
  481. package/build-module/components/inserter-list-item/index.js.map +1 -1
  482. package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -1
  483. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  484. package/build-module/components/inspector-controls/fill.js +3 -3
  485. package/build-module/components/inspector-controls/fill.js.map +1 -1
  486. package/build-module/components/inspector-controls/fill.native.js +3 -3
  487. package/build-module/components/inspector-controls/fill.native.js.map +1 -1
  488. package/build-module/components/inspector-controls-tabs/index.js +35 -24
  489. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  490. package/build-module/components/list-view/block-select-button.js +4 -0
  491. package/build-module/components/list-view/block-select-button.js.map +1 -1
  492. package/build-module/components/list-view/block.js +58 -4
  493. package/build-module/components/list-view/block.js.map +1 -1
  494. package/build-module/components/media-upload-progress/constants.js +7 -0
  495. package/build-module/components/media-upload-progress/constants.js.map +1 -0
  496. package/build-module/components/media-upload-progress/index.native.js +37 -8
  497. package/build-module/components/media-upload-progress/index.native.js.map +1 -1
  498. package/build-module/components/navigable-toolbar/index.js +11 -16
  499. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  500. package/build-module/components/plain-text/index.native.js +6 -1
  501. package/build-module/components/plain-text/index.native.js.map +1 -1
  502. package/build-module/components/preview-options/index.js +6 -62
  503. package/build-module/components/preview-options/index.js.map +1 -1
  504. package/build-module/components/provider/index.js +3 -1
  505. package/build-module/components/provider/index.js.map +1 -1
  506. package/build-module/components/provider/use-block-sync.js +7 -1
  507. package/build-module/components/provider/use-block-sync.js.map +1 -1
  508. package/build-module/components/rich-text/content.js +25 -21
  509. package/build-module/components/rich-text/content.js.map +1 -1
  510. package/build-module/components/rich-text/get-rich-text-values.js +2 -1
  511. package/build-module/components/rich-text/get-rich-text-values.js.map +1 -1
  512. package/build-module/components/rich-text/index.js +21 -39
  513. package/build-module/components/rich-text/index.js.map +1 -1
  514. package/build-module/components/rich-text/index.native.js +10 -18
  515. package/build-module/components/rich-text/index.native.js.map +1 -1
  516. package/build-module/components/rich-text/native/get-format-colors.native.js +22 -24
  517. package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
  518. package/build-module/components/rich-text/native/index.native.js +22 -56
  519. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  520. package/build-module/components/rich-text/use-input-rules.js +7 -3
  521. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  522. package/build-module/components/rich-text/use-mark-persistent.js +1 -1
  523. package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
  524. package/build-module/components/rich-text/with-deprecations.js +42 -0
  525. package/build-module/components/rich-text/with-deprecations.js.map +1 -0
  526. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  527. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  528. package/build-module/components/url-input/index.js +9 -6
  529. package/build-module/components/url-input/index.js.map +1 -1
  530. package/build-module/components/use-block-commands/index.js +14 -18
  531. package/build-module/components/use-block-commands/index.js.map +1 -1
  532. package/build-module/components/use-block-drop-zone/index.js +107 -18
  533. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  534. package/build-module/components/use-moving-animation/index.js +102 -94
  535. package/build-module/components/use-moving-animation/index.js.map +1 -1
  536. package/build-module/components/use-on-block-drop/index.js +9 -12
  537. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  538. package/build-module/components/use-resize-canvas/index.js +4 -1
  539. package/build-module/components/use-resize-canvas/index.js.map +1 -1
  540. package/build-module/components/use-settings/index.js +13 -1
  541. package/build-module/components/use-settings/index.js.map +1 -1
  542. package/build-module/components/writing-flow/index.js +0 -1
  543. package/build-module/components/writing-flow/index.js.map +1 -1
  544. package/build-module/components/writing-flow/use-drag-selection.js +15 -4
  545. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
  546. package/build-module/components/writing-flow/use-selection-observer.js +73 -27
  547. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
  548. package/build-module/components/writing-flow/use-tab-nav.js +7 -4
  549. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  550. package/build-module/hooks/align.js +20 -67
  551. package/build-module/hooks/align.js.map +1 -1
  552. package/build-module/hooks/align.native.js +1 -0
  553. package/build-module/hooks/align.native.js.map +1 -1
  554. package/build-module/hooks/anchor.js +12 -27
  555. package/build-module/hooks/anchor.js.map +1 -1
  556. package/build-module/hooks/aria-label.js +7 -1
  557. package/build-module/hooks/aria-label.js.map +1 -1
  558. package/build-module/hooks/background.js +197 -37
  559. package/build-module/hooks/background.js.map +1 -1
  560. package/build-module/hooks/block-hooks.js +22 -30
  561. package/build-module/hooks/block-hooks.js.map +1 -1
  562. package/build-module/hooks/block-renaming.js +17 -21
  563. package/build-module/hooks/block-renaming.js.map +1 -1
  564. package/build-module/hooks/border.js +52 -79
  565. package/build-module/hooks/border.js.map +1 -1
  566. package/build-module/hooks/color.js +78 -88
  567. package/build-module/hooks/color.js.map +1 -1
  568. package/build-module/hooks/content-lock-ui.js +27 -27
  569. package/build-module/hooks/content-lock-ui.js.map +1 -1
  570. package/build-module/hooks/custom-class-name.js +12 -28
  571. package/build-module/hooks/custom-class-name.js.map +1 -1
  572. package/build-module/hooks/custom-class-name.native.js +7 -1
  573. package/build-module/hooks/custom-class-name.native.js.map +1 -1
  574. package/build-module/hooks/dimensions.js +15 -16
  575. package/build-module/hooks/dimensions.js.map +1 -1
  576. package/build-module/hooks/duotone.js +30 -61
  577. package/build-module/hooks/duotone.js.map +1 -1
  578. package/build-module/hooks/font-family.js +20 -25
  579. package/build-module/hooks/font-family.js.map +1 -1
  580. package/build-module/hooks/font-size.js +50 -120
  581. package/build-module/hooks/font-size.js.map +1 -1
  582. package/build-module/hooks/index.js +20 -16
  583. package/build-module/hooks/index.js.map +1 -1
  584. package/build-module/hooks/index.native.js +10 -6
  585. package/build-module/hooks/index.native.js.map +1 -1
  586. package/build-module/hooks/layout-child.js +60 -0
  587. package/build-module/hooks/layout-child.js.map +1 -0
  588. package/build-module/hooks/layout.js +21 -100
  589. package/build-module/hooks/layout.js.map +1 -1
  590. package/build-module/hooks/padding.js +2 -2
  591. package/build-module/hooks/padding.js.map +1 -1
  592. package/build-module/hooks/position.js +38 -59
  593. package/build-module/hooks/position.js.map +1 -1
  594. package/build-module/hooks/style.js +52 -85
  595. package/build-module/hooks/style.js.map +1 -1
  596. package/build-module/hooks/typography.js +26 -11
  597. package/build-module/hooks/typography.js.map +1 -1
  598. package/build-module/hooks/typography.native.js +43 -17
  599. package/build-module/hooks/typography.native.js.map +1 -1
  600. package/build-module/hooks/use-typography-props.js +9 -1
  601. package/build-module/hooks/use-typography-props.js.map +1 -1
  602. package/build-module/hooks/utils.js +194 -9
  603. package/build-module/hooks/utils.js.map +1 -1
  604. package/build-module/private-apis.js +2 -6
  605. package/build-module/private-apis.js.map +1 -1
  606. package/build-module/private-apis.native.js +0 -2
  607. package/build-module/private-apis.native.js.map +1 -1
  608. package/build-module/store/actions.js +0 -15
  609. package/build-module/store/actions.js.map +1 -1
  610. package/build-module/store/private-actions.js +52 -0
  611. package/build-module/store/private-actions.js.map +1 -1
  612. package/build-module/store/private-selectors.js +44 -1
  613. package/build-module/store/private-selectors.js.map +1 -1
  614. package/build-module/store/reducer.js +18 -2
  615. package/build-module/store/reducer.js.map +1 -1
  616. package/build-module/store/selectors.js +4 -65
  617. package/build-module/store/selectors.js.map +1 -1
  618. package/build-module/store/undo-ignore.js +5 -0
  619. package/build-module/store/undo-ignore.js.map +1 -0
  620. package/build-module/store/utils.js +56 -0
  621. package/build-module/store/utils.js.map +1 -0
  622. package/build-module/utils/get-px-from-css-unit.js +9 -0
  623. package/build-module/utils/get-px-from-css-unit.js.map +1 -0
  624. package/build-module/utils/index.js +1 -1
  625. package/build-module/utils/index.js.map +1 -1
  626. package/build-module/utils/object.js +37 -97
  627. package/build-module/utils/object.js.map +1 -1
  628. package/build-module/utils/selection.js +9 -1
  629. package/build-module/utils/selection.js.map +1 -1
  630. package/build-module/utils/use-can-block-toolbar-be-focused.js +40 -0
  631. package/build-module/utils/use-can-block-toolbar-be-focused.js.map +1 -0
  632. package/build-style/content-rtl.css +7 -6
  633. package/build-style/content.css +7 -6
  634. package/build-style/style-rtl.css +164 -301
  635. package/build-style/style.css +164 -301
  636. package/package.json +31 -31
  637. package/src/components/alignment-control/README.md +0 -5
  638. package/src/components/block-alignment-control/README.md +0 -5
  639. package/src/components/block-alignment-matrix-control/README.md +0 -10
  640. package/src/components/block-breadcrumb/README.md +0 -5
  641. package/src/components/block-canvas/index.js +29 -17
  642. package/src/components/block-canvas/style.scss +6 -0
  643. package/src/components/block-caption/README.md +2 -7
  644. package/src/components/block-card/README.md +0 -5
  645. package/src/components/block-card/index.js +6 -4
  646. package/src/components/block-card/style.scss +7 -3
  647. package/src/components/block-controls/hook.js +8 -30
  648. package/src/components/block-controls/test/index.js +3 -3
  649. package/src/components/block-draggable/draggable-chip.js +11 -1
  650. package/src/components/block-draggable/index.js +116 -4
  651. package/src/components/block-draggable/index.native.js +0 -5
  652. package/src/components/block-draggable/style.scss +35 -0
  653. package/src/components/block-draggable/test/helpers.native.js +8 -7
  654. package/src/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  655. package/src/components/block-edit/context.js +3 -0
  656. package/src/components/block-edit/index.js +36 -10
  657. package/src/components/block-editing-mode/index.js +3 -3
  658. package/src/components/block-icon/README.md +0 -5
  659. package/src/components/block-info-slot-fill/index.js +6 -3
  660. package/src/components/block-inspector/README.md +0 -5
  661. package/src/components/block-inspector/index.js +3 -1
  662. package/src/components/block-inspector/style.scss +0 -4
  663. package/src/components/block-list/block-list-item-cell.native.js +5 -1
  664. package/src/components/block-list/block.js +309 -104
  665. package/src/components/block-list/block.native.js +69 -21
  666. package/src/components/block-list/content.scss +14 -10
  667. package/src/components/block-list/index.native.js +3 -5
  668. package/src/components/block-list/{block-list-block-context.js → private-block-context.js} +1 -1
  669. package/src/components/block-list/use-block-props/index.js +43 -86
  670. package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -34
  671. package/src/components/block-list/use-block-props/use-is-hovered.js +2 -13
  672. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +1 -5
  673. package/src/components/block-list/use-in-between-inserter.js +4 -1
  674. package/src/components/block-list/use-scroll-upon-insertion.native.js +52 -0
  675. package/src/components/block-lock/toolbar.js +23 -34
  676. package/src/components/block-mover/README.md +0 -5
  677. package/src/components/block-mover/index.js +1 -1
  678. package/src/components/block-parent-selector/README.md +0 -5
  679. package/src/components/block-patterns-list/README.md +0 -5
  680. package/src/components/block-patterns-list/index.js +9 -6
  681. package/src/components/block-removal-warning-modal/index.js +7 -14
  682. package/src/components/block-rename/modal.js +7 -1
  683. package/src/components/block-settings/container.native.js +3 -5
  684. package/src/components/block-styles/index.js +1 -1
  685. package/src/components/block-styles/index.native.js +4 -2
  686. package/src/components/block-styles/style.scss +0 -11
  687. package/src/components/block-switcher/index.js +49 -59
  688. package/src/components/block-switcher/test/__snapshots__/index.js.snap +3 -1
  689. package/src/components/block-toolbar/README.md +0 -5
  690. package/src/components/block-toolbar/index.js +179 -95
  691. package/src/components/block-toolbar/style.scss +50 -66
  692. package/src/components/block-tools/block-toolbar-breadcrumb.js +46 -0
  693. package/src/components/block-tools/block-toolbar-popover.js +84 -0
  694. package/src/components/block-tools/index.js +42 -29
  695. package/src/components/block-tools/style.scss +60 -172
  696. package/src/components/block-types-list/README.md +0 -5
  697. package/src/components/block-types-list/index.native.js +2 -1
  698. package/src/components/block-variation-picker/README.md +0 -5
  699. package/src/components/block-variation-picker/index.native.js +1 -1
  700. package/src/components/block-variation-transforms/README.md +0 -5
  701. package/src/components/block-variation-transforms/index.js +49 -3
  702. package/src/components/border-radius-control/linked-button.js +1 -1
  703. package/src/components/caption/README.md +0 -5
  704. package/src/components/color-palette/test/__snapshots__/control.js.snap +0 -1
  705. package/src/components/colors/utils.js +8 -1
  706. package/src/components/colors/with-colors.js +3 -1
  707. package/src/components/colors-gradients/control.js +49 -30
  708. package/src/components/colors-gradients/style.scss +0 -7
  709. package/src/components/contrast-checker/README.md +0 -4
  710. package/src/components/copy-handler/README.md +0 -10
  711. package/src/components/duotone-control/index.js +2 -5
  712. package/src/components/duotone-control/style.scss +1 -6
  713. package/src/components/font-sizes/utils.js +7 -1
  714. package/src/components/global-styles/border-panel.js +2 -1
  715. package/src/components/global-styles/color-panel.js +36 -26
  716. package/src/components/global-styles/dimensions-panel.js +4 -3
  717. package/src/components/global-styles/effects-panel.js +2 -1
  718. package/src/components/global-styles/filters-panel.js +6 -5
  719. package/src/components/global-styles/get-global-styles-changes.js +210 -0
  720. package/src/components/global-styles/hooks.js +5 -0
  721. package/src/components/global-styles/image-settings-panel.js +6 -0
  722. package/src/components/global-styles/index.js +1 -0
  723. package/src/components/global-styles/test/get-global-styles-changes.js +234 -0
  724. package/src/components/global-styles/typography-panel.js +60 -47
  725. package/src/components/global-styles/use-global-styles-output.js +9 -5
  726. package/src/components/global-styles/utils.js +7 -0
  727. package/src/components/height-control/README.md +2 -7
  728. package/src/components/height-control/index.js +4 -0
  729. package/src/components/image-link-destinations/index.native.js +152 -0
  730. package/src/components/image-link-destinations/style.native.scss +16 -0
  731. package/src/components/image-size-control/index.js +5 -2
  732. package/src/components/index.native.js +3 -2
  733. package/src/components/inner-blocks/README.md +13 -2
  734. package/src/components/inner-blocks/index.js +68 -29
  735. package/src/components/inner-blocks/index.native.js +19 -7
  736. package/src/components/inner-blocks/use-inner-block-template-sync.js +5 -7
  737. package/src/components/inner-blocks/use-nested-settings-update.js +6 -13
  738. package/src/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  739. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +15 -15
  740. package/src/components/inserter/block-patterns-tab/patterns-filter.js +15 -13
  741. package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +15 -18
  742. package/src/components/inserter/block-patterns-tab/utils.js +11 -12
  743. package/src/components/inserter/hooks/use-block-types-state.js +9 -11
  744. package/src/components/inserter/hooks/use-patterns-state.js +2 -2
  745. package/src/components/inserter/index.js +0 -1
  746. package/src/components/inserter/library.js +2 -8
  747. package/src/components/inserter/media-tab/media-panel.js +1 -1
  748. package/src/components/inserter/menu.js +26 -36
  749. package/src/components/inserter/preview-panel.js +2 -2
  750. package/src/components/inserter/style.scss +21 -21
  751. package/src/components/inserter/tabs.js +34 -25
  752. package/src/components/inserter-button/README.md +62 -0
  753. package/src/components/inserter-button/index.native.js +116 -0
  754. package/src/components/inserter-button/sparkles.js +15 -0
  755. package/src/components/inserter-button/style.native.scss +72 -0
  756. package/src/components/inserter-draggable-blocks/index.js +18 -5
  757. package/src/components/inserter-list-item/index.js +6 -6
  758. package/src/components/inspector-controls/block-support-tools-panel.js +2 -0
  759. package/src/components/inspector-controls/fill.js +6 -3
  760. package/src/components/inspector-controls/fill.native.js +6 -3
  761. package/src/components/inspector-controls-tabs/index.js +39 -28
  762. package/src/components/inspector-controls-tabs/style.scss +3 -2
  763. package/src/components/letter-spacing-control/README.md +0 -5
  764. package/src/components/line-height-control/README.md +0 -5
  765. package/src/components/link-control/style.scss +1 -1
  766. package/src/components/link-control/test/index.js +1 -1
  767. package/src/components/list-view/README.md +0 -5
  768. package/src/components/list-view/block-select-button.js +4 -0
  769. package/src/components/list-view/block.js +73 -2
  770. package/src/components/list-view/style.scss +6 -0
  771. package/src/components/media-upload-progress/constants.js +6 -0
  772. package/src/components/media-upload-progress/index.native.js +66 -14
  773. package/src/components/media-upload-progress/test/index.native.js +2 -2
  774. package/src/components/multi-selection-inspector/README.md +0 -5
  775. package/src/components/navigable-toolbar/README.md +2 -0
  776. package/src/components/navigable-toolbar/index.js +15 -13
  777. package/src/components/plain-text/index.native.js +6 -1
  778. package/src/components/preview-options/index.js +6 -86
  779. package/src/components/provider/index.js +1 -1
  780. package/src/components/provider/test/use-block-sync.js +20 -17
  781. package/src/components/provider/use-block-sync.js +6 -0
  782. package/src/components/rich-text/content.js +27 -20
  783. package/src/components/rich-text/get-rich-text-values.js +6 -1
  784. package/src/components/rich-text/index.js +23 -52
  785. package/src/components/rich-text/index.native.js +8 -25
  786. package/src/components/rich-text/native/get-format-colors.native.js +33 -40
  787. package/src/components/rich-text/native/index.native.js +22 -71
  788. package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +3 -3
  789. package/src/components/rich-text/native/test/index.native.js +72 -5
  790. package/src/components/rich-text/use-input-rules.js +8 -3
  791. package/src/components/rich-text/use-mark-persistent.js +1 -2
  792. package/src/components/rich-text/with-deprecations.js +51 -0
  793. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  794. package/src/components/text-decoration-control/README.md +40 -0
  795. package/src/components/text-transform-control/README.md +0 -4
  796. package/src/components/ungroup-button/README.md +0 -5
  797. package/src/components/unit-control/README.md +0 -4
  798. package/src/components/url-input/index.js +11 -11
  799. package/src/components/use-block-commands/index.js +18 -21
  800. package/src/components/use-block-drop-zone/index.js +181 -30
  801. package/src/components/use-moving-animation/index.js +107 -103
  802. package/src/components/use-on-block-drop/index.js +9 -24
  803. package/src/components/use-on-block-drop/test/index.js +12 -26
  804. package/src/components/use-resize-canvas/README.md +3 -7
  805. package/src/components/use-resize-canvas/index.js +4 -1
  806. package/src/components/use-settings/README.md +0 -4
  807. package/src/components/use-settings/index.js +15 -1
  808. package/src/components/writing-flow/index.js +0 -1
  809. package/src/components/writing-flow/use-drag-selection.js +18 -4
  810. package/src/components/writing-flow/use-selection-observer.js +99 -37
  811. package/src/components/writing-flow/use-tab-nav.js +7 -7
  812. package/src/hooks/align.js +16 -81
  813. package/src/hooks/align.native.js +1 -0
  814. package/src/hooks/anchor.js +14 -38
  815. package/src/hooks/aria-label.js +8 -5
  816. package/src/hooks/background.js +269 -32
  817. package/src/hooks/block-hooks.js +22 -51
  818. package/src/hooks/block-renaming.js +23 -37
  819. package/src/hooks/border.js +62 -124
  820. package/src/hooks/color.js +111 -138
  821. package/src/hooks/content-lock-ui.js +110 -122
  822. package/src/hooks/custom-class-name.js +9 -45
  823. package/src/hooks/custom-class-name.native.js +8 -5
  824. package/src/hooks/dimensions.js +14 -16
  825. package/src/hooks/duotone.js +70 -127
  826. package/src/hooks/font-family.js +14 -36
  827. package/src/hooks/font-size.js +67 -168
  828. package/src/hooks/index.js +58 -16
  829. package/src/hooks/index.native.js +22 -6
  830. package/src/hooks/layout-child.js +53 -0
  831. package/src/hooks/layout.js +17 -103
  832. package/src/hooks/padding.js +2 -2
  833. package/src/hooks/position.js +50 -90
  834. package/src/hooks/style.js +118 -193
  835. package/src/hooks/test/align.js +1 -178
  836. package/src/hooks/test/anchor.js +4 -9
  837. package/src/hooks/test/custom-class-name.js +3 -8
  838. package/src/hooks/test/style.js +4 -14
  839. package/src/hooks/typography.js +14 -16
  840. package/src/hooks/typography.native.js +31 -33
  841. package/src/hooks/use-typography-props.js +7 -1
  842. package/src/hooks/utils.js +261 -10
  843. package/src/private-apis.js +2 -6
  844. package/src/private-apis.native.js +0 -2
  845. package/src/store/actions.js +0 -15
  846. package/src/store/private-actions.js +48 -0
  847. package/src/store/private-selectors.js +56 -0
  848. package/src/store/reducer.js +20 -1
  849. package/src/store/selectors.js +10 -82
  850. package/src/store/undo-ignore.js +4 -0
  851. package/src/store/utils.js +74 -0
  852. package/src/style.scss +1 -2
  853. package/src/utils/get-px-from-css-unit.js +8 -0
  854. package/src/utils/index.js +1 -1
  855. package/src/utils/object.js +34 -104
  856. package/src/utils/selection.js +9 -2
  857. package/src/utils/test/object.js +1 -96
  858. package/src/utils/use-can-block-toolbar-be-focused.js +48 -0
  859. package/build/components/block-list/block-list-block-context.js +0 -14
  860. package/build/components/block-list/block-list-block-context.js.map +0 -1
  861. package/build/components/block-list/use-block-props/use-block-class-names.js +0 -67
  862. package/build/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
  863. package/build/components/block-list/use-block-props/use-block-custom-class-name.js +0 -46
  864. package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
  865. package/build/components/block-list/use-block-props/use-block-default-class-name.js +0 -37
  866. package/build/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
  867. package/build/components/block-tools/back-compat.js +0 -45
  868. package/build/components/block-tools/back-compat.js.map +0 -1
  869. package/build/components/block-tools/block-contextual-toolbar.js +0 -91
  870. package/build/components/block-tools/block-contextual-toolbar.js.map +0 -1
  871. package/build/components/block-tools/selected-block-tools.js +0 -113
  872. package/build/components/block-tools/selected-block-tools.js.map +0 -1
  873. package/build/components/inserter/hooks/use-debounced-input.js +0 -22
  874. package/build/components/inserter/hooks/use-debounced-input.js.map +0 -1
  875. package/build/components/use-display-block-controls/index.js +0 -39
  876. package/build/components/use-display-block-controls/index.js.map +0 -1
  877. package/build/components/use-display-block-controls/index.native.js +0 -39
  878. package/build/components/use-display-block-controls/index.native.js.map +0 -1
  879. package/build/hooks/custom-fields.js +0 -120
  880. package/build/hooks/custom-fields.js.map +0 -1
  881. package/build/utils/parse-css-unit-to-px.js +0 -302
  882. package/build/utils/parse-css-unit-to-px.js.map +0 -1
  883. package/build/utils/use-should-contextual-toolbar-show.js +0 -63
  884. package/build/utils/use-should-contextual-toolbar-show.js.map +0 -1
  885. package/build-module/components/block-list/block-list-block-context.js +0 -6
  886. package/build-module/components/block-list/block-list-block-context.js.map +0 -1
  887. package/build-module/components/block-list/use-block-props/use-block-class-names.js +0 -60
  888. package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
  889. package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js +0 -40
  890. package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
  891. package/build-module/components/block-list/use-block-props/use-block-default-class-name.js +0 -31
  892. package/build-module/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
  893. package/build-module/components/block-tools/back-compat.js +0 -35
  894. package/build-module/components/block-tools/back-compat.js.map +0 -1
  895. package/build-module/components/block-tools/block-contextual-toolbar.js +0 -83
  896. package/build-module/components/block-tools/block-contextual-toolbar.js.map +0 -1
  897. package/build-module/components/block-tools/selected-block-tools.js +0 -105
  898. package/build-module/components/block-tools/selected-block-tools.js.map +0 -1
  899. package/build-module/components/inserter/hooks/use-debounced-input.js +0 -15
  900. package/build-module/components/inserter/hooks/use-debounced-input.js.map +0 -1
  901. package/build-module/components/use-display-block-controls/index.js +0 -32
  902. package/build-module/components/use-display-block-controls/index.js.map +0 -1
  903. package/build-module/components/use-display-block-controls/index.native.js +0 -32
  904. package/build-module/components/use-display-block-controls/index.native.js.map +0 -1
  905. package/build-module/hooks/custom-fields.js +0 -118
  906. package/build-module/hooks/custom-fields.js.map +0 -1
  907. package/build-module/utils/parse-css-unit-to-px.js +0 -294
  908. package/build-module/utils/parse-css-unit-to-px.js.map +0 -1
  909. package/build-module/utils/use-should-contextual-toolbar-show.js +0 -57
  910. package/build-module/utils/use-should-contextual-toolbar-show.js.map +0 -1
  911. package/src/components/block-list/use-block-props/use-block-class-names.js +0 -66
  912. package/src/components/block-list/use-block-props/use-block-custom-class-name.js +0 -44
  913. package/src/components/block-list/use-block-props/use-block-default-class-name.js +0 -35
  914. package/src/components/block-parent-selector/style.scss +0 -11
  915. package/src/components/block-tools/back-compat.js +0 -35
  916. package/src/components/block-tools/block-contextual-toolbar.js +0 -100
  917. package/src/components/block-tools/selected-block-tools.js +0 -127
  918. package/src/components/inserter/hooks/use-debounced-input.js +0 -18
  919. package/src/components/preview-options/README.md +0 -94
  920. package/src/components/preview-options/style.scss +0 -64
  921. package/src/components/use-display-block-controls/index.js +0 -36
  922. package/src/components/use-display-block-controls/index.native.js +0 -37
  923. package/src/hooks/custom-fields.js +0 -142
  924. package/src/hooks/test/color.js +0 -112
  925. package/src/utils/parse-css-unit-to-px.js +0 -329
  926. package/src/utils/test/parse-css-unit-to-px.js +0 -172
  927. package/src/utils/use-should-contextual-toolbar-show.js +0 -85
@@ -1 +0,0 @@
1
- {"version":3,"names":["addFilter","PanelBody","TextControl","__","sprintf","hasBlockSupport","createHigherOrderComponent","InspectorControls","useBlockEditingMode","addAttribute","settings","attributes","connections","type","CustomFieldsControl","props","blockEditingMode","attributeName","name","createElement","title","initialOpen","__nextHasNoMarginBottom","autoComplete","label","value","onChange","nextValue","setAttributes","undefined","placeholder","source","withCustomFieldsControls","BlockEdit","hasCustomFieldsSupport","includes","key","Fragment","isSelected","window","__experimentalConnections"],"sources":["@wordpress/block-editor/src/hooks/custom-fields.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { PanelBody, TextControl } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { InspectorControls } from '../components';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * Filters registered block settings, extending attributes to include `connections`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttribute( settings ) {\n\tif ( hasBlockSupport( settings, '__experimentalConnections', true ) ) {\n\t\t// Gracefully handle if settings.attributes.connections is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tconnections: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction CustomFieldsControl( props ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\t// If the block is a paragraph or image block, we need to know which\n\t// attribute to use for the connection. Only the `content` attribute\n\t// of the paragraph block and the `url` attribute of the image block are supported.\n\tlet attributeName;\n\tif ( props.name === 'core/paragraph' ) attributeName = 'content';\n\tif ( props.name === 'core/image' ) attributeName = 'url';\n\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Connections' ) } initialOpen={ true }>\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tlabel={ __( 'Custom field meta_key' ) }\n\t\t\t\t\tvalue={\n\t\t\t\t\t\tprops.attributes?.connections?.attributes?.[\n\t\t\t\t\t\t\tattributeName\n\t\t\t\t\t\t]?.value || ''\n\t\t\t\t\t}\n\t\t\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\t\t\tif ( nextValue === '' ) {\n\t\t\t\t\t\t\tprops.setAttributes( {\n\t\t\t\t\t\t\t\tconnections: undefined,\n\t\t\t\t\t\t\t\t[ attributeName ]: undefined,\n\t\t\t\t\t\t\t\tplaceholder: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tprops.setAttributes( {\n\t\t\t\t\t\t\t\tconnections: {\n\t\t\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\t\t\t// The attributeName will be either `content` or `url`.\n\t\t\t\t\t\t\t\t\t\t[ attributeName ]: {\n\t\t\t\t\t\t\t\t\t\t\t// Source will be variable, could be post_meta, user_meta, term_meta, etc.\n\t\t\t\t\t\t\t\t\t\t\t// Could even be a custom source like a social media attribute.\n\t\t\t\t\t\t\t\t\t\t\tsource: 'meta_fields',\n\t\t\t\t\t\t\t\t\t\t\tvalue: nextValue,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t[ attributeName ]: undefined,\n\t\t\t\t\t\t\t\tplaceholder: sprintf(\n\t\t\t\t\t\t\t\t\t'This content will be replaced on the frontend by the value of \"%s\" custom field.',\n\t\t\t\t\t\t\t\t\tnextValue\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n}\n\n/**\n * Override the default edit UI to include a new block inspector control for\n * assigning a connection to blocks that has support for connections.\n * Currently, only the `core/paragraph` block is supported and there is only a relation\n * between paragraph content and a custom field.\n *\n * @param {Component} BlockEdit Original component.\n *\n * @return {Component} Wrapped component.\n */\nconst withCustomFieldsControls = createHigherOrderComponent( ( BlockEdit ) => {\n\treturn ( props ) => {\n\t\tconst hasCustomFieldsSupport = hasBlockSupport(\n\t\t\tprops.name,\n\t\t\t'__experimentalConnections',\n\t\t\tfalse\n\t\t);\n\n\t\t// Check if the current block is a paragraph or image block.\n\t\t// Currently, only these two blocks are supported.\n\t\tif ( ! [ 'core/paragraph', 'core/image' ].includes( props.name ) ) {\n\t\t\treturn <BlockEdit key=\"edit\" { ...props } />;\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t\t{ hasCustomFieldsSupport && props.isSelected && (\n\t\t\t\t\t<CustomFieldsControl { ...props } />\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t};\n}, 'withCustomFieldsControls' );\n\nif ( window.__experimentalConnections ) {\n\taddFilter(\n\t\t'blocks.registerBlockType',\n\t\t'core/editor/connections/attribute',\n\t\taddAttribute\n\t);\n\taddFilter(\n\t\t'editor.BlockEdit',\n\t\t'core/editor/connections/with-inspector-controls',\n\t\twithCustomFieldsControls\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,SAAS,EAAEC,WAAW,QAAQ,uBAAuB;AAC9D,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,0BAA0B,QAAQ,oBAAoB;;AAE/D;AACA;AACA;AACA,SAASC,iBAAiB,QA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@ -1,294 +0,0 @@
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?.trim().match(/^(0?[-.]?\d*\.?\d+)(r?e[m|x]|v[h|w|min|max]+|p[x|t|c]|[c|m]m|%|in|ch|Q|lh)$/);
9
- if (!isNaN(cssUnit) && !isNaN(parseFloat(cssUnit))) {
10
- return {
11
- value: parseFloat(cssUnit),
12
- unit: 'px'
13
- };
14
- }
15
- return match ? {
16
- value: parseFloat(match[1]) || match[1],
17
- unit: match[2]
18
- } : {
19
- value: cssUnit,
20
- unit: undefined
21
- };
22
- }
23
- /**
24
- * Evaluate a math expression.
25
- *
26
- * @param {string} expression
27
- * @return {number} evaluated expression.
28
- */
29
- function calculate(expression) {
30
- try {
31
- return Function(`'use strict'; return (${expression})`)();
32
- } catch (err) {
33
- return null;
34
- }
35
- }
36
-
37
- /**
38
- * Calculates the css function value for the supported css functions such as max, min, clamp and calc.
39
- *
40
- * @param {string} functionUnitValue string should be in a particular format (for example min(12px,12px) ) no nested loops.
41
- * @param {Object} options
42
- * @return {string} unit containing the unit in PX.
43
- */
44
- function getFunctionUnitValue(functionUnitValue, options) {
45
- const functionUnit = functionUnitValue.split(/[(),]/g).filter(Boolean);
46
- const units = functionUnit.slice(1).map(unit => parseUnit(getPxFromCssUnit(unit, options)).value).filter(Boolean);
47
- switch (functionUnit[0]) {
48
- case 'min':
49
- return Math.min(...units) + 'px';
50
- case 'max':
51
- return Math.max(...units) + 'px';
52
- case 'clamp':
53
- if (units.length !== 3) {
54
- return null;
55
- }
56
- if (units[1] < units[0]) {
57
- return units[0] + 'px';
58
- }
59
- if (units[1] > units[2]) {
60
- return units[2] + 'px';
61
- }
62
- return units[1] + 'px';
63
- case 'calc':
64
- return units[0] + 'px';
65
- }
66
- }
67
-
68
- /**
69
- * Take a css function such as min, max, calc, clamp and returns parsedUnit
70
- *
71
- * How this works for the nested function is that it first replaces the inner function call.
72
- * Then it tackles the outer onces.
73
- * So for example: min( max(25px, 35px), 40px )
74
- * in the first pass we would replace max(25px, 35px) with 35px.
75
- * then we would try to evaluate min( 35px, 40px )
76
- * and then finally return 35px.
77
- *
78
- * @param {string} cssUnit
79
- * @return {Object} parsedUnit object.
80
- */
81
- function parseUnitFunction(cssUnit) {
82
- while (true) {
83
- const currentCssUnit = cssUnit;
84
- const regExp = /(max|min|calc|clamp)\(([^()]*)\)/g;
85
- const matches = regExp.exec(cssUnit) || [];
86
- if (matches[0]) {
87
- const functionUnitValue = getFunctionUnitValue(matches[0]);
88
- cssUnit = cssUnit.replace(matches[0], functionUnitValue);
89
- }
90
-
91
- // If the unit hasn't been modified or we have a single value break free.
92
- if (cssUnit === currentCssUnit || parseFloat(cssUnit)) {
93
- break;
94
- }
95
- }
96
- return parseUnit(cssUnit);
97
- }
98
- /**
99
- * Return true if we think this is a math expression.
100
- *
101
- * @param {string} cssUnit the cssUnit value being evaluted.
102
- * @return {boolean} Whether the cssUnit is a math expression.
103
- */
104
- function isMathExpression(cssUnit) {
105
- for (let i = 0; i < cssUnit.length; i++) {
106
- if (['+', '-', '/', '*'].includes(cssUnit[i])) {
107
- return true;
108
- }
109
- }
110
- return false;
111
- }
112
- /**
113
- * Evaluates the math expression and return a px value.
114
- *
115
- * @param {string} cssUnit the cssUnit value being evaluted.
116
- * @return {string} return a converfted value to px.
117
- */
118
- function evalMathExpression(cssUnit) {
119
- let errorFound = false;
120
- // Convert every part of the expression to px values.
121
- // The following regex matches numbers that have a following unit
122
- // E.g. 5.25rem, 1vw
123
- const cssUnitsBits = cssUnit.match(/\d+\.?\d*[a-zA-Z]+|\.\d+[a-zA-Z]+/g);
124
- if (cssUnitsBits) {
125
- for (const unit of cssUnitsBits) {
126
- // Standardize the unit to px and extract the value.
127
- const parsedUnit = parseUnit(getPxFromCssUnit(unit));
128
- if (!parseFloat(parsedUnit.value)) {
129
- errorFound = true;
130
- // End early since we are dealing with a null value.
131
- break;
132
- }
133
- cssUnit = cssUnit.replace(unit, parsedUnit.value);
134
- }
135
- } else {
136
- errorFound = true;
137
- }
138
-
139
- // For mixed math expressions wrapped within CSS expressions
140
- const expressionsMatches = cssUnit.match(/(max|min|clamp)/g);
141
- if (!errorFound && expressionsMatches) {
142
- const values = cssUnit.split(',');
143
- for (const currentValue of values) {
144
- // Check for nested calc() and remove them to calculate the value.
145
- const rawCurrentValue = currentValue.replace(/\s|calc/g, '');
146
- if (isMathExpression(rawCurrentValue)) {
147
- const calculatedExpression = calculate(rawCurrentValue);
148
- if (calculatedExpression) {
149
- const calculatedValue = calculatedExpression.toFixed(0) + 'px';
150
- cssUnit = cssUnit.replace(currentValue, calculatedValue);
151
- }
152
- }
153
- }
154
- const parsedValue = parseUnitFunction(cssUnit);
155
- return !parsedValue ? null : parsedValue.value + parsedValue.unit;
156
- }
157
- if (errorFound) {
158
- return null;
159
- }
160
- const calculatedResult = calculate(cssUnit);
161
- return calculatedResult ? calculatedResult.toFixed(0) + 'px' : null;
162
- }
163
-
164
- /**
165
- * Convert a parsedUnit object to px value.
166
- *
167
- * @param {Object} parsedUnit
168
- * @param {Object} options
169
- * @return {string} or {null} returns the converted with in a px value format.
170
- */
171
- function convertParsedUnitToPx(parsedUnit, options) {
172
- const PIXELS_PER_INCH = 96;
173
- const ONE_PERCENT = 0.01;
174
- const defaultProperties = {
175
- fontSize: 16,
176
- lineHeight: 16,
177
- width: 375,
178
- height: 812,
179
- type: 'font'
180
- };
181
- const setOptions = Object.assign({}, defaultProperties, options);
182
- const relativeUnits = {
183
- em: setOptions.fontSize,
184
- rem: setOptions.fontSize,
185
- vh: setOptions.height * ONE_PERCENT,
186
- vw: setOptions.width * ONE_PERCENT,
187
- vmin: (setOptions.width < setOptions.height ? setOptions.width : setOptions.height) * ONE_PERCENT,
188
- vmax: (setOptions.width > setOptions.height ? setOptions.width : setOptions.height) * ONE_PERCENT,
189
- '%': (setOptions.type === 'font' ? setOptions.fontSize : setOptions.width) * ONE_PERCENT,
190
- ch: 8,
191
- // The advance measure (width) of the glyph "0" of the element's font. Approximate
192
- ex: 7.15625,
193
- // X-height of the element's font. Approximate.
194
- lh: setOptions.lineHeight
195
- };
196
- relativeUnits.svw = relativeUnits.vmin;
197
- relativeUnits.lvw = relativeUnits.vmax;
198
- relativeUnits.dvw = relativeUnits.vw;
199
- relativeUnits.svh = relativeUnits.vmin;
200
- relativeUnits.lvh = relativeUnits.vmax;
201
- relativeUnits.dvh = relativeUnits.vh;
202
- relativeUnits.vi = relativeUnits.vh;
203
- relativeUnits.svi = relativeUnits.vmin;
204
- relativeUnits.lvi = relativeUnits.vmax;
205
- relativeUnits.dvi = relativeUnits.vw;
206
- relativeUnits.vb = relativeUnits.vh;
207
- relativeUnits.svb = relativeUnits.vmin;
208
- relativeUnits.lvb = relativeUnits.vmax;
209
- relativeUnits.dvb = relativeUnits.vh;
210
- relativeUnits.svmin = relativeUnits.vmin;
211
- relativeUnits.lvmin = relativeUnits.vmin;
212
- relativeUnits.dvmin = relativeUnits.vmin;
213
- relativeUnits.svmax = relativeUnits.vmax;
214
- relativeUnits.lvmax = relativeUnits.vmax;
215
- relativeUnits.dvmax = relativeUnits.vmax;
216
- const absoluteUnits = {
217
- in: PIXELS_PER_INCH,
218
- cm: PIXELS_PER_INCH / 2.54,
219
- mm: PIXELS_PER_INCH / 25.4,
220
- pt: PIXELS_PER_INCH / 72,
221
- pc: PIXELS_PER_INCH / 6,
222
- px: 1,
223
- Q: PIXELS_PER_INCH / 2.54 / 40
224
- };
225
- if (relativeUnits[parsedUnit.unit]) {
226
- return (relativeUnits[parsedUnit.unit] * parsedUnit.value).toFixed(0) + 'px';
227
- }
228
- if (absoluteUnits[parsedUnit.unit]) {
229
- return (absoluteUnits[parsedUnit.unit] * parsedUnit.value).toFixed(0) + 'px';
230
- }
231
- return null;
232
- }
233
-
234
- /**
235
- * Returns the px value of a cssUnit.
236
- *
237
- * @param {string} cssUnit
238
- * @param {Object} options
239
- * @return {string} returns the cssUnit value in a simple px format.
240
- */
241
- export function getPxFromCssUnit(cssUnit, options = {}) {
242
- if (Number.isFinite(cssUnit)) {
243
- return cssUnit.toFixed(0) + 'px';
244
- }
245
- if (cssUnit === undefined) {
246
- return null;
247
- }
248
- let parsedUnit = parseUnit(cssUnit);
249
- if (!parsedUnit.unit) {
250
- parsedUnit = parseUnitFunction(cssUnit);
251
- }
252
- if (isMathExpression(cssUnit) && !parsedUnit.unit) {
253
- return evalMathExpression(cssUnit);
254
- }
255
- return convertParsedUnitToPx(parsedUnit, options);
256
- }
257
-
258
- // Use simple cache.
259
- const cache = {};
260
- /**
261
- * Returns the px value of a cssUnit. The memoized version of getPxFromCssUnit;
262
- *
263
- * @param {string} cssUnit
264
- * @param {Object} options
265
- * @return {string} returns the cssUnit value in a simple px format.
266
- */
267
- function memoizedGetPxFromCssUnit(cssUnit, options = {}) {
268
- const hash = cssUnit + hashOptions(options);
269
- if (!cache[hash]) {
270
- cache[hash] = getPxFromCssUnit(cssUnit, options);
271
- }
272
- return cache[hash];
273
- }
274
- function hashOptions(options) {
275
- let hash = '';
276
- if (options.hasOwnProperty('fontSize')) {
277
- hash = ':' + options.width;
278
- }
279
- if (options.hasOwnProperty('lineHeight')) {
280
- hash = ':' + options.lineHeight;
281
- }
282
- if (options.hasOwnProperty('width')) {
283
- hash = ':' + options.width;
284
- }
285
- if (options.hasOwnProperty('height')) {
286
- hash = ':' + options.height;
287
- }
288
- if (options.hasOwnProperty('type')) {
289
- hash = ':' + options.type;
290
- }
291
- return hash;
292
- }
293
- export default memoizedGetPxFromCssUnit;
294
- //# sourceMappingURL=parse-css-unit-to-px.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["parseUnit","cssUnit","match","trim","isNaN","parseFloat","value","unit","undefined","calculate","expression","Function","err","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","expressionsMatches","values","currentValue","rawCurrentValue","calculatedExpression","calculatedValue","toFixed","parsedValue","calculatedResult","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","svw","lvw","dvw","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","svmin","lvmin","dvmin","svmax","lvmax","dvmax","absoluteUnits","in","cm","mm","pt","pc","px","Q","Number","isFinite","cache","memoizedGetPxFromCssUnit","hash","hashOptions","hasOwnProperty"],"sources":["@wordpress/block-editor/src/utils/parse-css-unit-to-px.js"],"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*\\.?\\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\ttry {\n\t\treturn Function( `'use strict'; return (${ expression })` )();\n\t} catch ( err ) {\n\t\treturn null;\n\t}\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\t// The following regex matches numbers that have a following unit\n\t// E.g. 5.25rem, 1vw\n\tconst cssUnitsBits = cssUnit.match( /\\d+\\.?\\d*[a-zA-Z]+|\\.\\d+[a-zA-Z]+/g );\n\tif ( cssUnitsBits ) {\n\t\tfor ( const unit of cssUnitsBits ) {\n\t\t\t// Standardize the unit to px and extract the value.\n\t\t\tconst parsedUnit = parseUnit( getPxFromCssUnit( unit ) );\n\t\t\tif ( ! parseFloat( parsedUnit.value ) ) {\n\t\t\t\terrorFound = true;\n\t\t\t\t// End early since we are dealing with a null value.\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcssUnit = cssUnit.replace( unit, parsedUnit.value );\n\t\t}\n\t} else {\n\t\terrorFound = true;\n\t}\n\n\t// For mixed math expressions wrapped within CSS expressions\n\tconst expressionsMatches = cssUnit.match( /(max|min|clamp)/g );\n\tif ( ! errorFound && expressionsMatches ) {\n\t\tconst values = cssUnit.split( ',' );\n\t\tfor ( const currentValue of values ) {\n\t\t\t// Check for nested calc() and remove them to calculate the value.\n\t\t\tconst rawCurrentValue = currentValue.replace( /\\s|calc/g, '' );\n\n\t\t\tif ( isMathExpression( rawCurrentValue ) ) {\n\t\t\t\tconst calculatedExpression = calculate( rawCurrentValue );\n\n\t\t\t\tif ( calculatedExpression ) {\n\t\t\t\t\tconst calculatedValue =\n\t\t\t\t\t\tcalculatedExpression.toFixed( 0 ) + 'px';\n\t\t\t\t\tcssUnit = cssUnit.replace( currentValue, calculatedValue );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst parsedValue = parseUnitFunction( cssUnit );\n\t\treturn ! parsedValue ? null : parsedValue.value + parsedValue.unit;\n\t}\n\n\tif ( errorFound ) {\n\t\treturn null;\n\t}\n\n\tconst calculatedResult = calculate( cssUnit );\n\treturn calculatedResult ? calculatedResult.toFixed( 0 ) + 'px' : null;\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\trelativeUnits.svw = relativeUnits.vmin;\n\trelativeUnits.lvw = relativeUnits.vmax;\n\trelativeUnits.dvw = relativeUnits.vw;\n\trelativeUnits.svh = relativeUnits.vmin;\n\trelativeUnits.lvh = relativeUnits.vmax;\n\trelativeUnits.dvh = relativeUnits.vh;\n\trelativeUnits.vi = relativeUnits.vh;\n\trelativeUnits.svi = relativeUnits.vmin;\n\trelativeUnits.lvi = relativeUnits.vmax;\n\trelativeUnits.dvi = relativeUnits.vw;\n\trelativeUnits.vb = relativeUnits.vh;\n\trelativeUnits.svb = relativeUnits.vmin;\n\trelativeUnits.lvb = relativeUnits.vmax;\n\trelativeUnits.dvb = relativeUnits.vh;\n\trelativeUnits.svmin = relativeUnits.vmin;\n\trelativeUnits.lvmin = relativeUnits.vmin;\n\trelativeUnits.dvmin = relativeUnits.vmin;\n\trelativeUnits.svmax = relativeUnits.vmax;\n\trelativeUnits.lvmax = relativeUnits.vmax;\n\trelativeUnits.dvmax = relativeUnits.vmax;\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 );\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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAASA,CAAEC,OAAO,EAAG;EAC7B,MAAMC,KAAK,GAAGD,OAAO,EAClBE,IAAI,CAAC,CAAC,CACPD,KAAK,CACL,6EACD,CAAC;EACF,IAAK,CAAEE,KAAK,CAAEH,OAAQ,CAAC,IAAI,CAAEG,KAAK,CAAEC,UAAU,CAAEJ,OAAQ,CAA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AAKzC,OAAO,CAAC2F,cAAc,CAAE,QAAS,CAAC,EAAG;IACzCF,IAAI,GAAG,GAAG,GAAGzF,OAAO,CAAC0C,MAAM;EAC5B;EACA,IAAK1C,OAAO,CAAC2F,cAAc,CAAE,MAAO,CAAC,EAAG;IACvCF,IAAI,GAAG,GAAG,GAAGzF,OAAO,CAAC2C,IAAI;EAC1B;EACA,OAAO8C,IAAI;AACZ;AAEA,eAAeD,wBAAwB"}
@@ -1,57 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useSelect } from '@wordpress/data';
5
- import { isUnmodifiedDefaultBlock } from '@wordpress/blocks';
6
- import { useViewportMatch } from '@wordpress/compose';
7
-
8
- /**
9
- * Internal dependencies
10
- */
11
- import { store as blockEditorStore } from '../store';
12
- import { unlock } from '../lock-unlock';
13
-
14
- /**
15
- * Returns true if the contextual block toolbar should show, or false if it should be hidden.
16
- *
17
- * @return {boolean} Whether the block toolbar is hidden.
18
- */
19
- export function useShouldContextualToolbarShow() {
20
- const isLargeViewport = useViewportMatch('medium');
21
- const {
22
- shouldShowContextualToolbar,
23
- canFocusHiddenToolbar,
24
- fixedToolbarCanBeFocused
25
- } = useSelect(select => {
26
- const {
27
- __unstableGetEditorMode,
28
- isMultiSelecting,
29
- isTyping,
30
- isBlockInterfaceHidden,
31
- getBlock,
32
- getSettings,
33
- isNavigationMode,
34
- getSelectedBlockClientId,
35
- getFirstMultiSelectedBlockClientId
36
- } = unlock(select(blockEditorStore));
37
- const isEditMode = __unstableGetEditorMode() === 'edit';
38
- const hasFixedToolbar = getSettings().hasFixedToolbar;
39
- const isDistractionFree = getSettings().isDistractionFree;
40
- const selectedBlockId = getFirstMultiSelectedBlockClientId() || getSelectedBlockClientId();
41
- const hasSelectedBlockId = !!selectedBlockId;
42
- const isEmptyDefaultBlock = isUnmodifiedDefaultBlock(getBlock(selectedBlockId) || {});
43
- const _shouldShowContextualToolbar = isEditMode && !hasFixedToolbar && (!isDistractionFree || isNavigationMode()) && isLargeViewport && !isMultiSelecting() && !isTyping() && hasSelectedBlockId && !isEmptyDefaultBlock && !isBlockInterfaceHidden();
44
- const _canFocusHiddenToolbar = isEditMode && hasSelectedBlockId && !_shouldShowContextualToolbar && !hasFixedToolbar && !isDistractionFree && !isEmptyDefaultBlock;
45
- return {
46
- shouldShowContextualToolbar: _shouldShowContextualToolbar,
47
- canFocusHiddenToolbar: _canFocusHiddenToolbar,
48
- fixedToolbarCanBeFocused: (hasFixedToolbar || !isLargeViewport) && selectedBlockId
49
- };
50
- }, [isLargeViewport]);
51
- return {
52
- shouldShowContextualToolbar,
53
- canFocusHiddenToolbar,
54
- fixedToolbarCanBeFocused
55
- };
56
- }
57
- //# sourceMappingURL=use-should-contextual-toolbar-show.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useSelect","isUnmodifiedDefaultBlock","useViewportMatch","store","blockEditorStore","unlock","useShouldContextualToolbarShow","isLargeViewport","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","select","__unstableGetEditorMode","isMultiSelecting","isTyping","isBlockInterfaceHidden","getBlock","getSettings","isNavigationMode","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","isEditMode","hasFixedToolbar","isDistractionFree","selectedBlockId","hasSelectedBlockId","isEmptyDefaultBlock","_shouldShowContextualToolbar","_canFocusHiddenToolbar"],"sources":["@wordpress/block-editor/src/utils/use-should-contextual-toolbar-show.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\n/**\n * Returns true if the contextual block toolbar should show, or false if it should be hidden.\n *\n * @return {boolean} Whether the block toolbar is hidden.\n */\nexport function useShouldContextualToolbarShow() {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t\tisMultiSelecting,\n\t\t\t\tisTyping,\n\t\t\t\tisBlockInterfaceHidden,\n\t\t\t\tgetBlock,\n\t\t\t\tgetSettings,\n\t\t\t\tisNavigationMode,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetFirstMultiSelectedBlockClientId,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\tconst isEditMode = __unstableGetEditorMode() === 'edit';\n\t\t\tconst hasFixedToolbar = getSettings().hasFixedToolbar;\n\t\t\tconst isDistractionFree = getSettings().isDistractionFree;\n\t\t\tconst selectedBlockId =\n\t\t\t\tgetFirstMultiSelectedBlockClientId() ||\n\t\t\t\tgetSelectedBlockClientId();\n\t\t\tconst hasSelectedBlockId = !! selectedBlockId;\n\t\t\tconst isEmptyDefaultBlock = isUnmodifiedDefaultBlock(\n\t\t\t\tgetBlock( selectedBlockId ) || {}\n\t\t\t);\n\n\t\t\tconst _shouldShowContextualToolbar =\n\t\t\t\tisEditMode &&\n\t\t\t\t! hasFixedToolbar &&\n\t\t\t\t( ! isDistractionFree || isNavigationMode() ) &&\n\t\t\t\tisLargeViewport &&\n\t\t\t\t! isMultiSelecting() &&\n\t\t\t\t! isTyping() &&\n\t\t\t\thasSelectedBlockId &&\n\t\t\t\t! isEmptyDefaultBlock &&\n\t\t\t\t! isBlockInterfaceHidden();\n\n\t\t\tconst _canFocusHiddenToolbar =\n\t\t\t\tisEditMode &&\n\t\t\t\thasSelectedBlockId &&\n\t\t\t\t! _shouldShowContextualToolbar &&\n\t\t\t\t! hasFixedToolbar &&\n\t\t\t\t! isDistractionFree &&\n\t\t\t\t! isEmptyDefaultBlock;\n\n\t\t\treturn {\n\t\t\t\tshouldShowContextualToolbar: _shouldShowContextualToolbar,\n\t\t\t\tcanFocusHiddenToolbar: _canFocusHiddenToolbar,\n\t\t\t\tfixedToolbarCanBeFocused:\n\t\t\t\t\t( hasFixedToolbar || ! isLargeViewport ) && selectedBlockId,\n\t\t\t};\n\t\t},\n\t\t[ isLargeViewport ]\n\t);\n\n\treturn {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,wBAAwB,QAAQ,mBAAmB;AAC5D,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AACpD,SAASC,MAAM,QAAQ,gBAAgB;;AAEvC;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,8BAA8BA,CAAA,EAAG;EAChD,MAAMC,eAAe,GAAGL,gBAAgB,CAAE,QAAS,CAAC;EAEpD,MAAM;IACLM,2BAA2B;IAC3BC,qBAAqB;IACrBC;EACD,CAAC,GAAGV,SAAS,CACVW,MAAM,IAAM;IACb,MAAM;MACLC,uBAAuB;MACvBC,gBAAgB;MAChBC,QAAQ;MACRC,sBAAsB;MACtBC,QAAQ;MACRC,WAAW;MACXC,gBAAgB;MAChBC,wBAAwB;MACxBC;IACD,CAAC,GAAGf,MAAM,CAAEM,MAAM,CAAEP,gBAAiB,CAAE,CAAC;IAExC,MAAMiB,UAAU,GAAGT,uBAAuB,CAAC,CAAC,KAAK,MAAM;IACvD,MAAMU,eAAe,GAAGL,WAAW,CAAC,CAAC,CAACK,eAAe;IACrD,MAAMC,iBAAiB,GAAGN,WAAW,CAAC,CAAC,CAACM,iBAAiB;IACzD,MAAMC,eAAe,GACpBJ,kCAAkC,CAAC,CAAC,IACpCD,wBAAwB,CAAC,CAAC;IAC3B,MAAMM,kBAAkB,GAAG,CAAC,CAAED,eAAe;IAC7C,MAAME,mBAAmB,GAAGzB,wBAAwB,CACnDe,QAAQ,CAAEQ,eAAgB,CAAC,IAAI,CAAC,CACjC,CAAC;IAED,MAAMG,4BAA4B,GACjCN,UAAU,IACV,CAAEC,eAAe,KACf,CAAEC,iBAAiB,IAAIL,gBAAgB,CAAC,CAAC,CAAE,IAC7CX,eAAe,IACf,CAAEM,gBAAgB,CAAC,CAAC,IACpB,CAAEC,QAAQ,CAAC,CAAC,IACZW,kBAAkB,IAClB,CAAEC,mBAAmB,IACrB,CAAEX,sBAAsB,CAAC,CAAC;IAE3B,MAAMa,sBAAsB,GAC3BP,UAAU,IACVI,kBAAkB,IAClB,CAAEE,4BAA4B,IAC9B,CAAEL,eAAe,IACjB,CAAEC,iBAAiB,IACnB,CAAEG,mBAAmB;IAEtB,OAAO;MACNlB,2BAA2B,EAAEmB,4BAA4B;MACzDlB,qBAAqB,EAAEmB,sBAAsB;MAC7ClB,wBAAwB,EACvB,CAAEY,eAAe,IAAI,CAAEf,eAAe,KAAMiB;IAC9C,CAAC;EACF,CAAC,EACD,CAAEjB,eAAe,CAClB,CAAC;EAED,OAAO;IACNC,2BAA2B;IAC3BC,qBAAqB;IACrBC;EACD,CAAC;AACF"}
@@ -1,66 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import classnames from 'classnames';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import { useSelect } from '@wordpress/data';
10
- import { isReusableBlock, getBlockType } from '@wordpress/blocks';
11
-
12
- /**
13
- * Internal dependencies
14
- */
15
- import { store as blockEditorStore } from '../../../store';
16
-
17
- /**
18
- * Returns the class names used for the different states of the block.
19
- *
20
- * @param {string} clientId The block client ID.
21
- *
22
- * @return {string} The class names.
23
- */
24
- export function useBlockClassNames( clientId ) {
25
- return useSelect(
26
- ( select ) => {
27
- const {
28
- isBlockBeingDragged,
29
- isBlockHighlighted,
30
- isBlockSelected,
31
- isBlockMultiSelected,
32
- getBlockName,
33
- getSettings,
34
- hasSelectedInnerBlock,
35
- isTyping,
36
- __unstableIsFullySelected,
37
- __unstableSelectionHasUnmergeableBlock,
38
- } = select( blockEditorStore );
39
- const { outlineMode } = getSettings();
40
- const isDragging = isBlockBeingDragged( clientId );
41
- const isSelected = isBlockSelected( clientId );
42
- const name = getBlockName( clientId );
43
- const checkDeep = true;
44
- // "ancestor" is the more appropriate label due to "deep" check.
45
- const isAncestorOfSelectedBlock = hasSelectedInnerBlock(
46
- clientId,
47
- checkDeep
48
- );
49
- const isMultiSelected = isBlockMultiSelected( clientId );
50
- return classnames( {
51
- 'is-selected': isSelected,
52
- 'is-highlighted': isBlockHighlighted( clientId ),
53
- 'is-multi-selected': isMultiSelected,
54
- 'is-partially-selected':
55
- isMultiSelected &&
56
- ! __unstableIsFullySelected() &&
57
- ! __unstableSelectionHasUnmergeableBlock(),
58
- 'is-reusable': isReusableBlock( getBlockType( name ) ),
59
- 'is-dragging': isDragging,
60
- 'has-child-selected': isAncestorOfSelectedBlock,
61
- 'remove-outline': isSelected && outlineMode && isTyping(),
62
- } );
63
- },
64
- [ clientId ]
65
- );
66
- }
@@ -1,44 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useSelect } from '@wordpress/data';
5
- import { getBlockType } from '@wordpress/blocks';
6
-
7
- /**
8
- * Internal dependencies
9
- */
10
- import { store as blockEditorStore } from '../../../store';
11
-
12
- /**
13
- * Returns the custom class name if the block is a light block.
14
- *
15
- * @param {string} clientId The block client ID.
16
- *
17
- * @return {string} The custom class name.
18
- */
19
- export function useBlockCustomClassName( clientId ) {
20
- // It's good for this to be a separate selector because it will be executed
21
- // on every attribute change, while the other selectors are not re-evaluated
22
- // as much.
23
- return useSelect(
24
- ( select ) => {
25
- const { getBlockName, getBlockAttributes } =
26
- select( blockEditorStore );
27
- const attributes = getBlockAttributes( clientId );
28
-
29
- if ( ! attributes?.className ) {
30
- return;
31
- }
32
-
33
- const blockType = getBlockType( getBlockName( clientId ) );
34
- const hasLightBlockWrapper = blockType?.apiVersion > 1;
35
-
36
- if ( ! hasLightBlockWrapper ) {
37
- return;
38
- }
39
-
40
- return attributes.className;
41
- },
42
- [ clientId ]
43
- );
44
- }
@@ -1,35 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useSelect } from '@wordpress/data';
5
- import { getBlockType, getBlockDefaultClassName } from '@wordpress/blocks';
6
-
7
- /**
8
- * Internal dependencies
9
- */
10
- import { store as blockEditorStore } from '../../../store';
11
-
12
- /**
13
- * Returns the default class name if the block is a light block and it supports
14
- * `className`.
15
- *
16
- * @param {string} clientId The block client ID.
17
- *
18
- * @return {string} The class name, e.g. `wp-block-paragraph`.
19
- */
20
- export function useBlockDefaultClassName( clientId ) {
21
- return useSelect(
22
- ( select ) => {
23
- const name = select( blockEditorStore ).getBlockName( clientId );
24
- const blockType = getBlockType( name );
25
- const hasLightBlockWrapper = blockType?.apiVersion > 1;
26
-
27
- if ( ! hasLightBlockWrapper ) {
28
- return;
29
- }
30
-
31
- return getBlockDefaultClassName( name );
32
- },
33
- [ clientId ]
34
- );
35
- }
@@ -1,11 +0,0 @@
1
- .block-editor-block-parent-selector {
2
- background: $white;
3
- border-radius: $radius-block-ui;
4
-
5
- .block-editor-block-parent-selector__button {
6
- width: $grid-unit-60;
7
- height: $grid-unit-60;
8
- border: $border-width solid $gray-900;
9
- border-radius: $radius-block-ui;
10
- }
11
- }
@@ -1,35 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useContext } from '@wordpress/element';
5
- import { Disabled } from '@wordpress/components';
6
- import deprecated from '@wordpress/deprecated';
7
-
8
- /**
9
- * Internal dependencies
10
- */
11
- import InsertionPoint, { InsertionPointOpenRef } from './insertion-point';
12
- import BlockPopover from './selected-block-tools';
13
-
14
- export default function BlockToolsBackCompat( { children } ) {
15
- const openRef = useContext( InsertionPointOpenRef );
16
- const isDisabled = useContext( Disabled.Context );
17
-
18
- // If context is set, `BlockTools` is a parent component.
19
- if ( openRef || isDisabled ) {
20
- return children;
21
- }
22
-
23
- deprecated( 'wp.components.Popover.Slot name="block-toolbar"', {
24
- alternative: 'wp.blockEditor.BlockTools',
25
- since: '5.8',
26
- version: '6.3',
27
- } );
28
-
29
- return (
30
- <InsertionPoint __unstablePopoverSlot="block-toolbar">
31
- <BlockPopover __unstablePopoverSlot="block-toolbar" />
32
- { children }
33
- </InsertionPoint>
34
- );
35
- }