@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
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
9
9
|
} from '@wordpress/components';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
|
-
import { useCallback, useMemo } from '@wordpress/element';
|
|
11
|
+
import { useCallback, useMemo, useEffect } from '@wordpress/element';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Internal dependencies
|
|
@@ -21,8 +21,12 @@ import TextAlignmentControl from '../text-alignment-control';
|
|
|
21
21
|
import TextTransformControl from '../text-transform-control';
|
|
22
22
|
import TextDecorationControl from '../text-decoration-control';
|
|
23
23
|
import WritingModeControl from '../writing-mode-control';
|
|
24
|
-
import { getValueFromVariable,
|
|
24
|
+
import { getValueFromVariable, useToolsPanelDropdownMenuProps } from './utils';
|
|
25
25
|
import { setImmutably } from '../../utils/object';
|
|
26
|
+
import {
|
|
27
|
+
getMergedFontFamiliesAndFontFamilyFaces,
|
|
28
|
+
findNearestStyleAndWeight,
|
|
29
|
+
} from './typography-utils';
|
|
26
30
|
|
|
27
31
|
const MIN_TEXT_COLUMNS = 1;
|
|
28
32
|
const MAX_TEXT_COLUMNS = 6;
|
|
@@ -135,6 +139,7 @@ function TypographyToolsPanel( {
|
|
|
135
139
|
panelId,
|
|
136
140
|
children,
|
|
137
141
|
} ) {
|
|
142
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
138
143
|
const resetAll = () => {
|
|
139
144
|
const updatedValue = resetAllFilter( value );
|
|
140
145
|
onChange( updatedValue );
|
|
@@ -145,7 +150,7 @@ function TypographyToolsPanel( {
|
|
|
145
150
|
label={ __( 'Typography' ) }
|
|
146
151
|
resetAll={ resetAll }
|
|
147
152
|
panelId={ panelId }
|
|
148
|
-
dropdownMenuProps={
|
|
153
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
149
154
|
>
|
|
150
155
|
{ children }
|
|
151
156
|
</ToolsPanel>
|
|
@@ -179,15 +184,13 @@ export default function TypographyPanel( {
|
|
|
179
184
|
|
|
180
185
|
// Font Family
|
|
181
186
|
const hasFontFamilyEnabled = useHasFontFamilyControl( settings );
|
|
182
|
-
const fontFamilies = settings?.typography?.fontFamilies;
|
|
183
|
-
const mergedFontFamilies = useMemo( () => {
|
|
184
|
-
return [ 'default', 'theme', 'custom' ].flatMap(
|
|
185
|
-
( key ) => fontFamilies?.[ key ] ?? []
|
|
186
|
-
);
|
|
187
|
-
}, [ fontFamilies ] );
|
|
188
187
|
const fontFamily = decodeValue( inheritedValue?.typography?.fontFamily );
|
|
188
|
+
const { fontFamilies, fontFamilyFaces } = useMemo( () => {
|
|
189
|
+
return getMergedFontFamiliesAndFontFamilyFaces( settings, fontFamily );
|
|
190
|
+
}, [ settings, fontFamily ] );
|
|
191
|
+
|
|
189
192
|
const setFontFamily = ( newValue ) => {
|
|
190
|
-
const slug =
|
|
193
|
+
const slug = fontFamilies?.find(
|
|
191
194
|
( { fontFamily: f } ) => f === newValue
|
|
192
195
|
)?.slug;
|
|
193
196
|
onChange(
|
|
@@ -232,24 +235,50 @@ export default function TypographyPanel( {
|
|
|
232
235
|
const hasFontWeights = settings?.typography?.fontWeight;
|
|
233
236
|
const fontStyle = decodeValue( inheritedValue?.typography?.fontStyle );
|
|
234
237
|
const fontWeight = decodeValue( inheritedValue?.typography?.fontWeight );
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
238
|
+
const { nearestFontStyle, nearestFontWeight } = findNearestStyleAndWeight(
|
|
239
|
+
fontFamilyFaces,
|
|
240
|
+
fontStyle,
|
|
241
|
+
fontWeight
|
|
242
|
+
);
|
|
243
|
+
const setFontAppearance = useCallback(
|
|
244
|
+
( { fontStyle: newFontStyle, fontWeight: newFontWeight } ) => {
|
|
245
|
+
// Only update the font style and weight if they have changed.
|
|
246
|
+
if ( newFontStyle !== fontStyle || newFontWeight !== fontWeight ) {
|
|
247
|
+
onChange( {
|
|
248
|
+
...value,
|
|
249
|
+
typography: {
|
|
250
|
+
...value?.typography,
|
|
251
|
+
fontStyle: newFontStyle || undefined,
|
|
252
|
+
fontWeight: newFontWeight || undefined,
|
|
253
|
+
},
|
|
254
|
+
} );
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
[ fontStyle, fontWeight, onChange, value ]
|
|
258
|
+
);
|
|
248
259
|
const hasFontAppearance = () =>
|
|
249
260
|
!! value?.typography?.fontStyle || !! value?.typography?.fontWeight;
|
|
250
|
-
const resetFontAppearance = () => {
|
|
261
|
+
const resetFontAppearance = useCallback( () => {
|
|
251
262
|
setFontAppearance( {} );
|
|
252
|
-
};
|
|
263
|
+
}, [ setFontAppearance ] );
|
|
264
|
+
|
|
265
|
+
// Check if previous font style and weight values are available in the new font family.
|
|
266
|
+
useEffect( () => {
|
|
267
|
+
if ( nearestFontStyle && nearestFontWeight ) {
|
|
268
|
+
setFontAppearance( {
|
|
269
|
+
fontStyle: nearestFontStyle,
|
|
270
|
+
fontWeight: nearestFontWeight,
|
|
271
|
+
} );
|
|
272
|
+
} else {
|
|
273
|
+
// Reset font appearance if there are no available styles or weights.
|
|
274
|
+
resetFontAppearance();
|
|
275
|
+
}
|
|
276
|
+
}, [
|
|
277
|
+
nearestFontStyle,
|
|
278
|
+
nearestFontWeight,
|
|
279
|
+
resetFontAppearance,
|
|
280
|
+
setFontAppearance,
|
|
281
|
+
] );
|
|
253
282
|
|
|
254
283
|
// Line Height
|
|
255
284
|
const hasLineHeightEnabled = useHasLineHeightControl( settings );
|
|
@@ -386,7 +415,7 @@ export default function TypographyPanel( {
|
|
|
386
415
|
panelId={ panelId }
|
|
387
416
|
>
|
|
388
417
|
<FontFamilyControl
|
|
389
|
-
fontFamilies={
|
|
418
|
+
fontFamilies={ fontFamilies }
|
|
390
419
|
value={ fontFamily }
|
|
391
420
|
onChange={ setFontFamily }
|
|
392
421
|
size="__unstable-large"
|
|
@@ -430,8 +459,8 @@ export default function TypographyPanel( {
|
|
|
430
459
|
onChange={ setFontAppearance }
|
|
431
460
|
hasFontStyles={ hasFontStyles }
|
|
432
461
|
hasFontWeights={ hasFontWeights }
|
|
462
|
+
fontFamilyFaces={ fontFamilyFaces }
|
|
433
463
|
size="__unstable-large"
|
|
434
|
-
__nextHasNoMarginBottom
|
|
435
464
|
/>
|
|
436
465
|
</ToolsPanelItem>
|
|
437
466
|
) }
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
getComputedFluidTypographyValue,
|
|
12
12
|
getTypographyValueAndUnit,
|
|
13
13
|
} from '../font-sizes/fluid-utils';
|
|
14
|
+
import { getFontStylesAndWeights } from '../../utils/get-font-styles-and-weights';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* @typedef {Object} FluidPreset
|
|
@@ -122,3 +123,161 @@ export function getFluidTypographyOptionsFromSettings( settings ) {
|
|
|
122
123
|
fluid: typographySettings?.fluid,
|
|
123
124
|
};
|
|
124
125
|
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Returns an object of merged font families and the font faces from the selected font family
|
|
129
|
+
* based on the theme.json settings object and the currently selected font family.
|
|
130
|
+
*
|
|
131
|
+
* @param {Object} settings Theme.json settings.
|
|
132
|
+
* @param {string} selectedFontFamily Decoded font family string.
|
|
133
|
+
* @return {Object} Merged font families and font faces from the selected font family.
|
|
134
|
+
*/
|
|
135
|
+
export function getMergedFontFamiliesAndFontFamilyFaces(
|
|
136
|
+
settings,
|
|
137
|
+
selectedFontFamily
|
|
138
|
+
) {
|
|
139
|
+
const fontFamiliesFromSettings = settings?.typography?.fontFamilies;
|
|
140
|
+
|
|
141
|
+
const fontFamilies = [ 'default', 'theme', 'custom' ].flatMap(
|
|
142
|
+
( key ) => fontFamiliesFromSettings?.[ key ] ?? []
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
const fontFamilyFaces =
|
|
146
|
+
fontFamilies.find(
|
|
147
|
+
( family ) => family.fontFamily === selectedFontFamily
|
|
148
|
+
)?.fontFace ?? [];
|
|
149
|
+
|
|
150
|
+
return { fontFamilies, fontFamilyFaces };
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Returns the nearest font weight value from the available font weight list based on the new font weight.
|
|
155
|
+
* The nearest font weight is the one with the smallest difference from the new font weight.
|
|
156
|
+
*
|
|
157
|
+
* @param {Array} availableFontWeights Array of available font weights.
|
|
158
|
+
* @param {string} newFontWeightValue New font weight value.
|
|
159
|
+
* @return {string} Nearest font weight.
|
|
160
|
+
*/
|
|
161
|
+
export function findNearestFontWeight(
|
|
162
|
+
availableFontWeights,
|
|
163
|
+
newFontWeightValue
|
|
164
|
+
) {
|
|
165
|
+
if ( ! newFontWeightValue || typeof newFontWeightValue !== 'string' ) {
|
|
166
|
+
return '';
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if ( ! availableFontWeights || availableFontWeights.length === 0 ) {
|
|
170
|
+
return newFontWeightValue;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const nearestFontWeight = availableFontWeights?.reduce(
|
|
174
|
+
( nearest, { value: fw } ) => {
|
|
175
|
+
const currentDiff = Math.abs(
|
|
176
|
+
parseInt( fw ) - parseInt( newFontWeightValue )
|
|
177
|
+
);
|
|
178
|
+
const nearestDiff = Math.abs(
|
|
179
|
+
parseInt( nearest ) - parseInt( newFontWeightValue )
|
|
180
|
+
);
|
|
181
|
+
return currentDiff < nearestDiff ? fw : nearest;
|
|
182
|
+
},
|
|
183
|
+
availableFontWeights[ 0 ]?.value
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
return nearestFontWeight;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Returns the nearest font style based on the new font style.
|
|
191
|
+
* Defaults to an empty string if the new font style is not valid or available.
|
|
192
|
+
*
|
|
193
|
+
* @param {Array} availableFontStyles Array of available font weights.
|
|
194
|
+
* @param {string} newFontStyleValue New font style value.
|
|
195
|
+
* @return {string} Nearest font style or an empty string.
|
|
196
|
+
*/
|
|
197
|
+
export function findNearestFontStyle( availableFontStyles, newFontStyleValue ) {
|
|
198
|
+
if ( typeof newFontStyleValue !== 'string' || ! newFontStyleValue ) {
|
|
199
|
+
return '';
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const validStyles = [ 'normal', 'italic', 'oblique' ];
|
|
203
|
+
if ( ! validStyles.includes( newFontStyleValue ) ) {
|
|
204
|
+
return '';
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (
|
|
208
|
+
! availableFontStyles ||
|
|
209
|
+
availableFontStyles.length === 0 ||
|
|
210
|
+
availableFontStyles.find(
|
|
211
|
+
( style ) => style.value === newFontStyleValue
|
|
212
|
+
)
|
|
213
|
+
) {
|
|
214
|
+
return newFontStyleValue;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (
|
|
218
|
+
newFontStyleValue === 'oblique' &&
|
|
219
|
+
! availableFontStyles.find( ( style ) => style.value === 'oblique' )
|
|
220
|
+
) {
|
|
221
|
+
return 'italic';
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return '';
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Returns the nearest font style and weight based on the available font family faces and the new font style and weight.
|
|
229
|
+
*
|
|
230
|
+
* @param {Array} fontFamilyFaces Array of available font family faces.
|
|
231
|
+
* @param {string} fontStyle New font style. Defaults to previous value.
|
|
232
|
+
* @param {string} fontWeight New font weight. Defaults to previous value.
|
|
233
|
+
* @return {Object} Nearest font style and font weight.
|
|
234
|
+
*/
|
|
235
|
+
export function findNearestStyleAndWeight(
|
|
236
|
+
fontFamilyFaces,
|
|
237
|
+
fontStyle,
|
|
238
|
+
fontWeight
|
|
239
|
+
) {
|
|
240
|
+
let nearestFontStyle = fontStyle;
|
|
241
|
+
let nearestFontWeight = fontWeight;
|
|
242
|
+
|
|
243
|
+
const { fontStyles, fontWeights, combinedStyleAndWeightOptions } =
|
|
244
|
+
getFontStylesAndWeights( fontFamilyFaces );
|
|
245
|
+
|
|
246
|
+
// Check if the new font style and weight are available in the font family faces.
|
|
247
|
+
const hasFontStyle = fontStyles?.some(
|
|
248
|
+
( { value: fs } ) => fs === fontStyle
|
|
249
|
+
);
|
|
250
|
+
const hasFontWeight = fontWeights?.some(
|
|
251
|
+
( { value: fw } ) => fw === fontWeight
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
if ( ! hasFontStyle ) {
|
|
255
|
+
/*
|
|
256
|
+
* Default to italic if oblique is not available.
|
|
257
|
+
* Or find the nearest font style based on the nearest font weight.
|
|
258
|
+
*/
|
|
259
|
+
nearestFontStyle = fontStyle
|
|
260
|
+
? findNearestFontStyle( fontStyles, fontStyle )
|
|
261
|
+
: combinedStyleAndWeightOptions?.find(
|
|
262
|
+
( option ) =>
|
|
263
|
+
option.style.fontWeight ===
|
|
264
|
+
findNearestFontWeight( fontWeights, fontWeight )
|
|
265
|
+
)?.style?.fontStyle;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if ( ! hasFontWeight ) {
|
|
269
|
+
/*
|
|
270
|
+
* Find the nearest font weight based on available weights.
|
|
271
|
+
* Or find the nearest font weight based on the nearest font style.
|
|
272
|
+
*/
|
|
273
|
+
nearestFontWeight = fontWeight
|
|
274
|
+
? findNearestFontWeight( fontWeights, fontWeight )
|
|
275
|
+
: combinedStyleAndWeightOptions?.find(
|
|
276
|
+
( option ) =>
|
|
277
|
+
option.style.fontStyle ===
|
|
278
|
+
( nearestFontStyle || fontStyle )
|
|
279
|
+
)?.style?.fontWeight;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return { nearestFontStyle, nearestFontWeight };
|
|
283
|
+
}
|
|
@@ -31,12 +31,19 @@ import { GlobalStylesContext } from './context';
|
|
|
31
31
|
import { useGlobalSetting } from './hooks';
|
|
32
32
|
import { getDuotoneFilter } from '../duotone/utils';
|
|
33
33
|
import { getGapCSSValue } from '../../hooks/gap';
|
|
34
|
+
import { setBackgroundStyleDefaults } from '../../hooks/background';
|
|
34
35
|
import { store as blockEditorStore } from '../../store';
|
|
35
36
|
import { LAYOUT_DEFINITIONS } from '../../layouts/definitions';
|
|
36
37
|
import { getValueFromObjectPath, setImmutably } from '../../utils/object';
|
|
37
38
|
import { unlock } from '../../lock-unlock';
|
|
38
39
|
import { setThemeFileUris } from './theme-file-uri-utils';
|
|
39
40
|
|
|
41
|
+
// Elements that rely on class names in their selectors.
|
|
42
|
+
const ELEMENT_CLASS_NAMES = {
|
|
43
|
+
button: 'wp-element-button',
|
|
44
|
+
caption: 'wp-element-caption',
|
|
45
|
+
};
|
|
46
|
+
|
|
40
47
|
// List of block support features that can have their related styles
|
|
41
48
|
// generated under their own feature level selector rather than the block's.
|
|
42
49
|
const BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = {
|
|
@@ -387,6 +394,20 @@ export function getStylesDeclarations(
|
|
|
387
394
|
[]
|
|
388
395
|
);
|
|
389
396
|
|
|
397
|
+
/*
|
|
398
|
+
* Set background defaults.
|
|
399
|
+
* Applies to all background styles except the top-level site background.
|
|
400
|
+
*/
|
|
401
|
+
if ( ! isRoot && !! blockStyles.background ) {
|
|
402
|
+
blockStyles = {
|
|
403
|
+
...blockStyles,
|
|
404
|
+
background: {
|
|
405
|
+
...blockStyles.background,
|
|
406
|
+
...setBackgroundStyleDefaults( blockStyles.background ),
|
|
407
|
+
},
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
|
|
390
411
|
// The goal is to move everything to server side generated engine styles
|
|
391
412
|
// This is temporary as we absorb more and more styles into the engine.
|
|
392
413
|
const extraRules = getCSSRules( blockStyles );
|
|
@@ -628,6 +649,9 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
628
649
|
nodes.push( {
|
|
629
650
|
styles,
|
|
630
651
|
selector: ROOT_BLOCK_SELECTOR,
|
|
652
|
+
// Root selector (body) styles should not be wrapped in `:root where()` to keep
|
|
653
|
+
// specificity at (0,0,1) and maintain backwards compatibility.
|
|
654
|
+
skipSelectorWrapper: true,
|
|
631
655
|
} );
|
|
632
656
|
}
|
|
633
657
|
|
|
@@ -636,6 +660,9 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
636
660
|
nodes.push( {
|
|
637
661
|
styles: tree.styles?.elements?.[ name ],
|
|
638
662
|
selector,
|
|
663
|
+
// Top level elements that don't use a class name should not receive the
|
|
664
|
+
// `:root :where()` wrapper to maintain backwards compatibility.
|
|
665
|
+
skipSelectorWrapper: ! ELEMENT_CLASS_NAMES[ name ],
|
|
639
666
|
} );
|
|
640
667
|
}
|
|
641
668
|
} );
|
|
@@ -656,7 +683,7 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
656
683
|
}
|
|
657
684
|
const variationSelector =
|
|
658
685
|
blockSelectors[ blockName ]
|
|
659
|
-
|
|
686
|
+
?.styleVariationSelectors?.[ variationName ];
|
|
660
687
|
|
|
661
688
|
// Process the variation's inner element styles.
|
|
662
689
|
// This comes before the inner block styles so the
|
|
@@ -685,18 +712,18 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
685
712
|
const variationBlockSelector = scopeSelector(
|
|
686
713
|
variationSelector,
|
|
687
714
|
blockSelectors[ variationBlockName ]
|
|
688
|
-
|
|
715
|
+
?.selector
|
|
689
716
|
);
|
|
690
717
|
const variationDuotoneSelector = scopeSelector(
|
|
691
718
|
variationSelector,
|
|
692
719
|
blockSelectors[ variationBlockName ]
|
|
693
|
-
|
|
720
|
+
?.duotoneSelector
|
|
694
721
|
);
|
|
695
722
|
const variationFeatureSelectors =
|
|
696
723
|
scopeFeatureSelectors(
|
|
697
724
|
variationSelector,
|
|
698
725
|
blockSelectors[ variationBlockName ]
|
|
699
|
-
|
|
726
|
+
?.featureSelectors
|
|
700
727
|
);
|
|
701
728
|
|
|
702
729
|
const variationBlockStyleNodes =
|
|
@@ -713,10 +740,10 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
713
740
|
featureSelectors: variationFeatureSelectors,
|
|
714
741
|
fallbackGapValue:
|
|
715
742
|
blockSelectors[ variationBlockName ]
|
|
716
|
-
|
|
743
|
+
?.fallbackGapValue,
|
|
717
744
|
hasLayoutSupport:
|
|
718
745
|
blockSelectors[ variationBlockName ]
|
|
719
|
-
|
|
746
|
+
?.hasLayoutSupport,
|
|
720
747
|
styles: variationBlockStyleNodes,
|
|
721
748
|
} );
|
|
722
749
|
|
|
@@ -924,8 +951,8 @@ export const toStyles = (
|
|
|
924
951
|
ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }
|
|
925
952
|
.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
|
|
926
953
|
.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }
|
|
927
|
-
.has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull
|
|
928
|
-
.has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull
|
|
954
|
+
.has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) { padding-right: 0; padding-left: 0; }
|
|
955
|
+
.has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) > .alignfull { margin-left: 0; margin-right: 0;
|
|
929
956
|
`;
|
|
930
957
|
}
|
|
931
958
|
|
|
@@ -942,6 +969,7 @@ export const toStyles = (
|
|
|
942
969
|
hasLayoutSupport,
|
|
943
970
|
featureSelectors,
|
|
944
971
|
styleVariationSelectors,
|
|
972
|
+
skipSelectorWrapper,
|
|
945
973
|
} ) => {
|
|
946
974
|
// Process styles for block support features with custom feature level
|
|
947
975
|
// CSS selectors set.
|
|
@@ -1000,7 +1028,10 @@ export const toStyles = (
|
|
|
1000
1028
|
disableRootPadding
|
|
1001
1029
|
);
|
|
1002
1030
|
if ( styleDeclarations?.length ) {
|
|
1003
|
-
|
|
1031
|
+
const generalSelector = skipSelectorWrapper
|
|
1032
|
+
? selector
|
|
1033
|
+
: `:root :where(${ selector })`;
|
|
1034
|
+
ruleset += `${ generalSelector }{${ styleDeclarations.join(
|
|
1004
1035
|
';'
|
|
1005
1036
|
) };}`;
|
|
1006
1037
|
}
|
|
@@ -1094,7 +1125,11 @@ export const toStyles = (
|
|
|
1094
1125
|
.map( ( sel ) => sel + pseudoKey )
|
|
1095
1126
|
.join( ',' );
|
|
1096
1127
|
|
|
1097
|
-
|
|
1128
|
+
// As pseudo classes such as :hover, :focus etc. have class-level
|
|
1129
|
+
// specificity, they must use the `:root :where()` wrapper. This.
|
|
1130
|
+
// caps the specificity at `0-1-0` to allow proper nesting of variations
|
|
1131
|
+
// and block type element styles.
|
|
1132
|
+
const pseudoRule = `:root :where(${ _selector }){${ pseudoDeclarations.join(
|
|
1098
1133
|
';'
|
|
1099
1134
|
) };}`;
|
|
1100
1135
|
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import fastDeepEqual from 'fast-deep-equal/es6';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
10
|
+
|
|
6
11
|
/**
|
|
7
12
|
* Internal dependencies
|
|
8
13
|
*/
|
|
@@ -136,12 +141,18 @@ export const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {
|
|
|
136
141
|
'typography.fontFamily': 'fontFamily',
|
|
137
142
|
};
|
|
138
143
|
|
|
139
|
-
export
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
export function useToolsPanelDropdownMenuProps() {
|
|
145
|
+
const isMobile = useViewportMatch( 'medium', '<' );
|
|
146
|
+
return ! isMobile
|
|
147
|
+
? {
|
|
148
|
+
popoverProps: {
|
|
149
|
+
placement: 'left-start',
|
|
150
|
+
// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
|
|
151
|
+
offset: 259,
|
|
152
|
+
},
|
|
153
|
+
}
|
|
154
|
+
: {};
|
|
155
|
+
}
|
|
145
156
|
|
|
146
157
|
function findInPresetsBy(
|
|
147
158
|
features,
|