@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.
- package/CHANGELOG.md +2 -0
- package/LICENSE.md +1 -1
- package/README.md +12 -10
- package/build/components/block-canvas/index.js +21 -7
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-card/index.js +2 -2
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-controls/hook.js +3 -23
- package/build/components/block-controls/hook.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.js +6 -1
- package/build/components/block-draggable/draggable-chip.js.map +1 -1
- package/build/components/block-draggable/index.js +76 -6
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/index.native.js +0 -6
- package/build/components/block-draggable/index.native.js.map +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
- package/build/components/block-edit/context.js +5 -1
- package/build/components/block-edit/context.js.map +1 -1
- package/build/components/block-edit/index.js +18 -9
- package/build/components/block-edit/index.js.map +1 -1
- package/build/components/block-editing-mode/index.js +2 -3
- package/build/components/block-editing-mode/index.js.map +1 -1
- package/build/components/block-info-slot-fill/index.js +3 -4
- package/build/components/block-info-slot-fill/index.js.map +1 -1
- package/build/components/block-inspector/index.js +1 -1
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-list-item-cell.native.js +1 -0
- package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build/components/block-list/block.js +257 -95
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +58 -23
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +3 -5
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/private-block-context.js +14 -0
- package/build/components/block-list/private-block-context.js.map +1 -0
- package/build/components/block-list/use-block-props/index.js +49 -69
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -29
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-block-props/use-is-hovered.js +4 -14
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +3 -2
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list/use-scroll-upon-insertion.native.js +41 -0
- package/build/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
- package/build/components/block-lock/toolbar.js +21 -27
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mover/index.js +2 -1
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +5 -5
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +2 -9
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-rename/modal.js +3 -0
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-settings/container.native.js +6 -4
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-styles/index.js +1 -1
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/index.native.js +3 -2
- package/build/components/block-styles/index.native.js.map +1 -1
- package/build/components/block-switcher/index.js +4 -4
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +90 -29
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-toolbar-breadcrumb.js +49 -0
- package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
- package/build/components/block-tools/block-toolbar-popover.js +84 -0
- package/build/components/block-tools/block-toolbar-popover.js.map +1 -0
- package/build/components/block-tools/index.js +27 -24
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-types-list/index.native.js +4 -3
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/block-variation-picker/index.native.js +2 -1
- package/build/components/block-variation-picker/index.native.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +29 -2
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/border-radius-control/linked-button.js +1 -1
- package/build/components/border-radius-control/linked-button.js.map +1 -1
- package/build/components/colors/utils.js +10 -2
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors/with-colors.js +6 -2
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/colors-gradients/control.js +28 -17
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/duotone-control/index.js +1 -4
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/font-sizes/utils.js +10 -2
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/global-styles/border-panel.js +2 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +24 -21
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +4 -3
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/effects-panel.js +2 -1
- package/build/components/global-styles/effects-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +6 -3
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +192 -0
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -0
- package/build/components/global-styles/hooks.js +3 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +7 -1
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/index.js +7 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +43 -36
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +22 -8
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +8 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/height-control/index.js +6 -2
- package/build/components/height-control/index.js.map +1 -1
- package/build/components/image-link-destinations/index.native.js +118 -0
- package/build/components/image-link-destinations/index.native.js.map +1 -0
- package/build/components/image-size-control/index.js +2 -2
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.native.js +14 -5
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/index.js +61 -22
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +18 -4
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +5 -6
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +5 -9
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +10 -9
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +10 -10
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +9 -9
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/utils.js +10 -14
- package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +4 -14
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/index.js +1 -2
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/library.js +3 -7
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/media-tab/media-panel.js +2 -2
- package/build/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build/components/inserter/menu.js +26 -33
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/preview-panel.js +2 -2
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/tabs.js +21 -21
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inserter-button/index.native.js +98 -0
- package/build/components/inserter-button/index.native.js.map +1 -0
- package/build/components/inserter-button/sparkles.js +23 -0
- package/build/components/inserter-button/sparkles.js.map +1 -0
- package/build/components/inserter-draggable-blocks/index.js +8 -4
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inserter-list-item/index.js +2 -4
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +3 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.js +3 -3
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +3 -3
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +34 -23
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +4 -0
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +57 -3
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/media-upload-progress/constants.js +19 -0
- package/build/components/media-upload-progress/constants.js.map +1 -0
- package/build/components/media-upload-progress/index.native.js +42 -17
- package/build/components/media-upload-progress/index.native.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +11 -16
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +8 -3
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +6 -62
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/provider/index.js +3 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +7 -1
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/content.js +26 -23
- package/build/components/rich-text/content.js.map +1 -1
- package/build/components/rich-text/get-rich-text-values.js +2 -1
- package/build/components/rich-text/get-rich-text-values.js.map +1 -1
- package/build/components/rich-text/index.js +19 -37
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +9 -16
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/get-format-colors.native.js +22 -24
- package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +22 -57
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +7 -3
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/rich-text/use-mark-persistent.js +1 -1
- package/build/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build/components/rich-text/with-deprecations.js +50 -0
- package/build/components/rich-text/with-deprecations.js.map +1 -0
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +9 -6
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-commands/index.js +14 -18
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +108 -17
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +100 -92
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +9 -12
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +4 -1
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/use-settings/index.js +14 -0
- package/build/components/use-settings/index.js.map +1 -1
- package/build/components/writing-flow/index.js +0 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-drag-selection.js +15 -4
- package/build/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +73 -27
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +7 -4
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js +21 -69
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/align.native.js +11 -1
- package/build/hooks/align.native.js.map +1 -1
- package/build/hooks/anchor.js +14 -30
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/aria-label.js +9 -1
- package/build/hooks/aria-label.js.map +1 -1
- package/build/hooks/background.js +198 -36
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +24 -32
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-renaming.js +18 -22
- package/build/hooks/block-renaming.js.map +1 -1
- package/build/hooks/border.js +53 -80
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +79 -90
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +29 -29
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/custom-class-name.js +13 -30
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/custom-class-name.native.js +9 -1
- package/build/hooks/custom-class-name.native.js.map +1 -1
- package/build/hooks/dimensions.js +13 -14
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +31 -61
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-family.js +23 -28
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +52 -120
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +27 -16
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +15 -6
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout-child.js +68 -0
- package/build/hooks/layout-child.js.map +1 -0
- package/build/hooks/layout.js +25 -104
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/padding.js +2 -2
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/position.js +40 -62
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +52 -89
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +25 -10
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/typography.native.js +43 -18
- package/build/hooks/typography.native.js.map +1 -1
- package/build/hooks/use-typography-props.js +10 -2
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/hooks/utils.js +200 -10
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +2 -6
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +0 -2
- package/build/private-apis.native.js.map +1 -1
- package/build/store/actions.js +0 -16
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +54 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +46 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +18 -2
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +11 -73
- package/build/store/selectors.js.map +1 -1
- package/build/store/undo-ignore.js +12 -0
- package/build/store/undo-ignore.js.map +1 -0
- package/build/store/utils.js +66 -0
- package/build/store/utils.js.map +1 -0
- package/build/utils/get-px-from-css-unit.js +16 -0
- package/build/utils/get-px-from-css-unit.js.map +1 -0
- package/build/utils/index.js +2 -2
- package/build/utils/index.js.map +1 -1
- package/build/utils/object.js +38 -99
- package/build/utils/object.js.map +1 -1
- package/build/utils/selection.js +9 -1
- package/build/utils/selection.js.map +1 -1
- package/build/utils/use-can-block-toolbar-be-focused.js +46 -0
- package/build/utils/use-can-block-toolbar-be-focused.js.map +1 -0
- package/build-module/components/block-canvas/index.js +22 -8
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-card/index.js +2 -2
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-controls/hook.js +4 -24
- package/build-module/components/block-controls/hook.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.js +6 -1
- package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
- package/build-module/components/block-draggable/index.js +76 -6
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +1 -7
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
- package/build-module/components/block-edit/context.js +2 -0
- package/build-module/components/block-edit/context.js.map +1 -1
- package/build-module/components/block-edit/index.js +19 -10
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-editing-mode/index.js +3 -4
- package/build-module/components/block-editing-mode/index.js.map +1 -1
- package/build-module/components/block-info-slot-fill/index.js +3 -3
- package/build-module/components/block-info-slot-fill/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -1
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-list-item-cell.native.js +1 -0
- package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build-module/components/block-list/block.js +261 -99
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +60 -25
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +3 -5
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/private-block-context.js +6 -0
- package/build-module/components/block-list/private-block-context.js.map +1 -0
- package/build-module/components/block-list/use-block-props/index.js +50 -70
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -29
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-is-hovered.js +4 -14
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +3 -2
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list/use-scroll-upon-insertion.native.js +33 -0
- package/build-module/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
- package/build-module/components/block-lock/toolbar.js +22 -28
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-mover/index.js +2 -1
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +6 -6
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +3 -10
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js +3 -0
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +4 -2
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-styles/index.js +1 -1
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/index.native.js +3 -2
- package/build-module/components/block-styles/index.native.js.map +1 -1
- package/build-module/components/block-switcher/index.js +4 -4
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +89 -27
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js +41 -0
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
- package/build-module/components/block-tools/block-toolbar-popover.js +74 -0
- package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -0
- package/build-module/components/block-tools/index.js +27 -24
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +2 -1
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/block-variation-picker/index.native.js +2 -1
- package/build-module/components/block-variation-picker/index.native.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +30 -3
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/border-radius-control/linked-button.js +1 -1
- package/build-module/components/border-radius-control/linked-button.js.map +1 -1
- package/build-module/components/colors/utils.js +9 -1
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors/with-colors.js +5 -1
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +29 -18
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/duotone-control/index.js +1 -4
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/font-sizes/utils.js +9 -1
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +3 -2
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +26 -23
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +5 -4
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/effects-panel.js +3 -2
- package/build-module/components/global-styles/effects-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +8 -5
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +184 -0
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +3 -2
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +7 -1
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/index.js +1 -0
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +45 -38
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +15 -1
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +7 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/height-control/index.js +6 -2
- package/build-module/components/height-control/index.js.map +1 -1
- package/build-module/components/image-link-destinations/index.native.js +109 -0
- package/build-module/components/image-link-destinations/index.native.js.map +1 -0
- package/build-module/components/image-size-control/index.js +2 -2
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.native.js +3 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +62 -23
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +18 -4
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +5 -6
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +6 -10
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +11 -10
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +11 -11
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +11 -11
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/utils.js +7 -11
- package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +4 -14
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +2 -2
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/index.js +1 -2
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/library.js +3 -7
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build-module/components/inserter/menu.js +26 -33
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +2 -2
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter/tabs.js +22 -22
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inserter-button/index.native.js +89 -0
- package/build-module/components/inserter-button/index.native.js.map +1 -0
- package/build-module/components/inserter-button/sparkles.js +15 -0
- package/build-module/components/inserter-button/sparkles.js.map +1 -0
- package/build-module/components/inserter-draggable-blocks/index.js +9 -5
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +2 -4
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +3 -3
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +3 -3
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +35 -24
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +4 -0
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +58 -4
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/media-upload-progress/constants.js +7 -0
- package/build-module/components/media-upload-progress/constants.js.map +1 -0
- package/build-module/components/media-upload-progress/index.native.js +37 -8
- package/build-module/components/media-upload-progress/index.native.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +11 -16
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +6 -1
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +6 -62
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/provider/index.js +3 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +7 -1
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/content.js +25 -21
- package/build-module/components/rich-text/content.js.map +1 -1
- package/build-module/components/rich-text/get-rich-text-values.js +2 -1
- package/build-module/components/rich-text/get-rich-text-values.js.map +1 -1
- package/build-module/components/rich-text/index.js +21 -39
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +10 -18
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/get-format-colors.native.js +22 -24
- package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +22 -56
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +7 -3
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/rich-text/use-mark-persistent.js +1 -1
- package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build-module/components/rich-text/with-deprecations.js +42 -0
- package/build-module/components/rich-text/with-deprecations.js.map +1 -0
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/index.js +9 -6
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +14 -18
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +107 -18
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +102 -94
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +9 -12
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +4 -1
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +13 -1
- package/build-module/components/use-settings/index.js.map +1 -1
- package/build-module/components/writing-flow/index.js +0 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js +15 -4
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +73 -27
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +7 -4
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js +20 -67
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/align.native.js +1 -0
- package/build-module/hooks/align.native.js.map +1 -1
- package/build-module/hooks/anchor.js +12 -27
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/aria-label.js +7 -1
- package/build-module/hooks/aria-label.js.map +1 -1
- package/build-module/hooks/background.js +197 -37
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +22 -30
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-renaming.js +17 -21
- package/build-module/hooks/block-renaming.js.map +1 -1
- package/build-module/hooks/border.js +52 -79
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +78 -88
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +27 -27
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +12 -28
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/custom-class-name.native.js +7 -1
- package/build-module/hooks/custom-class-name.native.js.map +1 -1
- package/build-module/hooks/dimensions.js +15 -16
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +30 -61
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-family.js +20 -25
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +50 -120
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +20 -16
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +10 -6
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout-child.js +60 -0
- package/build-module/hooks/layout-child.js.map +1 -0
- package/build-module/hooks/layout.js +21 -100
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/padding.js +2 -2
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/position.js +38 -59
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +52 -85
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/typography.js +26 -11
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/typography.native.js +43 -17
- package/build-module/hooks/typography.native.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +9 -1
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/hooks/utils.js +194 -9
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +2 -6
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +0 -2
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/actions.js +0 -15
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +52 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +44 -1
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +18 -2
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +4 -65
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/undo-ignore.js +5 -0
- package/build-module/store/undo-ignore.js.map +1 -0
- package/build-module/store/utils.js +56 -0
- package/build-module/store/utils.js.map +1 -0
- package/build-module/utils/get-px-from-css-unit.js +9 -0
- package/build-module/utils/get-px-from-css-unit.js.map +1 -0
- package/build-module/utils/index.js +1 -1
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/object.js +37 -97
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/selection.js +9 -1
- package/build-module/utils/selection.js.map +1 -1
- package/build-module/utils/use-can-block-toolbar-be-focused.js +40 -0
- package/build-module/utils/use-can-block-toolbar-be-focused.js.map +1 -0
- package/build-style/content-rtl.css +7 -6
- package/build-style/content.css +7 -6
- package/build-style/style-rtl.css +164 -301
- package/build-style/style.css +164 -301
- package/package.json +31 -31
- package/src/components/alignment-control/README.md +0 -5
- package/src/components/block-alignment-control/README.md +0 -5
- package/src/components/block-alignment-matrix-control/README.md +0 -10
- package/src/components/block-breadcrumb/README.md +0 -5
- package/src/components/block-canvas/index.js +29 -17
- package/src/components/block-canvas/style.scss +6 -0
- package/src/components/block-caption/README.md +2 -7
- package/src/components/block-card/README.md +0 -5
- package/src/components/block-card/index.js +6 -4
- package/src/components/block-card/style.scss +7 -3
- package/src/components/block-controls/hook.js +8 -30
- package/src/components/block-controls/test/index.js +3 -3
- package/src/components/block-draggable/draggable-chip.js +11 -1
- package/src/components/block-draggable/index.js +116 -4
- package/src/components/block-draggable/index.native.js +0 -5
- package/src/components/block-draggable/style.scss +35 -0
- package/src/components/block-draggable/test/helpers.native.js +8 -7
- package/src/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
- package/src/components/block-edit/context.js +3 -0
- package/src/components/block-edit/index.js +36 -10
- package/src/components/block-editing-mode/index.js +3 -3
- package/src/components/block-icon/README.md +0 -5
- package/src/components/block-info-slot-fill/index.js +6 -3
- package/src/components/block-inspector/README.md +0 -5
- package/src/components/block-inspector/index.js +3 -1
- package/src/components/block-inspector/style.scss +0 -4
- package/src/components/block-list/block-list-item-cell.native.js +5 -1
- package/src/components/block-list/block.js +309 -104
- package/src/components/block-list/block.native.js +69 -21
- package/src/components/block-list/content.scss +14 -10
- package/src/components/block-list/index.native.js +3 -5
- package/src/components/block-list/{block-list-block-context.js → private-block-context.js} +1 -1
- package/src/components/block-list/use-block-props/index.js +43 -86
- package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -34
- package/src/components/block-list/use-block-props/use-is-hovered.js +2 -13
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +1 -5
- package/src/components/block-list/use-in-between-inserter.js +4 -1
- package/src/components/block-list/use-scroll-upon-insertion.native.js +52 -0
- package/src/components/block-lock/toolbar.js +23 -34
- package/src/components/block-mover/README.md +0 -5
- package/src/components/block-mover/index.js +1 -1
- package/src/components/block-parent-selector/README.md +0 -5
- package/src/components/block-patterns-list/README.md +0 -5
- package/src/components/block-patterns-list/index.js +9 -6
- package/src/components/block-removal-warning-modal/index.js +7 -14
- package/src/components/block-rename/modal.js +7 -1
- package/src/components/block-settings/container.native.js +3 -5
- package/src/components/block-styles/index.js +1 -1
- package/src/components/block-styles/index.native.js +4 -2
- package/src/components/block-styles/style.scss +0 -11
- package/src/components/block-switcher/index.js +49 -59
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +3 -1
- package/src/components/block-toolbar/README.md +0 -5
- package/src/components/block-toolbar/index.js +179 -95
- package/src/components/block-toolbar/style.scss +50 -66
- package/src/components/block-tools/block-toolbar-breadcrumb.js +46 -0
- package/src/components/block-tools/block-toolbar-popover.js +84 -0
- package/src/components/block-tools/index.js +42 -29
- package/src/components/block-tools/style.scss +60 -172
- package/src/components/block-types-list/README.md +0 -5
- package/src/components/block-types-list/index.native.js +2 -1
- package/src/components/block-variation-picker/README.md +0 -5
- package/src/components/block-variation-picker/index.native.js +1 -1
- package/src/components/block-variation-transforms/README.md +0 -5
- package/src/components/block-variation-transforms/index.js +49 -3
- package/src/components/border-radius-control/linked-button.js +1 -1
- package/src/components/caption/README.md +0 -5
- package/src/components/color-palette/test/__snapshots__/control.js.snap +0 -1
- package/src/components/colors/utils.js +8 -1
- package/src/components/colors/with-colors.js +3 -1
- package/src/components/colors-gradients/control.js +49 -30
- package/src/components/colors-gradients/style.scss +0 -7
- package/src/components/contrast-checker/README.md +0 -4
- package/src/components/copy-handler/README.md +0 -10
- package/src/components/duotone-control/index.js +2 -5
- package/src/components/duotone-control/style.scss +1 -6
- package/src/components/font-sizes/utils.js +7 -1
- package/src/components/global-styles/border-panel.js +2 -1
- package/src/components/global-styles/color-panel.js +36 -26
- package/src/components/global-styles/dimensions-panel.js +4 -3
- package/src/components/global-styles/effects-panel.js +2 -1
- package/src/components/global-styles/filters-panel.js +6 -5
- package/src/components/global-styles/get-global-styles-changes.js +210 -0
- package/src/components/global-styles/hooks.js +5 -0
- package/src/components/global-styles/image-settings-panel.js +6 -0
- package/src/components/global-styles/index.js +1 -0
- package/src/components/global-styles/test/get-global-styles-changes.js +234 -0
- package/src/components/global-styles/typography-panel.js +60 -47
- package/src/components/global-styles/use-global-styles-output.js +9 -5
- package/src/components/global-styles/utils.js +7 -0
- package/src/components/height-control/README.md +2 -7
- package/src/components/height-control/index.js +4 -0
- package/src/components/image-link-destinations/index.native.js +152 -0
- package/src/components/image-link-destinations/style.native.scss +16 -0
- package/src/components/image-size-control/index.js +5 -2
- package/src/components/index.native.js +3 -2
- package/src/components/inner-blocks/README.md +13 -2
- package/src/components/inner-blocks/index.js +68 -29
- package/src/components/inner-blocks/index.native.js +19 -7
- package/src/components/inner-blocks/use-inner-block-template-sync.js +5 -7
- package/src/components/inner-blocks/use-nested-settings-update.js +6 -13
- package/src/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +15 -15
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +15 -13
- package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +15 -18
- package/src/components/inserter/block-patterns-tab/utils.js +11 -12
- package/src/components/inserter/hooks/use-block-types-state.js +9 -11
- package/src/components/inserter/hooks/use-patterns-state.js +2 -2
- package/src/components/inserter/index.js +0 -1
- package/src/components/inserter/library.js +2 -8
- package/src/components/inserter/media-tab/media-panel.js +1 -1
- package/src/components/inserter/menu.js +26 -36
- package/src/components/inserter/preview-panel.js +2 -2
- package/src/components/inserter/style.scss +21 -21
- package/src/components/inserter/tabs.js +34 -25
- package/src/components/inserter-button/README.md +62 -0
- package/src/components/inserter-button/index.native.js +116 -0
- package/src/components/inserter-button/sparkles.js +15 -0
- package/src/components/inserter-button/style.native.scss +72 -0
- package/src/components/inserter-draggable-blocks/index.js +18 -5
- package/src/components/inserter-list-item/index.js +6 -6
- package/src/components/inspector-controls/block-support-tools-panel.js +2 -0
- package/src/components/inspector-controls/fill.js +6 -3
- package/src/components/inspector-controls/fill.native.js +6 -3
- package/src/components/inspector-controls-tabs/index.js +39 -28
- package/src/components/inspector-controls-tabs/style.scss +3 -2
- package/src/components/letter-spacing-control/README.md +0 -5
- package/src/components/line-height-control/README.md +0 -5
- package/src/components/link-control/style.scss +1 -1
- package/src/components/link-control/test/index.js +1 -1
- package/src/components/list-view/README.md +0 -5
- package/src/components/list-view/block-select-button.js +4 -0
- package/src/components/list-view/block.js +73 -2
- package/src/components/list-view/style.scss +6 -0
- package/src/components/media-upload-progress/constants.js +6 -0
- package/src/components/media-upload-progress/index.native.js +66 -14
- package/src/components/media-upload-progress/test/index.native.js +2 -2
- package/src/components/multi-selection-inspector/README.md +0 -5
- package/src/components/navigable-toolbar/README.md +2 -0
- package/src/components/navigable-toolbar/index.js +15 -13
- package/src/components/plain-text/index.native.js +6 -1
- package/src/components/preview-options/index.js +6 -86
- package/src/components/provider/index.js +1 -1
- package/src/components/provider/test/use-block-sync.js +20 -17
- package/src/components/provider/use-block-sync.js +6 -0
- package/src/components/rich-text/content.js +27 -20
- package/src/components/rich-text/get-rich-text-values.js +6 -1
- package/src/components/rich-text/index.js +23 -52
- package/src/components/rich-text/index.native.js +8 -25
- package/src/components/rich-text/native/get-format-colors.native.js +33 -40
- package/src/components/rich-text/native/index.native.js +22 -71
- package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +3 -3
- package/src/components/rich-text/native/test/index.native.js +72 -5
- package/src/components/rich-text/use-input-rules.js +8 -3
- package/src/components/rich-text/use-mark-persistent.js +1 -2
- package/src/components/rich-text/with-deprecations.js +51 -0
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/src/components/text-decoration-control/README.md +40 -0
- package/src/components/text-transform-control/README.md +0 -4
- package/src/components/ungroup-button/README.md +0 -5
- package/src/components/unit-control/README.md +0 -4
- package/src/components/url-input/index.js +11 -11
- package/src/components/use-block-commands/index.js +18 -21
- package/src/components/use-block-drop-zone/index.js +181 -30
- package/src/components/use-moving-animation/index.js +107 -103
- package/src/components/use-on-block-drop/index.js +9 -24
- package/src/components/use-on-block-drop/test/index.js +12 -26
- package/src/components/use-resize-canvas/README.md +3 -7
- package/src/components/use-resize-canvas/index.js +4 -1
- package/src/components/use-settings/README.md +0 -4
- package/src/components/use-settings/index.js +15 -1
- package/src/components/writing-flow/index.js +0 -1
- package/src/components/writing-flow/use-drag-selection.js +18 -4
- package/src/components/writing-flow/use-selection-observer.js +99 -37
- package/src/components/writing-flow/use-tab-nav.js +7 -7
- package/src/hooks/align.js +16 -81
- package/src/hooks/align.native.js +1 -0
- package/src/hooks/anchor.js +14 -38
- package/src/hooks/aria-label.js +8 -5
- package/src/hooks/background.js +269 -32
- package/src/hooks/block-hooks.js +22 -51
- package/src/hooks/block-renaming.js +23 -37
- package/src/hooks/border.js +62 -124
- package/src/hooks/color.js +111 -138
- package/src/hooks/content-lock-ui.js +110 -122
- package/src/hooks/custom-class-name.js +9 -45
- package/src/hooks/custom-class-name.native.js +8 -5
- package/src/hooks/dimensions.js +14 -16
- package/src/hooks/duotone.js +70 -127
- package/src/hooks/font-family.js +14 -36
- package/src/hooks/font-size.js +67 -168
- package/src/hooks/index.js +58 -16
- package/src/hooks/index.native.js +22 -6
- package/src/hooks/layout-child.js +53 -0
- package/src/hooks/layout.js +17 -103
- package/src/hooks/padding.js +2 -2
- package/src/hooks/position.js +50 -90
- package/src/hooks/style.js +118 -193
- package/src/hooks/test/align.js +1 -178
- package/src/hooks/test/anchor.js +4 -9
- package/src/hooks/test/custom-class-name.js +3 -8
- package/src/hooks/test/style.js +4 -14
- package/src/hooks/typography.js +14 -16
- package/src/hooks/typography.native.js +31 -33
- package/src/hooks/use-typography-props.js +7 -1
- package/src/hooks/utils.js +261 -10
- package/src/private-apis.js +2 -6
- package/src/private-apis.native.js +0 -2
- package/src/store/actions.js +0 -15
- package/src/store/private-actions.js +48 -0
- package/src/store/private-selectors.js +56 -0
- package/src/store/reducer.js +20 -1
- package/src/store/selectors.js +10 -82
- package/src/store/undo-ignore.js +4 -0
- package/src/store/utils.js +74 -0
- package/src/style.scss +1 -2
- package/src/utils/get-px-from-css-unit.js +8 -0
- package/src/utils/index.js +1 -1
- package/src/utils/object.js +34 -104
- package/src/utils/selection.js +9 -2
- package/src/utils/test/object.js +1 -96
- package/src/utils/use-can-block-toolbar-be-focused.js +48 -0
- package/build/components/block-list/block-list-block-context.js +0 -14
- package/build/components/block-list/block-list-block-context.js.map +0 -1
- package/build/components/block-list/use-block-props/use-block-class-names.js +0 -67
- package/build/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js +0 -46
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
- package/build/components/block-list/use-block-props/use-block-default-class-name.js +0 -37
- package/build/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
- package/build/components/block-tools/back-compat.js +0 -45
- package/build/components/block-tools/back-compat.js.map +0 -1
- package/build/components/block-tools/block-contextual-toolbar.js +0 -91
- package/build/components/block-tools/block-contextual-toolbar.js.map +0 -1
- package/build/components/block-tools/selected-block-tools.js +0 -113
- package/build/components/block-tools/selected-block-tools.js.map +0 -1
- package/build/components/inserter/hooks/use-debounced-input.js +0 -22
- package/build/components/inserter/hooks/use-debounced-input.js.map +0 -1
- package/build/components/use-display-block-controls/index.js +0 -39
- package/build/components/use-display-block-controls/index.js.map +0 -1
- package/build/components/use-display-block-controls/index.native.js +0 -39
- package/build/components/use-display-block-controls/index.native.js.map +0 -1
- package/build/hooks/custom-fields.js +0 -120
- package/build/hooks/custom-fields.js.map +0 -1
- package/build/utils/parse-css-unit-to-px.js +0 -302
- package/build/utils/parse-css-unit-to-px.js.map +0 -1
- package/build/utils/use-should-contextual-toolbar-show.js +0 -63
- package/build/utils/use-should-contextual-toolbar-show.js.map +0 -1
- package/build-module/components/block-list/block-list-block-context.js +0 -6
- package/build-module/components/block-list/block-list-block-context.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-class-names.js +0 -60
- package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js +0 -40
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js +0 -31
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
- package/build-module/components/block-tools/back-compat.js +0 -35
- package/build-module/components/block-tools/back-compat.js.map +0 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +0 -83
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +0 -1
- package/build-module/components/block-tools/selected-block-tools.js +0 -105
- package/build-module/components/block-tools/selected-block-tools.js.map +0 -1
- package/build-module/components/inserter/hooks/use-debounced-input.js +0 -15
- package/build-module/components/inserter/hooks/use-debounced-input.js.map +0 -1
- package/build-module/components/use-display-block-controls/index.js +0 -32
- package/build-module/components/use-display-block-controls/index.js.map +0 -1
- package/build-module/components/use-display-block-controls/index.native.js +0 -32
- package/build-module/components/use-display-block-controls/index.native.js.map +0 -1
- package/build-module/hooks/custom-fields.js +0 -118
- package/build-module/hooks/custom-fields.js.map +0 -1
- package/build-module/utils/parse-css-unit-to-px.js +0 -294
- package/build-module/utils/parse-css-unit-to-px.js.map +0 -1
- package/build-module/utils/use-should-contextual-toolbar-show.js +0 -57
- package/build-module/utils/use-should-contextual-toolbar-show.js.map +0 -1
- package/src/components/block-list/use-block-props/use-block-class-names.js +0 -66
- package/src/components/block-list/use-block-props/use-block-custom-class-name.js +0 -44
- package/src/components/block-list/use-block-props/use-block-default-class-name.js +0 -35
- package/src/components/block-parent-selector/style.scss +0 -11
- package/src/components/block-tools/back-compat.js +0 -35
- package/src/components/block-tools/block-contextual-toolbar.js +0 -100
- package/src/components/block-tools/selected-block-tools.js +0 -127
- package/src/components/inserter/hooks/use-debounced-input.js +0 -18
- package/src/components/preview-options/README.md +0 -94
- package/src/components/preview-options/style.scss +0 -64
- package/src/components/use-display-block-controls/index.js +0 -36
- package/src/components/use-display-block-controls/index.native.js +0 -37
- package/src/hooks/custom-fields.js +0 -142
- package/src/hooks/test/color.js +0 -112
- package/src/utils/parse-css-unit-to-px.js +0 -329
- package/src/utils/test/parse-css-unit-to-px.js +0 -172
- package/src/utils/use-should-contextual-toolbar-show.js +0 -85
package/src/hooks/anchor.js
CHANGED
|
@@ -5,7 +5,6 @@ import { addFilter } from '@wordpress/hooks';
|
|
|
5
5
|
import { PanelBody, TextControl, ExternalLink } from '@wordpress/components';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
import { hasBlockSupport } from '@wordpress/blocks';
|
|
8
|
-
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
9
8
|
import { Platform } from '@wordpress/element';
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -52,7 +51,11 @@ export function addAttribute( settings ) {
|
|
|
52
51
|
return settings;
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
function
|
|
54
|
+
function BlockEditAnchorControlPure( {
|
|
55
|
+
name: blockName,
|
|
56
|
+
anchor,
|
|
57
|
+
setAttributes,
|
|
58
|
+
} ) {
|
|
56
59
|
const blockEditingMode = useBlockEditingMode();
|
|
57
60
|
|
|
58
61
|
const isWeb = Platform.OS === 'web';
|
|
@@ -79,7 +82,7 @@ function BlockEditAnchorControl( { blockName, attributes, setAttributes } ) {
|
|
|
79
82
|
) }
|
|
80
83
|
</>
|
|
81
84
|
}
|
|
82
|
-
value={
|
|
85
|
+
value={ anchor || '' }
|
|
83
86
|
placeholder={ ! isWeb ? __( 'Add an anchor' ) : null }
|
|
84
87
|
onChange={ ( nextValue ) => {
|
|
85
88
|
nextValue = nextValue.replace( ANCHOR_REGEX, '-' );
|
|
@@ -116,31 +119,14 @@ function BlockEditAnchorControl( { blockName, attributes, setAttributes } ) {
|
|
|
116
119
|
);
|
|
117
120
|
}
|
|
118
121
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
export const withAnchorControls = createHigherOrderComponent( ( BlockEdit ) => {
|
|
128
|
-
return ( props ) => {
|
|
129
|
-
return (
|
|
130
|
-
<>
|
|
131
|
-
<BlockEdit { ...props } />
|
|
132
|
-
{ props.isSelected &&
|
|
133
|
-
hasBlockSupport( props.name, 'anchor' ) && (
|
|
134
|
-
<BlockEditAnchorControl
|
|
135
|
-
blockName={ props.name }
|
|
136
|
-
attributes={ props.attributes }
|
|
137
|
-
setAttributes={ props.setAttributes }
|
|
138
|
-
/>
|
|
139
|
-
) }
|
|
140
|
-
</>
|
|
141
|
-
);
|
|
142
|
-
};
|
|
143
|
-
}, 'withAnchorControls' );
|
|
122
|
+
export default {
|
|
123
|
+
addSaveProps,
|
|
124
|
+
edit: BlockEditAnchorControlPure,
|
|
125
|
+
attributeKeys: [ 'anchor' ],
|
|
126
|
+
hasSupport( name ) {
|
|
127
|
+
return hasBlockSupport( name, 'anchor' );
|
|
128
|
+
},
|
|
129
|
+
};
|
|
144
130
|
|
|
145
131
|
/**
|
|
146
132
|
* Override props assigned to save component to inject anchor ID, if block
|
|
@@ -162,13 +148,3 @@ export function addSaveProps( extraProps, blockType, attributes ) {
|
|
|
162
148
|
}
|
|
163
149
|
|
|
164
150
|
addFilter( 'blocks.registerBlockType', 'core/anchor/attribute', addAttribute );
|
|
165
|
-
addFilter(
|
|
166
|
-
'editor.BlockEdit',
|
|
167
|
-
'core/editor/anchor/with-inspector-controls',
|
|
168
|
-
withAnchorControls
|
|
169
|
-
);
|
|
170
|
-
addFilter(
|
|
171
|
-
'blocks.getSaveContent.extraProps',
|
|
172
|
-
'core/editor/anchor/save-props',
|
|
173
|
-
addSaveProps
|
|
174
|
-
);
|
package/src/hooks/aria-label.js
CHANGED
|
@@ -55,13 +55,16 @@ export function addSaveProps( extraProps, blockType, attributes ) {
|
|
|
55
55
|
return extraProps;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
export default {
|
|
59
|
+
addSaveProps,
|
|
60
|
+
attributeKeys: [ 'ariaLabel' ],
|
|
61
|
+
hasSupport( name ) {
|
|
62
|
+
return hasBlockSupport( name, 'ariaLabel' );
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
58
66
|
addFilter(
|
|
59
67
|
'blocks.registerBlockType',
|
|
60
68
|
'core/ariaLabel/attribute',
|
|
61
69
|
addAttribute
|
|
62
70
|
);
|
|
63
|
-
addFilter(
|
|
64
|
-
'blocks.getSaveContent.extraProps',
|
|
65
|
-
'core/ariaLabel/save-props',
|
|
66
|
-
addSaveProps
|
|
67
|
-
);
|
package/src/hooks/background.js
CHANGED
|
@@ -10,7 +10,12 @@ import { isBlobURL } from '@wordpress/blob';
|
|
|
10
10
|
import { getBlockSupport } from '@wordpress/blocks';
|
|
11
11
|
import { focus } from '@wordpress/dom';
|
|
12
12
|
import {
|
|
13
|
+
ToggleControl,
|
|
14
|
+
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
15
|
+
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
13
16
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
17
|
+
__experimentalUnitControl as UnitControl,
|
|
18
|
+
__experimentalVStack as VStack,
|
|
14
19
|
DropZone,
|
|
15
20
|
FlexItem,
|
|
16
21
|
MenuItem,
|
|
@@ -41,17 +46,28 @@ export const IMAGE_BACKGROUND_TYPE = 'image';
|
|
|
41
46
|
* Checks if there is a current value in the background image block support
|
|
42
47
|
* attributes.
|
|
43
48
|
*
|
|
44
|
-
* @param {Object}
|
|
49
|
+
* @param {Object} style Style attribute.
|
|
45
50
|
* @return {boolean} Whether or not the block has a background image value set.
|
|
46
51
|
*/
|
|
47
|
-
export function hasBackgroundImageValue(
|
|
52
|
+
export function hasBackgroundImageValue( style ) {
|
|
48
53
|
const hasValue =
|
|
49
|
-
!!
|
|
50
|
-
!!
|
|
54
|
+
!! style?.background?.backgroundImage?.id ||
|
|
55
|
+
!! style?.background?.backgroundImage?.url;
|
|
51
56
|
|
|
52
57
|
return hasValue;
|
|
53
58
|
}
|
|
54
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Checks if there is a current value in the background size block support
|
|
62
|
+
* attributes.
|
|
63
|
+
*
|
|
64
|
+
* @param {Object} style Style attribute.
|
|
65
|
+
* @return {boolean} Whether or not the block has a background size value set.
|
|
66
|
+
*/
|
|
67
|
+
export function hasBackgroundSizeValue( style ) {
|
|
68
|
+
return style?.background?.backgroundSize !== undefined;
|
|
69
|
+
}
|
|
70
|
+
|
|
55
71
|
/**
|
|
56
72
|
* Determine whether there is block support for background.
|
|
57
73
|
*
|
|
@@ -72,7 +88,11 @@ export function hasBackgroundSupport( blockName, feature = 'any' ) {
|
|
|
72
88
|
}
|
|
73
89
|
|
|
74
90
|
if ( feature === 'any' ) {
|
|
75
|
-
return
|
|
91
|
+
return (
|
|
92
|
+
!! support?.backgroundImage ||
|
|
93
|
+
!! support?.backgroundSize ||
|
|
94
|
+
!! support?.backgroundRepeat
|
|
95
|
+
);
|
|
76
96
|
}
|
|
77
97
|
|
|
78
98
|
return !! support?.[ feature ];
|
|
@@ -82,13 +102,10 @@ export function hasBackgroundSupport( blockName, feature = 'any' ) {
|
|
|
82
102
|
* Resets the background image block support attributes. This can be used when disabling
|
|
83
103
|
* the background image controls for a block via a `ToolsPanel`.
|
|
84
104
|
*
|
|
85
|
-
* @param {Object}
|
|
86
|
-
* @param {
|
|
87
|
-
* @param {Object} props.setAttributes Function to set block's attributes.
|
|
105
|
+
* @param {Object} style Style attribute.
|
|
106
|
+
* @param {Function} setAttributes Function to set block's attributes.
|
|
88
107
|
*/
|
|
89
|
-
export function resetBackgroundImage(
|
|
90
|
-
const { style = {} } = attributes;
|
|
91
|
-
|
|
108
|
+
export function resetBackgroundImage( style = {}, setAttributes ) {
|
|
92
109
|
setAttributes( {
|
|
93
110
|
style: cleanEmptyObject( {
|
|
94
111
|
...style,
|
|
@@ -100,6 +117,37 @@ export function resetBackgroundImage( { attributes = {}, setAttributes } ) {
|
|
|
100
117
|
} );
|
|
101
118
|
}
|
|
102
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Resets the background size block support attributes. This can be used when disabling
|
|
122
|
+
* the background size controls for a block via a `ToolsPanel`.
|
|
123
|
+
*
|
|
124
|
+
* @param {Object} style Style attribute.
|
|
125
|
+
* @param {Function} setAttributes Function to set block's attributes.
|
|
126
|
+
*/
|
|
127
|
+
function resetBackgroundSize( style = {}, setAttributes ) {
|
|
128
|
+
setAttributes( {
|
|
129
|
+
style: cleanEmptyObject( {
|
|
130
|
+
...style,
|
|
131
|
+
background: {
|
|
132
|
+
...style?.background,
|
|
133
|
+
backgroundRepeat: undefined,
|
|
134
|
+
backgroundSize: undefined,
|
|
135
|
+
},
|
|
136
|
+
} ),
|
|
137
|
+
} );
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Generates a CSS class name if an background image is set.
|
|
142
|
+
*
|
|
143
|
+
* @param {Object} style A block's style attribute.
|
|
144
|
+
*
|
|
145
|
+
* @return {string} CSS class name.
|
|
146
|
+
*/
|
|
147
|
+
export function getBackgroundImageClasses( style ) {
|
|
148
|
+
return hasBackgroundImageValue( style ) ? 'has-background' : '';
|
|
149
|
+
}
|
|
150
|
+
|
|
103
151
|
function InspectorImagePreview( { label, filename, url: imgUrl } ) {
|
|
104
152
|
const imgLabel = label || getFilename( imgUrl );
|
|
105
153
|
return (
|
|
@@ -145,20 +193,27 @@ function InspectorImagePreview( { label, filename, url: imgUrl } ) {
|
|
|
145
193
|
);
|
|
146
194
|
}
|
|
147
195
|
|
|
148
|
-
function BackgroundImagePanelItem(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
196
|
+
function BackgroundImagePanelItem( {
|
|
197
|
+
clientId,
|
|
198
|
+
isShownByDefault,
|
|
199
|
+
setAttributes,
|
|
200
|
+
} ) {
|
|
201
|
+
const { style, mediaUpload } = useSelect(
|
|
202
|
+
( select ) => {
|
|
203
|
+
const { getBlockAttributes, getSettings } =
|
|
204
|
+
select( blockEditorStore );
|
|
205
|
+
|
|
206
|
+
return {
|
|
207
|
+
style: getBlockAttributes( clientId )?.style,
|
|
208
|
+
mediaUpload: getSettings().mediaUpload,
|
|
209
|
+
};
|
|
210
|
+
},
|
|
211
|
+
[ clientId ]
|
|
212
|
+
);
|
|
213
|
+
const { id, title, url } = style?.background?.backgroundImage || {};
|
|
153
214
|
|
|
154
215
|
const replaceContainerRef = useRef();
|
|
155
216
|
|
|
156
|
-
const { mediaUpload } = useSelect( ( select ) => {
|
|
157
|
-
return {
|
|
158
|
-
mediaUpload: select( blockEditorStore ).getSettings().mediaUpload,
|
|
159
|
-
};
|
|
160
|
-
} );
|
|
161
|
-
|
|
162
217
|
const { createErrorNotice } = useDispatch( noticesStore );
|
|
163
218
|
const onUploadError = ( message ) => {
|
|
164
219
|
createErrorNotice( message, { type: 'snackbar' } );
|
|
@@ -167,9 +222,9 @@ function BackgroundImagePanelItem( props ) {
|
|
|
167
222
|
const onSelectMedia = ( media ) => {
|
|
168
223
|
if ( ! media || ! media.url ) {
|
|
169
224
|
const newStyle = {
|
|
170
|
-
...
|
|
225
|
+
...style,
|
|
171
226
|
background: {
|
|
172
|
-
...
|
|
227
|
+
...style?.background,
|
|
173
228
|
backgroundImage: undefined,
|
|
174
229
|
},
|
|
175
230
|
};
|
|
@@ -201,9 +256,9 @@ function BackgroundImagePanelItem( props ) {
|
|
|
201
256
|
}
|
|
202
257
|
|
|
203
258
|
const newStyle = {
|
|
204
|
-
...
|
|
259
|
+
...style,
|
|
205
260
|
background: {
|
|
206
|
-
...
|
|
261
|
+
...style?.background,
|
|
207
262
|
backgroundImage: {
|
|
208
263
|
url: media.url,
|
|
209
264
|
id: media.id,
|
|
@@ -244,15 +299,15 @@ function BackgroundImagePanelItem( props ) {
|
|
|
244
299
|
};
|
|
245
300
|
}, [] );
|
|
246
301
|
|
|
247
|
-
const hasValue = hasBackgroundImageValue(
|
|
302
|
+
const hasValue = hasBackgroundImageValue( style );
|
|
248
303
|
|
|
249
304
|
return (
|
|
250
305
|
<ToolsPanelItem
|
|
251
306
|
className="single-column"
|
|
252
307
|
hasValue={ () => hasValue }
|
|
253
308
|
label={ __( 'Background image' ) }
|
|
254
|
-
onDeselect={ () => resetBackgroundImage(
|
|
255
|
-
isShownByDefault={
|
|
309
|
+
onDeselect={ () => resetBackgroundImage( style, setAttributes ) }
|
|
310
|
+
isShownByDefault={ isShownByDefault }
|
|
256
311
|
resetAllFilter={ resetAllFilter }
|
|
257
312
|
panelId={ clientId }
|
|
258
313
|
>
|
|
@@ -286,7 +341,7 @@ function BackgroundImagePanelItem( props ) {
|
|
|
286
341
|
// closed and focus is redirected to the dropdown toggle button.
|
|
287
342
|
toggleButton?.focus();
|
|
288
343
|
toggleButton?.click();
|
|
289
|
-
resetBackgroundImage(
|
|
344
|
+
resetBackgroundImage( style, setAttributes );
|
|
290
345
|
} }
|
|
291
346
|
>
|
|
292
347
|
{ __( 'Reset ' ) }
|
|
@@ -302,8 +357,172 @@ function BackgroundImagePanelItem( props ) {
|
|
|
302
357
|
);
|
|
303
358
|
}
|
|
304
359
|
|
|
360
|
+
function backgroundSizeHelpText( value ) {
|
|
361
|
+
if ( value === 'cover' || value === undefined ) {
|
|
362
|
+
return __( 'Stretch image to cover the block.' );
|
|
363
|
+
}
|
|
364
|
+
if ( value === 'contain' ) {
|
|
365
|
+
return __( 'Resize image to fit without cropping.' );
|
|
366
|
+
}
|
|
367
|
+
return __( 'Set a fixed width.' );
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function BackgroundSizePanelItem( {
|
|
371
|
+
clientId,
|
|
372
|
+
isShownByDefault,
|
|
373
|
+
setAttributes,
|
|
374
|
+
} ) {
|
|
375
|
+
const style = useSelect(
|
|
376
|
+
( select ) =>
|
|
377
|
+
select( blockEditorStore ).getBlockAttributes( clientId )?.style,
|
|
378
|
+
[ clientId ]
|
|
379
|
+
);
|
|
380
|
+
|
|
381
|
+
const sizeValue = style?.background?.backgroundSize;
|
|
382
|
+
const repeatValue = style?.background?.backgroundRepeat;
|
|
383
|
+
|
|
384
|
+
// An `undefined` value is treated as `cover` by the toggle group control.
|
|
385
|
+
// An empty string is treated as `auto` by the toggle group control. This
|
|
386
|
+
// allows a user to select "Size" and then enter a custom value, with an
|
|
387
|
+
// empty value being treated as `auto`.
|
|
388
|
+
const currentValueForToggle =
|
|
389
|
+
( sizeValue !== undefined &&
|
|
390
|
+
sizeValue !== 'cover' &&
|
|
391
|
+
sizeValue !== 'contain' ) ||
|
|
392
|
+
sizeValue === ''
|
|
393
|
+
? 'auto'
|
|
394
|
+
: sizeValue || 'cover';
|
|
395
|
+
|
|
396
|
+
// If the current value is `cover` and the repeat value is `undefined`, then
|
|
397
|
+
// the toggle should be unchecked as the default state. Otherwise, the toggle
|
|
398
|
+
// should reflect the current repeat value.
|
|
399
|
+
const repeatCheckedValue =
|
|
400
|
+
repeatValue === 'no-repeat' ||
|
|
401
|
+
( currentValueForToggle === 'cover' && repeatValue === undefined )
|
|
402
|
+
? false
|
|
403
|
+
: true;
|
|
404
|
+
|
|
405
|
+
const hasValue = hasBackgroundSizeValue( style );
|
|
406
|
+
|
|
407
|
+
const resetAllFilter = useCallback( ( previousValue ) => {
|
|
408
|
+
return {
|
|
409
|
+
...previousValue,
|
|
410
|
+
style: {
|
|
411
|
+
...previousValue.style,
|
|
412
|
+
background: {
|
|
413
|
+
...previousValue.style?.background,
|
|
414
|
+
backgroundRepeat: undefined,
|
|
415
|
+
backgroundSize: undefined,
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
};
|
|
419
|
+
}, [] );
|
|
420
|
+
|
|
421
|
+
const updateBackgroundSize = ( next ) => {
|
|
422
|
+
// When switching to 'contain' toggle the repeat off.
|
|
423
|
+
let nextRepeat = repeatValue;
|
|
424
|
+
|
|
425
|
+
if ( next === 'contain' ) {
|
|
426
|
+
nextRepeat = 'no-repeat';
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
if (
|
|
430
|
+
( currentValueForToggle === 'cover' ||
|
|
431
|
+
currentValueForToggle === 'contain' ) &&
|
|
432
|
+
next === 'auto'
|
|
433
|
+
) {
|
|
434
|
+
nextRepeat = undefined;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
setAttributes( {
|
|
438
|
+
style: cleanEmptyObject( {
|
|
439
|
+
...style,
|
|
440
|
+
background: {
|
|
441
|
+
...style?.background,
|
|
442
|
+
backgroundRepeat: nextRepeat,
|
|
443
|
+
backgroundSize: next,
|
|
444
|
+
},
|
|
445
|
+
} ),
|
|
446
|
+
} );
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
const toggleIsRepeated = () => {
|
|
450
|
+
setAttributes( {
|
|
451
|
+
style: cleanEmptyObject( {
|
|
452
|
+
...style,
|
|
453
|
+
background: {
|
|
454
|
+
...style?.background,
|
|
455
|
+
backgroundRepeat:
|
|
456
|
+
repeatCheckedValue === true ? 'no-repeat' : undefined,
|
|
457
|
+
},
|
|
458
|
+
} ),
|
|
459
|
+
} );
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
return (
|
|
463
|
+
<VStack
|
|
464
|
+
as={ ToolsPanelItem }
|
|
465
|
+
spacing={ 2 }
|
|
466
|
+
className="single-column"
|
|
467
|
+
hasValue={ () => hasValue }
|
|
468
|
+
label={ __( 'Size' ) }
|
|
469
|
+
onDeselect={ () => resetBackgroundSize( style, setAttributes ) }
|
|
470
|
+
isShownByDefault={ isShownByDefault }
|
|
471
|
+
resetAllFilter={ resetAllFilter }
|
|
472
|
+
panelId={ clientId }
|
|
473
|
+
>
|
|
474
|
+
<ToggleGroupControl
|
|
475
|
+
__nextHasNoMarginBottom
|
|
476
|
+
size={ '__unstable-large' }
|
|
477
|
+
label={ __( 'Size' ) }
|
|
478
|
+
value={ currentValueForToggle }
|
|
479
|
+
onChange={ updateBackgroundSize }
|
|
480
|
+
isBlock={ true }
|
|
481
|
+
help={ backgroundSizeHelpText( sizeValue ) }
|
|
482
|
+
>
|
|
483
|
+
<ToggleGroupControlOption
|
|
484
|
+
key={ 'cover' }
|
|
485
|
+
value={ 'cover' }
|
|
486
|
+
label={ __( 'Cover' ) }
|
|
487
|
+
/>
|
|
488
|
+
<ToggleGroupControlOption
|
|
489
|
+
key={ 'contain' }
|
|
490
|
+
value={ 'contain' }
|
|
491
|
+
label={ __( 'Contain' ) }
|
|
492
|
+
/>
|
|
493
|
+
<ToggleGroupControlOption
|
|
494
|
+
key={ 'fixed' }
|
|
495
|
+
value={ 'auto' }
|
|
496
|
+
label={ __( 'Fixed' ) }
|
|
497
|
+
/>
|
|
498
|
+
</ToggleGroupControl>
|
|
499
|
+
{ sizeValue !== undefined &&
|
|
500
|
+
sizeValue !== 'cover' &&
|
|
501
|
+
sizeValue !== 'contain' ? (
|
|
502
|
+
<UnitControl
|
|
503
|
+
size={ '__unstable-large' }
|
|
504
|
+
onChange={ updateBackgroundSize }
|
|
505
|
+
value={ sizeValue }
|
|
506
|
+
/>
|
|
507
|
+
) : null }
|
|
508
|
+
{ currentValueForToggle !== 'cover' && (
|
|
509
|
+
<ToggleControl
|
|
510
|
+
__nextHasNoMarginBottom
|
|
511
|
+
label={ __( 'Repeat image' ) }
|
|
512
|
+
checked={ repeatCheckedValue }
|
|
513
|
+
onChange={ toggleIsRepeated }
|
|
514
|
+
/>
|
|
515
|
+
) }
|
|
516
|
+
</VStack>
|
|
517
|
+
);
|
|
518
|
+
}
|
|
519
|
+
|
|
305
520
|
export function BackgroundImagePanel( props ) {
|
|
306
|
-
const [ backgroundImage ] = useSettings(
|
|
521
|
+
const [ backgroundImage, backgroundSize ] = useSettings(
|
|
522
|
+
'background.backgroundImage',
|
|
523
|
+
'background.backgroundSize'
|
|
524
|
+
);
|
|
525
|
+
|
|
307
526
|
if (
|
|
308
527
|
! backgroundImage ||
|
|
309
528
|
! hasBackgroundSupport( props.name, 'backgroundImage' )
|
|
@@ -311,9 +530,27 @@ export function BackgroundImagePanel( props ) {
|
|
|
311
530
|
return null;
|
|
312
531
|
}
|
|
313
532
|
|
|
533
|
+
const showBackgroundSize = !! (
|
|
534
|
+
backgroundSize && hasBackgroundSupport( props.name, 'backgroundSize' )
|
|
535
|
+
);
|
|
536
|
+
|
|
537
|
+
const defaultControls = getBlockSupport( props.name, [
|
|
538
|
+
BACKGROUND_SUPPORT_KEY,
|
|
539
|
+
'__experimentalDefaultControls',
|
|
540
|
+
] );
|
|
541
|
+
|
|
314
542
|
return (
|
|
315
543
|
<InspectorControls group="background">
|
|
316
|
-
<BackgroundImagePanelItem
|
|
544
|
+
<BackgroundImagePanelItem
|
|
545
|
+
isShownByDefault={ defaultControls?.backgroundImage }
|
|
546
|
+
{ ...props }
|
|
547
|
+
/>
|
|
548
|
+
{ showBackgroundSize && (
|
|
549
|
+
<BackgroundSizePanelItem
|
|
550
|
+
isShownByDefault={ defaultControls?.backgroundSize }
|
|
551
|
+
{ ...props }
|
|
552
|
+
/>
|
|
553
|
+
) }
|
|
317
554
|
</InspectorControls>
|
|
318
555
|
);
|
|
319
556
|
}
|
package/src/hooks/block-hooks.js
CHANGED
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { addFilter } from '@wordpress/hooks';
|
|
6
5
|
import { Fragment, useMemo } from '@wordpress/element';
|
|
7
6
|
import {
|
|
8
7
|
__experimentalHStack as HStack,
|
|
9
8
|
PanelBody,
|
|
10
9
|
ToggleControl,
|
|
11
10
|
} from '@wordpress/components';
|
|
12
|
-
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
13
11
|
import { createBlock, store as blocksStore } from '@wordpress/blocks';
|
|
14
12
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
15
13
|
|
|
@@ -21,7 +19,7 @@ import { store as blockEditorStore } from '../store';
|
|
|
21
19
|
|
|
22
20
|
const EMPTY_OBJECT = {};
|
|
23
21
|
|
|
24
|
-
function
|
|
22
|
+
function BlockHooksControlPure( { name, clientId } ) {
|
|
25
23
|
const blockTypes = useSelect(
|
|
26
24
|
( select ) => select( blocksStore ).getBlockTypes(),
|
|
27
25
|
[]
|
|
@@ -30,10 +28,9 @@ function BlockHooksControl( props ) {
|
|
|
30
28
|
const hookedBlocksForCurrentBlock = useMemo(
|
|
31
29
|
() =>
|
|
32
30
|
blockTypes?.filter(
|
|
33
|
-
( { blockHooks } ) =>
|
|
34
|
-
blockHooks && props.blockName in blockHooks
|
|
31
|
+
( { blockHooks } ) => blockHooks && name in blockHooks
|
|
35
32
|
),
|
|
36
|
-
[ blockTypes,
|
|
33
|
+
[ blockTypes, name ]
|
|
37
34
|
);
|
|
38
35
|
|
|
39
36
|
const { blockIndex, rootClientId, innerBlocksLength } = useSelect(
|
|
@@ -42,13 +39,12 @@ function BlockHooksControl( props ) {
|
|
|
42
39
|
select( blockEditorStore );
|
|
43
40
|
|
|
44
41
|
return {
|
|
45
|
-
blockIndex: getBlockIndex(
|
|
46
|
-
innerBlocksLength: getBlock(
|
|
47
|
-
|
|
48
|
-
rootClientId: getBlockRootClientId( props.clientId ),
|
|
42
|
+
blockIndex: getBlockIndex( clientId ),
|
|
43
|
+
innerBlocksLength: getBlock( clientId )?.innerBlocks?.length,
|
|
44
|
+
rootClientId: getBlockRootClientId( clientId ),
|
|
49
45
|
};
|
|
50
46
|
},
|
|
51
|
-
[
|
|
47
|
+
[ clientId ]
|
|
52
48
|
);
|
|
53
49
|
|
|
54
50
|
const hookedBlockClientIds = useSelect(
|
|
@@ -65,8 +61,7 @@ function BlockHooksControl( props ) {
|
|
|
65
61
|
return clientIds;
|
|
66
62
|
}
|
|
67
63
|
|
|
68
|
-
const relativePosition =
|
|
69
|
-
block?.blockHooks?.[ props.blockName ];
|
|
64
|
+
const relativePosition = block?.blockHooks?.[ name ];
|
|
70
65
|
let candidates;
|
|
71
66
|
|
|
72
67
|
switch ( relativePosition ) {
|
|
@@ -83,12 +78,12 @@ function BlockHooksControl( props ) {
|
|
|
83
78
|
// Any of the current block's child blocks (with the right block type) qualifies
|
|
84
79
|
// as a hooked first or last child block, as the block might've been automatically
|
|
85
80
|
// inserted and then moved around a bit by the user.
|
|
86
|
-
candidates = getBlock(
|
|
81
|
+
candidates = getBlock( clientId ).innerBlocks;
|
|
87
82
|
break;
|
|
88
83
|
}
|
|
89
84
|
|
|
90
85
|
const hookedBlock = candidates?.find(
|
|
91
|
-
(
|
|
86
|
+
( candidate ) => name === candidate.name
|
|
92
87
|
);
|
|
93
88
|
|
|
94
89
|
// If the block exists in the designated location, we consider it hooked
|
|
@@ -118,12 +113,7 @@ function BlockHooksControl( props ) {
|
|
|
118
113
|
|
|
119
114
|
return EMPTY_OBJECT;
|
|
120
115
|
},
|
|
121
|
-
[
|
|
122
|
-
hookedBlocksForCurrentBlock,
|
|
123
|
-
props.blockName,
|
|
124
|
-
props.clientId,
|
|
125
|
-
rootClientId,
|
|
126
|
-
]
|
|
116
|
+
[ hookedBlocksForCurrentBlock, name, clientId, rootClientId ]
|
|
127
117
|
);
|
|
128
118
|
|
|
129
119
|
const { insertBlock, removeBlock } = useDispatch( blockEditorStore );
|
|
@@ -169,7 +159,7 @@ function BlockHooksControl( props ) {
|
|
|
169
159
|
block,
|
|
170
160
|
// TODO: It'd be great if insertBlock() would accept negative indices for insertion.
|
|
171
161
|
relativePosition === 'first_child' ? 0 : innerBlocksLength,
|
|
172
|
-
|
|
162
|
+
clientId, // Insert as a child of the current block.
|
|
173
163
|
false
|
|
174
164
|
);
|
|
175
165
|
break;
|
|
@@ -207,9 +197,7 @@ function BlockHooksControl( props ) {
|
|
|
207
197
|
if ( ! checked ) {
|
|
208
198
|
// Create and insert block.
|
|
209
199
|
const relativePosition =
|
|
210
|
-
block.blockHooks[
|
|
211
|
-
props.blockName
|
|
212
|
-
];
|
|
200
|
+
block.blockHooks[ name ];
|
|
213
201
|
insertBlockIntoDesignatedLocation(
|
|
214
202
|
createBlock( block.name ),
|
|
215
203
|
relativePosition
|
|
@@ -218,11 +206,12 @@ function BlockHooksControl( props ) {
|
|
|
218
206
|
}
|
|
219
207
|
|
|
220
208
|
// Remove block.
|
|
221
|
-
|
|
209
|
+
removeBlock(
|
|
222
210
|
hookedBlockClientIds[
|
|
223
211
|
block.name
|
|
224
|
-
]
|
|
225
|
-
|
|
212
|
+
],
|
|
213
|
+
false
|
|
214
|
+
);
|
|
226
215
|
} }
|
|
227
216
|
/>
|
|
228
217
|
);
|
|
@@ -235,27 +224,9 @@ function BlockHooksControl( props ) {
|
|
|
235
224
|
);
|
|
236
225
|
}
|
|
237
226
|
|
|
238
|
-
export
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
<>
|
|
243
|
-
<BlockEdit key="edit" { ...props } />
|
|
244
|
-
{ props.isSelected && (
|
|
245
|
-
<BlockHooksControl
|
|
246
|
-
blockName={ props.name }
|
|
247
|
-
clientId={ props.clientId }
|
|
248
|
-
/>
|
|
249
|
-
) }
|
|
250
|
-
</>
|
|
251
|
-
);
|
|
252
|
-
};
|
|
227
|
+
export default {
|
|
228
|
+
edit: BlockHooksControlPure,
|
|
229
|
+
hasSupport() {
|
|
230
|
+
return true;
|
|
253
231
|
},
|
|
254
|
-
|
|
255
|
-
);
|
|
256
|
-
|
|
257
|
-
addFilter(
|
|
258
|
-
'editor.BlockEdit',
|
|
259
|
-
'core/editor/block-hooks/with-inspector-controls',
|
|
260
|
-
withBlockHooksControls
|
|
261
|
-
);
|
|
232
|
+
};
|