@wordpress/block-editor 13.4.0 → 14.1.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 +13 -0
- package/README.md +20 -15
- package/build/autocompleters/block.js +1 -1
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/block-breadcrumb/index.js +3 -1
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-draggable/index.js +2 -2
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +2 -2
- 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 +24 -32
- package/build/components/block-list/use-block-props/use-block-refs.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +11 -4
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-mover/index.js +1 -2
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-popover/cover.js +1 -1
- package/build/components/block-popover/cover.js.map +1 -1
- package/build/components/block-popover/inbetween.js +2 -2
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +2 -2
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-settings-menu/block-mode-toggle.js +28 -34
- package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +1 -2
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +1 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +14 -3
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +2 -1
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +22 -19
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-toolbar.js +0 -1
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build/components/border-radius-control/index.js +1 -0
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/child-layout-control/index.js +3 -1
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/index.js +1 -1
- package/build/components/convert-to-group-buttons/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +2 -0
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/dimensions-tool/scale-tool.js +1 -0
- package/build/components/dimensions-tool/scale-tool.js.map +1 -1
- package/build/components/font-appearance-control/index.js +3 -0
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/font-family/index.js +15 -0
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +153 -77
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +3 -1
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build/components/global-styles/hooks.js +0 -7
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +1 -0
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/index.js +0 -6
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +0 -1
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +59 -40
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +80 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/grid/grid-item-movers.js +30 -26
- package/build/components/grid/grid-item-movers.js.map +1 -1
- package/build/components/grid/grid-item-resizer.js +14 -15
- package/build/components/grid/grid-item-resizer.js.map +1 -1
- package/build/components/grid/grid-visualizer.js +21 -6
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/grid/use-grid-layout-sync.js +56 -20
- package/build/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build/components/height-control/index.js +1 -0
- package/build/components/height-control/index.js.map +1 -1
- package/build/components/iframe/index.js +2 -4
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/zoom-dropdown.js +11 -7
- package/build/components/image-editor/zoom-dropdown.js.map +1 -1
- package/build/components/inner-blocks/button-block-appender.js +8 -8
- package/build/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build/components/inner-blocks/default-block-appender.js +7 -25
- package/build/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build/components/inner-blocks/index.js +9 -11
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/category-tabs/index.js +29 -2
- package/build/components/inserter/category-tabs/index.js.map +1 -1
- package/build/components/inserter/library.js +4 -2
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js +32 -14
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +4 -0
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/line-height-control/index.js +3 -15
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/search-input.js +0 -1
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/media-placeholder/index.js +9 -4
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +3 -1
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-upload/index.native.js +4 -1
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +12 -12
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/resolution-tool/index.js +1 -0
- package/build/components/resolution-tool/index.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +4 -2
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +8 -8
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/text-alignment-control/index.js +13 -8
- package/build/components/text-alignment-control/index.js.map +1 -1
- package/build/components/text-decoration-control/index.js +13 -8
- package/build/components/text-decoration-control/index.js.map +1 -1
- package/build/components/text-transform-control/index.js +13 -8
- package/build/components/text-transform-control/index.js.map +1 -1
- package/build/components/url-input/button.js +0 -1
- package/build/components/url-input/button.js.map +1 -1
- package/build/components/url-input/index.js +1 -11
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +2 -0
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/url-popover/link-editor.js +0 -1
- package/build/components/url-popover/link-editor.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +42 -4
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +3 -6
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +1 -3
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/use-settings/index.js +2 -1
- package/build/components/use-settings/index.js.map +1 -1
- package/build/components/writing-mode-control/index.js +13 -8
- package/build/components/writing-mode-control/index.js.map +1 -1
- package/build/hooks/background.js +19 -23
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-bindings.js +209 -39
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/block-hooks.js +1 -0
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-style-variation.js +2 -2
- package/build/hooks/block-style-variation.js.map +1 -1
- package/build/hooks/contrast-checker.js +6 -6
- package/build/hooks/contrast-checker.js.map +1 -1
- package/build/hooks/duotone.js +3 -3
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +7 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/line-height.js +0 -1
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/spacing-visualizer.js +1 -1
- package/build/hooks/spacing-visualizer.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +4 -0
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/use-zoom-out.js +1 -1
- package/build/hooks/use-zoom-out.js.map +1 -1
- package/build/hooks/utils.js +20 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/index.js +7 -0
- package/build/index.js.map +1 -1
- package/build/layouts/constrained.js +1 -0
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/flex.js +2 -0
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/grid.js +3 -0
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +3 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +9 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/private-selectors.js +30 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +10 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +4 -4
- package/build/store/selectors.js.map +1 -1
- package/build/utils/block-bindings.js +112 -0
- package/build/utils/block-bindings.js.map +1 -0
- package/build/utils/get-editor-region.js +1 -1
- package/build/utils/get-editor-region.js.map +1 -1
- package/build/utils/get-px-from-css-unit.js +1 -1
- package/build/utils/get-px-from-css-unit.js.map +1 -1
- package/build-module/autocompleters/block.js +1 -1
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +4 -2
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-draggable/index.js +3 -3
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +2 -2
- 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 +24 -34
- package/build-module/components/block-list/use-block-props/use-block-refs.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +11 -4
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-mover/index.js +1 -2
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-popover/cover.js +1 -1
- package/build-module/components/block-popover/cover.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +1 -1
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +1 -1
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-mode-toggle.js +29 -34
- package/build-module/components/block-settings-menu/block-mode-toggle.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +1 -2
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +1 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +14 -3
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +2 -1
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +23 -20
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +0 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +1 -0
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +3 -1
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.js +1 -1
- package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +2 -0
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/dimensions-tool/scale-tool.js +1 -0
- package/build-module/components/dimensions-tool/scale-tool.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +3 -0
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/font-family/index.js +14 -0
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +156 -80
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +3 -1
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +0 -6
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +1 -0
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/index.js +1 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +0 -1
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +61 -42
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +77 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +30 -26
- package/build-module/components/grid/grid-item-movers.js.map +1 -1
- package/build-module/components/grid/grid-item-resizer.js +14 -15
- package/build-module/components/grid/grid-item-resizer.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js +21 -6
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/grid/use-grid-layout-sync.js +56 -20
- package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build-module/components/height-control/index.js +1 -0
- package/build-module/components/height-control/index.js.map +1 -1
- package/build-module/components/iframe/index.js +2 -4
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/zoom-dropdown.js +12 -8
- package/build-module/components/image-editor/zoom-dropdown.js.map +1 -1
- package/build-module/components/inner-blocks/button-block-appender.js +7 -6
- package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build-module/components/inner-blocks/default-block-appender.js +6 -23
- package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +9 -11
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/category-tabs/index.js +30 -3
- package/build-module/components/inserter/category-tabs/index.js.map +1 -1
- package/build-module/components/inserter/library.js +4 -2
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js +32 -14
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +5 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/line-height-control/index.js +3 -14
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/search-input.js +0 -1
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +9 -4
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +3 -1
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +4 -1
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +12 -12
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/resolution-tool/index.js +1 -0
- package/build-module/components/resolution-tool/index.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js +5 -3
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +8 -8
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/text-alignment-control/index.js +13 -8
- package/build-module/components/text-alignment-control/index.js.map +1 -1
- package/build-module/components/text-decoration-control/index.js +13 -8
- package/build-module/components/text-decoration-control/index.js.map +1 -1
- package/build-module/components/text-transform-control/index.js +13 -8
- package/build-module/components/text-transform-control/index.js.map +1 -1
- package/build-module/components/url-input/button.js +0 -1
- package/build-module/components/url-input/button.js.map +1 -1
- package/build-module/components/url-input/index.js +1 -11
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +2 -0
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/url-popover/link-editor.js +0 -1
- package/build-module/components/url-popover/link-editor.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +42 -4
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +3 -6
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +1 -3
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +2 -1
- package/build-module/components/use-settings/index.js.map +1 -1
- package/build-module/components/writing-mode-control/index.js +13 -8
- package/build-module/components/writing-mode-control/index.js.map +1 -1
- package/build-module/hooks/background.js +19 -23
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-bindings.js +214 -43
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/block-hooks.js +1 -0
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-style-variation.js +3 -3
- package/build-module/hooks/block-style-variation.js.map +1 -1
- package/build-module/hooks/contrast-checker.js +7 -7
- package/build-module/hooks/contrast-checker.js.map +1 -1
- package/build-module/hooks/duotone.js +4 -4
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.js +2 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/line-height.js +0 -1
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/spacing-visualizer.js +1 -1
- package/build-module/hooks/spacing-visualizer.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +3 -0
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +1 -1
- package/build-module/hooks/use-zoom-out.js.map +1 -1
- package/build-module/hooks/utils.js +19 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/constrained.js +1 -0
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/flex.js +2 -0
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/grid.js +3 -0
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +4 -3
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +9 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-selectors.js +27 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +9 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +4 -4
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/block-bindings.js +105 -0
- package/build-module/utils/block-bindings.js.map +1 -0
- package/build-module/utils/get-editor-region.js +1 -1
- package/build-module/utils/get-editor-region.js.map +1 -1
- package/build-module/utils/get-px-from-css-unit.js +1 -1
- package/build-module/utils/get-px-from-css-unit.js.map +1 -1
- package/build-style/content-rtl.css +12 -26
- package/build-style/content.css +12 -26
- package/build-style/default-editor-styles-rtl.css +5 -2
- package/build-style/default-editor-styles.css +5 -2
- package/build-style/style-rtl.css +123 -83
- package/build-style/style.css +123 -83
- package/package.json +32 -32
- package/src/autocompleters/block.js +2 -1
- package/src/autocompleters/style.scss +4 -0
- package/src/components/block-breadcrumb/index.js +4 -2
- package/src/components/block-canvas/style.scss +1 -0
- package/src/components/block-draggable/index.js +3 -3
- package/src/components/block-list/content.scss +5 -13
- package/src/components/block-list/use-block-props/index.js +2 -2
- package/src/components/block-list/use-block-props/use-block-refs.js +27 -43
- package/src/components/block-list/use-in-between-inserter.js +17 -5
- package/src/components/block-mover/index.js +5 -2
- package/src/components/block-popover/cover.js +1 -1
- package/src/components/block-popover/inbetween.js +1 -1
- package/src/components/block-popover/index.js +1 -1
- package/src/components/block-settings-menu/block-mode-toggle.js +28 -31
- package/src/components/block-settings-menu/test/block-mode-toggle.js +26 -23
- package/src/components/block-tools/block-selection-button.js +1 -2
- package/src/components/block-tools/index.js +5 -6
- package/src/components/block-tools/insertion-point.js +11 -0
- package/src/components/block-tools/style.scss +1 -1
- package/src/components/block-tools/use-block-toolbar-popover-props.js +1 -1
- package/src/components/block-tools/use-show-block-tools.js +4 -1
- package/src/components/block-tools/zoom-out-mode-inserters.js +21 -19
- package/src/components/block-tools/zoom-out-toolbar.js +0 -1
- package/src/components/block-variation-transforms/style.scss +1 -1
- package/src/components/border-radius-control/index.js +1 -0
- package/src/components/border-radius-control/style.scss +0 -10
- package/src/components/button-block-appender/content.scss +1 -1
- package/src/components/child-layout-control/index.js +2 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +2 -2
- package/src/components/colors-gradients/test/control.js +3 -2
- package/src/components/convert-to-group-buttons/index.js +1 -1
- package/src/components/date-format-picker/index.js +2 -0
- package/src/components/dimensions-tool/scale-tool.js +1 -0
- package/src/components/font-appearance-control/index.js +3 -0
- package/src/components/font-family/README.md +17 -0
- package/src/components/font-family/index.js +19 -0
- package/src/components/font-family/stories/index.story.js +54 -0
- package/src/components/global-styles/background-panel.js +180 -93
- package/src/components/global-styles/get-global-styles-changes.js +4 -1
- package/src/components/global-styles/hooks.js +0 -5
- package/src/components/global-styles/image-settings-panel.js +1 -0
- package/src/components/global-styles/index.js +0 -1
- package/src/components/global-styles/style.scss +13 -12
- package/src/components/global-styles/test/use-global-styles-output.js +68 -7
- package/src/components/global-styles/test/utils.js +120 -0
- package/src/components/global-styles/typography-panel.js +0 -1
- package/src/components/global-styles/use-global-styles-output.js +71 -53
- package/src/components/global-styles/utils.js +90 -0
- package/src/components/grid/grid-item-movers.js +46 -44
- package/src/components/grid/grid-item-resizer.js +11 -17
- package/src/components/grid/grid-visualizer.js +23 -8
- package/src/components/grid/style.scss +60 -10
- package/src/components/grid/use-grid-layout-sync.js +68 -14
- package/src/components/height-control/index.js +1 -0
- package/src/components/iframe/content.scss +2 -2
- package/src/components/iframe/index.js +1 -3
- package/src/components/image-editor/zoom-dropdown.js +17 -9
- package/src/components/inner-blocks/button-block-appender.js +5 -7
- package/src/components/inner-blocks/default-block-appender.js +4 -23
- package/src/components/inner-blocks/index.js +10 -9
- package/src/components/inserter/category-tabs/index.js +35 -2
- package/src/components/inserter/library.js +2 -0
- package/src/components/inserter/menu.js +34 -29
- package/src/components/inserter/quick-inserter.js +4 -1
- package/src/components/inserter/style.scss +17 -12
- package/src/components/inserter-list-item/style.scss +1 -0
- package/src/components/inspector-controls/README.md +5 -0
- package/src/components/line-height-control/README.md +4 -5
- package/src/components/line-height-control/index.js +4 -21
- package/src/components/line-height-control/stories/index.story.js +0 -1
- package/src/components/line-height-control/test/index.js +1 -7
- package/src/components/link-control/search-input.js +0 -1
- package/src/components/link-control/style.scss +1 -1
- package/src/components/media-placeholder/index.js +12 -7
- package/src/components/media-replace-flow/README.md +7 -0
- package/src/components/media-replace-flow/index.js +3 -1
- package/src/components/media-upload/README.md +2 -0
- package/src/components/media-upload/index.native.js +2 -0
- package/src/components/multi-selection-inspector/index.js +8 -9
- package/src/components/resolution-tool/index.js +1 -0
- package/src/components/responsive-block-control/README.md +1 -0
- package/src/components/responsive-block-control/test/index.js +6 -1
- package/src/components/skip-to-selected-block/index.js +5 -3
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +11 -10
- package/src/components/spacing-sizes-control/style.scss +16 -16
- package/src/components/tabbed-sidebar/style.scss +1 -19
- package/src/components/text-alignment-control/index.js +20 -8
- package/src/components/text-decoration-control/index.js +20 -8
- package/src/components/text-decoration-control/stories/index.story.js +0 -4
- package/src/components/text-transform-control/index.js +20 -8
- package/src/components/text-transform-control/stories/index.story.js +0 -4
- package/src/components/url-input/README.md +0 -5
- package/src/components/url-input/button.js +0 -1
- package/src/components/url-input/index.js +1 -15
- package/src/components/url-input/style.scss +2 -2
- package/src/components/url-popover/image-url-input-ui.js +2 -0
- package/src/components/url-popover/link-editor.js +0 -1
- package/src/components/use-block-drop-zone/index.js +86 -16
- package/src/components/use-on-block-drop/index.js +1 -9
- package/src/components/use-resize-canvas/index.js +1 -3
- package/src/components/use-settings/index.js +2 -1
- package/src/components/writing-mode-control/index.js +20 -8
- package/src/hooks/background.js +21 -27
- package/src/hooks/block-bindings.js +248 -54
- package/src/hooks/block-bindings.scss +13 -2
- package/src/hooks/block-hooks.js +1 -0
- package/src/hooks/block-hooks.scss +1 -0
- package/src/hooks/block-style-variation.js +3 -3
- package/src/hooks/contrast-checker.js +7 -7
- package/src/hooks/duotone.js +4 -4
- package/src/hooks/index.js +2 -1
- package/src/hooks/line-height.js +0 -1
- package/src/hooks/spacing-visualizer.js +1 -1
- package/src/hooks/test/background.js +60 -0
- package/src/hooks/use-bindings-attributes.js +4 -0
- package/src/hooks/use-editor-wrapper-styles.native.scss +1 -0
- package/src/hooks/use-zoom-out.js +1 -1
- package/src/hooks/utils.js +14 -1
- package/src/index.js +1 -0
- package/src/layouts/constrained.js +1 -0
- package/src/layouts/flex.js +2 -0
- package/src/layouts/grid.js +3 -0
- package/src/private-apis.js +3 -2
- package/src/store/actions.js +13 -5
- package/src/store/private-selectors.js +36 -0
- package/src/store/reducer.js +7 -0
- package/src/store/selectors.js +4 -4
- package/src/store/test/private-selectors.js +89 -0
- package/src/style.scss +1 -2
- package/src/utils/block-bindings.js +98 -0
- package/src/utils/get-editor-region.js +1 -1
- package/src/utils/get-px-from-css-unit.js +1 -1
- package/src/utils/test/transform-styles.js +49 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/global-styles/theme-file-uri-utils.js +0 -80
- package/build/components/global-styles/theme-file-uri-utils.js.map +0 -1
- package/build/components/inner-blocks/with-client-id.js +0 -28
- package/build/components/inner-blocks/with-client-id.js.map +0 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -30
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +0 -1
- package/build/components/segmented-text-control/index.js +0 -63
- package/build/components/segmented-text-control/index.js.map +0 -1
- package/build-module/components/global-styles/theme-file-uri-utils.js +0 -73
- package/build-module/components/global-styles/theme-file-uri-utils.js.map +0 -1
- package/build-module/components/inner-blocks/with-client-id.js +0 -21
- package/build-module/components/inner-blocks/with-client-id.js.map +0 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -23
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +0 -1
- package/build-module/components/segmented-text-control/index.js +0 -58
- package/build-module/components/segmented-text-control/index.js.map +0 -1
- package/src/components/global-styles/test/theme-file-uri-utils.js +0 -66
- package/src/components/global-styles/theme-file-uri-utils.js +0 -77
- package/src/components/inner-blocks/with-client-id.js +0 -19
- package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -25
- package/src/components/segmented-text-control/index.js +0 -63
- package/src/components/segmented-text-control/style.scss +0 -15
|
@@ -209,11 +209,6 @@ export function useGlobalStyle(
|
|
|
209
209
|
return [ result, setStyle ];
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
export function useGlobalStyleLinks() {
|
|
213
|
-
const { merged: mergedConfig } = useContext( GlobalStylesContext );
|
|
214
|
-
return mergedConfig?._links;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
212
|
/**
|
|
218
213
|
* React hook that overrides a global settings object with block and element specific settings.
|
|
219
214
|
*
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
.block-editor-global-styles-background-panel__inspector-media-replace-container {
|
|
76
|
-
border:
|
|
76
|
+
border: $border-width solid $gray-300;
|
|
77
77
|
border-radius: 2px;
|
|
78
78
|
// Full width. ToolsPanel lays out children in a grid.
|
|
79
79
|
grid-column: 1 / -1;
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
.block-editor-global-styles-background-panel__image-tools-panel-item {
|
|
104
|
-
border:
|
|
104
|
+
border: $border-width solid $gray-300;
|
|
105
105
|
border-radius: 2px;
|
|
106
106
|
|
|
107
107
|
// Full width. ToolsPanel lays out children in a grid.
|
|
@@ -134,6 +134,17 @@
|
|
|
134
134
|
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
+
|
|
138
|
+
.block-editor-global-styles-background-panel__loading {
|
|
139
|
+
height: 100%;
|
|
140
|
+
position: absolute;
|
|
141
|
+
z-index: 1;
|
|
142
|
+
width: 100%;
|
|
143
|
+
padding: 10px 0 0 0;
|
|
144
|
+
svg {
|
|
145
|
+
margin: 0;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
137
148
|
}
|
|
138
149
|
|
|
139
150
|
.block-editor-global-styles-background-panel__image-preview-content,
|
|
@@ -193,10 +204,6 @@
|
|
|
193
204
|
.block-editor-global-styles-background-panel__dropdown-content-wrapper {
|
|
194
205
|
min-width: 260px;
|
|
195
206
|
overflow-x: hidden;
|
|
196
|
-
.components-base-control__help,
|
|
197
|
-
.components-toggle-control {
|
|
198
|
-
margin-bottom: 0;
|
|
199
|
-
}
|
|
200
207
|
|
|
201
208
|
.components-focal-point-picker-wrapper {
|
|
202
209
|
background-color: $gray-100;
|
|
@@ -215,12 +222,6 @@
|
|
|
215
222
|
}
|
|
216
223
|
}
|
|
217
224
|
|
|
218
|
-
.block-editor-global-styles-background-panel__hidden-tools-panel-item {
|
|
219
|
-
height: 0;
|
|
220
|
-
width: 0;
|
|
221
|
-
position: absolute;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
225
|
// Push control panel into the background when the media modal is open.
|
|
225
226
|
.modal-open .block-editor-global-styles-background-panel__popover {
|
|
226
227
|
z-index: z-index(".block-editor-global-styles-background-panel__popover");
|
|
@@ -763,7 +763,7 @@ describe( 'global styles renderer', () => {
|
|
|
763
763
|
} );
|
|
764
764
|
|
|
765
765
|
expect( layoutStyles ).toEqual(
|
|
766
|
-
'.is-layout-flow > * { margin-block-start: 0; margin-block-end: 0; }.is-layout-flow > * + * { margin-block-start: 0.5em; margin-block-end: 0; }.is-layout-flex { gap: 0.5em; }:root { --wp--style--block-gap: 0.5em; }.is-layout-flow > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }.is-layout-flow > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }.is-layout-flow > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-flex { display:flex; }.is-layout-flex { flex-wrap: wrap; align-items: center; }.is-layout-flex > * { margin: 0; }'
|
|
766
|
+
':root :where(.is-layout-flow) > * { margin-block-start: 0; margin-block-end: 0; }:root :where(.is-layout-flow) > * + * { margin-block-start: 0.5em; margin-block-end: 0; }:root :where(.is-layout-flex) { gap: 0.5em; }:root { --wp--style--block-gap: 0.5em; }.is-layout-flow > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }.is-layout-flow > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }.is-layout-flow > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-flex { display:flex; }.is-layout-flex { flex-wrap: wrap; align-items: center; }.is-layout-flex > * { margin: 0; }'
|
|
767
767
|
);
|
|
768
768
|
} );
|
|
769
769
|
|
|
@@ -780,7 +780,7 @@ describe( 'global styles renderer', () => {
|
|
|
780
780
|
} );
|
|
781
781
|
|
|
782
782
|
expect( layoutStyles ).toEqual(
|
|
783
|
-
'.is-layout-flow > * { margin-block-start: 0; margin-block-end: 0; }.is-layout-flow > * + * { margin-block-start: 12px; margin-block-end: 0; }.is-layout-flex { gap: 12px; }:root { --wp--style--block-gap: 12px; }.is-layout-flow > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }.is-layout-flow > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }.is-layout-flow > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-flex { display:flex; }.is-layout-flex { flex-wrap: wrap; align-items: center; }.is-layout-flex > * { margin: 0; }'
|
|
783
|
+
':root :where(.is-layout-flow) > * { margin-block-start: 0; margin-block-end: 0; }:root :where(.is-layout-flow) > * + * { margin-block-start: 12px; margin-block-end: 0; }:root :where(.is-layout-flex) { gap: 12px; }:root { --wp--style--block-gap: 12px; }.is-layout-flow > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }.is-layout-flow > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }.is-layout-flow > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-flex { display:flex; }.is-layout-flex { flex-wrap: wrap; align-items: center; }.is-layout-flex > * { margin: 0; }'
|
|
784
784
|
);
|
|
785
785
|
} );
|
|
786
786
|
|
|
@@ -797,7 +797,7 @@ describe( 'global styles renderer', () => {
|
|
|
797
797
|
} );
|
|
798
798
|
|
|
799
799
|
expect( layoutStyles ).toEqual(
|
|
800
|
-
'.wp-block-group-is-layout-flow > * { margin-block-start: 0; margin-block-end: 0; }.wp-block-group-is-layout-flow > * + * { margin-block-start: 12px; margin-block-end: 0; }.wp-block-group-is-layout-flex { gap: 12px; }'
|
|
800
|
+
':root :where(.wp-block-group-is-layout-flow) > * { margin-block-start: 0; margin-block-end: 0; }:root :where(.wp-block-group-is-layout-flow) > * + * { margin-block-start: 12px; margin-block-end: 0; }:root :where(.wp-block-group-is-layout-flex) { gap: 12px; }'
|
|
801
801
|
);
|
|
802
802
|
} );
|
|
803
803
|
|
|
@@ -1008,9 +1008,23 @@ describe( 'global styles renderer', () => {
|
|
|
1008
1008
|
ref: 'styles.elements.h1.typography.letterSpacing',
|
|
1009
1009
|
},
|
|
1010
1010
|
},
|
|
1011
|
+
background: {
|
|
1012
|
+
backgroundImage: {
|
|
1013
|
+
ref: 'styles.background.backgroundImage',
|
|
1014
|
+
},
|
|
1015
|
+
backgroundSize: {
|
|
1016
|
+
ref: 'styles.background.backgroundSize',
|
|
1017
|
+
},
|
|
1018
|
+
},
|
|
1011
1019
|
};
|
|
1012
1020
|
const tree = {
|
|
1013
1021
|
styles: {
|
|
1022
|
+
background: {
|
|
1023
|
+
backgroundImage: {
|
|
1024
|
+
url: 'http://my-image.org/image.gif',
|
|
1025
|
+
},
|
|
1026
|
+
backgroundSize: 'cover',
|
|
1027
|
+
},
|
|
1014
1028
|
elements: {
|
|
1015
1029
|
h1: {
|
|
1016
1030
|
typography: {
|
|
@@ -1026,16 +1040,63 @@ describe( 'global styles renderer', () => {
|
|
|
1026
1040
|
).toEqual( [
|
|
1027
1041
|
'font-size: var(--wp--preset--font-size--xx-large)',
|
|
1028
1042
|
'letter-spacing: 2px',
|
|
1043
|
+
"background-image: url( 'http://my-image.org/image.gif' )",
|
|
1044
|
+
'background-size: cover',
|
|
1045
|
+
] );
|
|
1046
|
+
} );
|
|
1047
|
+
it( 'should set default values for block background styles', () => {
|
|
1048
|
+
const backgroundStyles = {
|
|
1049
|
+
background: {
|
|
1050
|
+
backgroundImage: {
|
|
1051
|
+
url: 'https://wordpress.org/assets/image.jpg',
|
|
1052
|
+
id: 123,
|
|
1053
|
+
},
|
|
1054
|
+
},
|
|
1055
|
+
};
|
|
1056
|
+
expect(
|
|
1057
|
+
getStylesDeclarations( backgroundStyles, '.wp-block-group' )
|
|
1058
|
+
).toEqual( [
|
|
1059
|
+
"background-image: url( 'https://wordpress.org/assets/image.jpg' )",
|
|
1060
|
+
'background-size: cover',
|
|
1061
|
+
] );
|
|
1062
|
+
// Test with root-level styles.
|
|
1063
|
+
expect(
|
|
1064
|
+
getStylesDeclarations( backgroundStyles, ROOT_BLOCK_SELECTOR )
|
|
1065
|
+
).toEqual( [
|
|
1066
|
+
"background-image: url( 'https://wordpress.org/assets/image.jpg' )",
|
|
1067
|
+
] );
|
|
1068
|
+
expect(
|
|
1069
|
+
getStylesDeclarations(
|
|
1070
|
+
{
|
|
1071
|
+
background: {
|
|
1072
|
+
...backgroundStyles.background,
|
|
1073
|
+
backgroundSize: 'contain',
|
|
1074
|
+
},
|
|
1075
|
+
},
|
|
1076
|
+
'.wp-block-group'
|
|
1077
|
+
)
|
|
1078
|
+
).toEqual( [
|
|
1079
|
+
"background-image: url( 'https://wordpress.org/assets/image.jpg' )",
|
|
1080
|
+
'background-position: 50% 50%',
|
|
1081
|
+
'background-size: contain',
|
|
1029
1082
|
] );
|
|
1030
1083
|
} );
|
|
1031
1084
|
} );
|
|
1032
1085
|
|
|
1033
1086
|
describe( 'processCSSNesting', () => {
|
|
1087
|
+
it( 'should return empty string when supplied css is empty', () => {
|
|
1088
|
+
expect( processCSSNesting( '', '.foo' ) ).toEqual( '' );
|
|
1089
|
+
} );
|
|
1034
1090
|
it( 'should return processed CSS without any nested selectors', () => {
|
|
1035
1091
|
expect(
|
|
1036
1092
|
processCSSNesting( 'color: red; margin: auto;', '.foo' )
|
|
1037
1093
|
).toEqual( ':root :where(.foo){color: red; margin: auto;}' );
|
|
1038
1094
|
} );
|
|
1095
|
+
it( 'should return processed CSS when there are no root selectors', () => {
|
|
1096
|
+
expect(
|
|
1097
|
+
processCSSNesting( '&::before{color: red;}', '.foo' )
|
|
1098
|
+
).toEqual( ':root :where(.foo)::before{color: red;}' );
|
|
1099
|
+
} );
|
|
1039
1100
|
it( 'should return processed CSS with nested selectors', () => {
|
|
1040
1101
|
expect(
|
|
1041
1102
|
processCSSNesting(
|
|
@@ -1049,21 +1110,21 @@ describe( 'global styles renderer', () => {
|
|
|
1049
1110
|
it( 'should return processed CSS with pseudo elements', () => {
|
|
1050
1111
|
expect(
|
|
1051
1112
|
processCSSNesting(
|
|
1052
|
-
'color: red; margin: auto; &::before{color: blue;} & ::before{color: green;} &.one::before{color: yellow;} & .two::before{color: purple;}',
|
|
1113
|
+
'color: red; margin: auto; &::before{color: blue;} & ::before{color: green;} &.one::before{color: yellow;} & .two::before{color: purple;} & > ::before{color: darkseagreen;}',
|
|
1053
1114
|
'.foo'
|
|
1054
1115
|
)
|
|
1055
1116
|
).toEqual(
|
|
1056
|
-
':root :where(.foo){color: red; margin: auto;}:root :where(.foo::before
|
|
1117
|
+
':root :where(.foo){color: red; margin: auto;}:root :where(.foo)::before{color: blue;}:root :where(.foo) ::before{color: green;}:root :where(.foo.one)::before{color: yellow;}:root :where(.foo .two)::before{color: purple;}:root :where(.foo) > ::before{color: darkseagreen;}'
|
|
1057
1118
|
);
|
|
1058
1119
|
} );
|
|
1059
1120
|
it( 'should return processed CSS with multiple root selectors', () => {
|
|
1060
1121
|
expect(
|
|
1061
1122
|
processCSSNesting(
|
|
1062
|
-
'color: red; margin: auto; &.one{color: blue;} & .two{color: green;} &::before{color: yellow;} & ::before{color: purple;} &.three::before{color: orange;} & .four::before{color: skyblue;}',
|
|
1123
|
+
'color: red; margin: auto; &.one{color: blue;} & .two{color: green;} &::before{color: yellow;} & ::before{color: purple;} &.three::before{color: orange;} & .four::before{color: skyblue;} & > ::before{color: darkseagreen;}',
|
|
1063
1124
|
'.foo, .bar'
|
|
1064
1125
|
)
|
|
1065
1126
|
).toEqual(
|
|
1066
|
-
':root :where(.foo, .bar){color: red; margin: auto;}:root :where(.foo.one, .bar.one){color: blue;}:root :where(.foo .two, .bar .two){color: green;}:root :where(.foo
|
|
1127
|
+
':root :where(.foo, .bar){color: red; margin: auto;}:root :where(.foo.one, .bar.one){color: blue;}:root :where(.foo .two, .bar .two){color: green;}:root :where(.foo, .bar)::before{color: yellow;}:root :where(.foo, .bar) ::before{color: purple;}:root :where(.foo.three, .bar.three)::before{color: orange;}:root :where(.foo .four, .bar .four)::before{color: skyblue;}:root :where(.foo, .bar) > ::before{color: darkseagreen;}'
|
|
1067
1128
|
);
|
|
1068
1129
|
} );
|
|
1069
1130
|
} );
|
|
@@ -7,6 +7,9 @@ import {
|
|
|
7
7
|
getPresetVariableFromValue,
|
|
8
8
|
getValueFromVariable,
|
|
9
9
|
scopeFeatureSelectors,
|
|
10
|
+
getResolvedThemeFilePath,
|
|
11
|
+
getResolvedRefValue,
|
|
12
|
+
getResolvedValue,
|
|
10
13
|
} from '../utils';
|
|
11
14
|
|
|
12
15
|
describe( 'editor utils', () => {
|
|
@@ -52,6 +55,41 @@ describe( 'editor utils', () => {
|
|
|
52
55
|
},
|
|
53
56
|
},
|
|
54
57
|
},
|
|
58
|
+
styles: {
|
|
59
|
+
background: {
|
|
60
|
+
backgroundImage: {
|
|
61
|
+
url: 'file:./assets/image.jpg',
|
|
62
|
+
},
|
|
63
|
+
backgroundAttachment: 'fixed',
|
|
64
|
+
backgroundPosition: 'top left',
|
|
65
|
+
},
|
|
66
|
+
blocks: {
|
|
67
|
+
'core/group': {
|
|
68
|
+
background: {
|
|
69
|
+
backgroundImage: {
|
|
70
|
+
ref: 'styles.background.backgroundImage',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
dimensions: {
|
|
74
|
+
minHeight: '100px',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
_links: {
|
|
80
|
+
'wp:theme-file': [
|
|
81
|
+
{
|
|
82
|
+
name: 'file:./assets/image.jpg',
|
|
83
|
+
href: 'https://wordpress.org/assets/image.jpg',
|
|
84
|
+
target: 'styles.background.backgroundImage.url',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: 'file:./assets/other/image.jpg',
|
|
88
|
+
href: 'https://wordpress.org/assets/other/image.jpg',
|
|
89
|
+
target: "styles.blocks.['core/group'].background.backgroundImage.url",
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
55
93
|
isGlobalStylesUserThemeJSON: true,
|
|
56
94
|
};
|
|
57
95
|
|
|
@@ -366,4 +404,86 @@ describe( 'editor utils', () => {
|
|
|
366
404
|
} );
|
|
367
405
|
} );
|
|
368
406
|
} );
|
|
407
|
+
|
|
408
|
+
describe( 'getResolvedThemeFilePath()', () => {
|
|
409
|
+
it.each( [
|
|
410
|
+
[
|
|
411
|
+
'file:./assets/image.jpg',
|
|
412
|
+
'https://wordpress.org/assets/image.jpg',
|
|
413
|
+
'Should return absolute URL if found in themeFileURIs',
|
|
414
|
+
],
|
|
415
|
+
[
|
|
416
|
+
'file:./misc/image.jpg',
|
|
417
|
+
'file:./misc/image.jpg',
|
|
418
|
+
'Should return value if not found in themeFileURIs',
|
|
419
|
+
],
|
|
420
|
+
[
|
|
421
|
+
'https://wordpress.org/assets/image.jpg',
|
|
422
|
+
'https://wordpress.org/assets/image.jpg',
|
|
423
|
+
'Should not match absolute URLs',
|
|
424
|
+
],
|
|
425
|
+
] )(
|
|
426
|
+
'Given file %s and return value %s: %s',
|
|
427
|
+
( file, returnedValue ) => {
|
|
428
|
+
expect(
|
|
429
|
+
getResolvedThemeFilePath(
|
|
430
|
+
file,
|
|
431
|
+
themeJson._links[ 'wp:theme-file' ]
|
|
432
|
+
) === returnedValue
|
|
433
|
+
).toBe( true );
|
|
434
|
+
}
|
|
435
|
+
);
|
|
436
|
+
} );
|
|
437
|
+
|
|
438
|
+
describe( 'getResolvedRefValue()', () => {
|
|
439
|
+
it.each( [
|
|
440
|
+
[ 'blue', 'blue', null ],
|
|
441
|
+
[ 0, 0, themeJson ],
|
|
442
|
+
[
|
|
443
|
+
{ ref: 'styles.background.backgroundImage' },
|
|
444
|
+
{ url: 'file:./assets/image.jpg' },
|
|
445
|
+
themeJson,
|
|
446
|
+
],
|
|
447
|
+
[
|
|
448
|
+
{
|
|
449
|
+
ref: 'styles.blocks.core/group.background.backgroundImage',
|
|
450
|
+
},
|
|
451
|
+
undefined,
|
|
452
|
+
themeJson,
|
|
453
|
+
],
|
|
454
|
+
] )(
|
|
455
|
+
'Given ruleValue %s return expected value of %s',
|
|
456
|
+
( ruleValue, returnedValue, tree ) => {
|
|
457
|
+
expect( getResolvedRefValue( ruleValue, tree ) ).toEqual(
|
|
458
|
+
returnedValue
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
);
|
|
462
|
+
} );
|
|
463
|
+
|
|
464
|
+
describe( 'getResolvedValue()', () => {
|
|
465
|
+
it.each( [
|
|
466
|
+
[ 'blue', 'blue', null ],
|
|
467
|
+
[ 0, 0, themeJson ],
|
|
468
|
+
[
|
|
469
|
+
{ ref: 'styles.background.backgroundImage' },
|
|
470
|
+
{ url: 'https://wordpress.org/assets/image.jpg' },
|
|
471
|
+
themeJson,
|
|
472
|
+
],
|
|
473
|
+
[
|
|
474
|
+
{
|
|
475
|
+
ref: 'styles.blocks.core/group.background.backgroundImage',
|
|
476
|
+
},
|
|
477
|
+
undefined,
|
|
478
|
+
themeJson,
|
|
479
|
+
],
|
|
480
|
+
] )(
|
|
481
|
+
'Given ruleValue %s return expected value of %s',
|
|
482
|
+
( ruleValue, returnedValue, tree ) => {
|
|
483
|
+
expect( getResolvedValue( ruleValue, tree ) ).toEqual(
|
|
484
|
+
returnedValue
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
);
|
|
488
|
+
} );
|
|
369
489
|
} );
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from '@wordpress/blocks';
|
|
11
11
|
import { useSelect } from '@wordpress/data';
|
|
12
12
|
import { useContext, useMemo } from '@wordpress/element';
|
|
13
|
-
import { getCSSRules } from '@wordpress/style-engine';
|
|
13
|
+
import { getCSSRules, getCSSValueFromRawStyle } from '@wordpress/style-engine';
|
|
14
14
|
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
scopeFeatureSelectors,
|
|
25
25
|
appendToSelector,
|
|
26
26
|
getBlockStyleVariationSelector,
|
|
27
|
+
getResolvedValue,
|
|
27
28
|
} from './utils';
|
|
28
29
|
import { getBlockCSSSelector } from './get-block-css-selector';
|
|
29
30
|
import { getTypographyFontSizeValue } from './typography-utils';
|
|
@@ -36,7 +37,6 @@ import { store as blockEditorStore } from '../../store';
|
|
|
36
37
|
import { LAYOUT_DEFINITIONS } from '../../layouts/definitions';
|
|
37
38
|
import { getValueFromObjectPath, setImmutably } from '../../utils/object';
|
|
38
39
|
import { unlock } from '../../lock-unlock';
|
|
39
|
-
import { setThemeFileUris } from './theme-file-uri-utils';
|
|
40
40
|
|
|
41
41
|
// Elements that rely on class names in their selectors.
|
|
42
42
|
const ELEMENT_CLASS_NAMES = {
|
|
@@ -54,21 +54,6 @@ const BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = {
|
|
|
54
54
|
};
|
|
55
55
|
const { kebabCase } = unlock( componentsPrivateApis );
|
|
56
56
|
|
|
57
|
-
function compileStyleValue( uncompiledValue ) {
|
|
58
|
-
const VARIABLE_REFERENCE_PREFIX = 'var:';
|
|
59
|
-
const VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';
|
|
60
|
-
const VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';
|
|
61
|
-
|
|
62
|
-
if ( uncompiledValue?.startsWith?.( VARIABLE_REFERENCE_PREFIX ) ) {
|
|
63
|
-
const variable = uncompiledValue
|
|
64
|
-
.slice( VARIABLE_REFERENCE_PREFIX.length )
|
|
65
|
-
.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )
|
|
66
|
-
.join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );
|
|
67
|
-
return `var(--wp--${ variable })`;
|
|
68
|
-
}
|
|
69
|
-
return uncompiledValue;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
57
|
/**
|
|
73
58
|
* Transform given preset tree into a set of style declarations.
|
|
74
59
|
*
|
|
@@ -371,7 +356,7 @@ export function getStylesDeclarations(
|
|
|
371
356
|
? name
|
|
372
357
|
: kebabCase( name );
|
|
373
358
|
declarations.push(
|
|
374
|
-
`${ cssProperty }: ${
|
|
359
|
+
`${ cssProperty }: ${ getCSSValueFromRawStyle(
|
|
375
360
|
getValueFromObjectPath( styleValue, [ prop ] )
|
|
376
361
|
) }`
|
|
377
362
|
);
|
|
@@ -383,7 +368,7 @@ export function getStylesDeclarations(
|
|
|
383
368
|
? key
|
|
384
369
|
: kebabCase( key );
|
|
385
370
|
declarations.push(
|
|
386
|
-
`${ cssProperty }: ${
|
|
371
|
+
`${ cssProperty }: ${ getCSSValueFromRawStyle(
|
|
387
372
|
getValueFromObjectPath( blockStyles, pathToValue )
|
|
388
373
|
) }`
|
|
389
374
|
);
|
|
@@ -395,21 +380,40 @@ export function getStylesDeclarations(
|
|
|
395
380
|
);
|
|
396
381
|
|
|
397
382
|
/*
|
|
398
|
-
*
|
|
399
|
-
*
|
|
383
|
+
* Preprocess background image values.
|
|
384
|
+
*
|
|
385
|
+
* Note: As we absorb more and more styles into the engine, we could simplify this function.
|
|
386
|
+
* A refactor is for the style engine to handle ref resolution (and possibly defaults)
|
|
387
|
+
* via a public util used internally and externally. Theme.json tree and defaults could be passed
|
|
388
|
+
* as options.
|
|
400
389
|
*/
|
|
401
|
-
if (
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
390
|
+
if ( !! blockStyles.background ) {
|
|
391
|
+
/*
|
|
392
|
+
* Resolve dynamic values before they are compiled by the style engine,
|
|
393
|
+
* which doesn't (yet) resolve dynamic values.
|
|
394
|
+
*/
|
|
395
|
+
if ( blockStyles.background?.backgroundImage ) {
|
|
396
|
+
blockStyles.background.backgroundImage = getResolvedValue(
|
|
397
|
+
blockStyles.background.backgroundImage,
|
|
398
|
+
tree
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/*
|
|
403
|
+
* Set default values for block background styles.
|
|
404
|
+
* Top-level styles are an exception as they are applied to the body.
|
|
405
|
+
*/
|
|
406
|
+
if ( ! isRoot && !! blockStyles.background?.backgroundImage?.id ) {
|
|
407
|
+
blockStyles = {
|
|
408
|
+
...blockStyles,
|
|
409
|
+
background: {
|
|
410
|
+
...blockStyles.background,
|
|
411
|
+
...setBackgroundStyleDefaults( blockStyles.background ),
|
|
412
|
+
},
|
|
413
|
+
};
|
|
414
|
+
}
|
|
409
415
|
}
|
|
410
416
|
|
|
411
|
-
// The goal is to move everything to server side generated engine styles
|
|
412
|
-
// This is temporary as we absorb more and more styles into the engine.
|
|
413
417
|
const extraRules = getCSSRules( blockStyles );
|
|
414
418
|
extraRules.forEach( ( rule ) => {
|
|
415
419
|
// Don't output padding properties if padding variables are set or if we're not editing a full template.
|
|
@@ -424,18 +428,7 @@ export function getStylesDeclarations(
|
|
|
424
428
|
? rule.key
|
|
425
429
|
: kebabCase( rule.key );
|
|
426
430
|
|
|
427
|
-
let ruleValue = rule.value;
|
|
428
|
-
if ( typeof ruleValue !== 'string' && ruleValue?.ref ) {
|
|
429
|
-
const refPath = ruleValue.ref.split( '.' );
|
|
430
|
-
ruleValue = compileStyleValue(
|
|
431
|
-
getValueFromObjectPath( tree, refPath )
|
|
432
|
-
);
|
|
433
|
-
// Presence of another ref indicates a reference to another dynamic value.
|
|
434
|
-
// Pointing to another dynamic value is not supported.
|
|
435
|
-
if ( ! ruleValue || ruleValue?.ref ) {
|
|
436
|
-
return;
|
|
437
|
-
}
|
|
438
|
-
}
|
|
431
|
+
let ruleValue = getResolvedValue( rule.value, tree, null );
|
|
439
432
|
|
|
440
433
|
// Calculate fluid typography rules where available.
|
|
441
434
|
if ( cssProperty === 'font-size' ) {
|
|
@@ -544,10 +537,10 @@ export function getLayoutStyles( {
|
|
|
544
537
|
} else {
|
|
545
538
|
combinedSelector =
|
|
546
539
|
selector === ROOT_BLOCK_SELECTOR
|
|
547
|
-
?
|
|
540
|
+
? `:root :where(.${ className })${
|
|
548
541
|
spacingStyle?.selector || ''
|
|
549
542
|
}`
|
|
550
|
-
:
|
|
543
|
+
: `:root :where(${ selector }-${ className })${
|
|
551
544
|
spacingStyle?.selector || ''
|
|
552
545
|
}`;
|
|
553
546
|
}
|
|
@@ -1327,9 +1320,17 @@ function updateConfigWithSeparator( config ) {
|
|
|
1327
1320
|
export function processCSSNesting( css, blockSelector ) {
|
|
1328
1321
|
let processedCSS = '';
|
|
1329
1322
|
|
|
1323
|
+
if ( ! css || css.trim() === '' ) {
|
|
1324
|
+
return processedCSS;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1330
1327
|
// Split CSS nested rules.
|
|
1331
1328
|
const parts = css.split( '&' );
|
|
1332
1329
|
parts.forEach( ( part ) => {
|
|
1330
|
+
if ( ! part || part.trim() === '' ) {
|
|
1331
|
+
return;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1333
1334
|
const isRootCss = ! part.includes( '{' );
|
|
1334
1335
|
if ( isRootCss ) {
|
|
1335
1336
|
// If the part doesn't contain braces, it applies to the root level.
|
|
@@ -1342,11 +1343,32 @@ export function processCSSNesting( css, blockSelector ) {
|
|
|
1342
1343
|
}
|
|
1343
1344
|
|
|
1344
1345
|
const [ nestedSelector, cssValue ] = splittedPart;
|
|
1345
|
-
const combinedSelector = nestedSelector.startsWith( ' ' )
|
|
1346
|
-
? scopeSelector( blockSelector, nestedSelector )
|
|
1347
|
-
: appendToSelector( blockSelector, nestedSelector );
|
|
1348
1346
|
|
|
1349
|
-
|
|
1347
|
+
// Handle pseudo elements such as ::before, ::after, etc. Regex will also
|
|
1348
|
+
// capture any leading combinator such as >, +, or ~, as well as spaces.
|
|
1349
|
+
// This allows pseudo elements as descendants e.g. `.parent ::before`.
|
|
1350
|
+
const matches = nestedSelector.match( /([>+~\s]*::[a-zA-Z-]+)/ );
|
|
1351
|
+
const pseudoPart = matches ? matches[ 1 ] : '';
|
|
1352
|
+
const withoutPseudoElement = matches
|
|
1353
|
+
? nestedSelector.replace( pseudoPart, '' ).trim()
|
|
1354
|
+
: nestedSelector.trim();
|
|
1355
|
+
|
|
1356
|
+
let combinedSelector;
|
|
1357
|
+
if ( withoutPseudoElement === '' ) {
|
|
1358
|
+
// Only contained a pseudo element to use the block selector to form
|
|
1359
|
+
// the final `:root :where()` selector.
|
|
1360
|
+
combinedSelector = blockSelector;
|
|
1361
|
+
} else {
|
|
1362
|
+
// If the nested selector is a descendant of the block scope it with the
|
|
1363
|
+
// block selector. Otherwise append it to the block selector.
|
|
1364
|
+
combinedSelector = nestedSelector.startsWith( ' ' )
|
|
1365
|
+
? scopeSelector( blockSelector, withoutPseudoElement )
|
|
1366
|
+
: appendToSelector( blockSelector, withoutPseudoElement );
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
// Build final rule, re-adding any pseudo element outside the `:where()`
|
|
1370
|
+
// to maintain valid CSS selector.
|
|
1371
|
+
processedCSS += `:root :where(${ combinedSelector })${ pseudoPart }{${ cssValue.trim() }}`;
|
|
1350
1372
|
}
|
|
1351
1373
|
} );
|
|
1352
1374
|
return processedCSS;
|
|
@@ -1369,10 +1391,6 @@ export function useGlobalStylesOutputWithConfig(
|
|
|
1369
1391
|
disableRootPadding
|
|
1370
1392
|
) {
|
|
1371
1393
|
const [ blockGap ] = useGlobalSetting( 'spacing.blockGap' );
|
|
1372
|
-
mergedConfig = setThemeFileUris(
|
|
1373
|
-
mergedConfig,
|
|
1374
|
-
mergedConfig?._links?.[ 'wp:theme-file' ]
|
|
1375
|
-
);
|
|
1376
1394
|
const hasBlockGapSupport = blockGap !== null;
|
|
1377
1395
|
const hasFallbackGapSupport = ! hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support.
|
|
1378
1396
|
const disableLayoutStyles = useSelect( ( select ) => {
|