@wordpress/block-editor 13.2.0 → 13.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +0 -5
- package/build/components/alignment-control/ui.js +2 -2
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.js +1 -1
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.native.js +1 -1
- package/build/components/block-alignment-control/ui.native.js.map +1 -1
- package/build/components/block-breadcrumb/index.js +12 -1
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-inspector/index.js +6 -3
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +3 -1
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-refs.js +9 -2
- package/build/components/block-list/use-block-props/use-block-refs.js.map +1 -1
- package/build/components/block-list/use-block-props/use-is-hovered.js +25 -9
- package/build/components/block-list/use-block-props/use-is-hovered.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-lock/modal.js +2 -0
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-lock/toolbar.js +0 -1
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mover/button.js +1 -1
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +1 -1
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +2 -2
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +5 -7
- package/build/components/block-patterns-paging/index.js.map +1 -1
- package/build/components/block-quick-navigation/index.js +20 -17
- package/build/components/block-quick-navigation/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +2 -0
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-rename/modal.js +4 -12
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-switcher/index.js +1 -1
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +11 -12
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/preview-block-popover.js +20 -17
- package/build/components/block-switcher/preview-block-popover.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +6 -2
- package/build/components/block-toolbar/shuffle.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +7 -58
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/block-toolbar-breadcrumb.js +9 -2
- package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -1
- package/build/components/block-tools/index.js +14 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +9 -8
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserter-button.js +45 -0
- package/build/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -0
- package/build/components/block-tools/zoom-out-mode-inserters.js +29 -28
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-popover.js +58 -0
- package/build/components/block-tools/zoom-out-popover.js.map +1 -0
- package/build/components/block-tools/zoom-out-toolbar.js +138 -0
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -0
- package/build/components/button-block-appender/index.js +3 -1
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/child-layout-control/index.js +26 -18
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +1 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/default-block-appender/index.js +7 -4
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/dimensions-tool/index.js +6 -4
- package/build/components/dimensions-tool/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +22 -62
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +185 -116
- package/build/components/global-styles/background-panel.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 +2 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +2 -1
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +2 -1
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +13 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +2 -1
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +45 -24
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +121 -0
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +47 -13
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +17 -7
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/grid/grid-item-movers.js +90 -48
- package/build/components/grid/grid-item-movers.js.map +1 -1
- package/build/components/grid/grid-item-resizer.js +2 -2
- package/build/components/grid/grid-item-resizer.js.map +1 -1
- package/build/components/grid/grid-visualizer.js +117 -37
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/grid/use-grid-layout-sync.js +60 -41
- package/build/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build/components/index.js +1 -9
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +2 -2
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -19
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +20 -23
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/media-tab/media-panel.js +1 -0
- package/build/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build/components/inserter/menu.js +26 -4
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/preview-panel.js +20 -3
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +10 -3
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +2 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls-tabs/settings-tab.js +1 -2
- package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build/components/link-control/link-preview.js +1 -1
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/list-view/block-select-button.js +2 -6
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +2 -2
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/utils.js +3 -1
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/media-placeholder/index.js +19 -23
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +3 -1
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js +1 -1
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +1 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +9 -3
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/tabbed-sidebar/index.js +66 -0
- package/build/components/tabbed-sidebar/index.js.map +1 -0
- package/build/components/url-popover/image-url-input-ui.js +3 -3
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/url-popover/index.js +3 -0
- package/build/components/url-popover/index.js.map +1 -1
- package/build/hooks/background.js +26 -4
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +11 -17
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-style-variation.js +169 -4
- package/build/hooks/block-style-variation.js.map +1 -1
- package/build/hooks/duotone.js +16 -11
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/grid-visualizer.js +62 -0
- package/build/hooks/grid-visualizer.js.map +1 -0
- package/build/hooks/index.js +15 -2
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +47 -23
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/position.js +4 -15
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +96 -55
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/utils.js +2 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/constrained.js +50 -4
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/grid.js +92 -51
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +6 -4
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +18 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +0 -2
- package/build/store/defaults.js.map +1 -1
- package/build/store/defaults.native.js +0 -3
- package/build/store/defaults.native.js.map +1 -1
- package/build/store/private-keys.js +2 -1
- package/build/store/private-keys.js.map +1 -1
- package/build/store/reducer.js +19 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +13 -1
- package/build/store/selectors.js.map +1 -1
- package/build/utils/format-font-style.js +45 -0
- package/build/utils/format-font-style.js.map +1 -0
- package/build/utils/format-font-weight.js +68 -0
- package/build/utils/format-font-weight.js.map +1 -0
- package/build/utils/get-editor-region.js +34 -0
- package/build/utils/get-editor-region.js.map +1 -0
- package/build/utils/get-font-styles-and-weights.js +167 -0
- package/build/utils/get-font-styles-and-weights.js.map +1 -0
- package/build/utils/pasting.js +5 -13
- package/build/utils/pasting.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +2 -2
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +1 -1
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.native.js +1 -1
- package/build-module/components/block-alignment-control/ui.native.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +12 -1
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +6 -3
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +3 -1
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-refs.js +11 -4
- package/build-module/components/block-list/use-block-props/use-block-refs.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-is-hovered.js +26 -9
- package/build-module/components/block-list/use-block-props/use-is-hovered.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-lock/modal.js +2 -0
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +0 -1
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-mover/button.js +1 -1
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +1 -1
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +2 -2
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +5 -7
- package/build-module/components/block-patterns-paging/index.js.map +1 -1
- package/build-module/components/block-quick-navigation/index.js +20 -17
- package/build-module/components/block-quick-navigation/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +2 -0
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js +5 -13
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-switcher/index.js +1 -1
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +12 -13
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/preview-block-popover.js +20 -17
- package/build-module/components/block-switcher/preview-block-popover.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +6 -2
- package/build-module/components/block-toolbar/shuffle.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +10 -61
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js +9 -2
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -1
- package/build-module/components/block-tools/index.js +14 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +9 -8
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserter-button.js +37 -0
- package/build-module/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -0
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +30 -29
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-popover.js +49 -0
- package/build-module/components/block-tools/zoom-out-popover.js.map +1 -0
- package/build-module/components/block-tools/zoom-out-toolbar.js +131 -0
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -0
- package/build-module/components/button-block-appender/index.js +3 -1
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +27 -19
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +2 -2
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +7 -4
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/dimensions-tool/index.js +6 -4
- package/build-module/components/dimensions-tool/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +24 -62
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +188 -119
- package/build-module/components/global-styles/background-panel.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 +3 -2
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +3 -2
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +3 -2
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +13 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +3 -2
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +47 -26
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +117 -0
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +47 -13
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +15 -6
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +93 -50
- package/build-module/components/grid/grid-item-movers.js.map +1 -1
- package/build-module/components/grid/grid-item-resizer.js +2 -2
- package/build-module/components/grid/grid-item-resizer.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js +118 -38
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/grid/use-grid-layout-sync.js +61 -42
- package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build-module/components/index.js +0 -5
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +2 -2
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -19
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +20 -23
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js +1 -0
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build-module/components/inserter/menu.js +26 -4
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +20 -3
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +10 -3
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -2
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.js +1 -2
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +1 -1
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +3 -7
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +2 -2
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/utils.js +3 -1
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +19 -23
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +3 -1
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +9 -3
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/tabbed-sidebar/index.js +60 -0
- package/build-module/components/tabbed-sidebar/index.js.map +1 -0
- package/build-module/components/url-popover/image-url-input-ui.js +3 -3
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/url-popover/index.js +3 -0
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/hooks/background.js +26 -4
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +11 -17
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-style-variation.js +168 -4
- package/build-module/hooks/block-style-variation.js.map +1 -1
- package/build-module/hooks/duotone.js +16 -11
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/grid-visualizer.js +61 -0
- package/build-module/hooks/grid-visualizer.js.map +1 -0
- package/build-module/hooks/index.js +3 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +47 -23
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/position.js +4 -15
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +96 -56
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/utils.js +2 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/constrained.js +50 -4
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/grid.js +92 -51
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +8 -6
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +15 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +0 -2
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/defaults.native.js +0 -3
- package/build-module/store/defaults.native.js.map +1 -1
- package/build-module/store/private-keys.js +1 -0
- package/build-module/store/private-keys.js.map +1 -1
- package/build-module/store/reducer.js +18 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +10 -0
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/format-font-style.js +39 -0
- package/build-module/utils/format-font-style.js.map +1 -0
- package/build-module/utils/format-font-weight.js +62 -0
- package/build-module/utils/format-font-weight.js.map +1 -0
- package/build-module/utils/get-editor-region.js +28 -0
- package/build-module/utils/get-editor-region.js.map +1 -0
- package/build-module/utils/get-font-styles-and-weights.js +160 -0
- package/build-module/utils/get-font-styles-and-weights.js.map +1 -0
- package/build-module/utils/pasting.js +5 -13
- package/build-module/utils/pasting.js.map +1 -1
- package/build-style/content-rtl.css +7 -6
- package/build-style/content.css +7 -6
- package/build-style/style-rtl.css +356 -181
- package/build-style/style.css +356 -181
- package/build-types/components/block-context/index.d.ts +2 -2
- package/build-types/components/block-context/index.d.ts.map +1 -1
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +32 -32
- package/src/components/alignment-control/ui.js +2 -2
- package/src/components/block-alignment-control/ui.js +1 -1
- package/src/components/block-alignment-control/ui.native.js +1 -1
- package/src/components/block-breadcrumb/index.js +16 -1
- package/src/components/block-context/README.md +4 -4
- package/src/components/block-inspector/index.js +8 -4
- package/src/components/block-list/content.scss +2 -16
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-list/use-block-props/use-block-refs.js +19 -3
- package/src/components/block-list/use-block-props/use-is-hovered.js +26 -11
- package/src/components/block-list/use-in-between-inserter.js +5 -1
- package/src/components/block-lock/modal.js +10 -2
- package/src/components/block-lock/style.scss +4 -8
- package/src/components/block-lock/toolbar.js +0 -1
- package/src/components/block-mover/button.js +1 -1
- package/src/components/block-mover/index.js +1 -1
- package/src/components/block-pattern-setup/setup-toolbar.js +2 -2
- package/src/components/block-patterns-paging/index.js +8 -11
- package/src/components/block-patterns-paging/style.scss +0 -5
- package/src/components/block-quick-navigation/index.js +21 -28
- package/src/components/block-removal-warning-modal/index.js +10 -2
- package/src/components/block-rename/modal.js +2 -8
- package/src/components/block-switcher/index.js +1 -1
- package/src/components/block-switcher/pattern-transformations-menu.js +17 -15
- package/src/components/block-switcher/preview-block-popover.js +20 -14
- package/src/components/block-switcher/style.scss +8 -17
- package/src/components/block-switcher/test/index.js +6 -6
- package/src/components/block-toolbar/shuffle.js +9 -1
- package/src/components/block-toolbar/style.scss +1 -11
- package/src/components/block-tools/block-selection-button.js +11 -83
- package/src/components/block-tools/block-toolbar-breadcrumb.js +9 -4
- package/src/components/block-tools/index.js +21 -1
- package/src/components/block-tools/style.scss +23 -0
- package/src/components/block-tools/use-show-block-tools.js +21 -10
- package/src/components/block-tools/zoom-out-mode-inserter-button.js +47 -0
- package/src/components/block-tools/zoom-out-mode-inserters.js +44 -33
- package/src/components/block-tools/zoom-out-popover.js +50 -0
- package/src/components/block-tools/zoom-out-toolbar.js +140 -0
- package/src/components/button-block-appender/index.js +2 -1
- package/src/components/child-layout-control/index.js +41 -23
- package/src/components/date-format-picker/index.js +2 -2
- package/src/components/date-format-picker/style.scss +0 -9
- package/src/components/default-block-appender/index.js +11 -4
- package/src/components/dimensions-tool/index.js +97 -89
- package/src/components/font-appearance-control/index.js +24 -82
- package/src/components/font-appearance-control/style.scss +3 -5
- package/src/components/global-styles/background-panel.js +266 -167
- package/src/components/global-styles/border-panel.js +3 -2
- package/src/components/global-styles/color-panel.js +3 -2
- package/src/components/global-styles/dimensions-panel.js +3 -2
- package/src/components/global-styles/filters-panel.js +3 -2
- package/src/components/global-styles/hooks.js +14 -1
- package/src/components/global-styles/image-settings-panel.js +3 -2
- package/src/components/global-styles/style.scss +116 -19
- package/src/components/global-styles/test/typography-utils.js +594 -0
- package/src/components/global-styles/test/use-global-styles-output.js +3 -1
- package/src/components/global-styles/typography-panel.js +56 -27
- package/src/components/global-styles/typography-utils.js +159 -0
- package/src/components/global-styles/use-global-styles-output.js +45 -10
- package/src/components/global-styles/utils.js +17 -6
- package/src/components/grid/grid-item-movers.js +140 -86
- package/src/components/grid/grid-item-resizer.js +3 -2
- package/src/components/grid/grid-visualizer.js +172 -55
- package/src/components/grid/style.scss +157 -8
- package/src/components/grid/use-grid-layout-sync.js +88 -46
- package/src/components/iframe/content.scss +2 -1
- package/src/components/index.js +0 -5
- package/src/components/inner-blocks/index.js +6 -2
- package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -16
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +40 -44
- package/src/components/inserter/media-tab/media-panel.js +1 -0
- package/src/components/inserter/menu.js +47 -13
- package/src/components/inserter/preview-panel.js +27 -4
- package/src/components/inserter/quick-inserter.js +6 -1
- package/src/components/inserter/style.scss +58 -92
- package/src/components/inserter-draggable-blocks/index.js +11 -3
- package/src/components/inspector-controls/block-support-tools-panel.js +3 -3
- package/src/components/inspector-controls-tabs/settings-tab.js +0 -2
- package/src/components/inspector-controls-tabs/style.scss +0 -21
- package/src/components/link-control/link-preview.js +1 -1
- package/src/components/list-view/block-select-button.js +3 -13
- package/src/components/list-view/block.js +10 -3
- package/src/components/list-view/style.scss +2 -1
- package/src/components/list-view/utils.js +13 -2
- package/src/components/media-placeholder/index.js +22 -32
- package/src/components/navigable-toolbar/index.js +3 -1
- package/src/components/rich-text/format-toolbar/index.js +1 -1
- package/src/components/rich-text/index.js +1 -1
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +9 -2
- package/src/components/tabbed-sidebar/README.md +76 -0
- package/src/components/tabbed-sidebar/index.js +70 -0
- package/src/components/tabbed-sidebar/style.scss +53 -0
- package/src/components/url-popover/image-url-input-ui.js +3 -3
- package/src/components/url-popover/index.js +3 -0
- package/src/components/url-popover/style.scss +1 -0
- package/src/hooks/background.js +25 -10
- package/src/hooks/block-hooks.js +9 -16
- package/src/hooks/block-style-variation.js +202 -3
- package/src/hooks/duotone.js +16 -12
- package/src/hooks/grid-visualizer.js +62 -0
- package/src/hooks/index.js +3 -0
- package/src/hooks/layout-child.js +64 -39
- package/src/hooks/position.js +3 -20
- package/src/hooks/test/get-variation-styles-with-ref-values.js +91 -0
- package/src/hooks/use-bindings-attributes.js +107 -63
- package/src/hooks/utils.js +2 -0
- package/src/layouts/constrained.js +53 -4
- package/src/layouts/grid.js +148 -51
- package/src/private-apis.js +12 -7
- package/src/store/actions.js +15 -0
- package/src/store/defaults.js +0 -2
- package/src/store/defaults.native.js +0 -3
- package/src/store/private-keys.js +1 -0
- package/src/store/reducer.js +18 -0
- package/src/store/selectors.js +10 -0
- package/src/style.scss +1 -1
- package/src/utils/format-font-style.js +40 -0
- package/src/utils/format-font-weight.js +63 -0
- package/src/utils/get-editor-region.js +31 -0
- package/src/utils/get-font-styles-and-weights.js +191 -0
- package/src/utils/pasting.js +5 -12
- package/src/utils/test/format-font-style.js +34 -0
- package/src/utils/test/format-font-weight.js +66 -0
- package/src/utils/test/get-font-styles-and-weights.js +513 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/inserter/reusable-block-rename-hint.js +0 -71
- package/build/components/inserter/reusable-block-rename-hint.js.map +0 -1
- package/build/components/inspector-controls-tabs/settings-tab-hint.js +0 -53
- package/build/components/inspector-controls-tabs/settings-tab-hint.js.map +0 -1
- package/build-module/components/inserter/reusable-block-rename-hint.js +0 -64
- package/build-module/components/inserter/reusable-block-rename-hint.js.map +0 -1
- package/build-module/components/inspector-controls-tabs/settings-tab-hint.js +0 -47
- package/build-module/components/inspector-controls-tabs/settings-tab-hint.js.map +0 -1
- package/src/components/inserter/reusable-block-rename-hint.js +0 -69
- package/src/components/inspector-controls-tabs/settings-tab-hint.js +0 -52
- package/src/hooks/position.scss +0 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CustomSelectControl","useMemo","__","_x","sprintf","jsx","_jsx","FONT_STYLES","name","value","FONT_WEIGHTS","getFontAppearanceLabel","hasFontStyles","hasFontWeights","FontAppearanceControl","props","onChange","fontStyle","fontWeight","otherProps","hasStylesOrWeights","label","defaultOption","key","style","undefined","combineOptions","combinedOptions","forEach","styleName","styleValue","weightName","weightValue","optionName","push","styleOptions","weightOptions","selectOptions","options","currentSelection","find","option","getDescribedBy","className","describedBy","selectedItem"],"sources":["@wordpress/block-editor/src/components/font-appearance-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { CustomSelectControl } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { __, _x, sprintf } from '@wordpress/i18n';\n\nconst FONT_STYLES = [\n\t{\n\t\tname: _x( 'Regular', 'font style' ),\n\t\tvalue: 'normal',\n\t},\n\t{\n\t\tname: _x( 'Italic', 'font style' ),\n\t\tvalue: 'italic',\n\t},\n];\n\nconst FONT_WEIGHTS = [\n\t{\n\t\tname: _x( 'Thin', 'font weight' ),\n\t\tvalue: '100',\n\t},\n\t{\n\t\tname: _x( 'Extra Light', 'font weight' ),\n\t\tvalue: '200',\n\t},\n\t{\n\t\tname: _x( 'Light', 'font weight' ),\n\t\tvalue: '300',\n\t},\n\t{\n\t\tname: _x( 'Regular', 'font weight' ),\n\t\tvalue: '400',\n\t},\n\t{\n\t\tname: _x( 'Medium', 'font weight' ),\n\t\tvalue: '500',\n\t},\n\t{\n\t\tname: _x( 'Semi Bold', 'font weight' ),\n\t\tvalue: '600',\n\t},\n\t{\n\t\tname: _x( 'Bold', 'font weight' ),\n\t\tvalue: '700',\n\t},\n\t{\n\t\tname: _x( 'Extra Bold', 'font weight' ),\n\t\tvalue: '800',\n\t},\n\t{\n\t\tname: _x( 'Black', 'font weight' ),\n\t\tvalue: '900',\n\t},\n];\n\n/**\n * Adjusts font appearance field label in case either font styles or weights\n * are disabled.\n *\n * @param {boolean} hasFontStyles Whether font styles are enabled and present.\n * @param {boolean} hasFontWeights Whether font weights are enabled and present.\n * @return {string} A label representing what font appearance is being edited.\n */\nconst getFontAppearanceLabel = ( hasFontStyles, hasFontWeights ) => {\n\tif ( ! hasFontStyles ) {\n\t\treturn __( 'Font weight' );\n\t}\n\n\tif ( ! hasFontWeights ) {\n\t\treturn __( 'Font style' );\n\t}\n\n\treturn __( 'Appearance' );\n};\n\n/**\n * Control to display unified font style and weight options.\n *\n * @param {Object} props Component props.\n *\n * @return {Element} Font appearance control.\n */\nexport default function FontAppearanceControl( props ) {\n\tconst {\n\t\tonChange,\n\t\thasFontStyles = true,\n\t\thasFontWeights = true,\n\t\tvalue: { fontStyle, fontWeight },\n\t\t...otherProps\n\t} = props;\n\tconst hasStylesOrWeights = hasFontStyles || hasFontWeights;\n\tconst label = getFontAppearanceLabel( hasFontStyles, hasFontWeights );\n\tconst defaultOption = {\n\t\tkey: 'default',\n\t\tname: __( 'Default' ),\n\t\tstyle: { fontStyle: undefined, fontWeight: undefined },\n\t};\n\n\t// Combines both font style and weight options into a single dropdown.\n\tconst combineOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\n\t\tFONT_STYLES.forEach( ( { name: styleName, value: styleValue } ) => {\n\t\t\tFONT_WEIGHTS.forEach(\n\t\t\t\t( { name: weightName, value: weightValue } ) => {\n\t\t\t\t\tconst optionName =\n\t\t\t\t\t\tstyleValue === 'normal'\n\t\t\t\t\t\t\t? weightName\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: 1: Font weight name. 2: Font style name. */\n\t\t\t\t\t\t\t\t\t__( '%1$s %2$s' ),\n\t\t\t\t\t\t\t\t\tweightName,\n\t\t\t\t\t\t\t\t\tstyleName\n\t\t\t\t\t\t\t );\n\n\t\t\t\t\tcombinedOptions.push( {\n\t\t\t\t\t\tkey: `${ styleValue }-${ weightValue }`,\n\t\t\t\t\t\tname: optionName,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tfontStyle: styleValue,\n\t\t\t\t\t\t\tfontWeight: weightValue,\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t);\n\t\t} );\n\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font styles only.\n\tconst styleOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tFONT_STYLES.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: value, fontWeight: undefined },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font weights only.\n\tconst weightOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tFONT_WEIGHTS.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: undefined, fontWeight: value },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Map font styles and weights to select options.\n\tconst selectOptions = useMemo( () => {\n\t\tif ( hasFontStyles && hasFontWeights ) {\n\t\t\treturn combineOptions();\n\t\t}\n\n\t\treturn hasFontStyles ? styleOptions() : weightOptions();\n\t}, [ props.options ] );\n\n\t// Find current selection by comparing font style & weight against options,\n\t// and fall back to the Default option if there is no matching option.\n\tconst currentSelection =\n\t\tselectOptions.find(\n\t\t\t( option ) =>\n\t\t\t\toption.style.fontStyle === fontStyle &&\n\t\t\t\toption.style.fontWeight === fontWeight\n\t\t) || selectOptions[ 0 ];\n\n\t// Adjusts screen reader description based on styles or weights.\n\tconst getDescribedBy = () => {\n\t\tif ( ! currentSelection ) {\n\t\t\treturn __( 'No selected font appearance' );\n\t\t}\n\n\t\tif ( ! hasFontStyles ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font weight.\n\t\t\t\t__( 'Currently selected font weight: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\tif ( ! hasFontWeights ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font style.\n\t\t\t\t__( 'Currently selected font style: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\treturn sprintf(\n\t\t\t// translators: %s: Currently selected font appearance.\n\t\t\t__( 'Currently selected font appearance: %s' ),\n\t\t\tcurrentSelection.name\n\t\t);\n\t};\n\n\treturn (\n\t\thasStylesOrWeights && (\n\t\t\t<CustomSelectControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\tclassName=\"components-font-appearance-control\"\n\t\t\t\tlabel={ label }\n\t\t\t\tdescribedBy={ getDescribedBy() }\n\t\t\t\toptions={ selectOptions }\n\t\t\t\tvalue={ currentSelection }\n\t\t\t\tonChange={ ( { selectedItem } ) =>\n\t\t\t\t\tonChange( selectedItem.style )\n\t\t\t\t}\n\t\t\t/>\n\t\t)\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAElD,MAAMC,WAAW,GAAG,CACnB;EACCC,IAAI,EAAEL,EAAE,CAAE,SAAS,EAAE,YAAa,CAAC;EACnCM,KAAK,EAAE;AACR,CAAC,EACD;EACCD,IAAI,EAAEL,EAAE,CAAE,QAAQ,EAAE,YAAa,CAAC;EAClCM,KAAK,EAAE;AACR,CAAC,CACD;AAED,MAAMC,YAAY,GAAG,CACpB;EACCF,IAAI,EAAEL,EAAE,CAAE,MAAM,EAAE,aAAc,CAAC;EACjCM,KAAK,EAAE;AACR,CAAC,EACD;EACCD,IAAI,EAAEL,EAAE,CAAE,aAAa,EAAE,aAAc,CAAC;EACxCM,KAAK,EAAE;AACR,CAAC,EACD;EACCD,IAAI,EAAEL,EAAE,CAAE,OAAO,EAAE,aAAc,CAAC;EAClCM,KAAK,EAAE;AACR,CAAC,EACD;EACCD,IAAI,EAAEL,EAAE,CAAE,SAAS,EAAE,aAAc,CAAC;EACpCM,KAAK,EAAE;AACR,CAAC,EACD;EACCD,IAAI,EAAEL,EAAE,CAAE,QAAQ,EAAE,aAAc,CAAC;EACnCM,KAAK,EAAE;AACR,CAAC,EACD;EACCD,IAAI,EAAEL,EAAE,CAAE,WAAW,EAAE,aAAc,CAAC;EACtCM,KA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IACfuB,WAAW,EAAGF,cAAc,CAAC,CAAG;IAChCJ,OAAO,EAAGD,aAAe;IACzB5B,KAAK,EAAG8B,gBAAkB;IAC1BvB,QAAQ,EAAGA,CAAE;MAAE6B;IAAa,CAAC,KAC5B7B,QAAQ,CAAE6B,YAAY,CAACrB,KAAM;EAC7B,CACD,CACD;AAEH","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["CustomSelectControl","useMemo","__","sprintf","getFontStylesAndWeights","jsx","_jsx","getFontAppearanceLabel","hasFontStyles","hasFontWeights","FontAppearanceControl","props","onChange","fontFamilyFaces","value","fontStyle","fontWeight","otherProps","hasStylesOrWeights","label","defaultOption","key","name","style","undefined","fontStyles","fontWeights","combinedStyleAndWeightOptions","combineOptions","combinedOptions","push","styleOptions","forEach","weightOptions","selectOptions","options","currentSelection","find","option","getDescribedBy","className","describedBy","selectedItem"],"sources":["@wordpress/block-editor/src/components/font-appearance-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { CustomSelectControl } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getFontStylesAndWeights } from '../../utils/get-font-styles-and-weights';\n\n/**\n * Adjusts font appearance field label in case either font styles or weights\n * are disabled.\n *\n * @param {boolean} hasFontStyles Whether font styles are enabled and present.\n * @param {boolean} hasFontWeights Whether font weights are enabled and present.\n * @return {string} A label representing what font appearance is being edited.\n */\nconst getFontAppearanceLabel = ( hasFontStyles, hasFontWeights ) => {\n\tif ( ! hasFontStyles ) {\n\t\treturn __( 'Font weight' );\n\t}\n\n\tif ( ! hasFontWeights ) {\n\t\treturn __( 'Font style' );\n\t}\n\n\treturn __( 'Appearance' );\n};\n\n/**\n * Control to display font style and weight options of the active font.\n *\n * @param {Object} props Component props.\n *\n * @return {Element} Font appearance control.\n */\nexport default function FontAppearanceControl( props ) {\n\tconst {\n\t\tonChange,\n\t\thasFontStyles = true,\n\t\thasFontWeights = true,\n\t\tfontFamilyFaces,\n\t\tvalue: { fontStyle, fontWeight },\n\t\t...otherProps\n\t} = props;\n\tconst hasStylesOrWeights = hasFontStyles || hasFontWeights;\n\tconst label = getFontAppearanceLabel( hasFontStyles, hasFontWeights );\n\tconst defaultOption = {\n\t\tkey: 'default',\n\t\tname: __( 'Default' ),\n\t\tstyle: { fontStyle: undefined, fontWeight: undefined },\n\t};\n\tconst { fontStyles, fontWeights, combinedStyleAndWeightOptions } =\n\t\tgetFontStylesAndWeights( fontFamilyFaces );\n\n\t// Generates select options for combined font styles and weights.\n\tconst combineOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tif ( combinedStyleAndWeightOptions ) {\n\t\t\tcombinedOptions.push( ...combinedStyleAndWeightOptions );\n\t\t}\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font styles only.\n\tconst styleOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tfontStyles.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: value, fontWeight: undefined },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font weights only.\n\tconst weightOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tfontWeights.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: undefined, fontWeight: value },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Map font styles and weights to select options.\n\tconst selectOptions = useMemo( () => {\n\t\t// Display combined available font style and weight options.\n\t\tif ( hasFontStyles && hasFontWeights ) {\n\t\t\treturn combineOptions();\n\t\t}\n\n\t\t// Display only font style options or font weight options.\n\t\treturn hasFontStyles ? styleOptions() : weightOptions();\n\t}, [\n\t\tprops.options,\n\t\tfontStyles,\n\t\tfontWeights,\n\t\tcombinedStyleAndWeightOptions,\n\t] );\n\n\t// Find current selection by comparing font style & weight against options,\n\t// and fall back to the Default option if there is no matching option.\n\tconst currentSelection =\n\t\tselectOptions.find(\n\t\t\t( option ) =>\n\t\t\t\toption.style.fontStyle === fontStyle &&\n\t\t\t\toption.style.fontWeight === fontWeight\n\t\t) || selectOptions[ 0 ];\n\n\t// Adjusts screen reader description based on styles or weights.\n\tconst getDescribedBy = () => {\n\t\tif ( ! currentSelection ) {\n\t\t\treturn __( 'No selected font appearance' );\n\t\t}\n\n\t\tif ( ! hasFontStyles ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font weight.\n\t\t\t\t__( 'Currently selected font weight: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\tif ( ! hasFontWeights ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font style.\n\t\t\t\t__( 'Currently selected font style: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\treturn sprintf(\n\t\t\t// translators: %s: Currently selected font appearance.\n\t\t\t__( 'Currently selected font appearance: %s' ),\n\t\t\tcurrentSelection.name\n\t\t);\n\t};\n\n\treturn (\n\t\thasStylesOrWeights && (\n\t\t\t<CustomSelectControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\tclassName=\"components-font-appearance-control\"\n\t\t\t\tlabel={ label }\n\t\t\t\tdescribedBy={ getDescribedBy() }\n\t\t\t\toptions={ selectOptions }\n\t\t\t\tvalue={ currentSelection }\n\t\t\t\tonChange={ ( { selectedItem } ) =>\n\t\t\t\t\tonChange( selectedItem.style )\n\t\t\t\t}\n\t\t\t/>\n\t\t)\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;A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,aAAa,CAAE,CAAC,CAAE;;EAExB;EACA,MAAMK,cAAc,GAAGA,CAAA,KAAM;IAC5B,IAAK,CAAEH,gBAAgB,EAAG;MACzB,OAAOlC,EAAE,CAAE,6BAA8B,CAAC;IAC3C;IAEA,IAAK,CAAEM,aAAa,EAAG;MACtB,OAAOL,OAAO;MACb;MACAD,EAAE,CAAE,oCAAqC,CAAC,EAC1CkC,gBAAgB,CAACd,IAClB,CAAC;IACF;IAEA,IAAK,CAAEb,cAAc,EAAG;MACvB,OAAON,OAAO;MACb;MACAD,EAAE,CAAE,mCAAoC,CAAC,EACzCkC,gBAAgB,CAACd,IAClB,CAAC;IACF;IAEA,OAAOnB,OAAO;IACb;IACAD,EAAE,CAAE,wCAAyC,CAAC,EAC9CkC,gBAAgB,CAACd,IAClB,CAAC;EACF,CAAC;EAED,OACCJ,kBAAkB,iBACjBZ,IAAA,CAACN,mBAAmB;IAAA,GACdiB,UAAU;IACfuB,SAAS,EAAC,oCAAoC;IAC9CrB,KAAK,EAAGA,KAAO;IACfsB,WAAW,EAAGF,cAAc,CAAC,CAAG;IAChCJ,OAAO,EAAGD,aAAe;IACzBpB,KAAK,EAAGsB,gBAAkB;IAC1BxB,QAAQ,EAAGA,CAAE;MAAE8B;IAAa,CAAC,KAC5B9B,QAAQ,CAAE8B,YAAY,CAACnB,KAAM;EAC7B,CACD,CACD;AAEH","ignoreList":[]}
|
|
@@ -6,11 +6,11 @@ import clsx from 'clsx';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, ToggleControl, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, __experimentalUnitControl as UnitControl, __experimentalVStack as VStack, DropZone, FlexItem, FocalPointPicker, MenuItem, VisuallyHidden, __experimentalItemGroup as ItemGroup, __experimentalHStack as HStack, __experimentalTruncate as Truncate } from '@wordpress/components';
|
|
9
|
+
import { __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, ToggleControl, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, __experimentalUnitControl as UnitControl, __experimentalVStack as VStack, DropZone, FlexItem, FocalPointPicker, MenuItem, VisuallyHidden, __experimentalItemGroup as ItemGroup, __experimentalHStack as HStack, __experimentalTruncate as Truncate, Dropdown, __experimentalDropdownContentWrapper as DropdownContentWrapper } from '@wordpress/components';
|
|
10
10
|
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
11
11
|
import { store as noticesStore } from '@wordpress/notices';
|
|
12
12
|
import { getFilename } from '@wordpress/url';
|
|
13
|
-
import { useCallback, Platform, useRef } from '@wordpress/element';
|
|
13
|
+
import { useCallback, Platform, useRef, useState, useEffect } from '@wordpress/element';
|
|
14
14
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
15
15
|
import { focus } from '@wordpress/dom';
|
|
16
16
|
import { isBlobURL } from '@wordpress/blob';
|
|
@@ -18,7 +18,7 @@ import { isBlobURL } from '@wordpress/blob';
|
|
|
18
18
|
/**
|
|
19
19
|
* Internal dependencies
|
|
20
20
|
*/
|
|
21
|
-
import {
|
|
21
|
+
import { useToolsPanelDropdownMenuProps } from './utils';
|
|
22
22
|
import { setImmutably } from '../../utils/object';
|
|
23
23
|
import MediaReplaceFlow from '../media-replace-flow';
|
|
24
24
|
import { store as blockEditorStore } from '../../store';
|
|
@@ -27,9 +27,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
27
27
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
28
|
const IMAGE_BACKGROUND_TYPE = 'image';
|
|
29
29
|
const DEFAULT_CONTROLS = {
|
|
30
|
-
backgroundImage: true
|
|
31
|
-
backgroundSize: false
|
|
30
|
+
backgroundImage: true
|
|
32
31
|
};
|
|
32
|
+
const BACKGROUND_POPOVER_PROPS = {
|
|
33
|
+
placement: 'left-start',
|
|
34
|
+
offset: 36,
|
|
35
|
+
shift: true,
|
|
36
|
+
className: 'block-editor-global-styles-background-panel__popover'
|
|
37
|
+
};
|
|
38
|
+
const noop = () => {};
|
|
33
39
|
|
|
34
40
|
/**
|
|
35
41
|
* Checks site settings to see if the background panel may be used.
|
|
@@ -121,21 +127,30 @@ export const backgroundPositionToCoords = value => {
|
|
|
121
127
|
y
|
|
122
128
|
};
|
|
123
129
|
};
|
|
124
|
-
function
|
|
125
|
-
|
|
130
|
+
function InspectorImagePreviewItem({
|
|
131
|
+
as = 'span',
|
|
132
|
+
imgUrl,
|
|
133
|
+
toggleProps = {},
|
|
126
134
|
filename,
|
|
127
|
-
|
|
135
|
+
label,
|
|
136
|
+
className,
|
|
137
|
+
onToggleCallback = noop
|
|
128
138
|
}) {
|
|
129
|
-
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
if (typeof toggleProps?.isOpen !== 'undefined') {
|
|
141
|
+
onToggleCallback(toggleProps?.isOpen);
|
|
142
|
+
}
|
|
143
|
+
}, [toggleProps?.isOpen, onToggleCallback]);
|
|
130
144
|
return /*#__PURE__*/_jsx(ItemGroup, {
|
|
131
|
-
as:
|
|
145
|
+
as: as,
|
|
146
|
+
className: className,
|
|
147
|
+
...toggleProps,
|
|
132
148
|
children: /*#__PURE__*/_jsxs(HStack, {
|
|
133
|
-
justify:
|
|
149
|
+
justify: "flex-start",
|
|
134
150
|
as: "span",
|
|
151
|
+
className: "block-editor-global-styles-background-panel__inspector-preview-inner",
|
|
135
152
|
children: [imgUrl && /*#__PURE__*/_jsx("span", {
|
|
136
|
-
className:
|
|
137
|
-
'has-image': imgUrl
|
|
138
|
-
}),
|
|
153
|
+
className: "block-editor-global-styles-background-panel__inspector-image-indicator-wrapper",
|
|
139
154
|
"aria-hidden": true,
|
|
140
155
|
children: /*#__PURE__*/_jsx("span", {
|
|
141
156
|
className: "block-editor-global-styles-background-panel__inspector-image-indicator",
|
|
@@ -145,25 +160,69 @@ function InspectorImagePreview({
|
|
|
145
160
|
})
|
|
146
161
|
}), /*#__PURE__*/_jsxs(FlexItem, {
|
|
147
162
|
as: "span",
|
|
163
|
+
style: imgUrl ? {} : {
|
|
164
|
+
flexGrow: 1
|
|
165
|
+
},
|
|
148
166
|
children: [/*#__PURE__*/_jsx(Truncate, {
|
|
149
167
|
numberOfLines: 1,
|
|
150
168
|
className: "block-editor-global-styles-background-panel__inspector-media-replace-title",
|
|
151
|
-
children:
|
|
169
|
+
children: label
|
|
152
170
|
}), /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
153
171
|
as: "span",
|
|
154
172
|
children: imgUrl ? sprintf( /* translators: %s: file name */
|
|
155
|
-
__('Background image: %s'), filename ||
|
|
173
|
+
__('Background image: %s'), filename || label) : __('No background image selected')
|
|
156
174
|
})]
|
|
157
175
|
})]
|
|
158
176
|
})
|
|
159
177
|
});
|
|
160
178
|
}
|
|
161
|
-
function
|
|
162
|
-
|
|
163
|
-
|
|
179
|
+
function BackgroundControlsPanel({
|
|
180
|
+
label,
|
|
181
|
+
filename,
|
|
182
|
+
url: imgUrl,
|
|
183
|
+
children,
|
|
184
|
+
onToggle: onToggleCallback = noop,
|
|
185
|
+
hasImageValue
|
|
186
|
+
}) {
|
|
187
|
+
if (!hasImageValue) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const imgLabel = label || getFilename(imgUrl) || __('Add background image');
|
|
191
|
+
return /*#__PURE__*/_jsx(Dropdown, {
|
|
192
|
+
popoverProps: BACKGROUND_POPOVER_PROPS,
|
|
193
|
+
renderToggle: ({
|
|
194
|
+
onToggle,
|
|
195
|
+
isOpen
|
|
196
|
+
}) => {
|
|
197
|
+
const toggleProps = {
|
|
198
|
+
onClick: onToggle,
|
|
199
|
+
className: 'block-editor-global-styles-background-panel__dropdown-toggle',
|
|
200
|
+
'aria-expanded': isOpen,
|
|
201
|
+
'aria-label': __('Background size, position and repeat options.'),
|
|
202
|
+
isOpen
|
|
203
|
+
};
|
|
204
|
+
return /*#__PURE__*/_jsx(InspectorImagePreviewItem, {
|
|
205
|
+
imgUrl: imgUrl,
|
|
206
|
+
filename: filename,
|
|
207
|
+
label: imgLabel,
|
|
208
|
+
toggleProps: toggleProps,
|
|
209
|
+
as: "button",
|
|
210
|
+
onToggleCallback: onToggleCallback
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
renderContent: () => /*#__PURE__*/_jsx(DropdownContentWrapper, {
|
|
214
|
+
className: "block-editor-global-styles-background-panel__dropdown-content-wrapper",
|
|
215
|
+
paddingSize: "medium",
|
|
216
|
+
children: children
|
|
217
|
+
})
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
function BackgroundImageControls({
|
|
164
221
|
onChange,
|
|
165
222
|
style,
|
|
166
223
|
inheritedValue,
|
|
224
|
+
onRemoveImage = noop,
|
|
225
|
+
displayInPanel,
|
|
167
226
|
themeFileURIs
|
|
168
227
|
}) {
|
|
169
228
|
const mediaUpload = useSelect(select => select(blockEditorStore).getSettings().mediaUpload, []);
|
|
@@ -224,15 +283,6 @@ function BackgroundImageToolsPanelItem({
|
|
|
224
283
|
onError: onUploadError
|
|
225
284
|
});
|
|
226
285
|
};
|
|
227
|
-
const resetAllFilter = useCallback(previousValue => {
|
|
228
|
-
return {
|
|
229
|
-
...previousValue,
|
|
230
|
-
style: {
|
|
231
|
-
...previousValue.style,
|
|
232
|
-
background: undefined
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
}, []);
|
|
236
286
|
const hasValue = hasBackgroundImageValue(style);
|
|
237
287
|
const closeAndFocus = () => {
|
|
238
288
|
const [toggleButton] = focus.tabbable.find(replaceContainerRef.current);
|
|
@@ -244,52 +294,48 @@ function BackgroundImageToolsPanelItem({
|
|
|
244
294
|
};
|
|
245
295
|
const onRemove = () => onChange(setImmutably(style, ['background', 'backgroundImage'], 'none'));
|
|
246
296
|
const canRemove = !hasValue && hasBackgroundImageValue(inheritedValue);
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
children: __('Reset ')
|
|
282
|
-
})]
|
|
283
|
-
}), /*#__PURE__*/_jsx(DropZone, {
|
|
284
|
-
onFilesDrop: onFilesDrop,
|
|
285
|
-
label: __('Drop to upload')
|
|
297
|
+
const imgLabel = title || getFilename(url) || __('Add background image');
|
|
298
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
299
|
+
ref: replaceContainerRef,
|
|
300
|
+
className: "block-editor-global-styles-background-panel__image-tools-panel-item",
|
|
301
|
+
children: [/*#__PURE__*/_jsxs(MediaReplaceFlow, {
|
|
302
|
+
mediaId: id,
|
|
303
|
+
mediaURL: url,
|
|
304
|
+
allowedTypes: [IMAGE_BACKGROUND_TYPE],
|
|
305
|
+
accept: "image/*",
|
|
306
|
+
onSelect: onSelectMedia,
|
|
307
|
+
popoverProps: {
|
|
308
|
+
className: clsx({
|
|
309
|
+
'block-editor-global-styles-background-panel__media-replace-popover': displayInPanel
|
|
310
|
+
})
|
|
311
|
+
},
|
|
312
|
+
name: /*#__PURE__*/_jsx(InspectorImagePreviewItem, {
|
|
313
|
+
className: "block-editor-global-styles-background-panel__image-preview",
|
|
314
|
+
imgUrl: getResolvedThemeFilePath(url, themeFileURIs),
|
|
315
|
+
filename: title,
|
|
316
|
+
label: imgLabel
|
|
317
|
+
}),
|
|
318
|
+
variant: "secondary",
|
|
319
|
+
children: [canRemove && /*#__PURE__*/_jsx(MenuItem, {
|
|
320
|
+
onClick: () => {
|
|
321
|
+
closeAndFocus();
|
|
322
|
+
onRemove();
|
|
323
|
+
},
|
|
324
|
+
children: __('Remove')
|
|
325
|
+
}), hasValue && /*#__PURE__*/_jsx(MenuItem, {
|
|
326
|
+
onClick: () => {
|
|
327
|
+
closeAndFocus();
|
|
328
|
+
onRemoveImage();
|
|
329
|
+
},
|
|
330
|
+
children: __('Reset ')
|
|
286
331
|
})]
|
|
287
|
-
})
|
|
332
|
+
}), /*#__PURE__*/_jsx(DropZone, {
|
|
333
|
+
onFilesDrop: onFilesDrop,
|
|
334
|
+
label: __('Drop to upload')
|
|
335
|
+
})]
|
|
288
336
|
});
|
|
289
337
|
}
|
|
290
|
-
function
|
|
291
|
-
panelId,
|
|
292
|
-
isShownByDefault,
|
|
338
|
+
function BackgroundSizeControls({
|
|
293
339
|
onChange,
|
|
294
340
|
style,
|
|
295
341
|
inheritedValue,
|
|
@@ -300,6 +346,7 @@ function BackgroundSizeToolsPanelItem({
|
|
|
300
346
|
const repeatValue = style?.background?.backgroundRepeat || inheritedValue?.background?.backgroundRepeat;
|
|
301
347
|
const imageValue = style?.background?.backgroundImage?.url || inheritedValue?.background?.backgroundImage?.url;
|
|
302
348
|
const positionValue = style?.background?.backgroundPosition || inheritedValue?.background?.backgroundPosition;
|
|
349
|
+
const attachmentValue = style?.background?.backgroundAttachment || inheritedValue?.background?.backgroundAttachment;
|
|
303
350
|
|
|
304
351
|
/*
|
|
305
352
|
* An `undefined` value is replaced with any supplied
|
|
@@ -316,20 +363,6 @@ function BackgroundSizeToolsPanelItem({
|
|
|
316
363
|
* should reflect the current repeat value.
|
|
317
364
|
*/
|
|
318
365
|
const repeatCheckedValue = !(repeatValue === 'no-repeat' || currentValueForToggle === 'cover' && repeatValue === undefined);
|
|
319
|
-
const hasValue = hasBackgroundSizeValue(style);
|
|
320
|
-
const resetAllFilter = useCallback(previousValue => {
|
|
321
|
-
return {
|
|
322
|
-
...previousValue,
|
|
323
|
-
style: {
|
|
324
|
-
...previousValue.style,
|
|
325
|
-
background: {
|
|
326
|
-
...previousValue.style?.background,
|
|
327
|
-
backgroundRepeat: undefined,
|
|
328
|
-
backgroundSize: undefined
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
}, []);
|
|
333
366
|
const updateBackgroundSize = next => {
|
|
334
367
|
// When switching to 'contain' toggle the repeat off.
|
|
335
368
|
let nextRepeat = repeatValue;
|
|
@@ -373,28 +406,22 @@ function BackgroundSizeToolsPanelItem({
|
|
|
373
406
|
onChange(setImmutably(style, ['background', 'backgroundPosition'], coordsToBackgroundPosition(next)));
|
|
374
407
|
};
|
|
375
408
|
const toggleIsRepeated = () => onChange(setImmutably(style, ['background', 'backgroundRepeat'], repeatCheckedValue === true ? 'no-repeat' : 'repeat'));
|
|
376
|
-
const
|
|
377
|
-
...style?.background,
|
|
378
|
-
backgroundPosition: undefined,
|
|
379
|
-
backgroundRepeat: undefined,
|
|
380
|
-
backgroundSize: undefined
|
|
381
|
-
}));
|
|
409
|
+
const toggleScrollWithPage = () => onChange(setImmutably(style, ['background', 'backgroundAttachment'], attachmentValue === 'fixed' ? 'scroll' : 'fixed'));
|
|
382
410
|
return /*#__PURE__*/_jsxs(VStack, {
|
|
383
|
-
|
|
384
|
-
spacing: 2,
|
|
411
|
+
spacing: 4,
|
|
385
412
|
className: "single-column",
|
|
386
|
-
hasValue: () => hasValue,
|
|
387
|
-
label: __('Size'),
|
|
388
|
-
onDeselect: resetBackgroundSize,
|
|
389
|
-
isShownByDefault: isShownByDefault,
|
|
390
|
-
resetAllFilter: resetAllFilter,
|
|
391
|
-
panelId: panelId,
|
|
392
413
|
children: [/*#__PURE__*/_jsx(FocalPointPicker, {
|
|
393
414
|
__next40pxDefaultSize: true,
|
|
394
|
-
|
|
415
|
+
__nextHasNoMarginBottom: true,
|
|
416
|
+
label: __('Focal point'),
|
|
395
417
|
url: getResolvedThemeFilePath(imageValue, themeFileURIs),
|
|
396
418
|
value: backgroundPositionToCoords(positionValue),
|
|
397
419
|
onChange: updateBackgroundPosition
|
|
420
|
+
}), /*#__PURE__*/_jsx(ToggleControl, {
|
|
421
|
+
label: __('Fixed background'),
|
|
422
|
+
checked: attachmentValue === 'fixed',
|
|
423
|
+
onChange: toggleScrollWithPage,
|
|
424
|
+
help: __('Whether your image should scroll with the page or stay fixed in place.')
|
|
398
425
|
}), /*#__PURE__*/_jsxs(ToggleGroupControl, {
|
|
399
426
|
size: "__unstable-large",
|
|
400
427
|
label: __('Size'),
|
|
@@ -416,18 +443,20 @@ function BackgroundSizeToolsPanelItem({
|
|
|
416
443
|
justify: "flex-start",
|
|
417
444
|
spacing: 2,
|
|
418
445
|
as: "span",
|
|
419
|
-
children: [
|
|
446
|
+
children: [/*#__PURE__*/_jsx(UnitControl, {
|
|
420
447
|
"aria-label": __('Background image width'),
|
|
421
448
|
onChange: updateBackgroundSize,
|
|
422
449
|
value: sizeValue,
|
|
423
450
|
size: "__unstable-large",
|
|
424
451
|
__unstableInputWidth: "100px",
|
|
425
452
|
min: 0,
|
|
426
|
-
placeholder: __('Auto')
|
|
427
|
-
|
|
453
|
+
placeholder: __('Auto'),
|
|
454
|
+
disabled: currentValueForToggle !== 'auto' || currentValueForToggle === undefined
|
|
455
|
+
}), /*#__PURE__*/_jsx(ToggleControl, {
|
|
428
456
|
label: __('Repeat'),
|
|
429
457
|
checked: repeatCheckedValue,
|
|
430
|
-
onChange: toggleIsRepeated
|
|
458
|
+
onChange: toggleIsRepeated,
|
|
459
|
+
disabled: currentValueForToggle === 'cover'
|
|
431
460
|
})]
|
|
432
461
|
})]
|
|
433
462
|
});
|
|
@@ -440,6 +469,7 @@ function BackgroundToolsPanel({
|
|
|
440
469
|
children,
|
|
441
470
|
headerLabel
|
|
442
471
|
}) {
|
|
472
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
443
473
|
const resetAll = () => {
|
|
444
474
|
const updatedValue = resetAllFilter(value);
|
|
445
475
|
onChange(updatedValue);
|
|
@@ -450,7 +480,7 @@ function BackgroundToolsPanel({
|
|
|
450
480
|
label: headerLabel,
|
|
451
481
|
resetAll: resetAll,
|
|
452
482
|
panelId: panelId,
|
|
453
|
-
dropdownMenuProps:
|
|
483
|
+
dropdownMenuProps: dropdownMenuProps,
|
|
454
484
|
children: children
|
|
455
485
|
});
|
|
456
486
|
}
|
|
@@ -472,28 +502,67 @@ export default function BackgroundPanel({
|
|
|
472
502
|
background: {}
|
|
473
503
|
};
|
|
474
504
|
}, []);
|
|
475
|
-
const
|
|
505
|
+
const resetBackground = () => onChange(setImmutably(value, ['background'], {}));
|
|
506
|
+
const {
|
|
507
|
+
title,
|
|
508
|
+
url
|
|
509
|
+
} = value?.background?.backgroundImage || {
|
|
510
|
+
...inheritedValue?.background?.backgroundImage
|
|
511
|
+
};
|
|
512
|
+
const hasImageValue = hasBackgroundImageValue(value) || hasBackgroundImageValue(inheritedValue);
|
|
513
|
+
const shouldShowBackgroundImageControls = hasImageValue && (settings?.background?.backgroundSize || settings?.background?.backgroundPosition || settings?.background?.backgroundRepeat);
|
|
514
|
+
const [isDropDownOpen, setIsDropDownOpen] = useState(false);
|
|
476
515
|
return /*#__PURE__*/_jsxs(Wrapper, {
|
|
477
516
|
resetAllFilter: resetAllFilter,
|
|
478
517
|
value: value,
|
|
479
518
|
onChange: onChange,
|
|
480
519
|
panelId: panelId,
|
|
481
520
|
headerLabel: headerLabel,
|
|
482
|
-
children: [/*#__PURE__*/_jsx(
|
|
483
|
-
|
|
484
|
-
|
|
521
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
522
|
+
className: clsx('block-editor-global-styles-background-panel__inspector-media-replace-container', {
|
|
523
|
+
'is-open': isDropDownOpen
|
|
524
|
+
}),
|
|
525
|
+
children: shouldShowBackgroundImageControls ? /*#__PURE__*/_jsx(BackgroundControlsPanel, {
|
|
526
|
+
label: title,
|
|
527
|
+
filename: title,
|
|
528
|
+
url: getResolvedThemeFilePath(url, themeFileURIs),
|
|
529
|
+
onToggle: setIsDropDownOpen,
|
|
530
|
+
hasImageValue: hasImageValue,
|
|
531
|
+
children: /*#__PURE__*/_jsxs(VStack, {
|
|
532
|
+
spacing: 3,
|
|
533
|
+
className: "single-column",
|
|
534
|
+
children: [/*#__PURE__*/_jsx(BackgroundImageControls, {
|
|
535
|
+
onChange: onChange,
|
|
536
|
+
style: value,
|
|
537
|
+
inheritedValue: inheritedValue,
|
|
538
|
+
themeFileURIs: themeFileURIs,
|
|
539
|
+
displayInPanel: true,
|
|
540
|
+
onRemoveImage: () => {
|
|
541
|
+
setIsDropDownOpen(false);
|
|
542
|
+
resetBackground();
|
|
543
|
+
}
|
|
544
|
+
}), /*#__PURE__*/_jsx(BackgroundSizeControls, {
|
|
545
|
+
onChange: onChange,
|
|
546
|
+
panelId: panelId,
|
|
547
|
+
style: value,
|
|
548
|
+
defaultValues: defaultValues,
|
|
549
|
+
inheritedValue: inheritedValue,
|
|
550
|
+
themeFileURIs: themeFileURIs
|
|
551
|
+
})]
|
|
552
|
+
})
|
|
553
|
+
}) : /*#__PURE__*/_jsx(BackgroundImageControls, {
|
|
554
|
+
onChange: onChange,
|
|
555
|
+
style: value,
|
|
556
|
+
inheritedValue: inheritedValue,
|
|
557
|
+
themeFileURIs: themeFileURIs
|
|
558
|
+
})
|
|
559
|
+
}), /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
560
|
+
hasValue: () => hasImageValue,
|
|
561
|
+
label: __('Image'),
|
|
562
|
+
onDeselect: resetBackground,
|
|
485
563
|
isShownByDefault: defaultControls.backgroundImage,
|
|
486
|
-
style: value,
|
|
487
|
-
inheritedValue: inheritedValue,
|
|
488
|
-
themeFileURIs: themeFileURIs
|
|
489
|
-
}), shouldShowBackgroundSizeControls && /*#__PURE__*/_jsx(BackgroundSizeToolsPanelItem, {
|
|
490
|
-
onChange: onChange,
|
|
491
564
|
panelId: panelId,
|
|
492
|
-
|
|
493
|
-
style: value,
|
|
494
|
-
inheritedValue: inheritedValue,
|
|
495
|
-
defaultValues: defaultValues,
|
|
496
|
-
themeFileURIs: themeFileURIs
|
|
565
|
+
className: "block-editor-global-styles-background-panel__hidden-tools-panel-item"
|
|
497
566
|
})]
|
|
498
567
|
});
|
|
499
568
|
}
|