@wordpress/block-editor 16.0.0 → 16.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 +18 -0
- package/README.md +8 -0
- package/build/components/alignment-control/ui.cjs +2 -4
- package/build/components/alignment-control/ui.cjs.map +2 -2
- package/build/components/background-image-control/index.cjs +40 -10
- package/build/components/background-image-control/index.cjs.map +2 -2
- package/build/components/block-alignment-control/ui.cjs +5 -3
- package/build/components/block-alignment-control/ui.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +73 -46
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-list/block-html.cjs +4 -1
- package/build/components/block-list/block-html.cjs.map +2 -2
- package/build/components/block-list/use-block-props/index.cjs +5 -2
- package/build/components/block-list/use-block-props/index.cjs.map +2 -2
- package/build/components/block-list/use-block-props/use-focus-handler.cjs +2 -3
- package/build/components/block-list/use-block-props/use-focus-handler.cjs.map +2 -2
- package/build/components/block-list/use-block-props/use-register-block-event-handlers.cjs +48 -0
- package/build/components/block-list/use-block-props/use-register-block-event-handlers.cjs.map +7 -0
- package/build/components/block-parent-selector/index.cjs +2 -2
- package/build/components/block-parent-selector/index.cjs.map +2 -2
- package/build/components/block-toolbar/switch-section-style.cjs +4 -2
- package/build/components/block-toolbar/switch-section-style.cjs.map +3 -3
- package/build/components/block-tools/empty-block-inserter.cjs +2 -7
- package/build/components/block-tools/empty-block-inserter.cjs.map +2 -2
- package/build/components/block-vertical-alignment-control/ui.cjs +3 -5
- package/build/components/block-vertical-alignment-control/ui.cjs.map +2 -2
- package/build/components/border-radius-control/utils.cjs +8 -58
- package/build/components/border-radius-control/utils.cjs.map +2 -2
- package/build/components/colors-gradients/control.cjs +5 -3
- package/build/components/colors-gradients/control.cjs.map +2 -2
- package/build/components/dimension-control/index.cjs +30 -20
- package/build/components/dimension-control/index.cjs.map +3 -3
- package/build/components/dimensions-tool/aspect-ratio-tool.cjs +9 -2
- package/build/components/dimensions-tool/aspect-ratio-tool.cjs.map +3 -3
- package/build/components/editor-styles/index.cjs +9 -1
- package/build/components/editor-styles/index.cjs.map +2 -2
- package/build/components/global-styles/background-panel.cjs +66 -25
- package/build/components/global-styles/background-panel.cjs.map +3 -3
- package/build/components/global-styles/border-panel.cjs +153 -55
- package/build/components/global-styles/border-panel.cjs.map +3 -3
- package/build/components/global-styles/color-gradient-dropdown-item.cjs +46 -14
- package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +3 -3
- package/build/components/global-styles/color-panel.cjs +63 -17
- package/build/components/global-styles/color-panel.cjs.map +2 -2
- package/build/components/global-styles/dimensions-panel.cjs +242 -64
- package/build/components/global-styles/dimensions-panel.cjs.map +3 -3
- package/build/components/global-styles/filters-panel.cjs +59 -20
- package/build/components/global-styles/filters-panel.cjs.map +3 -3
- package/build/components/global-styles/hooks.cjs +4 -1
- package/build/components/global-styles/hooks.cjs.map +2 -2
- package/build/components/global-styles/inheritance/index.cjs +142 -0
- package/build/components/global-styles/inheritance/index.cjs.map +7 -0
- package/build/components/global-styles/inherited-value-context.cjs +173 -0
- package/build/components/global-styles/inherited-value-context.cjs.map +7 -0
- package/build/components/global-styles/shadow-panel-components.cjs +38 -20
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/global-styles/state-control.cjs +1 -1
- package/build/components/global-styles/state-control.cjs.map +2 -2
- package/build/components/global-styles/typography-panel.cjs +271 -78
- package/build/components/global-styles/typography-panel.cjs.map +3 -3
- package/build/components/inspector-controls-tabs/styles-tab.cjs +10 -1
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/line-height-control/index.cjs +1 -1
- package/build/components/line-height-control/index.cjs.map +2 -2
- package/build/components/link-control/index.cjs +3 -1
- package/build/components/link-control/index.cjs.map +2 -2
- package/build/components/preset-input-control/index.cjs +2 -1
- package/build/components/preset-input-control/index.cjs.map +2 -2
- package/build/components/provider/block-refs-provider.cjs +8 -2
- package/build/components/provider/block-refs-provider.cjs.map +2 -2
- package/build/components/provider/index.cjs +1 -1
- package/build/components/provider/index.cjs.map +2 -2
- package/build/components/provider/use-block-sync.cjs +18 -6
- package/build/components/provider/use-block-sync.cjs.map +2 -2
- package/build/components/provider/use-media-upload-settings.cjs +3 -1
- package/build/components/provider/use-media-upload-settings.cjs.map +2 -2
- package/build/components/rich-text/index.cjs +23 -13
- package/build/components/rich-text/index.cjs.map +2 -2
- package/build/components/spacing-sizes-control/utils.cjs +6 -19
- package/build/components/spacing-sizes-control/utils.cjs.map +2 -2
- package/build/components/text-indent-control/index.cjs +8 -2
- package/build/components/text-indent-control/index.cjs.map +2 -2
- package/build/components/url-input/index.cjs +303 -344
- package/build/components/url-input/index.cjs.map +3 -3
- package/build/components/writing-flow/index.cjs +2 -0
- package/build/components/writing-flow/index.cjs.map +3 -3
- package/build/components/writing-flow/use-arrow-nav.cjs +24 -1
- package/build/components/writing-flow/use-arrow-nav.cjs.map +2 -2
- package/build/components/writing-flow/use-click-selection.cjs +28 -2
- package/build/components/writing-flow/use-click-selection.cjs.map +2 -2
- package/build/components/writing-flow/use-editable-root-event-handlers.cjs +179 -0
- package/build/components/writing-flow/use-editable-root-event-handlers.cjs.map +7 -0
- package/build/components/writing-flow/use-editable-root.cjs +5 -42
- package/build/components/writing-flow/use-editable-root.cjs.map +2 -2
- package/build/components/writing-flow/use-home-end.cjs +1 -1
- package/build/components/writing-flow/use-home-end.cjs.map +2 -2
- package/build/components/writing-flow/use-selection-observer.cjs +17 -13
- package/build/components/writing-flow/use-selection-observer.cjs.map +2 -2
- package/build/components/writing-flow/utils.cjs +3 -14
- package/build/components/writing-flow/utils.cjs.map +2 -2
- package/build/hooks/background.cjs +13 -10
- package/build/hooks/background.cjs.map +2 -2
- package/build/hooks/block-style-variation.cjs +4 -45
- package/build/hooks/block-style-variation.cjs.map +3 -3
- package/build/hooks/border.cjs +19 -4
- package/build/hooks/border.cjs.map +2 -2
- package/build/hooks/custom-css.cjs +6 -2
- package/build/hooks/custom-css.cjs.map +2 -2
- package/build/hooks/dimensions.cjs +15 -4
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/duotone.cjs +26 -14
- package/build/hooks/duotone.cjs.map +3 -3
- package/build/hooks/elements.cjs +14 -4
- package/build/hooks/elements.cjs.map +2 -2
- package/build/hooks/line-height.cjs +1 -2
- package/build/hooks/line-height.cjs.map +2 -2
- package/build/hooks/typography.cjs +13 -4
- package/build/hooks/typography.cjs.map +2 -2
- package/build/private-apis.cjs +9 -5
- package/build/private-apis.cjs.map +3 -3
- package/build/store/actions.cjs +9 -4
- package/build/store/actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +28 -1
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +6 -6
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +23 -0
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/native-undo.cjs +55 -0
- package/build/utils/native-undo.cjs.map +7 -0
- package/build-module/components/alignment-control/ui.mjs +2 -4
- package/build-module/components/alignment-control/ui.mjs.map +2 -2
- package/build-module/components/background-image-control/index.mjs +43 -10
- package/build-module/components/background-image-control/index.mjs.map +2 -2
- package/build-module/components/block-alignment-control/ui.mjs +5 -3
- package/build-module/components/block-alignment-control/ui.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +74 -46
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-list/block-html.mjs +4 -1
- package/build-module/components/block-list/block-html.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/index.mjs +5 -2
- package/build-module/components/block-list/use-block-props/index.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-focus-handler.mjs +2 -3
- package/build-module/components/block-list/use-block-props/use-focus-handler.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-register-block-event-handlers.mjs +28 -0
- package/build-module/components/block-list/use-block-props/use-register-block-event-handlers.mjs.map +7 -0
- package/build-module/components/block-parent-selector/index.mjs +2 -2
- package/build-module/components/block-parent-selector/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/switch-section-style.mjs +4 -2
- package/build-module/components/block-toolbar/switch-section-style.mjs.map +2 -2
- package/build-module/components/block-tools/empty-block-inserter.mjs +2 -7
- package/build-module/components/block-tools/empty-block-inserter.mjs.map +2 -2
- package/build-module/components/block-vertical-alignment-control/ui.mjs +4 -6
- package/build-module/components/block-vertical-alignment-control/ui.mjs.map +2 -2
- package/build-module/components/border-radius-control/utils.mjs +11 -53
- package/build-module/components/border-radius-control/utils.mjs.map +2 -2
- package/build-module/components/colors-gradients/control.mjs +5 -3
- package/build-module/components/colors-gradients/control.mjs.map +2 -2
- package/build-module/components/dimension-control/index.mjs +30 -20
- package/build-module/components/dimension-control/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs +10 -6
- package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs.map +2 -2
- package/build-module/components/editor-styles/index.mjs +9 -1
- package/build-module/components/editor-styles/index.mjs.map +2 -2
- package/build-module/components/global-styles/background-panel.mjs +71 -29
- package/build-module/components/global-styles/background-panel.mjs.map +2 -2
- package/build-module/components/global-styles/border-panel.mjs +157 -56
- package/build-module/components/global-styles/border-panel.mjs.map +2 -2
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +51 -15
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +2 -2
- package/build-module/components/global-styles/color-panel.mjs +63 -17
- package/build-module/components/global-styles/color-panel.mjs.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs +248 -66
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/filters-panel.mjs +64 -21
- package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
- package/build-module/components/global-styles/hooks.mjs +4 -1
- package/build-module/components/global-styles/hooks.mjs.map +2 -2
- package/build-module/components/global-styles/inheritance/index.mjs +108 -0
- package/build-module/components/global-styles/inheritance/index.mjs.map +7 -0
- package/build-module/components/global-styles/inherited-value-context.mjs +141 -0
- package/build-module/components/global-styles/inherited-value-context.mjs.map +7 -0
- package/build-module/components/global-styles/shadow-panel-components.mjs +38 -20
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/global-styles/state-control.mjs +1 -1
- package/build-module/components/global-styles/state-control.mjs.map +2 -2
- package/build-module/components/global-styles/typography-panel.mjs +276 -79
- package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +6 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/line-height-control/index.mjs +1 -1
- package/build-module/components/line-height-control/index.mjs.map +2 -2
- package/build-module/components/link-control/index.mjs +4 -2
- package/build-module/components/link-control/index.mjs.map +2 -2
- package/build-module/components/preset-input-control/index.mjs +2 -1
- package/build-module/components/preset-input-control/index.mjs.map +2 -2
- package/build-module/components/provider/block-refs-provider.mjs +8 -2
- package/build-module/components/provider/block-refs-provider.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +1 -1
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-sync.mjs +18 -6
- package/build-module/components/provider/use-block-sync.mjs.map +2 -2
- package/build-module/components/provider/use-media-upload-settings.mjs +3 -1
- package/build-module/components/provider/use-media-upload-settings.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +28 -14
- package/build-module/components/rich-text/index.mjs.map +2 -2
- package/build-module/components/spacing-sizes-control/utils.mjs +6 -18
- package/build-module/components/spacing-sizes-control/utils.mjs.map +2 -2
- package/build-module/components/text-indent-control/index.mjs +8 -2
- package/build-module/components/text-indent-control/index.mjs.map +2 -2
- package/build-module/components/url-input/index.mjs +306 -353
- package/build-module/components/url-input/index.mjs.map +2 -2
- package/build-module/components/writing-flow/index.mjs +2 -0
- package/build-module/components/writing-flow/index.mjs.map +2 -2
- package/build-module/components/writing-flow/use-arrow-nav.mjs +24 -1
- package/build-module/components/writing-flow/use-arrow-nav.mjs.map +2 -2
- package/build-module/components/writing-flow/use-click-selection.mjs +28 -2
- package/build-module/components/writing-flow/use-click-selection.mjs.map +2 -2
- package/build-module/components/writing-flow/use-editable-root-event-handlers.mjs +154 -0
- package/build-module/components/writing-flow/use-editable-root-event-handlers.mjs.map +7 -0
- package/build-module/components/writing-flow/use-editable-root.mjs +5 -37
- package/build-module/components/writing-flow/use-editable-root.mjs.map +2 -2
- package/build-module/components/writing-flow/use-home-end.mjs +1 -1
- package/build-module/components/writing-flow/use-home-end.mjs.map +2 -2
- package/build-module/components/writing-flow/use-selection-observer.mjs +18 -14
- package/build-module/components/writing-flow/use-selection-observer.mjs.map +2 -2
- package/build-module/components/writing-flow/utils.mjs +2 -11
- package/build-module/components/writing-flow/utils.mjs.map +2 -2
- package/build-module/hooks/background.mjs +13 -10
- package/build-module/hooks/background.mjs.map +2 -2
- package/build-module/hooks/block-style-variation.mjs +8 -44
- package/build-module/hooks/block-style-variation.mjs.map +2 -2
- package/build-module/hooks/border.mjs +19 -4
- package/build-module/hooks/border.mjs.map +2 -2
- package/build-module/hooks/custom-css.mjs +7 -3
- package/build-module/hooks/custom-css.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs +15 -4
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/duotone.mjs +20 -9
- package/build-module/hooks/duotone.mjs.map +2 -2
- package/build-module/hooks/elements.mjs +14 -4
- package/build-module/hooks/elements.mjs.map +2 -2
- package/build-module/hooks/line-height.mjs +1 -2
- package/build-module/hooks/line-height.mjs.map +2 -2
- package/build-module/hooks/typography.mjs +13 -4
- package/build-module/hooks/typography.mjs.map +2 -2
- package/build-module/private-apis.mjs +7 -3
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs +9 -4
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +29 -1
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +6 -6
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +23 -0
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/native-undo.mjs +29 -0
- package/build-module/utils/native-undo.mjs.map +7 -0
- package/build-style/content-rtl.css +10 -18
- package/build-style/content.css +10 -18
- package/build-style/style-rtl.css +150 -7
- package/build-style/style.css +150 -7
- package/package.json +40 -41
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +1 -1
- package/src/components/alignment-control/ui.js +2 -4
- package/src/components/background-image-control/index.js +74 -37
- package/src/components/background-image-control/style.scss +13 -4
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +3 -3
- package/src/components/block-alignment-control/test/index.js +1 -1
- package/src/components/block-alignment-control/ui.js +4 -2
- package/src/components/block-breadcrumb/test/__snapshots__/index.js.snap +1 -1
- package/src/components/block-compare/test/__snapshots__/block-view.js.snap +1 -1
- package/src/components/block-icon/test/__snapshots__/index.js.snap +1 -1
- package/src/components/block-inspector/index.js +60 -31
- package/src/components/block-list/block-html.js +5 -0
- package/src/components/block-list/content.scss +1 -11
- package/src/components/block-list/use-block-props/index.js +5 -1
- package/src/components/block-list/use-block-props/use-focus-handler.js +9 -8
- package/src/components/block-list/use-block-props/use-register-block-event-handlers.js +45 -0
- package/src/components/block-parent-selector/index.js +5 -2
- package/src/components/block-toolbar/switch-section-style.js +5 -2
- package/src/components/block-tools/empty-block-inserter.js +3 -7
- package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +3 -3
- package/src/components/block-vertical-alignment-control/test/index.js +18 -2
- package/src/components/block-vertical-alignment-control/ui.js +3 -5
- package/src/components/border-radius-control/test/utils.js +0 -41
- package/src/components/border-radius-control/utils.js +16 -107
- package/src/components/button-block-appender/content.scss +6 -2
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
- package/src/components/colors-gradients/control.js +6 -3
- package/src/components/default-block-appender/test/__snapshots__/index.js.snap +1 -1
- package/src/components/dimension-control/index.js +13 -1
- package/src/components/dimensions-tool/aspect-ratio-tool.js +13 -6
- package/src/components/editor-styles/index.js +16 -1
- package/src/components/global-styles/background-panel.js +107 -34
- package/src/components/global-styles/border-panel.js +219 -48
- package/src/components/global-styles/color-gradient-dropdown-item.js +93 -28
- package/src/components/global-styles/color-panel.js +92 -11
- package/src/components/global-styles/dimensions-panel.js +422 -71
- package/src/components/global-styles/filters-panel.js +88 -28
- package/src/components/global-styles/hooks.js +8 -1
- package/src/components/global-styles/inheritance/index.js +204 -0
- package/src/components/global-styles/inheritance/style.scss +184 -0
- package/src/components/global-styles/inheritance/test/index.js +281 -0
- package/src/components/global-styles/inherited-value-context.js +271 -0
- package/src/components/global-styles/shadow-panel-components.js +48 -26
- package/src/components/global-styles/state-control.js +2 -2
- package/src/components/global-styles/test/background-panel.js +338 -1
- package/src/components/global-styles/test/border-panel.js +441 -0
- package/src/components/global-styles/test/color-panel.js +182 -2
- package/src/components/global-styles/test/dimensions-panel.js +753 -0
- package/src/components/global-styles/test/filters-panel.js +194 -0
- package/src/components/global-styles/test/inherited-value-context-core.js +98 -0
- package/src/components/global-styles/test/inherited-value-context.js +454 -0
- package/src/components/global-styles/test/typography-panel-core.js +185 -0
- package/src/components/global-styles/test/typography-panel.js +849 -12
- package/src/components/global-styles/typography-panel.js +449 -100
- package/src/components/image-editor/style.scss +33 -0
- package/src/components/inner-blocks/test/__snapshots__/index.js.snap +1 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +5 -1
- package/src/components/line-height-control/index.js +1 -1
- package/src/components/link-control/index.js +7 -2
- package/src/components/preset-input-control/index.js +4 -1
- package/src/components/provider/block-refs-provider.js +12 -2
- package/src/components/provider/index.js +2 -2
- package/src/components/provider/use-block-sync.js +18 -6
- package/src/components/provider/use-media-upload-settings.js +2 -0
- package/src/components/rich-text/index.js +37 -16
- package/src/components/spacing-sizes-control/test/utils.js +16 -5
- package/src/components/spacing-sizes-control/utils.js +11 -28
- package/src/components/text-indent-control/index.js +8 -0
- package/src/components/url-input/index.js +363 -431
- package/src/components/url-input/test/index.js +592 -0
- package/src/components/warning/test/__snapshots__/index.js.snap +1 -1
- package/src/components/writing-flow/index.js +2 -0
- package/src/components/writing-flow/use-arrow-nav.js +51 -1
- package/src/components/writing-flow/use-click-selection.js +54 -3
- package/src/components/writing-flow/use-editable-root-event-handlers.js +266 -0
- package/src/components/writing-flow/use-editable-root.js +7 -77
- package/src/components/writing-flow/use-home-end.js +17 -9
- package/src/components/writing-flow/use-selection-observer.js +32 -15
- package/src/components/writing-flow/utils.js +3 -24
- package/src/hooks/background.js +26 -21
- package/src/hooks/block-fields/rich-text/styles.scss +1 -1
- package/src/hooks/block-style-variation.js +8 -74
- package/src/hooks/border.js +19 -4
- package/src/hooks/custom-css.js +15 -6
- package/src/hooks/dimensions.js +17 -4
- package/src/hooks/duotone.js +26 -8
- package/src/hooks/elements.js +14 -3
- package/src/hooks/line-height.js +0 -1
- package/src/hooks/test/inherited-value-wiring.js +411 -0
- package/src/hooks/test/preset-round-trip.js +456 -0
- package/src/hooks/typography.js +35 -23
- package/src/private-apis.js +11 -2
- package/src/store/actions.js +10 -4
- package/src/store/private-selectors.js +57 -1
- package/src/store/reducer.js +9 -9
- package/src/store/selectors.js +56 -8
- package/src/store/test/private-selectors.js +160 -1
- package/src/style.scss +2 -0
- package/src/utils/native-undo.js +56 -0
- package/build/components/duotone/utils.cjs +0 -87
- package/build/components/duotone/utils.cjs.map +0 -7
- package/build-module/components/duotone/utils.mjs +0 -59
- package/build-module/components/duotone/utils.mjs.map +0 -7
- package/src/components/duotone/utils.js +0 -90
- package/src/hooks/test/get-variation-styles-with-ref-values.js +0 -91
package/src/hooks/background.js
CHANGED
|
@@ -24,13 +24,13 @@ import {
|
|
|
24
24
|
hasBackgroundImageValue,
|
|
25
25
|
hasBackgroundGradientValue,
|
|
26
26
|
} from '../components/global-styles/background-panel';
|
|
27
|
-
import { globalStylesDataKey } from '../store/private-keys';
|
|
28
27
|
import {
|
|
29
28
|
getStyleForState,
|
|
30
29
|
isDefaultBlockStyleState,
|
|
31
30
|
setStyleForState,
|
|
32
31
|
useBlockStyleState,
|
|
33
32
|
} from './block-style-state';
|
|
33
|
+
import { useResolvedStyle } from '../components/global-styles/inherited-value-context';
|
|
34
34
|
|
|
35
35
|
export const BACKGROUND_SUPPORT_KEY = 'background';
|
|
36
36
|
|
|
@@ -179,24 +179,25 @@ export function BackgroundImagePanel( {
|
|
|
179
179
|
asWrapper,
|
|
180
180
|
} ) {
|
|
181
181
|
const selectedState = useBlockStyleState();
|
|
182
|
-
const { style, className, backgroundColor, gradient
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
182
|
+
const { style, className, backgroundColor, gradient } = useSelect(
|
|
183
|
+
( select ) => {
|
|
184
|
+
const { getBlockAttributes } = select( blockEditorStore );
|
|
185
|
+
const blockAttributes = getBlockAttributes( clientId );
|
|
186
|
+
return {
|
|
187
|
+
style: blockAttributes?.style,
|
|
188
|
+
className: blockAttributes?.className,
|
|
189
|
+
backgroundColor: blockAttributes?.backgroundColor,
|
|
190
|
+
gradient: blockAttributes?.gradient,
|
|
191
|
+
};
|
|
192
|
+
},
|
|
193
|
+
[ clientId ]
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
const { value: inheritedValue } = useResolvedStyle(
|
|
197
|
+
name,
|
|
198
|
+
className,
|
|
199
|
+
selectedState
|
|
200
|
+
);
|
|
200
201
|
|
|
201
202
|
const backgroundGradientSupported = hasBackgroundSupport(
|
|
202
203
|
name,
|
|
@@ -381,15 +382,19 @@ export function BackgroundImagePanel( {
|
|
|
381
382
|
|
|
382
383
|
return (
|
|
383
384
|
<StylesBackgroundPanel
|
|
384
|
-
inheritedValue={ inheritedValue }
|
|
385
385
|
as={ Wrapper }
|
|
386
386
|
panelId={ clientId }
|
|
387
387
|
defaultValues={ BACKGROUND_BLOCK_DEFAULT_VALUES }
|
|
388
388
|
settings={ updatedSettings }
|
|
389
389
|
onChange={ onChange }
|
|
390
390
|
defaultControls={ defaultControls }
|
|
391
|
-
value={
|
|
391
|
+
value={
|
|
392
|
+
isStateSelected
|
|
393
|
+
? getStyleForState( style, selectedState )
|
|
394
|
+
: styleValue
|
|
395
|
+
}
|
|
392
396
|
contrastWarning={ contrastWarning }
|
|
397
|
+
inheritedValue={ inheritedValue }
|
|
393
398
|
/>
|
|
394
399
|
);
|
|
395
400
|
}
|
|
@@ -4,17 +4,22 @@
|
|
|
4
4
|
import { getBlockTypes, store as blocksStore } from '@wordpress/blocks';
|
|
5
5
|
import { useSelect } from '@wordpress/data';
|
|
6
6
|
import { useMemo } from '@wordpress/element';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
toStyles,
|
|
9
|
+
getBlockSelectors,
|
|
10
|
+
privateApis as globalStylesEnginePrivateApis,
|
|
11
|
+
} from '@wordpress/global-styles-engine';
|
|
8
12
|
|
|
9
13
|
/**
|
|
10
14
|
* Internal dependencies
|
|
11
15
|
*/
|
|
12
16
|
import { usePrivateStyleOverride } from './utils';
|
|
13
|
-
import { getValueFromObjectPath } from '../utils/object';
|
|
14
17
|
import { store as blockEditorStore } from '../store';
|
|
15
18
|
import { globalStylesDataKey } from '../store/private-keys';
|
|
16
19
|
import { unlock } from '../lock-unlock';
|
|
17
20
|
|
|
21
|
+
const { getVariationStyle } = unlock( globalStylesEnginePrivateApis );
|
|
22
|
+
|
|
18
23
|
const VARIATION_PREFIX = 'is-style-';
|
|
19
24
|
|
|
20
25
|
function getVariationMatches( className ) {
|
|
@@ -175,77 +180,6 @@ export function BlockStyleVariationOverridesWithConfig( { config } ) {
|
|
|
175
180
|
);
|
|
176
181
|
}
|
|
177
182
|
|
|
178
|
-
/**
|
|
179
|
-
* Retrieves any variation styles data and resolves any referenced values.
|
|
180
|
-
*
|
|
181
|
-
* @param {Object} globalStyles A complete global styles object, containing settings and styles.
|
|
182
|
-
* @param {string} name The name of the desired block type.
|
|
183
|
-
* @param {variation} variation The of the block style variation to retrieve data for.
|
|
184
|
-
*
|
|
185
|
-
* @return {Object|undefined} The global styles data for the specified variation.
|
|
186
|
-
*/
|
|
187
|
-
export function getVariationStylesWithRefValues(
|
|
188
|
-
globalStyles,
|
|
189
|
-
name,
|
|
190
|
-
variation
|
|
191
|
-
) {
|
|
192
|
-
if ( ! globalStyles?.styles?.blocks?.[ name ]?.variations?.[ variation ] ) {
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// Helper to recursively look for `ref` values to resolve.
|
|
197
|
-
const replaceRefs = ( variationStyles ) => {
|
|
198
|
-
Object.keys( variationStyles ).forEach( ( key ) => {
|
|
199
|
-
const value = variationStyles[ key ];
|
|
200
|
-
|
|
201
|
-
// Only process objects.
|
|
202
|
-
if ( typeof value === 'object' && value !== null ) {
|
|
203
|
-
// Process `ref` value if present.
|
|
204
|
-
if ( value.ref !== undefined ) {
|
|
205
|
-
if (
|
|
206
|
-
typeof value.ref !== 'string' ||
|
|
207
|
-
value.ref.trim() === ''
|
|
208
|
-
) {
|
|
209
|
-
// Remove invalid ref.
|
|
210
|
-
delete variationStyles[ key ];
|
|
211
|
-
} else {
|
|
212
|
-
// Resolve `ref` value.
|
|
213
|
-
const refValue = getValueFromObjectPath(
|
|
214
|
-
globalStyles,
|
|
215
|
-
value.ref
|
|
216
|
-
);
|
|
217
|
-
|
|
218
|
-
if ( refValue ) {
|
|
219
|
-
variationStyles[ key ] = refValue;
|
|
220
|
-
} else {
|
|
221
|
-
delete variationStyles[ key ];
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
} else {
|
|
225
|
-
// Recursively resolve `ref` values in nested objects.
|
|
226
|
-
replaceRefs( value );
|
|
227
|
-
|
|
228
|
-
// After recursion, if value is empty due to explicitly
|
|
229
|
-
// `undefined` ref value, remove it.
|
|
230
|
-
if ( Object.keys( value ).length === 0 ) {
|
|
231
|
-
delete variationStyles[ key ];
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
} );
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
// Deep clone variation node to avoid mutating it within global styles and losing refs.
|
|
239
|
-
const styles = JSON.parse(
|
|
240
|
-
JSON.stringify(
|
|
241
|
-
globalStyles.styles.blocks[ name ].variations[ variation ]
|
|
242
|
-
)
|
|
243
|
-
);
|
|
244
|
-
replaceRefs( styles );
|
|
245
|
-
|
|
246
|
-
return styles;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
183
|
function useBlockStyleVariation( name, variation, clientId ) {
|
|
250
184
|
const { globalSettings, globalStyles } = useSelect( ( select ) => {
|
|
251
185
|
const settings = select( blockEditorStore ).getSettings();
|
|
@@ -256,7 +190,7 @@ function useBlockStyleVariation( name, variation, clientId ) {
|
|
|
256
190
|
}, [] );
|
|
257
191
|
|
|
258
192
|
return useMemo( () => {
|
|
259
|
-
const variationStyles =
|
|
193
|
+
const variationStyles = getVariationStyle(
|
|
260
194
|
{
|
|
261
195
|
settings: globalSettings,
|
|
262
196
|
styles: globalStyles,
|
package/src/hooks/border.js
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
useHasBorderPanelControls,
|
|
30
30
|
BorderPanel as StylesBorderPanel,
|
|
31
31
|
} from '../components/global-styles';
|
|
32
|
+
import { useResolvedStyle } from '../components/global-styles/inherited-value-context';
|
|
32
33
|
import { store as blockEditorStore } from '../store';
|
|
33
34
|
import {
|
|
34
35
|
getStyleForState,
|
|
@@ -149,19 +150,32 @@ function BordersInspectorControl( { label, children, resetAllFilter } ) {
|
|
|
149
150
|
export function BorderPanel( { clientId, name, setAttributes, settings } ) {
|
|
150
151
|
const selectedState = useBlockStyleState();
|
|
151
152
|
const isEnabled = useHasBorderPanel( settings );
|
|
152
|
-
const { style, borderColor } = useSelect(
|
|
153
|
+
const { style, borderColor, className } = useSelect(
|
|
153
154
|
( select ) => {
|
|
154
155
|
// Early return to avoid subscription when disabled
|
|
155
156
|
if ( ! isEnabled ) {
|
|
156
157
|
return {};
|
|
157
158
|
}
|
|
158
|
-
const {
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
const {
|
|
160
|
+
style: _style,
|
|
161
|
+
borderColor: _borderColor,
|
|
162
|
+
className: _className,
|
|
163
|
+
} = select( blockEditorStore ).getBlockAttributes( clientId ) || {};
|
|
164
|
+
return {
|
|
165
|
+
style: _style,
|
|
166
|
+
borderColor: _borderColor,
|
|
167
|
+
className: _className,
|
|
168
|
+
};
|
|
161
169
|
},
|
|
162
170
|
[ clientId, isEnabled ]
|
|
163
171
|
);
|
|
164
172
|
|
|
173
|
+
const { value: inheritedValue } = useResolvedStyle(
|
|
174
|
+
name,
|
|
175
|
+
className,
|
|
176
|
+
selectedState
|
|
177
|
+
);
|
|
178
|
+
|
|
165
179
|
const isStateSelected = ! isDefaultBlockStyleState( selectedState );
|
|
166
180
|
|
|
167
181
|
const value = useMemo( () => {
|
|
@@ -204,6 +218,7 @@ export function BorderPanel( { clientId, name, setAttributes, settings } ) {
|
|
|
204
218
|
value={ value }
|
|
205
219
|
onChange={ onChange }
|
|
206
220
|
defaultControls={ defaultControls }
|
|
221
|
+
inheritedValue={ inheritedValue }
|
|
207
222
|
/>
|
|
208
223
|
);
|
|
209
224
|
}
|
package/src/hooks/custom-css.js
CHANGED
|
@@ -10,7 +10,7 @@ import InspectorControls from '../components/inspector-controls';
|
|
|
10
10
|
import AdvancedPanel, {
|
|
11
11
|
validateCSS,
|
|
12
12
|
} from '../components/global-styles/advanced-panel';
|
|
13
|
-
import { cleanEmptyObject,
|
|
13
|
+
import { cleanEmptyObject, usePrivateStyleOverride } from './utils';
|
|
14
14
|
import { store as blockEditorStore } from '../store';
|
|
15
15
|
|
|
16
16
|
// Stable reference for useInstanceId.
|
|
@@ -96,11 +96,12 @@ function CustomCSSEdit( { clientId, name, setAttributes } ) {
|
|
|
96
96
|
* Hook to handle custom CSS for a block in the editor.
|
|
97
97
|
* Generates a unique class and applies scoped CSS via style override.
|
|
98
98
|
*
|
|
99
|
-
* @param {Object} props
|
|
100
|
-
* @param {Object} props.style
|
|
99
|
+
* @param {Object} props Block props.
|
|
100
|
+
* @param {Object} props.style Block style attribute.
|
|
101
|
+
* @param {string} props.clientId Block client ID.
|
|
101
102
|
* @return {Object} Block props including className for custom CSS scoping.
|
|
102
103
|
*/
|
|
103
|
-
function useBlockProps( { style } ) {
|
|
104
|
+
function useBlockProps( { style, clientId } ) {
|
|
104
105
|
const customCSS = style?.css;
|
|
105
106
|
|
|
106
107
|
// Validate CSS is non-empty and passes validation checks.
|
|
@@ -150,8 +151,16 @@ function useBlockProps( { style } ) {
|
|
|
150
151
|
return processCSSNesting( customCSS, customCSSSelector );
|
|
151
152
|
}, [ customCSS, customCSSSelector, isValidCSS ] );
|
|
152
153
|
|
|
153
|
-
// Inject the CSS via style override.
|
|
154
|
-
|
|
154
|
+
// Inject the CSS via style override. The type makes EditorStyles print
|
|
155
|
+
// it after all other overrides (e.g. block style variations), matching
|
|
156
|
+
// the front end where the custom CSS stylesheet is printed last. The
|
|
157
|
+
// clientId keeps custom CSS overrides in block order relative to each
|
|
158
|
+
// other, which is the order they print in on the front end.
|
|
159
|
+
usePrivateStyleOverride( {
|
|
160
|
+
css: transformedCSS,
|
|
161
|
+
clientId,
|
|
162
|
+
__unstableType: 'custom-css',
|
|
163
|
+
} );
|
|
155
164
|
|
|
156
165
|
// Only add the class if there's valid custom CSS.
|
|
157
166
|
if ( ! isValidCSS ) {
|
package/src/hooks/dimensions.js
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
DimensionsPanel as StylesDimensionsPanel,
|
|
20
20
|
useHasDimensionsPanel,
|
|
21
21
|
} from '../components/global-styles';
|
|
22
|
+
import { useResolvedStyle } from '../components/global-styles/inherited-value-context';
|
|
22
23
|
import { MarginVisualizer, PaddingVisualizer } from './spacing-visualizer';
|
|
23
24
|
import { store as blockEditorStore } from '../store';
|
|
24
25
|
import { unlock } from '../lock-unlock';
|
|
@@ -78,17 +79,28 @@ export function DimensionsPanel( { clientId, name, setAttributes, settings } ) {
|
|
|
78
79
|
const selectedState = useBlockStyleState();
|
|
79
80
|
const isStateSelected = ! isDefaultBlockStyleState( selectedState );
|
|
80
81
|
const isEnabled = useHasDimensionsPanel( settings, selectedState );
|
|
81
|
-
const style = useSelect(
|
|
82
|
+
const { style, className } = useSelect(
|
|
82
83
|
( select ) => {
|
|
83
84
|
// Early return to avoid subscription when disabled
|
|
84
85
|
if ( ! isEnabled ) {
|
|
85
|
-
return
|
|
86
|
+
return {};
|
|
86
87
|
}
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
const attributes =
|
|
89
|
+
select( blockEditorStore ).getBlockAttributes( clientId ) || {};
|
|
90
|
+
return {
|
|
91
|
+
style: attributes.style,
|
|
92
|
+
className: attributes.className,
|
|
93
|
+
};
|
|
89
94
|
},
|
|
90
95
|
[ clientId, isEnabled ]
|
|
91
96
|
);
|
|
97
|
+
|
|
98
|
+
const { value: inheritedValue } = useResolvedStyle(
|
|
99
|
+
name,
|
|
100
|
+
className,
|
|
101
|
+
selectedState
|
|
102
|
+
);
|
|
103
|
+
|
|
92
104
|
const [ visualizedProperty, setVisualizedProperty ] = useVisualizer();
|
|
93
105
|
const value = isStateSelected
|
|
94
106
|
? getStyleForState( style, selectedState )
|
|
@@ -139,6 +151,7 @@ export function DimensionsPanel( { clientId, name, setAttributes, settings } ) {
|
|
|
139
151
|
onVisualize={
|
|
140
152
|
isStateSelected ? undefined : setVisualizedProperty
|
|
141
153
|
}
|
|
154
|
+
inheritedValue={ inheritedValue }
|
|
142
155
|
/>
|
|
143
156
|
{ ! isStateSelected &&
|
|
144
157
|
!! settings?.spacing?.padding &&
|
package/src/hooks/duotone.js
CHANGED
|
@@ -15,7 +15,11 @@ import {
|
|
|
15
15
|
import { useInstanceId } from '@wordpress/compose';
|
|
16
16
|
import { addFilter } from '@wordpress/hooks';
|
|
17
17
|
import { useMemo, useEffect } from '@wordpress/element';
|
|
18
|
-
import {
|
|
18
|
+
import { useSelect } from '@wordpress/data';
|
|
19
|
+
import {
|
|
20
|
+
getBlockSelector,
|
|
21
|
+
privateApis as globalStylesEnginePrivateApis,
|
|
22
|
+
} from '@wordpress/global-styles-engine';
|
|
19
23
|
|
|
20
24
|
/**
|
|
21
25
|
* Internal dependencies
|
|
@@ -26,20 +30,21 @@ import {
|
|
|
26
30
|
__experimentalDuotoneControl as DuotoneControl,
|
|
27
31
|
useSettings,
|
|
28
32
|
} from '../components';
|
|
29
|
-
import {
|
|
30
|
-
getDuotoneFilter,
|
|
31
|
-
getDuotoneStylesheet,
|
|
32
|
-
getDuotoneUnsetStylesheet,
|
|
33
|
-
} from '../components/duotone/utils';
|
|
34
33
|
import { scopeSelector } from '../components/global-styles/utils';
|
|
35
34
|
import {
|
|
36
35
|
cleanEmptyObject,
|
|
37
36
|
useBlockSettings,
|
|
38
37
|
usePrivateStyleOverride,
|
|
39
38
|
} from './utils';
|
|
39
|
+
import { unlock } from '../lock-unlock';
|
|
40
40
|
import { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';
|
|
41
|
+
import { useResolvedStyle } from '../components/global-styles/inherited-value-context';
|
|
41
42
|
import { useBlockEditingMode } from '../components/block-editing-mode';
|
|
42
43
|
import { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';
|
|
44
|
+
import { store as blockEditorStore } from '../store';
|
|
45
|
+
|
|
46
|
+
const { getDuotoneFilter, getDuotoneStylesheet, getDuotoneUnsetStylesheet } =
|
|
47
|
+
unlock( globalStylesEnginePrivateApis );
|
|
43
48
|
|
|
44
49
|
const EMPTY_ARRAY = [];
|
|
45
50
|
|
|
@@ -98,11 +103,21 @@ export function getDuotonePresetFromColors( colors, duotonePalette ) {
|
|
|
98
103
|
return preset ? `var:preset|duotone|${ preset.slug }` : undefined;
|
|
99
104
|
}
|
|
100
105
|
|
|
101
|
-
function DuotonePanelPure( { style, setAttributes, name } ) {
|
|
106
|
+
function DuotonePanelPure( { style, setAttributes, name, clientId } ) {
|
|
102
107
|
const duotoneStyle = style?.color?.duotone;
|
|
103
108
|
const settings = useBlockSettings( name );
|
|
104
109
|
const blockEditingMode = useBlockEditingMode();
|
|
105
110
|
|
|
111
|
+
const className = useSelect(
|
|
112
|
+
( select ) =>
|
|
113
|
+
clientId
|
|
114
|
+
? select( blockEditorStore ).getBlockAttributes( clientId )
|
|
115
|
+
?.className
|
|
116
|
+
: undefined,
|
|
117
|
+
[ clientId ]
|
|
118
|
+
);
|
|
119
|
+
const { value: inheritedValue } = useResolvedStyle( name, className );
|
|
120
|
+
|
|
106
121
|
const duotonePalette = useMultiOriginPresets( {
|
|
107
122
|
presetSetting: 'color.duotone',
|
|
108
123
|
defaultSetting: 'color.defaultDuotone',
|
|
@@ -137,7 +152,9 @@ function DuotonePanelPure( { style, setAttributes, name } ) {
|
|
|
137
152
|
<>
|
|
138
153
|
<InspectorControls group="filter">
|
|
139
154
|
<StylesFiltersPanel
|
|
140
|
-
value={ {
|
|
155
|
+
value={ {
|
|
156
|
+
filter: { duotone: duotonePresetOrColors },
|
|
157
|
+
} }
|
|
141
158
|
onChange={ ( newDuotone ) => {
|
|
142
159
|
const newStyle = {
|
|
143
160
|
...style,
|
|
@@ -150,6 +167,7 @@ function DuotonePanelPure( { style, setAttributes, name } ) {
|
|
|
150
167
|
} );
|
|
151
168
|
} }
|
|
152
169
|
settings={ settings }
|
|
170
|
+
inheritedValue={ inheritedValue }
|
|
153
171
|
/>
|
|
154
172
|
</InspectorControls>
|
|
155
173
|
<BlockControls group="block" __experimentalShareWithChildBlocks>
|
package/src/hooks/elements.js
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
useHasColorPanel,
|
|
15
15
|
default as StylesColorPanel,
|
|
16
16
|
} from '../components/global-styles/color-panel';
|
|
17
|
+
import { useResolvedStyle } from '../components/global-styles/inherited-value-context';
|
|
17
18
|
import { cleanEmptyObject } from './utils';
|
|
18
19
|
import { store as blockEditorStore } from '../store';
|
|
19
20
|
import { COLOR_SUPPORT_KEY } from './color';
|
|
@@ -59,18 +60,27 @@ export function ElementsEdit( {
|
|
|
59
60
|
const selectedState = useBlockStyleState();
|
|
60
61
|
const isEnabled = useHasColorPanel( settings );
|
|
61
62
|
|
|
62
|
-
const style = useSelect(
|
|
63
|
+
const { style, className } = useSelect(
|
|
63
64
|
( select ) => {
|
|
64
65
|
if ( ! isEnabled ) {
|
|
65
|
-
return
|
|
66
|
+
return {};
|
|
66
67
|
}
|
|
67
68
|
const attributes =
|
|
68
69
|
select( blockEditorStore ).getBlockAttributes( clientId );
|
|
69
|
-
return
|
|
70
|
+
return {
|
|
71
|
+
style: attributes?.style,
|
|
72
|
+
className: attributes?.className,
|
|
73
|
+
};
|
|
70
74
|
},
|
|
71
75
|
[ clientId, isEnabled ]
|
|
72
76
|
);
|
|
73
77
|
|
|
78
|
+
const { value: inheritedValue } = useResolvedStyle(
|
|
79
|
+
name,
|
|
80
|
+
className,
|
|
81
|
+
selectedState
|
|
82
|
+
);
|
|
83
|
+
|
|
74
84
|
const isStateSelected = ! isDefaultBlockStyleState( selectedState );
|
|
75
85
|
|
|
76
86
|
const value = useMemo( () => {
|
|
@@ -134,6 +144,7 @@ export function ElementsEdit( {
|
|
|
134
144
|
defaultControls={ defaultControls }
|
|
135
145
|
label={ label }
|
|
136
146
|
contrastWarning={ contrastWarning }
|
|
147
|
+
inheritedValue={ inheritedValue }
|
|
137
148
|
/>
|
|
138
149
|
);
|
|
139
150
|
}
|