@wordpress/block-editor 11.5.0 → 11.7.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 +6 -0
- package/README.md +4 -0
- package/build/components/block-list/block-html.js +1 -3
- package/build/components/block-list/block-html.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.js +63 -80
- package/build/components/block-list/block-invalid-warning.js.map +1 -1
- package/build/components/block-preview/auto.js +6 -23
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -1
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js +1 -0
- package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +6 -3
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build/components/editor-styles/index.js +20 -2
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +306 -0
- package/build/components/global-styles/border-panel.js.map +1 -0
- package/build/components/global-styles/color-panel.js +583 -0
- package/build/components/global-styles/color-panel.js.map +1 -0
- package/build/components/global-styles/dimensions-panel.js +8 -30
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/get-block-css-selector.js +129 -0
- package/build/components/global-styles/get-block-css-selector.js.map +1 -0
- package/build/components/global-styles/hooks.js +109 -3
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +36 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +66 -45
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +180 -99
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +2 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/image-size-control/index.js +8 -5
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/inserter/index.js +29 -17
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/menu.js +1 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +4 -2
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-results.js +10 -3
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +1 -1
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls-tabs/position-controls-panel.js +43 -7
- package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build/components/line-height-control/index.js +15 -1
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/index.js +1 -1
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-item.js +5 -2
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/list-view/appender.js +105 -0
- package/build/components/list-view/appender.js.map +1 -0
- package/build/components/list-view/block.js +5 -5
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +25 -5
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +37 -13
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +1 -2
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/media-replace-flow/index.js +13 -4
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +28 -3
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/components/off-canvas-editor/branch.js +5 -3
- package/build/components/off-canvas-editor/branch.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +9 -7
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/off-canvas-editor/link-ui.js +0 -1
- package/build/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build/components/provider/use-block-sync.js +17 -3
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/format-edit.js +2 -30
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +0 -3
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/writing-flow/use-input.js +4 -8
- package/build/components/writing-flow/use-input.js.map +1 -1
- package/build/hooks/border.js +90 -240
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +92 -229
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +4 -2
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/{color-panel.js → contrast-checker.js} +11 -49
- package/build/hooks/contrast-checker.js.map +1 -0
- package/build/hooks/custom-class-name.js +4 -4
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/custom-class-name.native.js +3 -4
- package/build/hooks/custom-class-name.native.js.map +1 -1
- package/build/hooks/dimensions.js +0 -1
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +3 -1
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/layout.js +19 -22
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +2 -2
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +23 -26
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/supports.js +7 -1
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.js +2 -2
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +50 -75
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/constrained.js +6 -2
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/grid.js +165 -0
- package/build/layouts/grid.js.map +1 -0
- package/build/layouts/index.js +3 -1
- package/build/layouts/index.js.map +1 -1
- package/build/private-apis.js +7 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +10 -8
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +19 -3
- package/build/store/selectors.js.map +1 -1
- package/build/utils/object.js +76 -0
- package/build/utils/object.js.map +1 -0
- package/build/utils/parse-css-unit-to-px.js +15 -9
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/components/block-list/block-html.js +1 -3
- package/build-module/components/block-list/block-html.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.js +66 -78
- package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
- package/build-module/components/block-preview/auto.js +6 -22
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +1 -1
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js +1 -0
- package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +6 -3
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build-module/components/editor-styles/index.js +19 -2
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +291 -0
- package/build-module/components/global-styles/border-panel.js.map +1 -0
- package/build-module/components/global-styles/color-panel.js +554 -0
- package/build-module/components/global-styles/color-panel.js.map +1 -0
- package/build-module/components/global-styles/dimensions-panel.js +7 -30
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/get-block-css-selector.js +120 -0
- package/build-module/components/global-styles/get-block-css-selector.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +104 -3
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +3 -0
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +65 -46
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +181 -100
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +2 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/image-size-control/index.js +8 -5
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/inserter/index.js +28 -16
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/menu.js +1 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +4 -2
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-results.js +10 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +1 -1
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js +42 -7
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build-module/components/line-height-control/index.js +15 -1
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +1 -1
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-item.js +4 -2
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/list-view/appender.js +88 -0
- package/build-module/components/list-view/appender.js.map +1 -0
- package/build-module/components/list-view/block.js +5 -4
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +22 -5
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +32 -12
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +1 -2
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +12 -4
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +28 -4
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/components/off-canvas-editor/branch.js +5 -3
- package/build-module/components/off-canvas-editor/branch.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +9 -7
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/link-ui.js +0 -1
- package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +17 -3
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/format-edit.js +3 -31
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +0 -3
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/writing-flow/use-input.js +4 -8
- package/build-module/components/writing-flow/use-input.js.map +1 -1
- package/build-module/hooks/border.js +92 -240
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +90 -232
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +4 -2
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/{color-panel.js → contrast-checker.js} +10 -44
- package/build-module/hooks/contrast-checker.js.map +1 -0
- package/build-module/hooks/custom-class-name.js +4 -4
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/custom-class-name.native.js +3 -4
- package/build-module/hooks/custom-class-name.native.js.map +1 -1
- package/build-module/hooks/dimensions.js +0 -1
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +4 -2
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/layout.js +19 -22
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +3 -3
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +23 -26
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/supports.js +7 -1
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.js +2 -2
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +48 -72
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/constrained.js +6 -2
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/grid.js +151 -0
- package/build-module/layouts/grid.js.map +1 -0
- package/build-module/layouts/index.js +2 -1
- package/build-module/layouts/index.js.map +1 -1
- package/build-module/private-apis.js +5 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +10 -8
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +17 -3
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/object.js +69 -0
- package/build-module/utils/object.js.map +1 -0
- package/build-module/utils/parse-css-unit-to-px.js +15 -9
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-style/style-rtl.css +32 -12
- package/build-style/style.css +32 -12
- package/package.json +31 -31
- package/src/components/block-draggable/content.scss +1 -1
- package/src/components/block-inspector/style.scss +3 -0
- package/src/components/block-list/block-html.js +1 -1
- package/src/components/block-list/block-invalid-warning.js +72 -64
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +20 -2
- package/src/components/block-preview/auto.js +2 -17
- package/src/components/block-preview/test/index.js +0 -2
- package/src/components/block-settings-menu-controls/index.js +2 -1
- package/src/components/block-styles/style.scss +2 -2
- package/src/components/block-switcher/block-transformations-menu.native.js +1 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +16 -14
- package/src/components/colors-gradients/style.scss +8 -8
- package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +48 -38
- package/src/components/editor-styles/index.js +29 -1
- package/src/components/global-styles/border-panel.js +285 -0
- package/src/components/global-styles/color-panel.js +706 -0
- package/src/components/global-styles/dimensions-panel.js +13 -42
- package/src/components/global-styles/get-block-css-selector.js +129 -0
- package/src/components/global-styles/hooks.js +154 -1
- package/src/components/global-styles/index.js +3 -0
- package/src/components/global-styles/test/use-global-styles-output.js +31 -2
- package/src/components/global-styles/typography-panel.js +67 -45
- package/src/components/global-styles/use-global-styles-output.js +176 -93
- package/src/components/global-styles/utils.js +3 -0
- package/src/components/image-size-control/index.js +4 -3
- package/src/components/image-size-control/test/index.js +2 -2
- package/src/components/inner-blocks/README.md +1 -1
- package/src/components/inserter/index.js +30 -11
- package/src/components/inserter/menu.js +0 -1
- package/src/components/inserter/quick-inserter.js +2 -0
- package/src/components/inserter/search-results.js +7 -1
- package/src/components/inserter/style.scss +3 -0
- package/src/components/inserter/tabs.js +1 -9
- package/src/components/inspector-controls-tabs/position-controls-panel.js +40 -9
- package/src/components/line-height-control/index.js +10 -1
- package/src/components/link-control/index.js +1 -1
- package/src/components/link-control/search-item.js +3 -1
- package/src/components/link-control/style.scss +0 -4
- package/src/components/link-control/test/index.js +0 -2
- package/src/components/list-view/appender.js +101 -0
- package/src/components/list-view/block.js +5 -4
- package/src/components/list-view/branch.js +30 -1
- package/src/components/list-view/index.js +43 -10
- package/src/components/list-view/style.scss +19 -0
- package/src/components/list-view/use-block-selection.js +0 -2
- package/src/components/media-replace-flow/index.js +36 -24
- package/src/components/media-replace-flow/style.scss +5 -2
- package/src/components/off-canvas-editor/appender.js +31 -5
- package/src/components/off-canvas-editor/branch.js +3 -1
- package/src/components/off-canvas-editor/index.js +7 -7
- package/src/components/off-canvas-editor/link-ui.js +0 -1
- package/src/components/provider/use-block-sync.js +21 -4
- package/src/components/rich-text/format-edit.js +2 -32
- package/src/components/rich-text/format-toolbar-container.js +1 -7
- package/src/components/url-popover/test/index.js +0 -2
- package/src/components/writing-flow/use-input.js +4 -5
- package/src/hooks/border.js +93 -225
- package/src/hooks/color.js +120 -296
- package/src/hooks/content-lock-ui.js +6 -2
- package/src/hooks/{color-panel.js → contrast-checker.js} +10 -46
- package/src/hooks/custom-class-name.js +4 -4
- package/src/hooks/custom-class-name.native.js +3 -4
- package/src/hooks/dimensions.js +0 -1
- package/src/hooks/duotone.js +8 -5
- package/src/hooks/layout.js +19 -16
- package/src/hooks/position.js +3 -3
- package/src/hooks/style.js +29 -28
- package/src/hooks/supports.js +6 -0
- package/src/hooks/test/style.js +2 -1
- package/src/hooks/test/use-typography-props.js +2 -0
- package/src/hooks/test/utils.js +0 -104
- package/src/hooks/typography.js +2 -1
- package/src/hooks/utils.js +63 -70
- package/src/layouts/constrained.js +23 -17
- package/src/layouts/grid.js +172 -0
- package/src/layouts/index.js +2 -1
- package/src/layouts/test/grid.js +21 -0
- package/src/private-apis.js +4 -0
- package/src/store/actions.js +10 -8
- package/src/store/selectors.js +20 -3
- package/src/utils/object.js +69 -0
- package/src/utils/parse-css-unit-to-px.js +14 -9
- package/src/utils/test/object.js +107 -0
- package/src/utils/test/parse-css-unit-to-px.js +1 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/hooks/border-radius.js +0 -100
- package/build/hooks/border-radius.js.map +0 -1
- package/build/hooks/color-panel.js.map +0 -1
- package/build-module/hooks/border-radius.js +0 -84
- package/build-module/hooks/border-radius.js.map +0 -1
- package/build-module/hooks/color-panel.js.map +0 -1
- package/src/hooks/border-radius.js +0 -70
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
FontSizePicker,
|
|
6
|
+
__experimentalNumberControl as NumberControl,
|
|
6
7
|
__experimentalToolsPanel as ToolsPanel,
|
|
7
8
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
8
9
|
} from '@wordpress/components';
|
|
@@ -19,6 +20,10 @@ import LetterSpacingControl from '../letter-spacing-control';
|
|
|
19
20
|
import TextTransformControl from '../text-transform-control';
|
|
20
21
|
import TextDecorationControl from '../text-decoration-control';
|
|
21
22
|
import { getValueFromVariable } from './utils';
|
|
23
|
+
import { immutableSet } from '../../utils/object';
|
|
24
|
+
|
|
25
|
+
const MIN_TEXT_COLUMNS = 1;
|
|
26
|
+
const MAX_TEXT_COLUMNS = 6;
|
|
22
27
|
|
|
23
28
|
export function useHasTypographyPanel( settings ) {
|
|
24
29
|
const hasFontFamily = useHasFontFamilyControl( settings );
|
|
@@ -27,6 +32,7 @@ export function useHasTypographyPanel( settings ) {
|
|
|
27
32
|
const hasLetterSpacing = useHasLetterSpacingControl( settings );
|
|
28
33
|
const hasTextTransform = useHasTextTransformControl( settings );
|
|
29
34
|
const hasTextDecoration = useHasTextDecorationControl( settings );
|
|
35
|
+
const hasTextColumns = useHasTextColumnsControl( settings );
|
|
30
36
|
const hasFontSize = useHasFontSizeControl( settings );
|
|
31
37
|
|
|
32
38
|
return (
|
|
@@ -36,7 +42,8 @@ export function useHasTypographyPanel( settings ) {
|
|
|
36
42
|
hasLetterSpacing ||
|
|
37
43
|
hasTextTransform ||
|
|
38
44
|
hasFontSize ||
|
|
39
|
-
hasTextDecoration
|
|
45
|
+
hasTextDecoration ||
|
|
46
|
+
hasTextColumns
|
|
40
47
|
);
|
|
41
48
|
}
|
|
42
49
|
|
|
@@ -93,6 +100,10 @@ function useHasTextDecorationControl( settings ) {
|
|
|
93
100
|
return settings?.typography?.textDecoration;
|
|
94
101
|
}
|
|
95
102
|
|
|
103
|
+
function useHasTextColumnsControl( settings ) {
|
|
104
|
+
return settings?.typography?.textColumns;
|
|
105
|
+
}
|
|
106
|
+
|
|
96
107
|
function TypographyToolsPanel( {
|
|
97
108
|
resetAllFilter,
|
|
98
109
|
onChange,
|
|
@@ -124,6 +135,7 @@ const DEFAULT_CONTROLS = {
|
|
|
124
135
|
letterSpacing: true,
|
|
125
136
|
textTransform: true,
|
|
126
137
|
textDecoration: true,
|
|
138
|
+
textColumns: true,
|
|
127
139
|
};
|
|
128
140
|
|
|
129
141
|
export default function TypographyPanel( {
|
|
@@ -150,15 +162,13 @@ export default function TypographyPanel( {
|
|
|
150
162
|
const slug = fontFamilies?.find(
|
|
151
163
|
( { fontFamily: f } ) => f === newValue
|
|
152
164
|
)?.slug;
|
|
153
|
-
onChange(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
},
|
|
161
|
-
} );
|
|
165
|
+
onChange(
|
|
166
|
+
immutableSet(
|
|
167
|
+
value,
|
|
168
|
+
[ 'typography', 'fontFamily' ],
|
|
169
|
+
slug ? `var:preset|font-family|${ slug }` : newValue
|
|
170
|
+
)
|
|
171
|
+
);
|
|
162
172
|
};
|
|
163
173
|
const hasFontFamily = () => !! value?.typography?.fontFamily;
|
|
164
174
|
const resetFontFamily = () => setFontFamily( undefined );
|
|
@@ -177,13 +187,9 @@ export default function TypographyPanel( {
|
|
|
177
187
|
? `var:preset|font-size|${ metadata?.slug }`
|
|
178
188
|
: newValue;
|
|
179
189
|
|
|
180
|
-
onChange(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
...value?.typography,
|
|
184
|
-
fontSize: actualValue,
|
|
185
|
-
},
|
|
186
|
-
} );
|
|
190
|
+
onChange(
|
|
191
|
+
immutableSet( value, [ 'typography', 'fontSize' ], actualValue )
|
|
192
|
+
);
|
|
187
193
|
};
|
|
188
194
|
const hasFontSize = () => !! value?.typography?.fontSize;
|
|
189
195
|
const resetFontSize = () => setFontSize( undefined );
|
|
@@ -218,13 +224,9 @@ export default function TypographyPanel( {
|
|
|
218
224
|
const hasLineHeightEnabled = useHasLineHeightControl( settings );
|
|
219
225
|
const lineHeight = decodeValue( inheritedValue?.typography?.lineHeight );
|
|
220
226
|
const setLineHeight = ( newValue ) => {
|
|
221
|
-
onChange(
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
...value?.typography,
|
|
225
|
-
lineHeight: newValue,
|
|
226
|
-
},
|
|
227
|
-
} );
|
|
227
|
+
onChange(
|
|
228
|
+
immutableSet( value, [ 'typography', 'lineHeight' ], newValue )
|
|
229
|
+
);
|
|
228
230
|
};
|
|
229
231
|
const hasLineHeight = () => !! value?.typography?.lineHeight;
|
|
230
232
|
const resetLineHeight = () => setLineHeight( undefined );
|
|
@@ -235,30 +237,33 @@ export default function TypographyPanel( {
|
|
|
235
237
|
inheritedValue?.typography?.letterSpacing
|
|
236
238
|
);
|
|
237
239
|
const setLetterSpacing = ( newValue ) => {
|
|
238
|
-
onChange(
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
...value?.typography,
|
|
242
|
-
letterSpacing: newValue,
|
|
243
|
-
},
|
|
244
|
-
} );
|
|
240
|
+
onChange(
|
|
241
|
+
immutableSet( value, [ 'typography', 'letterSpacing' ], newValue )
|
|
242
|
+
);
|
|
245
243
|
};
|
|
246
244
|
const hasLetterSpacing = () => !! value?.typography?.letterSpacing;
|
|
247
245
|
const resetLetterSpacing = () => setLetterSpacing( undefined );
|
|
248
246
|
|
|
247
|
+
// Text Columns
|
|
248
|
+
const hasTextColumnsControl = useHasTextColumnsControl( settings );
|
|
249
|
+
const textColumns = decodeValue( inheritedValue?.typography?.textColumns );
|
|
250
|
+
const setTextColumns = ( newValue ) => {
|
|
251
|
+
onChange(
|
|
252
|
+
immutableSet( value, [ 'typography', 'textColumns' ], newValue )
|
|
253
|
+
);
|
|
254
|
+
};
|
|
255
|
+
const hasTextColumns = () => !! value?.typography?.textColumns;
|
|
256
|
+
const resetTextColumns = () => setTextColumns( undefined );
|
|
257
|
+
|
|
249
258
|
// Text Transform
|
|
250
259
|
const hasTextTransformControl = useHasTextTransformControl( settings );
|
|
251
260
|
const textTransform = decodeValue(
|
|
252
261
|
inheritedValue?.typography?.textTransform
|
|
253
262
|
);
|
|
254
263
|
const setTextTransform = ( newValue ) => {
|
|
255
|
-
onChange(
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
...value?.typography,
|
|
259
|
-
textTransform: newValue,
|
|
260
|
-
},
|
|
261
|
-
} );
|
|
264
|
+
onChange(
|
|
265
|
+
immutableSet( value, [ 'typography', 'textTransform' ], newValue )
|
|
266
|
+
);
|
|
262
267
|
};
|
|
263
268
|
const hasTextTransform = () => !! value?.typography?.textTransform;
|
|
264
269
|
const resetTextTransform = () => setTextTransform( undefined );
|
|
@@ -269,13 +274,9 @@ export default function TypographyPanel( {
|
|
|
269
274
|
inheritedValue?.typography?.textDecoration
|
|
270
275
|
);
|
|
271
276
|
const setTextDecoration = ( newValue ) => {
|
|
272
|
-
onChange(
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
...value?.typography,
|
|
276
|
-
textDecoration: newValue,
|
|
277
|
-
},
|
|
278
|
-
} );
|
|
277
|
+
onChange(
|
|
278
|
+
immutableSet( value, [ 'typography', 'textDecoration' ], newValue )
|
|
279
|
+
);
|
|
279
280
|
};
|
|
280
281
|
const hasTextDecoration = () => !! value?.typography?.textDecoration;
|
|
281
282
|
const resetTextDecoration = () => setTextDecoration( undefined );
|
|
@@ -388,6 +389,27 @@ export default function TypographyPanel( {
|
|
|
388
389
|
/>
|
|
389
390
|
</ToolsPanelItem>
|
|
390
391
|
) }
|
|
392
|
+
{ hasTextColumnsControl && (
|
|
393
|
+
<ToolsPanelItem
|
|
394
|
+
className="single-column"
|
|
395
|
+
label={ __( 'Text columns' ) }
|
|
396
|
+
hasValue={ hasTextColumns }
|
|
397
|
+
onDeselect={ resetTextColumns }
|
|
398
|
+
isShownByDefault={ defaultControls.textColumns }
|
|
399
|
+
panelId={ panelId }
|
|
400
|
+
>
|
|
401
|
+
<NumberControl
|
|
402
|
+
label={ __( 'Text columns' ) }
|
|
403
|
+
max={ MAX_TEXT_COLUMNS }
|
|
404
|
+
min={ MIN_TEXT_COLUMNS }
|
|
405
|
+
onChange={ setTextColumns }
|
|
406
|
+
size="__unstable-large"
|
|
407
|
+
spinControls="custom"
|
|
408
|
+
value={ textColumns }
|
|
409
|
+
initialPosition={ 1 }
|
|
410
|
+
/>
|
|
411
|
+
</ToolsPanelItem>
|
|
412
|
+
) }
|
|
391
413
|
{ hasTextDecorationControl && (
|
|
392
414
|
<ToolsPanelItem
|
|
393
415
|
className="single-column"
|
|
@@ -13,13 +13,14 @@ import {
|
|
|
13
13
|
store as blocksStore,
|
|
14
14
|
} from '@wordpress/blocks';
|
|
15
15
|
import { useSelect } from '@wordpress/data';
|
|
16
|
-
import { useContext, useMemo } from '@wordpress/element';
|
|
16
|
+
import { renderToString, useContext, useMemo } from '@wordpress/element';
|
|
17
17
|
import { getCSSRules } from '@wordpress/style-engine';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Internal dependencies
|
|
21
21
|
*/
|
|
22
22
|
import { PRESET_METADATA, ROOT_BLOCK_SELECTOR, scopeSelector } from './utils';
|
|
23
|
+
import { getBlockCSSSelector } from './get-block-css-selector';
|
|
23
24
|
import { getTypographyFontSizeValue } from './typography-utils';
|
|
24
25
|
import { GlobalStylesContext } from './context';
|
|
25
26
|
import { useGlobalSetting } from './hooks';
|
|
@@ -95,11 +96,11 @@ function getPresetsDeclarations( blockPresets = {}, mergedSettings ) {
|
|
|
95
96
|
/**
|
|
96
97
|
* Transform given preset tree into a set of preset class declarations.
|
|
97
98
|
*
|
|
98
|
-
* @param {string} blockSelector
|
|
99
|
-
* @param {Object}
|
|
99
|
+
* @param {?string} blockSelector
|
|
100
|
+
* @param {Object} blockPresets
|
|
100
101
|
* @return {string} CSS declarations for the preset classes.
|
|
101
102
|
*/
|
|
102
|
-
function getPresetsClasses( blockSelector, blockPresets = {} ) {
|
|
103
|
+
function getPresetsClasses( blockSelector = '*', blockPresets = {} ) {
|
|
103
104
|
return PRESET_METADATA.reduce(
|
|
104
105
|
( declarations, { path, cssVarInfix, classes } ) => {
|
|
105
106
|
if ( ! classes ) {
|
|
@@ -144,13 +145,16 @@ function getPresetsSvgFilters( blockPresets = {} ) {
|
|
|
144
145
|
return [ 'default', 'theme' ]
|
|
145
146
|
.filter( ( origin ) => presetByOrigin[ origin ] )
|
|
146
147
|
.flatMap( ( origin ) =>
|
|
147
|
-
presetByOrigin[ origin ].map( ( preset ) =>
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
148
|
+
presetByOrigin[ origin ].map( ( preset ) =>
|
|
149
|
+
renderToString(
|
|
150
|
+
<PresetDuotoneFilter
|
|
151
|
+
preset={ preset }
|
|
152
|
+
key={ preset.slug }
|
|
153
|
+
/>
|
|
154
|
+
)
|
|
155
|
+
)
|
|
156
|
+
)
|
|
157
|
+
.join( '' );
|
|
154
158
|
} );
|
|
155
159
|
}
|
|
156
160
|
|
|
@@ -193,6 +197,89 @@ function concatFeatureVariationSelectorString(
|
|
|
193
197
|
return combinedSelectors.join( ', ' );
|
|
194
198
|
}
|
|
195
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Generate style declarations for a block's custom feature and subfeature
|
|
202
|
+
* selectors.
|
|
203
|
+
*
|
|
204
|
+
* NOTE: The passed `styles` object will be mutated by this function.
|
|
205
|
+
*
|
|
206
|
+
* @param {Object} selectors Custom selectors object for a block.
|
|
207
|
+
* @param {Object} styles A block's styles object.
|
|
208
|
+
*
|
|
209
|
+
* @return {Object} Style declarations.
|
|
210
|
+
*/
|
|
211
|
+
const getFeatureDeclarations = ( selectors, styles ) => {
|
|
212
|
+
const declarations = {};
|
|
213
|
+
|
|
214
|
+
Object.entries( selectors ).forEach( ( [ feature, selector ] ) => {
|
|
215
|
+
// We're only processing features/subfeatures that have styles.
|
|
216
|
+
if ( feature === 'root' || ! styles?.[ feature ] ) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const isShorthand = typeof selector === 'string';
|
|
221
|
+
|
|
222
|
+
// If we have a selector object instead of shorthand process it.
|
|
223
|
+
if ( ! isShorthand ) {
|
|
224
|
+
Object.entries( selector ).forEach(
|
|
225
|
+
( [ subfeature, subfeatureSelector ] ) => {
|
|
226
|
+
// Don't process root feature selector yet or any
|
|
227
|
+
// subfeature that doesn't have a style.
|
|
228
|
+
if (
|
|
229
|
+
subfeature === 'root' ||
|
|
230
|
+
! styles?.[ feature ][ subfeature ]
|
|
231
|
+
) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Create a temporary styles object and build
|
|
236
|
+
// declarations for subfeature.
|
|
237
|
+
const subfeatureStyles = {
|
|
238
|
+
[ feature ]: {
|
|
239
|
+
[ subfeature ]: styles[ feature ][ subfeature ],
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
const newDeclarations =
|
|
243
|
+
getStylesDeclarations( subfeatureStyles );
|
|
244
|
+
|
|
245
|
+
// Merge new declarations in with any others that
|
|
246
|
+
// share the same selector.
|
|
247
|
+
declarations[ subfeatureSelector ] = [
|
|
248
|
+
...( declarations[ subfeatureSelector ] || [] ),
|
|
249
|
+
...newDeclarations,
|
|
250
|
+
];
|
|
251
|
+
|
|
252
|
+
// Remove the subfeature's style now it will be
|
|
253
|
+
// included under its own selector not the block's.
|
|
254
|
+
delete styles[ feature ][ subfeature ];
|
|
255
|
+
}
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// Now subfeatures have been processed and removed, we can
|
|
260
|
+
// process root, or shorthand, feature selectors.
|
|
261
|
+
if ( isShorthand || selector.root ) {
|
|
262
|
+
const featureSelector = isShorthand ? selector : selector.root;
|
|
263
|
+
|
|
264
|
+
// Create temporary style object and build declarations for feature.
|
|
265
|
+
const featureStyles = { [ feature ]: styles[ feature ] };
|
|
266
|
+
const newDeclarations = getStylesDeclarations( featureStyles );
|
|
267
|
+
|
|
268
|
+
// Merge new declarations with any others that share the selector.
|
|
269
|
+
declarations[ featureSelector ] = [
|
|
270
|
+
...( declarations[ featureSelector ] || [] ),
|
|
271
|
+
...newDeclarations,
|
|
272
|
+
];
|
|
273
|
+
|
|
274
|
+
// Remove the feature from the block's styles now as it will be
|
|
275
|
+
// included under its own selector not the block's.
|
|
276
|
+
delete styles[ feature ];
|
|
277
|
+
}
|
|
278
|
+
} );
|
|
279
|
+
|
|
280
|
+
return declarations;
|
|
281
|
+
};
|
|
282
|
+
|
|
196
283
|
/**
|
|
197
284
|
* Transform given style tree into a set of style declarations.
|
|
198
285
|
*
|
|
@@ -399,7 +486,7 @@ export function getLayoutStyles( {
|
|
|
399
486
|
? `${ selector } .${ className }${
|
|
400
487
|
spacingStyle?.selector || ''
|
|
401
488
|
}`
|
|
402
|
-
: `${ selector }
|
|
489
|
+
: `${ selector }-${ className }${ selector }-${ className }${
|
|
403
490
|
spacingStyle?.selector || ''
|
|
404
491
|
}`;
|
|
405
492
|
}
|
|
@@ -496,9 +583,9 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
496
583
|
}
|
|
497
584
|
|
|
498
585
|
Object.entries( ELEMENTS ).forEach( ( [ name, selector ] ) => {
|
|
499
|
-
if ( !! tree.styles?.elements[ name ] ) {
|
|
586
|
+
if ( !! tree.styles?.elements?.[ name ] ) {
|
|
500
587
|
nodes.push( {
|
|
501
|
-
styles: tree.styles?.elements[ name ],
|
|
588
|
+
styles: tree.styles?.elements?.[ name ],
|
|
502
589
|
selector,
|
|
503
590
|
} );
|
|
504
591
|
}
|
|
@@ -529,7 +616,7 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
529
616
|
blockSelectors[ blockName ].fallbackGapValue,
|
|
530
617
|
hasLayoutSupport:
|
|
531
618
|
blockSelectors[ blockName ].hasLayoutSupport,
|
|
532
|
-
selector: blockSelectors[ blockName ]
|
|
619
|
+
selector: blockSelectors[ blockName ]?.selector,
|
|
533
620
|
styles: blockStyles,
|
|
534
621
|
featureSelectors:
|
|
535
622
|
blockSelectors[ blockName ].featureSelectors,
|
|
@@ -547,7 +634,7 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
547
634
|
) {
|
|
548
635
|
nodes.push( {
|
|
549
636
|
styles: value,
|
|
550
|
-
selector: blockSelectors[ blockName ]
|
|
637
|
+
selector: blockSelectors[ blockName ]?.selector
|
|
551
638
|
.split( ',' )
|
|
552
639
|
.map( ( sel ) => {
|
|
553
640
|
const elementSelectors =
|
|
@@ -606,7 +693,7 @@ export const getNodesWithSettings = ( tree, blockSelectors ) => {
|
|
|
606
693
|
nodes.push( {
|
|
607
694
|
presets: blockPresets,
|
|
608
695
|
custom: blockCustom,
|
|
609
|
-
selector: blockSelectors[ blockName ]
|
|
696
|
+
selector: blockSelectors[ blockName ]?.selector,
|
|
610
697
|
} );
|
|
611
698
|
}
|
|
612
699
|
}
|
|
@@ -692,23 +779,16 @@ export const toStyles = (
|
|
|
692
779
|
// Process styles for block support features with custom feature level
|
|
693
780
|
// CSS selectors set.
|
|
694
781
|
if ( featureSelectors ) {
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
if ( !! featureDeclarations.length ) {
|
|
706
|
-
ruleset =
|
|
707
|
-
ruleset +
|
|
708
|
-
`${ featureSelector }{${ featureDeclarations.join(
|
|
709
|
-
';'
|
|
710
|
-
) } }`;
|
|
711
|
-
}
|
|
782
|
+
const featureDeclarations = getFeatureDeclarations(
|
|
783
|
+
featureSelectors,
|
|
784
|
+
styles
|
|
785
|
+
);
|
|
786
|
+
|
|
787
|
+
Object.entries( featureDeclarations ).forEach(
|
|
788
|
+
( [ cssSelector, declarations ] ) => {
|
|
789
|
+
if ( !! declarations.length ) {
|
|
790
|
+
const rules = declarations.join( ';' );
|
|
791
|
+
ruleset = ruleset + `${ cssSelector }{${ rules }}`;
|
|
712
792
|
}
|
|
713
793
|
}
|
|
714
794
|
);
|
|
@@ -720,43 +800,32 @@ export const toStyles = (
|
|
|
720
800
|
if ( styles?.variations?.[ styleVariationName ] ) {
|
|
721
801
|
// If the block uses any custom selectors for block support, add those first.
|
|
722
802
|
if ( featureSelectors ) {
|
|
723
|
-
|
|
724
|
-
(
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
featureStyles
|
|
803
|
+
const featureDeclarations =
|
|
804
|
+
getFeatureDeclarations(
|
|
805
|
+
featureSelectors,
|
|
806
|
+
styles?.variations?.[
|
|
807
|
+
styleVariationName
|
|
808
|
+
]
|
|
809
|
+
);
|
|
810
|
+
|
|
811
|
+
Object.entries( featureDeclarations ).forEach(
|
|
812
|
+
( [ baseSelector, declarations ] ) => {
|
|
813
|
+
if ( !! declarations.length ) {
|
|
814
|
+
const cssSelector =
|
|
815
|
+
concatFeatureVariationSelectorString(
|
|
816
|
+
baseSelector,
|
|
817
|
+
styleVariationSelector
|
|
739
818
|
);
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
!! featureDeclarations.length
|
|
746
|
-
) {
|
|
747
|
-
ruleset =
|
|
748
|
-
ruleset +
|
|
749
|
-
`${ concatFeatureVariationSelectorString(
|
|
750
|
-
featureSelector,
|
|
751
|
-
styleVariationSelector
|
|
752
|
-
) }{${ featureDeclarations.join(
|
|
753
|
-
';'
|
|
754
|
-
) } }`;
|
|
755
|
-
}
|
|
819
|
+
const rules =
|
|
820
|
+
declarations.join( ';' );
|
|
821
|
+
ruleset =
|
|
822
|
+
ruleset +
|
|
823
|
+
`${ cssSelector }{${ rules }}`;
|
|
756
824
|
}
|
|
757
825
|
}
|
|
758
826
|
);
|
|
759
827
|
}
|
|
828
|
+
|
|
760
829
|
// Otherwise add regular selectors.
|
|
761
830
|
const styleVariationDeclarations =
|
|
762
831
|
getStylesDeclarations(
|
|
@@ -907,15 +976,37 @@ export function toSvgFilters( tree, blockSelectors ) {
|
|
|
907
976
|
} );
|
|
908
977
|
}
|
|
909
978
|
|
|
979
|
+
const getSelectorsConfig = ( blockType, rootSelector ) => {
|
|
980
|
+
if ( ! isEmpty( blockType?.selectors ) ) {
|
|
981
|
+
return blockType.selectors;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
const config = { root: rootSelector };
|
|
985
|
+
Object.entries( BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS ).forEach(
|
|
986
|
+
( [ featureKey, featureName ] ) => {
|
|
987
|
+
const featureSelector = getBlockCSSSelector(
|
|
988
|
+
blockType,
|
|
989
|
+
featureKey
|
|
990
|
+
);
|
|
991
|
+
|
|
992
|
+
if ( featureSelector ) {
|
|
993
|
+
config[ featureName ] = featureSelector;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
);
|
|
997
|
+
|
|
998
|
+
return config;
|
|
999
|
+
};
|
|
1000
|
+
|
|
910
1001
|
export const getBlockSelectors = ( blockTypes, getBlockStyles ) => {
|
|
911
1002
|
const result = {};
|
|
912
1003
|
blockTypes.forEach( ( blockType ) => {
|
|
913
1004
|
const name = blockType.name;
|
|
914
|
-
const selector =
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
1005
|
+
const selector = getBlockCSSSelector( blockType, 'root' );
|
|
1006
|
+
const duotoneSelector = getBlockCSSSelector(
|
|
1007
|
+
blockType,
|
|
1008
|
+
'filter.duotone'
|
|
1009
|
+
);
|
|
919
1010
|
const hasLayoutSupport = !! blockType?.supports?.__experimentalLayout;
|
|
920
1011
|
const fallbackGapValue =
|
|
921
1012
|
blockType?.supports?.spacing?.blockGap?.__experimentalDefault;
|
|
@@ -930,20 +1021,7 @@ export const getBlockSelectors = ( blockTypes, getBlockStyles ) => {
|
|
|
930
1021
|
} );
|
|
931
1022
|
}
|
|
932
1023
|
// For each block support feature add any custom selectors.
|
|
933
|
-
const featureSelectors =
|
|
934
|
-
Object.entries( BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS ).forEach(
|
|
935
|
-
( [ featureKey, featureName ] ) => {
|
|
936
|
-
const featureSelector =
|
|
937
|
-
blockType?.supports?.[ featureKey ]?.__experimentalSelector;
|
|
938
|
-
|
|
939
|
-
if ( featureSelector ) {
|
|
940
|
-
featureSelectors[ featureName ] = scopeSelector(
|
|
941
|
-
selector,
|
|
942
|
-
featureSelector
|
|
943
|
-
);
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
);
|
|
1024
|
+
const featureSelectors = getSelectorsConfig( blockType, selector );
|
|
947
1025
|
|
|
948
1026
|
result[ name ] = {
|
|
949
1027
|
duotoneSelector,
|
|
@@ -973,10 +1051,10 @@ export const getBlockSelectors = ( blockTypes, getBlockStyles ) => {
|
|
|
973
1051
|
*/
|
|
974
1052
|
function updateConfigWithSeparator( config ) {
|
|
975
1053
|
const needsSeparatorStyleUpdate =
|
|
976
|
-
config.styles?.blocks[ 'core/separator' ] &&
|
|
977
|
-
config.styles?.blocks[ 'core/separator' ].color?.background &&
|
|
978
|
-
! config.styles?.blocks[ 'core/separator' ].color?.text &&
|
|
979
|
-
! config.styles?.blocks[ 'core/separator' ].border?.color;
|
|
1054
|
+
config.styles?.blocks?.[ 'core/separator' ] &&
|
|
1055
|
+
config.styles?.blocks?.[ 'core/separator' ].color?.background &&
|
|
1056
|
+
! config.styles?.blocks?.[ 'core/separator' ].color?.text &&
|
|
1057
|
+
! config.styles?.blocks?.[ 'core/separator' ].border?.color;
|
|
980
1058
|
if ( needsSeparatorStyleUpdate ) {
|
|
981
1059
|
return {
|
|
982
1060
|
...config,
|
|
@@ -1049,9 +1127,9 @@ export function useGlobalStylesOutput() {
|
|
|
1049
1127
|
hasFallbackGapSupport,
|
|
1050
1128
|
disableLayoutStyles
|
|
1051
1129
|
);
|
|
1130
|
+
const svgs = toSvgFilters( mergedConfig, blockSelectors );
|
|
1052
1131
|
|
|
1053
|
-
const
|
|
1054
|
-
const stylesheets = [
|
|
1132
|
+
const styles = [
|
|
1055
1133
|
{
|
|
1056
1134
|
css: customProperties,
|
|
1057
1135
|
isGlobalStyles: true,
|
|
@@ -1065,6 +1143,11 @@ export function useGlobalStylesOutput() {
|
|
|
1065
1143
|
css: mergedConfig.styles.css ?? '',
|
|
1066
1144
|
isGlobalStyles: true,
|
|
1067
1145
|
},
|
|
1146
|
+
{
|
|
1147
|
+
assets: svgs,
|
|
1148
|
+
__unstableType: 'svg',
|
|
1149
|
+
isGlobalStyles: true,
|
|
1150
|
+
},
|
|
1068
1151
|
];
|
|
1069
1152
|
|
|
1070
1153
|
// Loop through the blocks to check if there are custom CSS values.
|
|
@@ -1073,7 +1156,7 @@ export function useGlobalStylesOutput() {
|
|
|
1073
1156
|
getBlockTypes().forEach( ( blockType ) => {
|
|
1074
1157
|
if ( mergedConfig.styles.blocks[ blockType.name ]?.css ) {
|
|
1075
1158
|
const selector = blockSelectors[ blockType.name ].selector;
|
|
1076
|
-
|
|
1159
|
+
styles.push( {
|
|
1077
1160
|
css: processCSSNesting(
|
|
1078
1161
|
mergedConfig.styles.blocks[ blockType.name ]?.css,
|
|
1079
1162
|
selector
|
|
@@ -1083,7 +1166,7 @@ export function useGlobalStylesOutput() {
|
|
|
1083
1166
|
}
|
|
1084
1167
|
} );
|
|
1085
1168
|
|
|
1086
|
-
return [
|
|
1169
|
+
return [ styles, mergedConfig.settings ];
|
|
1087
1170
|
}, [
|
|
1088
1171
|
hasBlockGapSupport,
|
|
1089
1172
|
hasFallbackGapSupport,
|
|
@@ -16,7 +16,9 @@ export const ROOT_BLOCK_SUPPORTS = [
|
|
|
16
16
|
'backgroundColor',
|
|
17
17
|
'color',
|
|
18
18
|
'linkColor',
|
|
19
|
+
'captionColor',
|
|
19
20
|
'buttonColor',
|
|
21
|
+
'headingColor',
|
|
20
22
|
'fontFamily',
|
|
21
23
|
'fontSize',
|
|
22
24
|
'fontStyle',
|
|
@@ -103,6 +105,7 @@ export const STYLE_PATH_TO_CSS_VAR_INFIX = {
|
|
|
103
105
|
'elements.link.typography.fontSize': 'font-size',
|
|
104
106
|
'elements.button.color.text': 'color',
|
|
105
107
|
'elements.button.color.background': 'color',
|
|
108
|
+
'elements.caption.color.text': 'color',
|
|
106
109
|
'elements.button.typography.fontFamily': 'font-family',
|
|
107
110
|
'elements.button.typography.fontSize': 'font-size',
|
|
108
111
|
'elements.heading.color': 'color',
|
|
@@ -38,17 +38,16 @@ export default function ImageSizeControl( {
|
|
|
38
38
|
{ imageSizeOptions && imageSizeOptions.length > 0 && (
|
|
39
39
|
<SelectControl
|
|
40
40
|
__nextHasNoMarginBottom
|
|
41
|
-
label={ __( '
|
|
41
|
+
label={ __( 'Resolution' ) }
|
|
42
42
|
value={ slug }
|
|
43
43
|
options={ imageSizeOptions }
|
|
44
44
|
onChange={ onChangeImage }
|
|
45
45
|
help={ imageSizeHelp }
|
|
46
|
+
size="__unstable-large"
|
|
46
47
|
/>
|
|
47
48
|
) }
|
|
48
49
|
{ isResizable && (
|
|
49
50
|
<div className="block-editor-image-size-control">
|
|
50
|
-
<p>{ __( 'Image dimensions' ) }</p>
|
|
51
|
-
|
|
52
51
|
<HStack align="baseline" spacing="3">
|
|
53
52
|
<NumberControl
|
|
54
53
|
className="block-editor-image-size-control__width"
|
|
@@ -58,6 +57,7 @@ export default function ImageSizeControl( {
|
|
|
58
57
|
onChange={ ( value ) =>
|
|
59
58
|
updateDimension( 'width', value )
|
|
60
59
|
}
|
|
60
|
+
size="__unstable-large"
|
|
61
61
|
/>
|
|
62
62
|
<NumberControl
|
|
63
63
|
className="block-editor-image-size-control__height"
|
|
@@ -67,6 +67,7 @@ export default function ImageSizeControl( {
|
|
|
67
67
|
onChange={ ( value ) =>
|
|
68
68
|
updateDimension( 'height', value )
|
|
69
69
|
}
|
|
70
|
+
size="__unstable-large"
|
|
70
71
|
/>
|
|
71
72
|
</HStack>
|
|
72
73
|
<HStack>
|
|
@@ -334,7 +334,7 @@ describe( 'ImageSizeControl', () => {
|
|
|
334
334
|
);
|
|
335
335
|
|
|
336
336
|
expect(
|
|
337
|
-
screen.getByRole( 'combobox', { name: '
|
|
337
|
+
screen.getByRole( 'combobox', { name: 'Resolution' } )
|
|
338
338
|
).toHaveValue( 'medium' );
|
|
339
339
|
} );
|
|
340
340
|
|
|
@@ -351,7 +351,7 @@ describe( 'ImageSizeControl', () => {
|
|
|
351
351
|
);
|
|
352
352
|
|
|
353
353
|
await user.selectOptions(
|
|
354
|
-
screen.getByRole( 'combobox', { name: '
|
|
354
|
+
screen.getByRole( 'combobox', { name: 'Resolution' } ),
|
|
355
355
|
'thumbnail'
|
|
356
356
|
);
|
|
357
357
|
|
|
@@ -130,7 +130,7 @@ _Options:_
|
|
|
130
130
|
- `'insert'` — prevents inserting or removing blocks, but allows moving existing ones.
|
|
131
131
|
- `false` — prevents locking from being applied to an `InnerBlocks` area even if a parent block contains locking. ( Boolean )
|
|
132
132
|
|
|
133
|
-
If locking is not set in an `InnerBlocks` area: the locking of the parent `InnerBlocks` area is used. Note that `contentOnly` can't be
|
|
133
|
+
If locking is not set in an `InnerBlocks` area: the locking of the parent `InnerBlocks` area is used. Note that `contentOnly` can't be overridden: it's present, the `templateLock` value of any children is ignored.
|
|
134
134
|
|
|
135
135
|
If the block is a top level block: the locking of the Custom Post Type is used.
|
|
136
136
|
|