@wordpress/block-editor 11.6.0 → 11.8.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 +46 -55
- 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.native.js +4 -3
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +11 -21
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +3 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-popover/inbetween.js +2 -9
- package/build/components/block-popover/inbetween.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/block-settings-dropdown.js +1 -10
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/caption/index.native.js +0 -1
- package/build/components/caption/index.native.js.map +1 -1
- package/build/components/date-format-picker/index.js +1 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/editor-styles/index.js +20 -2
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +15 -29
- package/build/components/global-styles/border-panel.js.map +1 -1
- 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 +23 -44
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/effects-panel.js +244 -0
- package/build/components/global-styles/effects-panel.js.map +1 -0
- package/build/components/global-styles/filters-panel.js +151 -0
- package/build/components/global-styles/filters-panel.js.map +1 -0
- package/build/components/global-styles/get-block-css-selector.js +118 -0
- package/build/components/global-styles/get-block-css-selector.js.map +1 -0
- package/build/components/global-styles/hooks.js +60 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +46 -2
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +9 -35
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +173 -91
- 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/iframe/index.js +1 -1
- package/build/components/iframe/index.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/image-size-control/use-dimension-handler.js +5 -3
- package/build/components/image-size-control/use-dimension-handler.js.map +1 -1
- package/build/components/index.js +16 -0
- package/build/components/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +4 -2
- package/build/components/inserter/block-patterns-tab.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/inspector-controls-tabs/utils.js +5 -3
- package/build/components/inspector-controls-tabs/utils.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/list-view/appender.js +105 -0
- package/build/components/list-view/appender.js.map +1 -0
- package/build/components/list-view/block.js +6 -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 +56 -14
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +7 -3
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +8 -2
- package/build/components/list-view/use-list-view-drop-zone.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/block-contents.js +6 -1
- package/build/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +17 -14
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/resizable-box-popover/index.js +38 -0
- package/build/components/resizable-box-popover/index.js.map +1 -0
- 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/index.js +0 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +7 -11
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +8 -0
- package/build/components/spacing-sizes-control/spacing-input-control.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/anchor.js +1 -1
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border.js +1 -2
- 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/dimensions.js +0 -1
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +92 -64
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/margin.js +27 -17
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +19 -9
- package/build/hooks/padding.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/typography.js +0 -1
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +28 -76
- package/build/hooks/utils.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/layouts/utils.js +3 -2
- package/build/layouts/utils.js.map +1 -1
- package/build/private-apis.js +7 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +1 -1
- package/build/store/actions.js.map +1 -1
- package/build/utils/object.js +76 -0
- package/build/utils/object.js.map +1 -0
- 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.native.js +4 -3
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +11 -19
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +2 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +2 -9
- package/build-module/components/block-popover/inbetween.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/block-settings-dropdown.js +1 -9
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/caption/index.native.js +0 -1
- package/build-module/components/caption/index.native.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +1 -1
- package/build-module/components/date-format-picker/index.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 +15 -29
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- 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 +22 -44
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/effects-panel.js +228 -0
- package/build-module/components/global-styles/effects-panel.js.map +1 -0
- package/build-module/components/global-styles/filters-panel.js +139 -0
- package/build-module/components/global-styles/filters-panel.js.map +1 -0
- package/build-module/components/global-styles/get-block-css-selector.js +109 -0
- package/build-module/components/global-styles/get-block-css-selector.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +58 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +5 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +8 -35
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +175 -93
- 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/iframe/index.js +1 -1
- package/build-module/components/iframe/index.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/image-size-control/use-dimension-handler.js +5 -3
- package/build-module/components/image-size-control/use-dimension-handler.js.map +1 -1
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +5 -2
- package/build-module/components/inserter/block-patterns-tab.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/inspector-controls-tabs/utils.js +4 -3
- package/build-module/components/inspector-controls-tabs/utils.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/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 +6 -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 +50 -13
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +7 -3
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +8 -4
- package/build-module/components/list-view/use-list-view-drop-zone.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/block-contents.js +5 -1
- package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +17 -14
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/resizable-box-popover/index.js +26 -0
- package/build-module/components/resizable-box-popover/index.js.map +1 -0
- 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/index.js +0 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +7 -10
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +7 -0
- package/build-module/components/spacing-sizes-control/spacing-input-control.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/anchor.js +1 -1
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border.js +1 -2
- 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/dimensions.js +0 -1
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +91 -65
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/margin.js +29 -18
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +21 -10
- package/build-module/hooks/padding.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/typography.js +0 -1
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +27 -74
- package/build-module/hooks/utils.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/layouts/utils.js +3 -2
- package/build-module/layouts/utils.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 +1 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/utils/object.js +69 -0
- package/build-module/utils/object.js.map +1 -0
- package/build-style/style-rtl.css +77 -16
- package/build-style/style.css +77 -16
- package/package.json +31 -31
- package/src/components/block-draggable/content.scss +1 -1
- package/src/components/block-inspector/style.scss +6 -4
- package/src/components/block-list/block-html.js +1 -1
- package/src/components/block-list/block.native.js +3 -2
- package/src/components/block-list/index.native.js +19 -38
- package/src/components/block-list/use-in-between-inserter.js +4 -1
- package/src/components/block-popover/inbetween.js +2 -13
- package/src/components/block-preview/auto.js +2 -17
- package/src/components/block-settings-menu/block-settings-dropdown.js +2 -12
- package/src/components/caption/index.native.js +0 -1
- package/src/components/colors-gradients/style.scss +8 -8
- package/src/components/date-format-picker/index.js +1 -1
- package/src/components/editor-styles/index.js +29 -1
- package/src/components/global-styles/README.md +129 -16
- package/src/components/global-styles/border-panel.js +13 -32
- package/src/components/global-styles/color-panel.js +706 -0
- package/src/components/global-styles/dimensions-panel.js +43 -55
- package/src/components/global-styles/effects-panel.js +228 -0
- package/src/components/global-styles/filters-panel.js +157 -0
- package/src/components/global-styles/get-block-css-selector.js +118 -0
- package/src/components/global-styles/hooks.js +90 -0
- package/src/components/global-styles/index.js +4 -1
- package/src/components/global-styles/style.scss +42 -0
- package/src/components/global-styles/test/use-global-styles-output.js +34 -5
- package/src/components/global-styles/typography-panel.js +26 -51
- package/src/components/global-styles/use-global-styles-output.js +188 -89
- package/src/components/global-styles/utils.js +3 -0
- package/src/components/iframe/index.js +1 -1
- package/src/components/image-size-control/index.js +4 -3
- package/src/components/image-size-control/test/index.js +2 -2
- package/src/components/image-size-control/use-dimension-handler.js +4 -3
- package/src/components/index.js +4 -1
- package/src/components/inner-blocks/README.md +1 -1
- package/src/components/inserter/block-patterns-tab.js +3 -1
- package/src/components/inspector-controls-tabs/position-controls-panel.js +40 -9
- package/src/components/inspector-controls-tabs/utils.js +4 -3
- package/src/components/line-height-control/index.js +10 -1
- package/src/components/list-view/README.md +2 -0
- package/src/components/list-view/appender.js +101 -0
- package/src/components/list-view/block.js +6 -4
- package/src/components/list-view/branch.js +30 -1
- package/src/components/list-view/index.js +60 -11
- package/src/components/list-view/style.scss +22 -1
- package/src/components/list-view/test/use-list-view-drop-zone.js +188 -0
- package/src/components/list-view/use-list-view-client-ids.js +5 -3
- package/src/components/list-view/use-list-view-drop-zone.js +9 -3
- 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/block-contents.js +4 -0
- package/src/components/off-canvas-editor/index.js +15 -11
- package/src/components/resizable-box-popover/index.js +27 -0
- package/src/components/rich-text/format-edit.js +2 -32
- package/src/components/rich-text/index.js +0 -1
- package/src/components/rich-text/index.native.js +2 -5
- package/src/components/spacing-sizes-control/spacing-input-control.js +10 -0
- package/src/components/spacing-sizes-control/style.scss +7 -7
- package/src/components/writing-flow/use-input.js +4 -5
- package/src/hooks/anchor.js +1 -1
- package/src/hooks/border.js +1 -2
- 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/dimensions.js +0 -1
- package/src/hooks/duotone.js +121 -76
- package/src/hooks/margin.js +31 -26
- package/src/hooks/padding.js +24 -18
- package/src/hooks/position.js +3 -3
- package/src/hooks/style.js +29 -28
- package/src/hooks/test/utils.js +0 -104
- package/src/hooks/typography.js +0 -1
- package/src/hooks/utils.js +31 -74
- package/src/layouts/grid.js +172 -0
- package/src/layouts/index.js +2 -1
- package/src/layouts/test/grid.js +21 -0
- package/src/layouts/utils.js +2 -2
- package/src/private-apis.js +4 -0
- package/src/store/actions.js +1 -1
- package/src/style.scss +1 -0
- package/src/utils/object.js +69 -0
- package/src/utils/test/object.js +145 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/rich-text/use-native-props.js +0 -11
- package/build/components/rich-text/use-native-props.js.map +0 -1
- package/build/components/rich-text/use-native-props.native.js +0 -24
- package/build/components/rich-text/use-native-props.native.js.map +0 -1
- package/build/hooks/color-panel.js.map +0 -1
- package/build-module/components/rich-text/use-native-props.js +0 -4
- package/build-module/components/rich-text/use-native-props.js.map +0 -1
- package/build-module/components/rich-text/use-native-props.native.js +0 -15
- package/build-module/components/rich-text/use-native-props.native.js.map +0 -1
- package/build-module/hooks/color-panel.js.map +0 -1
- package/src/components/rich-text/use-native-props.js +0 -3
- package/src/components/rich-text/use-native-props.native.js +0 -17
|
@@ -31,6 +31,8 @@ const VALID_SETTINGS = [
|
|
|
31
31
|
'shadow.presets',
|
|
32
32
|
'shadow.defaultPresets',
|
|
33
33
|
'color.background',
|
|
34
|
+
'color.button',
|
|
35
|
+
'color.caption',
|
|
34
36
|
'color.custom',
|
|
35
37
|
'color.customDuotone',
|
|
36
38
|
'color.customGradient',
|
|
@@ -39,6 +41,7 @@ const VALID_SETTINGS = [
|
|
|
39
41
|
'color.defaultPalette',
|
|
40
42
|
'color.duotone',
|
|
41
43
|
'color.gradients',
|
|
44
|
+
'color.heading',
|
|
42
45
|
'color.link',
|
|
43
46
|
'color.palette',
|
|
44
47
|
'color.text',
|
|
@@ -251,6 +254,41 @@ export function useSettingsForBlockElement(
|
|
|
251
254
|
};
|
|
252
255
|
}
|
|
253
256
|
|
|
257
|
+
updatedSettings.color = {
|
|
258
|
+
...updatedSettings.color,
|
|
259
|
+
text:
|
|
260
|
+
updatedSettings.color?.text &&
|
|
261
|
+
supportedStyles.includes( 'color' ),
|
|
262
|
+
background:
|
|
263
|
+
updatedSettings.color?.background &&
|
|
264
|
+
( supportedStyles.includes( 'background' ) ||
|
|
265
|
+
supportedStyles.includes( 'backgroundColor' ) ),
|
|
266
|
+
button:
|
|
267
|
+
updatedSettings.color?.button &&
|
|
268
|
+
supportedStyles.includes( 'buttonColor' ),
|
|
269
|
+
heading:
|
|
270
|
+
updatedSettings.color?.heading &&
|
|
271
|
+
supportedStyles.includes( 'headingColor' ),
|
|
272
|
+
link:
|
|
273
|
+
updatedSettings.color?.link &&
|
|
274
|
+
supportedStyles.includes( 'linkColor' ),
|
|
275
|
+
caption:
|
|
276
|
+
updatedSettings.color?.caption &&
|
|
277
|
+
supportedStyles.includes( 'captionColor' ),
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
// Some blocks can enable background colors but disable gradients.
|
|
281
|
+
if ( ! supportedStyles.includes( 'background' ) ) {
|
|
282
|
+
updatedSettings.color.gradients = [];
|
|
283
|
+
updatedSettings.color.customGradient = false;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// If filters are not supported by the block/element, disable duotone.
|
|
287
|
+
if ( ! supportedStyles.includes( 'filter' ) ) {
|
|
288
|
+
updatedSettings.color.defaultDuotone = false;
|
|
289
|
+
updatedSettings.color.customDuotone = false;
|
|
290
|
+
}
|
|
291
|
+
|
|
254
292
|
[
|
|
255
293
|
'lineHeight',
|
|
256
294
|
'fontStyle',
|
|
@@ -328,6 +366,10 @@ export function useSettingsForBlockElement(
|
|
|
328
366
|
}
|
|
329
367
|
} );
|
|
330
368
|
|
|
369
|
+
updatedSettings.shadow = supportedStyles.includes( 'shadow' )
|
|
370
|
+
? updatedSettings.shadow
|
|
371
|
+
: false;
|
|
372
|
+
|
|
331
373
|
return updatedSettings;
|
|
332
374
|
}, [ parentSettings, supportedStyles, supports ] );
|
|
333
375
|
}
|
|
@@ -379,3 +421,51 @@ export function useColorsPerOrigin( settings ) {
|
|
|
379
421
|
shouldDisplayDefaultColors,
|
|
380
422
|
] );
|
|
381
423
|
}
|
|
424
|
+
|
|
425
|
+
export function useGradientsPerOrigin( settings ) {
|
|
426
|
+
const customGradients = settings?.color?.gradients?.custom;
|
|
427
|
+
const themeGradients = settings?.color?.gradients?.theme;
|
|
428
|
+
const defaultGradients = settings?.color?.gradients?.default;
|
|
429
|
+
const shouldDisplayDefaultGradients = settings?.color?.defaultGradients;
|
|
430
|
+
|
|
431
|
+
return useMemo( () => {
|
|
432
|
+
const result = [];
|
|
433
|
+
if ( themeGradients && themeGradients.length ) {
|
|
434
|
+
result.push( {
|
|
435
|
+
name: _x(
|
|
436
|
+
'Theme',
|
|
437
|
+
'Indicates this palette comes from the theme.'
|
|
438
|
+
),
|
|
439
|
+
gradients: themeGradients,
|
|
440
|
+
} );
|
|
441
|
+
}
|
|
442
|
+
if (
|
|
443
|
+
shouldDisplayDefaultGradients &&
|
|
444
|
+
defaultGradients &&
|
|
445
|
+
defaultGradients.length
|
|
446
|
+
) {
|
|
447
|
+
result.push( {
|
|
448
|
+
name: _x(
|
|
449
|
+
'Default',
|
|
450
|
+
'Indicates this palette comes from WordPress.'
|
|
451
|
+
),
|
|
452
|
+
gradients: defaultGradients,
|
|
453
|
+
} );
|
|
454
|
+
}
|
|
455
|
+
if ( customGradients && customGradients.length ) {
|
|
456
|
+
result.push( {
|
|
457
|
+
name: _x(
|
|
458
|
+
'Custom',
|
|
459
|
+
'Indicates this palette is created by the user.'
|
|
460
|
+
),
|
|
461
|
+
gradients: customGradients,
|
|
462
|
+
} );
|
|
463
|
+
}
|
|
464
|
+
return result;
|
|
465
|
+
}, [
|
|
466
|
+
customGradients,
|
|
467
|
+
themeGradients,
|
|
468
|
+
defaultGradients,
|
|
469
|
+
shouldDisplayDefaultGradients,
|
|
470
|
+
] );
|
|
471
|
+
}
|
|
@@ -3,8 +3,8 @@ export {
|
|
|
3
3
|
useGlobalSetting,
|
|
4
4
|
useGlobalStyle,
|
|
5
5
|
useSettingsForBlockElement,
|
|
6
|
-
useColorsPerOrigin,
|
|
7
6
|
} from './hooks';
|
|
7
|
+
export { getBlockCSSSelector } from './get-block-css-selector';
|
|
8
8
|
export { useGlobalStylesOutput } from './use-global-styles-output';
|
|
9
9
|
export { GlobalStylesContext } from './context';
|
|
10
10
|
export {
|
|
@@ -16,3 +16,6 @@ export {
|
|
|
16
16
|
useHasDimensionsPanel,
|
|
17
17
|
} from './dimensions-panel';
|
|
18
18
|
export { default as BorderPanel, useHasBorderPanel } from './border-panel';
|
|
19
|
+
export { default as ColorPanel, useHasColorPanel } from './color-panel';
|
|
20
|
+
export { default as EffectsPanel, useHasEffectsPanel } from './effects-panel';
|
|
21
|
+
export { default as FiltersPanel, useHasFiltersPanel } from './filters-panel';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.block-editor-global-styles-effects-panel__toggle-icon {
|
|
2
|
+
fill: currentColor;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.block-editor-global-styles-effects-panel__shadow-popover-container {
|
|
6
|
+
width: 230px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.block-editor-global-styles-effects-panel__shadow-dropdown {
|
|
10
|
+
display: block;
|
|
11
|
+
padding: 0;
|
|
12
|
+
|
|
13
|
+
> button {
|
|
14
|
+
width: 100%;
|
|
15
|
+
padding: $grid-unit-10;
|
|
16
|
+
|
|
17
|
+
&.is-open {
|
|
18
|
+
background-color: $gray-100;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// wrapper to clip the shadow beyond 6px
|
|
24
|
+
.block-editor-global-styles-effects-panel__shadow-indicator-wrapper {
|
|
25
|
+
padding: 6px;
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// These styles are similar to the color palette.
|
|
33
|
+
.block-editor-global-styles-effects-panel__shadow-indicator {
|
|
34
|
+
color: $gray-800;
|
|
35
|
+
border: $gray-200 $border-width solid;
|
|
36
|
+
border-radius: $radius-block-ui;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
padding: 0;
|
|
39
|
+
|
|
40
|
+
height: 24px;
|
|
41
|
+
width: 24px;
|
|
42
|
+
}
|
|
@@ -480,7 +480,7 @@ describe( 'global styles renderer', () => {
|
|
|
480
480
|
expect( toStyles( tree, blockSelectors ) ).toEqual(
|
|
481
481
|
'body {margin: 0;}' +
|
|
482
482
|
'body{background-color: red;margin: 10px;padding: 10px;}a{color: blue;}a:hover{color: orange;}a:focus{color: orange;}h1{font-size: 42px;}.wp-block-group{margin-top: 10px;margin-right: 20px;margin-bottom: 30px;margin-left: 40px;padding-top: 11px;padding-right: 22px;padding-bottom: 33px;padding-left: 44px;}h1,h2,h3,h4,h5,h6{color: orange;}h1 a,h2 a,h3 a,h4 a,h5 a,h6 a{color: hotpink;}h1 a:hover,h2 a:hover,h3 a:hover,h4 a:hover,h5 a:hover,h6 a:hover{color: red;}h1 a:focus,h2 a:focus,h3 a:focus,h4 a:focus,h5 a:focus,h6 a:focus{color: red;}' +
|
|
483
|
-
'.wp-block-image img, .wp-block-image .wp-crop-area{border-radius: 9999px
|
|
483
|
+
'.wp-block-image img, .wp-block-image .wp-crop-area{border-radius: 9999px}.wp-block-image{color: red;}.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }' +
|
|
484
484
|
'.has-white-color{color: var(--wp--preset--color--white) !important;}.has-white-background-color{background-color: var(--wp--preset--color--white) !important;}.has-white-border-color{border-color: var(--wp--preset--color--white) !important;}.has-black-color{color: var(--wp--preset--color--black) !important;}.has-black-background-color{background-color: var(--wp--preset--color--black) !important;}.has-black-border-color{border-color: var(--wp--preset--color--black) !important;}h1.has-blue-color,h2.has-blue-color,h3.has-blue-color,h4.has-blue-color,h5.has-blue-color,h6.has-blue-color{color: var(--wp--preset--color--blue) !important;}h1.has-blue-background-color,h2.has-blue-background-color,h3.has-blue-background-color,h4.has-blue-background-color,h5.has-blue-background-color,h6.has-blue-background-color{background-color: var(--wp--preset--color--blue) !important;}h1.has-blue-border-color,h2.has-blue-border-color,h3.has-blue-border-color,h4.has-blue-border-color,h5.has-blue-border-color,h6.has-blue-border-color{border-color: var(--wp--preset--color--blue) !important;}'
|
|
485
485
|
);
|
|
486
486
|
} );
|
|
@@ -612,7 +612,7 @@ describe( 'global styles renderer', () => {
|
|
|
612
612
|
} );
|
|
613
613
|
|
|
614
614
|
expect( layoutStyles ).toEqual(
|
|
615
|
-
'body .is-layout-flow > * { margin-block-start: 0; margin-block-end: 0; }body .is-layout-flow > * + * { margin-block-start: 0.5em; margin-block-end: 0; }body .is-layout-flex { gap: 0.5em; }body { --wp--style--block-gap: 0.5em; }body .is-layout-flow > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }body .is-layout-flow > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }body .is-layout-flow > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-flex { display:flex; }body .is-layout-flex { flex-wrap: wrap; align-items: center; }body .is-layout-flex > * { margin: 0; }'
|
|
615
|
+
':where(body .is-layout-flow) > * { margin-block-start: 0; margin-block-end: 0; }:where(body .is-layout-flow) > * + * { margin-block-start: 0.5em; margin-block-end: 0; }:where(body .is-layout-flex) { gap: 0.5em; }body { --wp--style--block-gap: 0.5em; }body .is-layout-flow > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }body .is-layout-flow > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }body .is-layout-flow > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-flex { display:flex; }body .is-layout-flex { flex-wrap: wrap; align-items: center; }body .is-layout-flex > * { margin: 0; }'
|
|
616
616
|
);
|
|
617
617
|
} );
|
|
618
618
|
|
|
@@ -628,7 +628,7 @@ describe( 'global styles renderer', () => {
|
|
|
628
628
|
} );
|
|
629
629
|
|
|
630
630
|
expect( layoutStyles ).toEqual(
|
|
631
|
-
'body .is-layout-flow > * { margin-block-start: 0; margin-block-end: 0; }body .is-layout-flow > * + * { margin-block-start: 12px; margin-block-end: 0; }body .is-layout-flex { gap: 12px; }body { --wp--style--block-gap: 12px; }body .is-layout-flow > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }body .is-layout-flow > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }body .is-layout-flow > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-flex { display:flex; }body .is-layout-flex { flex-wrap: wrap; align-items: center; }body .is-layout-flex > * { margin: 0; }'
|
|
631
|
+
':where(body .is-layout-flow) > * { margin-block-start: 0; margin-block-end: 0; }:where(body .is-layout-flow) > * + * { margin-block-start: 12px; margin-block-end: 0; }:where(body .is-layout-flex) { gap: 12px; }body { --wp--style--block-gap: 12px; }body .is-layout-flow > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }body .is-layout-flow > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }body .is-layout-flow > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-flex { display:flex; }body .is-layout-flex { flex-wrap: wrap; align-items: center; }body .is-layout-flex > * { margin: 0; }'
|
|
632
632
|
);
|
|
633
633
|
} );
|
|
634
634
|
|
|
@@ -644,7 +644,7 @@ describe( 'global styles renderer', () => {
|
|
|
644
644
|
} );
|
|
645
645
|
|
|
646
646
|
expect( layoutStyles ).toEqual(
|
|
647
|
-
'.wp-block-group-is-layout-flow
|
|
647
|
+
'.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; }'
|
|
648
648
|
);
|
|
649
649
|
} );
|
|
650
650
|
|
|
@@ -668,6 +668,34 @@ describe( 'global styles renderer', () => {
|
|
|
668
668
|
|
|
669
669
|
describe( 'getBlockSelectors', () => {
|
|
670
670
|
it( 'should return block selectors data', () => {
|
|
671
|
+
const imageSelectors = {
|
|
672
|
+
root: '.my-image',
|
|
673
|
+
border: '.my-image img, .my-image .crop-area',
|
|
674
|
+
filter: { duotone: 'img' },
|
|
675
|
+
};
|
|
676
|
+
const imageBlock = {
|
|
677
|
+
name: 'core/image',
|
|
678
|
+
selectors: imageSelectors,
|
|
679
|
+
};
|
|
680
|
+
const blockTypes = [ imageBlock ];
|
|
681
|
+
|
|
682
|
+
expect( getBlockSelectors( blockTypes, () => {} ) ).toEqual( {
|
|
683
|
+
'core/image': {
|
|
684
|
+
name: imageBlock.name,
|
|
685
|
+
selector: imageSelectors.root,
|
|
686
|
+
duotoneSelector: imageSelectors.filter.duotone,
|
|
687
|
+
fallbackGapValue: undefined,
|
|
688
|
+
featureSelectors: {
|
|
689
|
+
root: '.my-image',
|
|
690
|
+
border: '.my-image img, .my-image .crop-area',
|
|
691
|
+
filter: { duotone: 'img' },
|
|
692
|
+
},
|
|
693
|
+
hasLayoutSupport: false,
|
|
694
|
+
},
|
|
695
|
+
} );
|
|
696
|
+
} );
|
|
697
|
+
|
|
698
|
+
it( 'should return block selectors data with old experimental selectors', () => {
|
|
671
699
|
const imageSupports = {
|
|
672
700
|
__experimentalBorder: {
|
|
673
701
|
radius: true,
|
|
@@ -685,9 +713,10 @@ describe( 'global styles renderer', () => {
|
|
|
685
713
|
'core/image': {
|
|
686
714
|
name: imageBlock.name,
|
|
687
715
|
selector: imageSupports.__experimentalSelector,
|
|
688
|
-
duotoneSelector:
|
|
716
|
+
duotoneSelector: '.my-image img',
|
|
689
717
|
fallbackGapValue: undefined,
|
|
690
718
|
featureSelectors: {
|
|
719
|
+
root: '.my-image',
|
|
691
720
|
border: '.my-image img, .my-image .crop-area',
|
|
692
721
|
},
|
|
693
722
|
hasLayoutSupport: false,
|
|
@@ -20,6 +20,7 @@ import LetterSpacingControl from '../letter-spacing-control';
|
|
|
20
20
|
import TextTransformControl from '../text-transform-control';
|
|
21
21
|
import TextDecorationControl from '../text-decoration-control';
|
|
22
22
|
import { getValueFromVariable } from './utils';
|
|
23
|
+
import { immutableSet } from '../../utils/object';
|
|
23
24
|
|
|
24
25
|
const MIN_TEXT_COLUMNS = 1;
|
|
25
26
|
const MAX_TEXT_COLUMNS = 6;
|
|
@@ -161,15 +162,13 @@ export default function TypographyPanel( {
|
|
|
161
162
|
const slug = fontFamilies?.find(
|
|
162
163
|
( { fontFamily: f } ) => f === newValue
|
|
163
164
|
)?.slug;
|
|
164
|
-
onChange(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
},
|
|
172
|
-
} );
|
|
165
|
+
onChange(
|
|
166
|
+
immutableSet(
|
|
167
|
+
value,
|
|
168
|
+
[ 'typography', 'fontFamily' ],
|
|
169
|
+
slug ? `var:preset|font-family|${ slug }` : newValue
|
|
170
|
+
)
|
|
171
|
+
);
|
|
173
172
|
};
|
|
174
173
|
const hasFontFamily = () => !! value?.typography?.fontFamily;
|
|
175
174
|
const resetFontFamily = () => setFontFamily( undefined );
|
|
@@ -188,13 +187,9 @@ export default function TypographyPanel( {
|
|
|
188
187
|
? `var:preset|font-size|${ metadata?.slug }`
|
|
189
188
|
: newValue;
|
|
190
189
|
|
|
191
|
-
onChange(
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
...value?.typography,
|
|
195
|
-
fontSize: actualValue,
|
|
196
|
-
},
|
|
197
|
-
} );
|
|
190
|
+
onChange(
|
|
191
|
+
immutableSet( value, [ 'typography', 'fontSize' ], actualValue )
|
|
192
|
+
);
|
|
198
193
|
};
|
|
199
194
|
const hasFontSize = () => !! value?.typography?.fontSize;
|
|
200
195
|
const resetFontSize = () => setFontSize( undefined );
|
|
@@ -229,13 +224,9 @@ export default function TypographyPanel( {
|
|
|
229
224
|
const hasLineHeightEnabled = useHasLineHeightControl( settings );
|
|
230
225
|
const lineHeight = decodeValue( inheritedValue?.typography?.lineHeight );
|
|
231
226
|
const setLineHeight = ( newValue ) => {
|
|
232
|
-
onChange(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
...value?.typography,
|
|
236
|
-
lineHeight: newValue,
|
|
237
|
-
},
|
|
238
|
-
} );
|
|
227
|
+
onChange(
|
|
228
|
+
immutableSet( value, [ 'typography', 'lineHeight' ], newValue )
|
|
229
|
+
);
|
|
239
230
|
};
|
|
240
231
|
const hasLineHeight = () => !! value?.typography?.lineHeight;
|
|
241
232
|
const resetLineHeight = () => setLineHeight( undefined );
|
|
@@ -246,13 +237,9 @@ export default function TypographyPanel( {
|
|
|
246
237
|
inheritedValue?.typography?.letterSpacing
|
|
247
238
|
);
|
|
248
239
|
const setLetterSpacing = ( newValue ) => {
|
|
249
|
-
onChange(
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
...value?.typography,
|
|
253
|
-
letterSpacing: newValue,
|
|
254
|
-
},
|
|
255
|
-
} );
|
|
240
|
+
onChange(
|
|
241
|
+
immutableSet( value, [ 'typography', 'letterSpacing' ], newValue )
|
|
242
|
+
);
|
|
256
243
|
};
|
|
257
244
|
const hasLetterSpacing = () => !! value?.typography?.letterSpacing;
|
|
258
245
|
const resetLetterSpacing = () => setLetterSpacing( undefined );
|
|
@@ -261,13 +248,9 @@ export default function TypographyPanel( {
|
|
|
261
248
|
const hasTextColumnsControl = useHasTextColumnsControl( settings );
|
|
262
249
|
const textColumns = decodeValue( inheritedValue?.typography?.textColumns );
|
|
263
250
|
const setTextColumns = ( newValue ) => {
|
|
264
|
-
onChange(
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
...value?.typography,
|
|
268
|
-
textColumns: newValue,
|
|
269
|
-
},
|
|
270
|
-
} );
|
|
251
|
+
onChange(
|
|
252
|
+
immutableSet( value, [ 'typography', 'textColumns' ], newValue )
|
|
253
|
+
);
|
|
271
254
|
};
|
|
272
255
|
const hasTextColumns = () => !! value?.typography?.textColumns;
|
|
273
256
|
const resetTextColumns = () => setTextColumns( undefined );
|
|
@@ -278,13 +261,9 @@ export default function TypographyPanel( {
|
|
|
278
261
|
inheritedValue?.typography?.textTransform
|
|
279
262
|
);
|
|
280
263
|
const setTextTransform = ( newValue ) => {
|
|
281
|
-
onChange(
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
...value?.typography,
|
|
285
|
-
textTransform: newValue,
|
|
286
|
-
},
|
|
287
|
-
} );
|
|
264
|
+
onChange(
|
|
265
|
+
immutableSet( value, [ 'typography', 'textTransform' ], newValue )
|
|
266
|
+
);
|
|
288
267
|
};
|
|
289
268
|
const hasTextTransform = () => !! value?.typography?.textTransform;
|
|
290
269
|
const resetTextTransform = () => setTextTransform( undefined );
|
|
@@ -295,13 +274,9 @@ export default function TypographyPanel( {
|
|
|
295
274
|
inheritedValue?.typography?.textDecoration
|
|
296
275
|
);
|
|
297
276
|
const setTextDecoration = ( newValue ) => {
|
|
298
|
-
onChange(
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
...value?.typography,
|
|
302
|
-
textDecoration: newValue,
|
|
303
|
-
},
|
|
304
|
-
} );
|
|
277
|
+
onChange(
|
|
278
|
+
immutableSet( value, [ 'typography', 'textDecoration' ], newValue )
|
|
279
|
+
);
|
|
305
280
|
};
|
|
306
281
|
const hasTextDecoration = () => !! value?.typography?.textDecoration;
|
|
307
282
|
const resetTextDecoration = () => setTextDecoration( undefined );
|