@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
|
@@ -210,6 +210,7 @@ export default function NavigableToolbar( {
|
|
|
210
210
|
shouldUseKeyboardFocusShortcut = true,
|
|
211
211
|
__experimentalInitialIndex: initialIndex,
|
|
212
212
|
__experimentalOnIndexChange: onIndexChange,
|
|
213
|
+
orientation = 'horizontal',
|
|
213
214
|
...props
|
|
214
215
|
} ) {
|
|
215
216
|
const toolbarRef = useRef();
|
|
@@ -230,6 +231,7 @@ export default function NavigableToolbar( {
|
|
|
230
231
|
<Toolbar
|
|
231
232
|
label={ props[ 'aria-label' ] }
|
|
232
233
|
ref={ toolbarRef }
|
|
234
|
+
orientation={ orientation }
|
|
233
235
|
{ ...props }
|
|
234
236
|
>
|
|
235
237
|
{ children }
|
|
@@ -239,7 +241,7 @@ export default function NavigableToolbar( {
|
|
|
239
241
|
|
|
240
242
|
return (
|
|
241
243
|
<NavigableMenu
|
|
242
|
-
orientation=
|
|
244
|
+
orientation={ orientation }
|
|
243
245
|
role="toolbar"
|
|
244
246
|
ref={ toolbarRef }
|
|
245
247
|
{ ...props }
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
Button,
|
|
6
|
-
CustomSelectControl,
|
|
7
6
|
Icon,
|
|
8
7
|
RangeControl,
|
|
9
8
|
__experimentalHStack as HStack,
|
|
10
9
|
__experimentalUnitControl as UnitControl,
|
|
11
10
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
12
11
|
__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
|
|
12
|
+
privateApis as componentsPrivateApis,
|
|
13
13
|
} from '@wordpress/components';
|
|
14
14
|
import { useSelect } from '@wordpress/data';
|
|
15
15
|
import { useState, useMemo } from '@wordpress/element';
|
|
@@ -31,6 +31,11 @@ import {
|
|
|
31
31
|
getPresetValueFromCustomValue,
|
|
32
32
|
isValueSpacingPreset,
|
|
33
33
|
} from '../utils';
|
|
34
|
+
import { unlock } from '../../../lock-unlock';
|
|
35
|
+
|
|
36
|
+
const { CustomSelectControlV2Legacy: CustomSelectControl } = unlock(
|
|
37
|
+
componentsPrivateApis
|
|
38
|
+
);
|
|
34
39
|
|
|
35
40
|
const CUSTOM_VALUE_SETTINGS = {
|
|
36
41
|
px: { max: 300, steps: 1 },
|
|
@@ -298,9 +303,11 @@ export default function SpacingInputControl( {
|
|
|
298
303
|
<CustomSelectControl
|
|
299
304
|
className="spacing-sizes-control__custom-select-control"
|
|
300
305
|
value={
|
|
306
|
+
// passing empty string as a fallback to continue using the
|
|
307
|
+
// component in controlled mode
|
|
301
308
|
options.find(
|
|
302
309
|
( option ) => option.key === currentValue
|
|
303
|
-
) || ''
|
|
310
|
+
) || ''
|
|
304
311
|
}
|
|
305
312
|
onChange={ ( selection ) => {
|
|
306
313
|
onChange(
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Tabbed Panel
|
|
2
|
+
|
|
3
|
+
The `TabbedPanel` component is used to create the secondary panels in the editor.
|
|
4
|
+
|
|
5
|
+
## Development guidelines
|
|
6
|
+
|
|
7
|
+
This acts as a wrapper for the `Tabs` component, but adding conventions that can be shared between all secondary panels, for example:
|
|
8
|
+
|
|
9
|
+
- A close button
|
|
10
|
+
- Tabs that fill the panel
|
|
11
|
+
- Custom scollbars
|
|
12
|
+
|
|
13
|
+
### Usage
|
|
14
|
+
|
|
15
|
+
Renders a block alignment toolbar with alignments options.
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
import { TabbedSidebar } from '@wordpress/components';
|
|
19
|
+
|
|
20
|
+
const MyTabbedSidebar = () => (
|
|
21
|
+
<TabbedSidebar
|
|
22
|
+
tabs={ [
|
|
23
|
+
{
|
|
24
|
+
name: 'slug-1',
|
|
25
|
+
title: _x( 'Title 1', 'context' ),
|
|
26
|
+
panel: <PanelContents>,
|
|
27
|
+
panelRef: useRef('an-optional-ref'),
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'slug-2',
|
|
31
|
+
title: _x( 'Title 2', 'context' ),
|
|
32
|
+
panel: <PanelContents />,
|
|
33
|
+
},
|
|
34
|
+
] }
|
|
35
|
+
onClose={ onClickCloseButton }
|
|
36
|
+
onSelect={ onSelectTab }
|
|
37
|
+
defaultTabId="slug-1"
|
|
38
|
+
ref={ tabsRef }
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Props
|
|
44
|
+
|
|
45
|
+
### `defaultTabId`
|
|
46
|
+
|
|
47
|
+
- **Type:** `String`
|
|
48
|
+
- **Default:** `undefined`
|
|
49
|
+
|
|
50
|
+
This is passed to the `Tabs` component so it can handle the tab to select by default when it component renders.
|
|
51
|
+
|
|
52
|
+
### `onClose`
|
|
53
|
+
|
|
54
|
+
- **Type:** `Function`
|
|
55
|
+
|
|
56
|
+
The function that is called when the close button is clicked.
|
|
57
|
+
|
|
58
|
+
### `onSelect`
|
|
59
|
+
|
|
60
|
+
- **Type:** `Function`
|
|
61
|
+
|
|
62
|
+
This is passed to the `Tabs` component - it will be called when a tab has been selected. It is passed the selected tab's ID as an argument.
|
|
63
|
+
|
|
64
|
+
### `selectedTab`
|
|
65
|
+
|
|
66
|
+
- **Type:** `String`
|
|
67
|
+
- **Default:** `undefined`
|
|
68
|
+
|
|
69
|
+
This is passed to the `Tabs` component - it will display this tab as selected.
|
|
70
|
+
|
|
71
|
+
### `tabs`
|
|
72
|
+
|
|
73
|
+
- **Type:** `Array`
|
|
74
|
+
- **Default:** `undefined`
|
|
75
|
+
|
|
76
|
+
An array of tabs which will be rendered as `TabList` and `TabPanel` components.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
Button,
|
|
6
|
+
privateApis as componentsPrivateApis,
|
|
7
|
+
} from '@wordpress/components';
|
|
8
|
+
import { forwardRef } from '@wordpress/element';
|
|
9
|
+
import { closeSmall } from '@wordpress/icons';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import { unlock } from '../../lock-unlock';
|
|
15
|
+
|
|
16
|
+
const { Tabs } = unlock( componentsPrivateApis );
|
|
17
|
+
|
|
18
|
+
function TabbedSidebar(
|
|
19
|
+
{ defaultTabId, onClose, onSelect, selectedTab, tabs, closeButtonLabel },
|
|
20
|
+
ref
|
|
21
|
+
) {
|
|
22
|
+
return (
|
|
23
|
+
<div className="block-editor-tabbed-sidebar">
|
|
24
|
+
<Tabs
|
|
25
|
+
selectOnMove={ false }
|
|
26
|
+
defaultTabId={ defaultTabId }
|
|
27
|
+
onSelect={ onSelect }
|
|
28
|
+
selectedTabId={ selectedTab }
|
|
29
|
+
>
|
|
30
|
+
<div className="block-editor-tabbed-sidebar__tablist-and-close-button">
|
|
31
|
+
<Button
|
|
32
|
+
className="block-editor-tabbed-sidebar__close-button"
|
|
33
|
+
icon={ closeSmall }
|
|
34
|
+
label={ closeButtonLabel }
|
|
35
|
+
onClick={ () => onClose() }
|
|
36
|
+
size="small"
|
|
37
|
+
/>
|
|
38
|
+
|
|
39
|
+
<Tabs.TabList
|
|
40
|
+
className="block-editor-tabbed-sidebar__tablist"
|
|
41
|
+
ref={ ref }
|
|
42
|
+
>
|
|
43
|
+
{ tabs.map( ( tab ) => (
|
|
44
|
+
<Tabs.Tab
|
|
45
|
+
key={ tab.name }
|
|
46
|
+
tabId={ tab.name }
|
|
47
|
+
className="block-editor-tabbed-sidebar__tab"
|
|
48
|
+
>
|
|
49
|
+
{ tab.title }
|
|
50
|
+
</Tabs.Tab>
|
|
51
|
+
) ) }
|
|
52
|
+
</Tabs.TabList>
|
|
53
|
+
</div>
|
|
54
|
+
{ tabs.map( ( tab ) => (
|
|
55
|
+
<Tabs.TabPanel
|
|
56
|
+
key={ tab.name }
|
|
57
|
+
tabId={ tab.name }
|
|
58
|
+
focusable={ false }
|
|
59
|
+
className="block-editor-tabbed-sidebar__tabpanel"
|
|
60
|
+
ref={ tab.panelRef }
|
|
61
|
+
>
|
|
62
|
+
{ tab.panel }
|
|
63
|
+
</Tabs.TabPanel>
|
|
64
|
+
) ) }
|
|
65
|
+
</Tabs>
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export default forwardRef( TabbedSidebar );
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.block-editor-tabbed-sidebar {
|
|
2
|
+
height: 100%;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
flex-grow: 1;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
|
|
8
|
+
@include break-medium() {
|
|
9
|
+
width: 350px;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.block-editor-tabbed-sidebar__tablist-and-close-button {
|
|
14
|
+
border-bottom: $border-width solid $gray-300;
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: space-between;
|
|
17
|
+
padding-right: $grid-unit-15;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
.block-editor-tabbed-sidebar__close-button {
|
|
22
|
+
background: $white;
|
|
23
|
+
/* stylelint-disable-next-line property-disallowed-list -- This should be removed when https://github.com/WordPress/gutenberg/issues/59013 is fixed. */
|
|
24
|
+
order: 1;
|
|
25
|
+
align-self: center;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.block-editor-tabbed-sidebar__tablist {
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
flex-grow: 1;
|
|
31
|
+
margin-bottom: -$border-width;
|
|
32
|
+
width: 100%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.block-editor-tabbed-sidebar__tab {
|
|
36
|
+
flex-grow: 1;
|
|
37
|
+
margin-bottom: -$border-width;
|
|
38
|
+
|
|
39
|
+
&[id$="reusable"] {
|
|
40
|
+
flex-grow: inherit;
|
|
41
|
+
// These are to align the `reusable` icon with the search icon.
|
|
42
|
+
padding-left: $grid-unit-20;
|
|
43
|
+
padding-right: $grid-unit-20;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.block-editor-tabbed-sidebar__tabpanel {
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-grow: 1;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
overflow-y: auto;
|
|
52
|
+
scrollbar-gutter: auto;
|
|
53
|
+
}
|
|
@@ -272,7 +272,7 @@ const ImageURLInputUI = ( {
|
|
|
272
272
|
icon={ linkOff }
|
|
273
273
|
label={ __( 'Disable expand on click' ) }
|
|
274
274
|
onClick={ () => {
|
|
275
|
-
onSetLightbox( false );
|
|
275
|
+
onSetLightbox?.( false );
|
|
276
276
|
} }
|
|
277
277
|
size="compact"
|
|
278
278
|
/>
|
|
@@ -302,7 +302,7 @@ const ImageURLInputUI = ( {
|
|
|
302
302
|
label={ __( 'Remove link' ) }
|
|
303
303
|
onClick={ () => {
|
|
304
304
|
onLinkRemove();
|
|
305
|
-
resetLightbox();
|
|
305
|
+
resetLightbox?.();
|
|
306
306
|
} }
|
|
307
307
|
size="compact"
|
|
308
308
|
/>
|
|
@@ -366,7 +366,7 @@ const ImageURLInputUI = ( {
|
|
|
366
366
|
LINK_DESTINATION_NONE,
|
|
367
367
|
href: '',
|
|
368
368
|
} );
|
|
369
|
-
onSetLightbox( true );
|
|
369
|
+
onSetLightbox?.( true );
|
|
370
370
|
stopEditLink();
|
|
371
371
|
} }
|
|
372
372
|
>
|
package/src/hooks/background.js
CHANGED
|
@@ -16,6 +16,10 @@ import {
|
|
|
16
16
|
useHasBackgroundPanel,
|
|
17
17
|
hasBackgroundImageValue,
|
|
18
18
|
} from '../components/global-styles/background-panel';
|
|
19
|
+
import {
|
|
20
|
+
globalStylesDataKey,
|
|
21
|
+
globalStylesLinksDataKey,
|
|
22
|
+
} from '../store/private-keys';
|
|
19
23
|
|
|
20
24
|
export const BACKGROUND_SUPPORT_KEY = 'background';
|
|
21
25
|
|
|
@@ -134,10 +138,25 @@ export function BackgroundImagePanel( {
|
|
|
134
138
|
setAttributes,
|
|
135
139
|
settings,
|
|
136
140
|
} ) {
|
|
137
|
-
const style = useSelect(
|
|
138
|
-
( select ) =>
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
const { style, inheritedValue, _links } = useSelect(
|
|
142
|
+
( select ) => {
|
|
143
|
+
const { getBlockAttributes, getSettings } =
|
|
144
|
+
select( blockEditorStore );
|
|
145
|
+
const _settings = getSettings();
|
|
146
|
+
return {
|
|
147
|
+
style: getBlockAttributes( clientId )?.style,
|
|
148
|
+
_links: _settings[ globalStylesLinksDataKey ],
|
|
149
|
+
/*
|
|
150
|
+
* @TODO 1. Pass inherited value down to all block style controls,
|
|
151
|
+
* See: packages/block-editor/src/hooks/style.js
|
|
152
|
+
* @TODO 2. Add support for block style variations,
|
|
153
|
+
* See implementation: packages/block-editor/src/hooks/block-style-variation.js
|
|
154
|
+
*/
|
|
155
|
+
inheritedValue:
|
|
156
|
+
_settings[ globalStylesDataKey ]?.blocks?.[ name ],
|
|
157
|
+
};
|
|
158
|
+
},
|
|
159
|
+
[ clientId, name ]
|
|
141
160
|
);
|
|
142
161
|
|
|
143
162
|
if (
|
|
@@ -147,11 +166,6 @@ export function BackgroundImagePanel( {
|
|
|
147
166
|
return null;
|
|
148
167
|
}
|
|
149
168
|
|
|
150
|
-
const defaultControls = getBlockSupport( name, [
|
|
151
|
-
BACKGROUND_SUPPORT_KEY,
|
|
152
|
-
'__experimentalDefaultControls',
|
|
153
|
-
] );
|
|
154
|
-
|
|
155
169
|
const onChange = ( newStyle ) => {
|
|
156
170
|
setAttributes( {
|
|
157
171
|
style: cleanEmptyObject( newStyle ),
|
|
@@ -170,13 +184,14 @@ export function BackgroundImagePanel( {
|
|
|
170
184
|
|
|
171
185
|
return (
|
|
172
186
|
<StylesBackgroundPanel
|
|
187
|
+
inheritedValue={ inheritedValue }
|
|
173
188
|
as={ BackgroundInspectorControl }
|
|
174
189
|
panelId={ clientId }
|
|
175
|
-
defaultControls={ defaultControls }
|
|
176
190
|
defaultValues={ BACKGROUND_DEFAULT_VALUES }
|
|
177
191
|
settings={ updatedSettings }
|
|
178
192
|
onChange={ onChange }
|
|
179
193
|
value={ style }
|
|
194
|
+
themeFileURIs={ _links?.[ 'wp:theme-file' ] }
|
|
180
195
|
/>
|
|
181
196
|
);
|
|
182
197
|
}
|
package/src/hooks/block-hooks.js
CHANGED
|
@@ -43,25 +43,12 @@ function BlockHooksControlPure( {
|
|
|
43
43
|
[ blockTypes, name, ignoredHookedBlocks ]
|
|
44
44
|
);
|
|
45
45
|
|
|
46
|
-
const { blockIndex, rootClientId, innerBlocksLength } = useSelect(
|
|
47
|
-
( select ) => {
|
|
48
|
-
const { getBlocks, getBlockIndex, getBlockRootClientId } =
|
|
49
|
-
select( blockEditorStore );
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
blockIndex: getBlockIndex( clientId ),
|
|
53
|
-
innerBlocksLength: getBlocks( clientId )?.length,
|
|
54
|
-
rootClientId: getBlockRootClientId( clientId ),
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
[ clientId ]
|
|
58
|
-
);
|
|
59
|
-
|
|
60
46
|
const hookedBlockClientIds = useSelect(
|
|
61
47
|
( select ) => {
|
|
62
|
-
const { getBlocks, getGlobalBlockCount } =
|
|
48
|
+
const { getBlocks, getBlockRootClientId, getGlobalBlockCount } =
|
|
63
49
|
select( blockEditorStore );
|
|
64
50
|
|
|
51
|
+
const rootClientId = getBlockRootClientId( clientId );
|
|
65
52
|
const _hookedBlockClientIds = hookedBlocksForCurrentBlock.reduce(
|
|
66
53
|
( clientIds, block ) => {
|
|
67
54
|
// If the block doesn't exist anywhere in the block tree,
|
|
@@ -127,9 +114,11 @@ function BlockHooksControlPure( {
|
|
|
127
114
|
|
|
128
115
|
return EMPTY_OBJECT;
|
|
129
116
|
},
|
|
130
|
-
[ hookedBlocksForCurrentBlock, name, clientId
|
|
117
|
+
[ hookedBlocksForCurrentBlock, name, clientId ]
|
|
131
118
|
);
|
|
132
119
|
|
|
120
|
+
const { getBlockIndex, getBlockCount, getBlockRootClientId } =
|
|
121
|
+
useSelect( blockEditorStore );
|
|
133
122
|
const { insertBlock, removeBlock } = useDispatch( blockEditorStore );
|
|
134
123
|
|
|
135
124
|
if ( ! hookedBlocksForCurrentBlock.length ) {
|
|
@@ -150,6 +139,10 @@ function BlockHooksControlPure( {
|
|
|
150
139
|
);
|
|
151
140
|
|
|
152
141
|
const insertBlockIntoDesignatedLocation = ( block, relativePosition ) => {
|
|
142
|
+
const blockIndex = getBlockIndex( clientId );
|
|
143
|
+
const innerBlocksLength = getBlockCount( clientId );
|
|
144
|
+
const rootClientId = getBlockRootClientId( clientId );
|
|
145
|
+
|
|
153
146
|
switch ( relativePosition ) {
|
|
154
147
|
case 'before':
|
|
155
148
|
case 'after':
|
|
@@ -14,8 +14,10 @@ import {
|
|
|
14
14
|
getBlockSelectors,
|
|
15
15
|
} from '../components/global-styles';
|
|
16
16
|
import { useStyleOverride } from './utils';
|
|
17
|
+
import { getValueFromObjectPath } from '../utils/object';
|
|
17
18
|
import { store as blockEditorStore } from '../store';
|
|
18
19
|
import { globalStylesDataKey } from '../store/private-keys';
|
|
20
|
+
import { unlock } from '../lock-unlock';
|
|
19
21
|
|
|
20
22
|
const VARIATION_PREFIX = 'is-style-';
|
|
21
23
|
|
|
@@ -59,6 +61,197 @@ function getVariationNameFromClass( className, registeredStyles = [] ) {
|
|
|
59
61
|
return null;
|
|
60
62
|
}
|
|
61
63
|
|
|
64
|
+
// A helper component to apply a style override using the useStyleOverride hook.
|
|
65
|
+
function OverrideStyles( { override } ) {
|
|
66
|
+
useStyleOverride( override );
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* This component is used to generate new block style variation overrides
|
|
71
|
+
* based on an incoming theme config. If a matching style is found in the config,
|
|
72
|
+
* a new override is created and returned. The overrides can be used in conjunction with
|
|
73
|
+
* useStyleOverride to apply the new styles to the editor. Its use is
|
|
74
|
+
* subject to change.
|
|
75
|
+
*
|
|
76
|
+
* @param {Object} props Props.
|
|
77
|
+
* @param {Object} props.config A global styles object, containing settings and styles.
|
|
78
|
+
* @return {JSX.Element|undefined} An array of new block variation overrides.
|
|
79
|
+
*/
|
|
80
|
+
export function __unstableBlockStyleVariationOverridesWithConfig( { config } ) {
|
|
81
|
+
const { getBlockStyles, overrides } = useSelect(
|
|
82
|
+
( select ) => ( {
|
|
83
|
+
getBlockStyles: select( blocksStore ).getBlockStyles,
|
|
84
|
+
overrides: unlock( select( blockEditorStore ) ).getStyleOverrides(),
|
|
85
|
+
} ),
|
|
86
|
+
[]
|
|
87
|
+
);
|
|
88
|
+
const { getBlockName } = useSelect( blockEditorStore );
|
|
89
|
+
|
|
90
|
+
const overridesWithConfig = useMemo( () => {
|
|
91
|
+
if ( ! overrides?.length ) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const newOverrides = [];
|
|
95
|
+
const overriddenClientIds = [];
|
|
96
|
+
for ( const [ , override ] of overrides ) {
|
|
97
|
+
if (
|
|
98
|
+
override?.variation &&
|
|
99
|
+
override?.clientId &&
|
|
100
|
+
/*
|
|
101
|
+
* Because this component overwrites existing style overrides,
|
|
102
|
+
* filter out any overrides that are already present in the store.
|
|
103
|
+
*/
|
|
104
|
+
! overriddenClientIds.includes( override.clientId )
|
|
105
|
+
) {
|
|
106
|
+
const blockName = getBlockName( override.clientId );
|
|
107
|
+
const configStyles =
|
|
108
|
+
config?.styles?.blocks?.[ blockName ]?.variations?.[
|
|
109
|
+
override.variation
|
|
110
|
+
];
|
|
111
|
+
if ( configStyles ) {
|
|
112
|
+
const variationConfig = {
|
|
113
|
+
settings: config?.settings,
|
|
114
|
+
// The variation style data is all that is needed to generate
|
|
115
|
+
// the styles for the current application to a block. The variation
|
|
116
|
+
// name is updated to match the instance specific class name.
|
|
117
|
+
styles: {
|
|
118
|
+
blocks: {
|
|
119
|
+
[ blockName ]: {
|
|
120
|
+
variations: {
|
|
121
|
+
[ `${ override.variation }-${ override.clientId }` ]:
|
|
122
|
+
configStyles,
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
const blockSelectors = getBlockSelectors(
|
|
129
|
+
getBlockTypes(),
|
|
130
|
+
getBlockStyles,
|
|
131
|
+
override.clientId
|
|
132
|
+
);
|
|
133
|
+
const hasBlockGapSupport = false;
|
|
134
|
+
const hasFallbackGapSupport = true;
|
|
135
|
+
const disableLayoutStyles = true;
|
|
136
|
+
const disableRootPadding = true;
|
|
137
|
+
const variationStyles = toStyles(
|
|
138
|
+
variationConfig,
|
|
139
|
+
blockSelectors,
|
|
140
|
+
hasBlockGapSupport,
|
|
141
|
+
hasFallbackGapSupport,
|
|
142
|
+
disableLayoutStyles,
|
|
143
|
+
disableRootPadding,
|
|
144
|
+
{
|
|
145
|
+
blockGap: false,
|
|
146
|
+
blockStyles: true,
|
|
147
|
+
layoutStyles: false,
|
|
148
|
+
marginReset: false,
|
|
149
|
+
presets: false,
|
|
150
|
+
rootPadding: false,
|
|
151
|
+
variationStyles: true,
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
newOverrides.push( {
|
|
155
|
+
id: `${ override.variation }-${ override.clientId }`,
|
|
156
|
+
css: variationStyles,
|
|
157
|
+
__unstableType: 'variation',
|
|
158
|
+
variation: override.variation,
|
|
159
|
+
// The clientId will be stored with the override and used to ensure
|
|
160
|
+
// the order of overrides matches the order of blocks so that the
|
|
161
|
+
// correct CSS cascade is maintained.
|
|
162
|
+
clientId: override.clientId,
|
|
163
|
+
} );
|
|
164
|
+
overriddenClientIds.push( override.clientId );
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return newOverrides;
|
|
169
|
+
}, [ config, overrides, getBlockStyles, getBlockName ] );
|
|
170
|
+
|
|
171
|
+
if ( ! overridesWithConfig || ! overridesWithConfig.length ) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return (
|
|
176
|
+
<>
|
|
177
|
+
{ overridesWithConfig.map( ( override ) => (
|
|
178
|
+
<OverrideStyles key={ override.id } override={ override } />
|
|
179
|
+
) ) }
|
|
180
|
+
</>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Retrieves any variation styles data and resolves any referenced values.
|
|
186
|
+
*
|
|
187
|
+
* @param {Object} globalStyles A complete global styles object, containing settings and styles.
|
|
188
|
+
* @param {string} name The name of the desired block type.
|
|
189
|
+
* @param {variation} variation The of the block style variation to retrieve data for.
|
|
190
|
+
*
|
|
191
|
+
* @return {Object|undefined} The global styles data for the specified variation.
|
|
192
|
+
*/
|
|
193
|
+
export function getVariationStylesWithRefValues(
|
|
194
|
+
globalStyles,
|
|
195
|
+
name,
|
|
196
|
+
variation
|
|
197
|
+
) {
|
|
198
|
+
if ( ! globalStyles?.styles?.blocks?.[ name ]?.variations?.[ variation ] ) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Helper to recursively look for `ref` values to resolve.
|
|
203
|
+
const replaceRefs = ( variationStyles ) => {
|
|
204
|
+
Object.keys( variationStyles ).forEach( ( key ) => {
|
|
205
|
+
const value = variationStyles[ key ];
|
|
206
|
+
|
|
207
|
+
// Only process objects.
|
|
208
|
+
if ( typeof value === 'object' && value !== null ) {
|
|
209
|
+
// Process `ref` value if present.
|
|
210
|
+
if ( value.ref !== undefined ) {
|
|
211
|
+
if (
|
|
212
|
+
typeof value.ref !== 'string' ||
|
|
213
|
+
value.ref.trim() === ''
|
|
214
|
+
) {
|
|
215
|
+
// Remove invalid ref.
|
|
216
|
+
delete variationStyles[ key ];
|
|
217
|
+
} else {
|
|
218
|
+
// Resolve `ref` value.
|
|
219
|
+
const refValue = getValueFromObjectPath(
|
|
220
|
+
globalStyles,
|
|
221
|
+
value.ref
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
if ( refValue ) {
|
|
225
|
+
variationStyles[ key ] = refValue;
|
|
226
|
+
} else {
|
|
227
|
+
delete variationStyles[ key ];
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
} else {
|
|
231
|
+
// Recursively resolve `ref` values in nested objects.
|
|
232
|
+
replaceRefs( value );
|
|
233
|
+
|
|
234
|
+
// After recursion, if value is empty due to explicitly
|
|
235
|
+
// `undefined` ref value, remove it.
|
|
236
|
+
if ( Object.keys( value ).length === 0 ) {
|
|
237
|
+
delete variationStyles[ key ];
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
} );
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
// Deep clone variation node to avoid mutating it within global styles and losing refs.
|
|
245
|
+
const styles = JSON.parse(
|
|
246
|
+
JSON.stringify(
|
|
247
|
+
globalStyles.styles.blocks[ name ].variations[ variation ]
|
|
248
|
+
)
|
|
249
|
+
);
|
|
250
|
+
replaceRefs( styles );
|
|
251
|
+
|
|
252
|
+
return styles;
|
|
253
|
+
}
|
|
254
|
+
|
|
62
255
|
function useBlockStyleVariation( name, variation, clientId ) {
|
|
63
256
|
// Prefer global styles data in GlobalStylesContext, which are available
|
|
64
257
|
// if in the site editor. Otherwise fall back to whatever is in the
|
|
@@ -73,9 +266,14 @@ function useBlockStyleVariation( name, variation, clientId ) {
|
|
|
73
266
|
}, [] );
|
|
74
267
|
|
|
75
268
|
return useMemo( () => {
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
269
|
+
const variationStyles = getVariationStylesWithRefValues(
|
|
270
|
+
{
|
|
271
|
+
settings: mergedConfig?.settings ?? globalSettings,
|
|
272
|
+
styles: mergedConfig?.styles ?? globalStyles,
|
|
273
|
+
},
|
|
274
|
+
name,
|
|
275
|
+
variation
|
|
276
|
+
);
|
|
79
277
|
|
|
80
278
|
return {
|
|
81
279
|
settings: mergedConfig?.settings ?? globalSettings,
|
|
@@ -157,6 +355,7 @@ function useBlockProps( { name, className, clientId } ) {
|
|
|
157
355
|
id: `variation-${ clientId }`,
|
|
158
356
|
css: variationStyles,
|
|
159
357
|
__unstableType: 'variation',
|
|
358
|
+
variation,
|
|
160
359
|
// The clientId will be stored with the override and used to ensure
|
|
161
360
|
// the order of overrides matches the order of blocks so that the
|
|
162
361
|
// correct CSS cascade is maintained.
|