@wordpress/block-editor 15.19.1-next.v.202605131032.0 → 15.20.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 +15 -1
- package/build/components/block-card/index.cjs +51 -41
- package/build/components/block-card/index.cjs.map +3 -3
- package/build/components/block-heading-level-dropdown/heading-level-icon.cjs.map +3 -3
- package/build/components/block-icon/index.cjs +7 -1
- package/build/components/block-icon/index.cjs.map +3 -3
- package/build/components/block-inspector/index.cjs +156 -11
- package/build/components/block-inspector/index.cjs.map +3 -3
- package/build/components/block-inspector/inspector-pre-tabs-slot-fill.cjs +38 -0
- package/build/components/block-inspector/inspector-pre-tabs-slot-fill.cjs.map +7 -0
- package/build/components/block-list/use-block-props/index.cjs +1 -1
- 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 +3 -4
- package/build/components/block-list/use-block-props/use-focus-handler.cjs.map +3 -3
- package/build/components/block-list/use-block-props/use-is-hovered.cjs +24 -14
- package/build/components/block-list/use-block-props/use-is-hovered.cjs.map +3 -3
- package/build/components/block-lock/modal.cjs.map +3 -3
- package/build/components/block-patterns-list/index.cjs +13 -2
- package/build/components/block-patterns-list/index.cjs.map +2 -2
- package/build/components/block-popover/index.cjs +13 -3
- package/build/components/block-popover/index.cjs.map +2 -2
- package/build/components/block-toolbar/switch-section-style.cjs.map +3 -3
- package/build/components/block-visibility/modal.cjs.map +3 -3
- package/build/components/block-visibility/viewport-visibility-info.cjs.map +3 -3
- package/build/components/colors-gradients/control.cjs +7 -4
- package/build/components/colors-gradients/control.cjs.map +2 -2
- package/build/components/global-styles/advanced-panel.cjs +24 -22
- package/build/components/global-styles/advanced-panel.cjs.map +3 -3
- package/build/components/global-styles/color-panel.cjs +95 -58
- package/build/components/global-styles/color-panel.cjs.map +2 -2
- package/build/components/global-styles/dimensions-panel.cjs +11 -5
- package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
- package/build/components/global-styles/index.cjs +3 -0
- package/build/components/global-styles/index.cjs.map +2 -2
- package/build/components/global-styles/shadow-panel-components.cjs +38 -26
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/global-styles/state-control-badges.cjs +69 -0
- package/build/components/global-styles/state-control-badges.cjs.map +7 -0
- package/build/components/global-styles/state-control.cjs +54 -63
- package/build/components/global-styles/state-control.cjs.map +3 -3
- package/build/components/iframe/index.cjs +0 -3
- package/build/components/iframe/index.cjs.map +2 -2
- package/build/components/iframe/use-scale-canvas.cjs +4 -1
- package/build/components/iframe/use-scale-canvas.cjs.map +2 -2
- package/build/components/inserter/hooks/use-patterns-state.cjs +4 -6
- package/build/components/inserter/hooks/use-patterns-state.cjs.map +2 -2
- package/build/components/inserter/index.cjs +1 -0
- package/build/components/inserter/index.cjs.map +2 -2
- package/build/components/inserter/media-tab/media-preview.cjs +27 -18
- package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
- package/build/components/inserter/media-tab/utils.cjs +1 -1
- package/build/components/inserter/media-tab/utils.cjs.map +2 -2
- package/build/components/inserter/panel.cjs.map +3 -3
- package/build/components/inspector-controls/block-support-tools-panel.cjs +10 -2
- package/build/components/inspector-controls/block-support-tools-panel.cjs.map +2 -2
- package/build/components/inspector-controls/fill.cjs +14 -4
- package/build/components/inspector-controls/fill.cjs.map +2 -2
- package/build/components/inspector-controls/groups.cjs +2 -0
- package/build/components/inspector-controls/groups.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/index.cjs +13 -8
- package/build/components/inspector-controls-tabs/index.cjs.map +3 -3
- package/build/components/inspector-controls-tabs/settings-tab.cjs +1 -4
- package/build/components/inspector-controls-tabs/settings-tab.cjs.map +3 -3
- package/build/components/inspector-controls-tabs/styles-tab.cjs +9 -0
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +3 -3
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs +11 -5
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs.map +2 -2
- package/build/components/list-view/block-select-button.cjs +20 -8
- package/build/components/list-view/block-select-button.cjs.map +2 -2
- package/build/components/list-view/block.cjs +2 -1
- package/build/components/list-view/block.cjs.map +2 -2
- package/build/components/preset-input-control/custom-value-controls.cjs +10 -1
- package/build/components/preset-input-control/custom-value-controls.cjs.map +2 -2
- package/build/components/preset-input-control/index.cjs.map +3 -3
- package/build/components/provider/use-media-upload-settings.cjs +1 -0
- package/build/components/provider/use-media-upload-settings.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/enter.cjs +9 -2
- package/build/components/rich-text/event-listeners/enter.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/paste-handler.cjs +4 -4
- package/build/components/rich-text/event-listeners/paste-handler.cjs.map +3 -3
- package/build/hooks/background.cjs +13 -3
- package/build/hooks/background.cjs.map +2 -2
- package/build/hooks/block-fields/link/index.cjs.map +3 -3
- package/build/hooks/block-fields/media/index.cjs.map +3 -3
- package/build/hooks/block-style-state.cjs +112 -0
- package/build/hooks/block-style-state.cjs.map +7 -0
- package/build/hooks/border.cjs +13 -3
- package/build/hooks/border.cjs.map +2 -2
- package/build/hooks/color.cjs +28 -9
- package/build/hooks/color.cjs.map +2 -2
- package/build/hooks/dimensions.cjs +15 -6
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/layout-child.cjs +147 -61
- package/build/hooks/layout-child.cjs.map +2 -2
- package/build/hooks/layout.cjs +263 -56
- package/build/hooks/layout.cjs.map +3 -3
- package/build/hooks/state-utils.cjs +94 -0
- package/build/hooks/state-utils.cjs.map +7 -0
- package/build/hooks/states.cjs +124 -0
- package/build/hooks/states.cjs.map +7 -0
- package/build/hooks/style.cjs +304 -17
- package/build/hooks/style.cjs.map +3 -3
- package/build/hooks/typography.cjs +14 -5
- package/build/hooks/typography.cjs.map +2 -2
- package/build/layouts/constrained.cjs +128 -55
- package/build/layouts/constrained.cjs.map +3 -3
- package/build/layouts/flex.cjs +119 -31
- package/build/layouts/flex.cjs.map +3 -3
- package/build/layouts/grid.cjs +103 -40
- package/build/layouts/grid.cjs.map +3 -3
- package/build/private-apis.cjs +2 -0
- package/build/private-apis.cjs.map +2 -2
- package/build/store/private-actions.cjs +18 -0
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-keys.cjs +10 -2
- package/build/store/private-keys.cjs.map +2 -2
- package/build/store/private-selectors.cjs +26 -2
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +70 -1
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/utils.cjs +1 -1
- package/build/store/utils.cjs.map +2 -2
- package/build/utils/color-values.cjs +44 -0
- package/build/utils/color-values.cjs.map +7 -0
- package/build-module/components/block-card/index.mjs +52 -45
- package/build-module/components/block-card/index.mjs.map +2 -2
- package/build-module/components/block-heading-level-dropdown/heading-level-icon.mjs +2 -2
- package/build-module/components/block-heading-level-dropdown/heading-level-icon.mjs.map +2 -2
- package/build-module/components/block-icon/index.mjs +8 -2
- package/build-module/components/block-icon/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +166 -13
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-inspector/inspector-pre-tabs-slot-fill.mjs +12 -0
- package/build-module/components/block-inspector/inspector-pre-tabs-slot-fill.mjs.map +7 -0
- package/build-module/components/block-list/use-block-props/index.mjs +1 -1
- 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 +7 -5
- 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-is-hovered.mjs +28 -15
- package/build-module/components/block-list/use-block-props/use-is-hovered.mjs.map +2 -2
- package/build-module/components/block-lock/modal.mjs +4 -4
- package/build-module/components/block-lock/modal.mjs.map +2 -2
- package/build-module/components/block-patterns-list/index.mjs +14 -4
- package/build-module/components/block-patterns-list/index.mjs.map +2 -2
- package/build-module/components/block-popover/index.mjs +13 -3
- package/build-module/components/block-popover/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/switch-section-style.mjs +2 -2
- package/build-module/components/block-toolbar/switch-section-style.mjs.map +2 -2
- package/build-module/components/block-visibility/modal.mjs +2 -2
- package/build-module/components/block-visibility/modal.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-visibility-info.mjs +2 -2
- package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +2 -2
- package/build-module/components/colors-gradients/control.mjs +7 -4
- package/build-module/components/colors-gradients/control.mjs.map +2 -2
- package/build-module/components/global-styles/advanced-panel.mjs +25 -27
- package/build-module/components/global-styles/advanced-panel.mjs.map +2 -2
- package/build-module/components/global-styles/color-panel.mjs +96 -59
- package/build-module/components/global-styles/color-panel.mjs.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs +14 -5
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/index.mjs +2 -0
- package/build-module/components/global-styles/index.mjs.map +2 -2
- package/build-module/components/global-styles/shadow-panel-components.mjs +39 -28
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/global-styles/state-control-badges.mjs +48 -0
- package/build-module/components/global-styles/state-control-badges.mjs.map +7 -0
- package/build-module/components/global-styles/state-control.mjs +57 -71
- package/build-module/components/global-styles/state-control.mjs.map +2 -2
- package/build-module/components/iframe/index.mjs +0 -3
- package/build-module/components/iframe/index.mjs.map +2 -2
- package/build-module/components/iframe/use-scale-canvas.mjs +4 -1
- package/build-module/components/iframe/use-scale-canvas.mjs.map +2 -2
- package/build-module/components/inserter/hooks/use-patterns-state.mjs +8 -7
- package/build-module/components/inserter/hooks/use-patterns-state.mjs.map +2 -2
- package/build-module/components/inserter/index.mjs +1 -0
- package/build-module/components/inserter/index.mjs.map +2 -2
- package/build-module/components/inserter/media-tab/media-preview.mjs +27 -19
- package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
- package/build-module/components/inserter/media-tab/utils.mjs +1 -1
- package/build-module/components/inserter/media-tab/utils.mjs.map +2 -2
- package/build-module/components/inserter/panel.mjs +2 -2
- package/build-module/components/inserter/panel.mjs.map +2 -2
- package/build-module/components/inspector-controls/block-support-tools-panel.mjs +10 -2
- package/build-module/components/inspector-controls/block-support-tools-panel.mjs.map +2 -2
- package/build-module/components/inspector-controls/fill.mjs +18 -5
- package/build-module/components/inspector-controls/fill.mjs.map +2 -2
- package/build-module/components/inspector-controls/groups.mjs +2 -0
- package/build-module/components/inspector-controls/groups.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/index.mjs +14 -10
- package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/settings-tab.mjs +1 -4
- package/build-module/components/inspector-controls-tabs/settings-tab.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +9 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs +11 -5
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs.map +2 -2
- package/build-module/components/list-view/block-select-button.mjs +20 -9
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +2 -1
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/components/preset-input-control/custom-value-controls.mjs +10 -2
- package/build-module/components/preset-input-control/custom-value-controls.mjs.map +2 -2
- package/build-module/components/preset-input-control/index.mjs +2 -2
- package/build-module/components/preset-input-control/index.mjs.map +2 -2
- package/build-module/components/provider/use-media-upload-settings.mjs +1 -0
- package/build-module/components/provider/use-media-upload-settings.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs +9 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +2 -2
- package/build-module/hooks/background.mjs +18 -3
- package/build-module/hooks/background.mjs.map +2 -2
- package/build-module/hooks/block-fields/link/index.mjs +3 -3
- package/build-module/hooks/block-fields/link/index.mjs.map +2 -2
- package/build-module/hooks/block-fields/media/index.mjs +3 -3
- package/build-module/hooks/block-fields/media/index.mjs.map +2 -2
- package/build-module/hooks/block-style-state.mjs +79 -0
- package/build-module/hooks/block-style-state.mjs.map +7 -0
- package/build-module/hooks/border.mjs +18 -3
- package/build-module/hooks/border.mjs.map +2 -2
- package/build-module/hooks/color.mjs +33 -9
- package/build-module/hooks/color.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs +20 -6
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/layout-child.mjs +141 -61
- package/build-module/hooks/layout-child.mjs.map +2 -2
- package/build-module/hooks/layout.mjs +270 -58
- package/build-module/hooks/layout.mjs.map +2 -2
- package/build-module/hooks/state-utils.mjs +64 -0
- package/build-module/hooks/state-utils.mjs.map +7 -0
- package/build-module/hooks/states.mjs +85 -0
- package/build-module/hooks/states.mjs.map +7 -0
- package/build-module/hooks/style.mjs +309 -18
- package/build-module/hooks/style.mjs.map +2 -2
- package/build-module/hooks/typography.mjs +19 -5
- package/build-module/hooks/typography.mjs.map +2 -2
- package/build-module/layouts/constrained.mjs +130 -57
- package/build-module/layouts/constrained.mjs.map +2 -2
- package/build-module/layouts/flex.mjs +123 -35
- package/build-module/layouts/flex.mjs.map +2 -2
- package/build-module/layouts/grid.mjs +105 -42
- package/build-module/layouts/grid.mjs.map +2 -2
- package/build-module/private-apis.mjs +4 -0
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +16 -0
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-keys.mjs +7 -1
- package/build-module/store/private-keys.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +25 -2
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +69 -1
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/utils.mjs +5 -2
- package/build-module/store/utils.mjs.map +2 -2
- package/build-module/utils/color-values.mjs +19 -0
- package/build-module/utils/color-values.mjs.map +7 -0
- package/build-style/content-rtl.css +18 -3
- package/build-style/content.css +18 -3
- package/build-style/style-rtl.css +14 -17
- package/build-style/style.css +14 -17
- package/package.json +41 -41
- package/src/components/audio-player/index.native.js +7 -3
- package/src/components/block-card/index.js +67 -60
- package/src/components/block-heading-level-dropdown/heading-level-icon.js +2 -2
- package/src/components/block-icon/index.js +5 -2
- package/src/components/block-icon/index.native.js +2 -2
- package/src/components/block-inspector/index.js +153 -7
- package/src/components/block-inspector/inspector-pre-tabs-slot-fill.js +11 -0
- package/src/components/block-list/block-selection-button.native.js +3 -3
- package/src/components/block-list/content.scss +0 -6
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-list/use-block-props/use-focus-handler.js +8 -6
- package/src/components/block-list/use-block-props/use-is-hovered.js +32 -15
- package/src/components/block-lock/modal.js +4 -4
- package/src/components/block-patterns-list/index.js +14 -5
- package/src/components/block-patterns-list/stories/index.story.jsx +2 -0
- package/src/components/block-patterns-list/style.scss +0 -1
- package/src/components/block-popover/index.js +20 -10
- package/src/components/block-toolbar/switch-section-style.js +2 -2
- package/src/components/block-visibility/modal.js +2 -2
- package/src/components/block-visibility/viewport-visibility-info.js +2 -2
- package/src/components/colors/test/with-colors.js +1 -1
- package/src/components/colors-gradients/control.js +10 -8
- package/src/components/colors-gradients/test/control.js +98 -1
- package/src/components/global-styles/advanced-panel.js +44 -39
- package/src/components/global-styles/color-panel.js +133 -60
- package/src/components/global-styles/dimensions-panel.js +17 -4
- package/src/components/global-styles/index.js +1 -0
- package/src/components/global-styles/shadow-panel-components.js +29 -19
- package/src/components/global-styles/state-control-badges.js +58 -0
- package/src/components/global-styles/state-control.js +28 -36
- package/src/components/global-styles/test/color-panel.js +135 -0
- package/src/components/iframe/index.js +0 -3
- package/src/components/iframe/use-scale-canvas.js +8 -2
- package/src/components/inserter/hooks/use-patterns-state.js +12 -7
- package/src/components/inserter/index.js +1 -0
- package/src/components/inserter/media-tab/media-preview.js +29 -20
- package/src/components/inserter/media-tab/utils.js +1 -1
- package/src/components/inserter/panel.js +2 -2
- package/src/components/inserter/style.scss +1 -0
- package/src/components/inserter-button/index.native.js +5 -2
- package/src/components/inspector-controls/block-support-tools-panel.js +10 -2
- package/src/components/inspector-controls/fill.js +18 -5
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/index.js +9 -5
- package/src/components/inspector-controls-tabs/settings-tab.js +1 -7
- package/src/components/inspector-controls-tabs/styles-tab.js +6 -0
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +13 -7
- package/src/components/list-view/block-select-button.js +19 -9
- package/src/components/list-view/block.js +6 -1
- package/src/components/media-replace-flow/style.scss +0 -18
- package/src/components/preset-input-control/custom-value-controls.js +13 -6
- package/src/components/preset-input-control/index.js +2 -2
- package/src/components/provider/use-media-upload-settings.js +1 -0
- package/src/components/rich-text/event-listeners/enter.js +14 -2
- package/src/components/rich-text/event-listeners/paste-handler.js +5 -4
- package/src/components/unsupported-block-details/index.native.js +6 -2
- package/src/components/video-player/index.native.js +2 -2
- package/src/components/warning/index.native.js +2 -2
- package/src/hooks/background.js +59 -37
- package/src/hooks/block-fields/link/index.js +3 -3
- package/src/hooks/block-fields/media/index.js +3 -3
- package/src/hooks/block-style-state.js +127 -0
- package/src/hooks/border.js +25 -6
- package/src/hooks/color.js +40 -18
- package/src/hooks/dimensions.js +32 -11
- package/src/hooks/layout-child.js +179 -62
- package/src/hooks/layout.js +349 -75
- package/src/hooks/layout.scss +6 -0
- package/src/hooks/state-utils.js +158 -0
- package/src/hooks/states.js +109 -0
- package/src/hooks/style.js +456 -19
- package/src/hooks/test/block-style-state.js +270 -0
- package/src/hooks/test/layout.js +185 -0
- package/src/hooks/test/state-utils.js +193 -0
- package/src/hooks/test/style.js +301 -1
- package/src/hooks/typography.js +33 -14
- package/src/layouts/constrained.js +182 -95
- package/src/layouts/flex.js +141 -36
- package/src/layouts/grid.js +122 -32
- package/src/layouts/test/flex.js +57 -20
- package/src/private-apis.js +4 -0
- package/src/store/private-actions.js +32 -0
- package/src/store/private-keys.js +4 -0
- package/src/store/private-selectors.js +44 -2
- package/src/store/reducer.js +105 -1
- package/src/store/test/private-actions.js +26 -0
- package/src/store/test/private-selectors.js +90 -0
- package/src/store/test/reducer.js +363 -0
- package/src/store/utils.js +6 -2
- package/src/utils/color-values.js +28 -0
- package/src/utils/test/color-values.js +78 -0
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
8
8
|
__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,
|
|
9
9
|
__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,
|
|
10
|
-
|
|
10
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
11
11
|
} from '@wordpress/components';
|
|
12
12
|
import { __ } from '@wordpress/i18n';
|
|
13
13
|
import {
|
|
@@ -27,7 +27,7 @@ import { useSettings } from '../components/use-settings';
|
|
|
27
27
|
import { appendSelectors, getBlockGapCSS, getAlignmentsInfo } from './utils';
|
|
28
28
|
import { getGapCSSValue } from '../hooks/gap';
|
|
29
29
|
import { BlockControls, JustifyContentControl } from '../components';
|
|
30
|
-
import { shouldSkipSerialization } from '../hooks/utils';
|
|
30
|
+
import { cleanEmptyObject, shouldSkipSerialization } from '../hooks/utils';
|
|
31
31
|
import { LAYOUT_DEFINITIONS } from './definitions';
|
|
32
32
|
|
|
33
33
|
export default {
|
|
@@ -37,6 +37,8 @@ export default {
|
|
|
37
37
|
layout,
|
|
38
38
|
onChange,
|
|
39
39
|
layoutBlockSupport = {},
|
|
40
|
+
resetLayout = {},
|
|
41
|
+
clientId,
|
|
40
42
|
} ) {
|
|
41
43
|
const { wideSize, contentSize, justifyContent = 'center' } = layout;
|
|
42
44
|
const {
|
|
@@ -70,92 +72,143 @@ export default {
|
|
|
70
72
|
const units = useCustomUnits( {
|
|
71
73
|
availableUnits: availableUnits || [ '%', 'px', 'em', 'rem', 'vw' ],
|
|
72
74
|
} );
|
|
75
|
+
const hasLayoutValue = ( key, defaultValue ) =>
|
|
76
|
+
( layout?.[ key ] ?? defaultValue ) !==
|
|
77
|
+
( resetLayout?.[ key ] ?? defaultValue );
|
|
78
|
+
const resetContentSize = () =>
|
|
79
|
+
onChange(
|
|
80
|
+
cleanEmptyObject( {
|
|
81
|
+
...layout,
|
|
82
|
+
contentSize: resetLayout?.contentSize,
|
|
83
|
+
} )
|
|
84
|
+
);
|
|
85
|
+
const resetWideSize = () =>
|
|
86
|
+
onChange(
|
|
87
|
+
cleanEmptyObject( {
|
|
88
|
+
...layout,
|
|
89
|
+
wideSize: resetLayout?.wideSize,
|
|
90
|
+
} )
|
|
91
|
+
);
|
|
92
|
+
const resetJustification = () =>
|
|
93
|
+
onChange(
|
|
94
|
+
cleanEmptyObject( {
|
|
95
|
+
...layout,
|
|
96
|
+
justifyContent: resetLayout?.justifyContent,
|
|
97
|
+
} )
|
|
98
|
+
);
|
|
99
|
+
const hasContentSizeValue = () => hasLayoutValue( 'contentSize' );
|
|
100
|
+
const hasWideSizeValue = () => hasLayoutValue( 'wideSize' );
|
|
101
|
+
const hasJustificationValue = () =>
|
|
102
|
+
hasLayoutValue( 'justifyContent', 'center' );
|
|
103
|
+
|
|
73
104
|
return (
|
|
74
|
-
|
|
75
|
-
spacing={ 4 }
|
|
76
|
-
className="block-editor-hooks__layout-constrained"
|
|
77
|
-
>
|
|
105
|
+
<>
|
|
78
106
|
{ allowCustomContentAndWideSize && (
|
|
79
107
|
<>
|
|
80
|
-
<
|
|
81
|
-
__next40pxDefaultSize
|
|
108
|
+
<ToolsPanelItem
|
|
82
109
|
label={ __( 'Content width' ) }
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
110
|
+
hasValue={ hasContentSizeValue }
|
|
111
|
+
onDeselect={ resetContentSize }
|
|
112
|
+
panelId={ clientId }
|
|
113
|
+
>
|
|
114
|
+
<UnitControl
|
|
115
|
+
__next40pxDefaultSize
|
|
116
|
+
label={ __( 'Content width' ) }
|
|
117
|
+
labelPosition="top"
|
|
118
|
+
value={ contentSize || wideSize || '' }
|
|
119
|
+
onChange={ ( nextWidth ) => {
|
|
120
|
+
nextWidth =
|
|
121
|
+
0 > parseFloat( nextWidth )
|
|
122
|
+
? '0'
|
|
123
|
+
: nextWidth;
|
|
124
|
+
onChange(
|
|
125
|
+
cleanEmptyObject( {
|
|
126
|
+
...layout,
|
|
127
|
+
contentSize:
|
|
128
|
+
nextWidth !== ''
|
|
129
|
+
? nextWidth
|
|
130
|
+
: undefined,
|
|
131
|
+
} )
|
|
132
|
+
);
|
|
133
|
+
} }
|
|
134
|
+
units={ units }
|
|
135
|
+
prefix={
|
|
136
|
+
<InputControlPrefixWrapper variant="icon">
|
|
137
|
+
<Icon icon={ alignNone } />
|
|
138
|
+
</InputControlPrefixWrapper>
|
|
139
|
+
}
|
|
140
|
+
/>
|
|
141
|
+
</ToolsPanelItem>
|
|
142
|
+
<ToolsPanelItem
|
|
107
143
|
label={ __( 'Wide width' ) }
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
144
|
+
hasValue={ hasWideSizeValue }
|
|
145
|
+
onDeselect={ resetWideSize }
|
|
146
|
+
panelId={ clientId }
|
|
147
|
+
>
|
|
148
|
+
<UnitControl
|
|
149
|
+
__next40pxDefaultSize
|
|
150
|
+
label={ __( 'Wide width' ) }
|
|
151
|
+
labelPosition="top"
|
|
152
|
+
value={ wideSize || contentSize || '' }
|
|
153
|
+
onChange={ ( nextWidth ) => {
|
|
154
|
+
nextWidth =
|
|
155
|
+
0 > parseFloat( nextWidth )
|
|
156
|
+
? '0'
|
|
157
|
+
: nextWidth;
|
|
158
|
+
onChange(
|
|
159
|
+
cleanEmptyObject( {
|
|
160
|
+
...layout,
|
|
161
|
+
wideSize:
|
|
162
|
+
nextWidth !== ''
|
|
163
|
+
? nextWidth
|
|
164
|
+
: undefined,
|
|
165
|
+
} )
|
|
166
|
+
);
|
|
167
|
+
} }
|
|
168
|
+
units={ units }
|
|
169
|
+
prefix={
|
|
170
|
+
<InputControlPrefixWrapper variant="icon">
|
|
171
|
+
<Icon icon={ stretchWide } />
|
|
172
|
+
</InputControlPrefixWrapper>
|
|
173
|
+
}
|
|
174
|
+
/>
|
|
175
|
+
<p className="block-editor-hooks__layout-constrained-helptext">
|
|
176
|
+
{ __(
|
|
177
|
+
'Customize the width for all elements that are assigned to the center or wide columns.'
|
|
178
|
+
) }
|
|
179
|
+
</p>
|
|
180
|
+
</ToolsPanelItem>
|
|
135
181
|
</>
|
|
136
182
|
) }
|
|
137
183
|
{ allowJustification && (
|
|
138
|
-
<
|
|
139
|
-
__next40pxDefaultSize
|
|
184
|
+
<ToolsPanelItem
|
|
140
185
|
label={ __( 'Justification' ) }
|
|
141
|
-
|
|
142
|
-
|
|
186
|
+
hasValue={ hasJustificationValue }
|
|
187
|
+
onDeselect={ resetJustification }
|
|
188
|
+
panelId={ clientId }
|
|
143
189
|
>
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
190
|
+
<ToggleGroupControl
|
|
191
|
+
__next40pxDefaultSize
|
|
192
|
+
label={ __( 'Justification' ) }
|
|
193
|
+
value={ justifyContent }
|
|
194
|
+
onChange={ onJustificationChange }
|
|
195
|
+
>
|
|
196
|
+
{ justificationOptions.map(
|
|
197
|
+
( { value, icon, label } ) => {
|
|
198
|
+
return (
|
|
199
|
+
<ToggleGroupControlOptionIcon
|
|
200
|
+
key={ value }
|
|
201
|
+
value={ value }
|
|
202
|
+
icon={ icon }
|
|
203
|
+
label={ label }
|
|
204
|
+
/>
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
) }
|
|
208
|
+
</ToggleGroupControl>
|
|
209
|
+
</ToolsPanelItem>
|
|
157
210
|
) }
|
|
158
|
-
|
|
211
|
+
</>
|
|
159
212
|
);
|
|
160
213
|
},
|
|
161
214
|
toolBarControls: function DefaultLayoutToolbarControls( {
|
|
@@ -180,13 +233,26 @@ export default {
|
|
|
180
233
|
getLayoutStyle: function getLayoutStyle( {
|
|
181
234
|
selector,
|
|
182
235
|
layout = {},
|
|
236
|
+
viewportOverrides,
|
|
183
237
|
style,
|
|
184
238
|
blockName,
|
|
185
239
|
hasBlockGapSupport,
|
|
186
240
|
layoutDefinitions = LAYOUT_DEFINITIONS,
|
|
187
241
|
} ) {
|
|
188
|
-
const
|
|
242
|
+
const hasViewportOverrides = viewportOverrides !== undefined;
|
|
243
|
+
const effectiveLayout = hasViewportOverrides
|
|
244
|
+
? { ...layout, ...viewportOverrides }
|
|
245
|
+
: layout;
|
|
246
|
+
const hasViewportOverride = ( key ) =>
|
|
247
|
+
Object.hasOwn( viewportOverrides || {}, key );
|
|
248
|
+
const { contentSize, wideSize, justifyContent } = effectiveLayout;
|
|
189
249
|
const blockGapStyleValue = getGapCSSValue( style?.spacing?.blockGap );
|
|
250
|
+
const hasBlockGapOverride =
|
|
251
|
+
! hasViewportOverrides ||
|
|
252
|
+
Object.hasOwn( style?.spacing || {}, 'blockGap' );
|
|
253
|
+
const hasBlockSpacingOverride =
|
|
254
|
+
! hasViewportOverrides ||
|
|
255
|
+
Object.hasOwn( style?.spacing || {}, 'padding' );
|
|
190
256
|
|
|
191
257
|
// If a block's block.json skips serialization for spacing or
|
|
192
258
|
// spacing.blockGap, don't apply the user-defined value to the styles.
|
|
@@ -205,16 +271,29 @@ export default {
|
|
|
205
271
|
const marginRight =
|
|
206
272
|
justifyContent === 'right' ? '0 !important' : 'auto !important';
|
|
207
273
|
|
|
274
|
+
const hasJustificationOverride =
|
|
275
|
+
hasViewportOverrides && hasViewportOverride( 'justifyContent' );
|
|
276
|
+
const shouldOutputConstrainedSizes =
|
|
277
|
+
! hasViewportOverrides ||
|
|
278
|
+
hasViewportOverride( 'contentSize' ) ||
|
|
279
|
+
hasViewportOverride( 'wideSize' );
|
|
280
|
+
const constrainedSizeDeclarations = [
|
|
281
|
+
`max-width: ${ contentSize ?? wideSize }`,
|
|
282
|
+
];
|
|
283
|
+
if ( ! hasViewportOverrides || hasJustificationOverride ) {
|
|
284
|
+
constrainedSizeDeclarations.push(
|
|
285
|
+
`margin-left: ${ marginLeft }`,
|
|
286
|
+
`margin-right: ${ marginRight }`
|
|
287
|
+
);
|
|
288
|
+
}
|
|
208
289
|
let output =
|
|
209
|
-
!! contentSize || !! wideSize
|
|
290
|
+
shouldOutputConstrainedSizes && ( !! contentSize || !! wideSize )
|
|
210
291
|
? `
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
margin-left: ${ marginLeft };
|
|
217
|
-
margin-right: ${ marginRight };
|
|
292
|
+
${ appendSelectors(
|
|
293
|
+
selector,
|
|
294
|
+
'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'
|
|
295
|
+
) } {
|
|
296
|
+
${ constrainedSizeDeclarations.join( '; ' ) };
|
|
218
297
|
}
|
|
219
298
|
${ appendSelectors( selector, '> .alignwide' ) } {
|
|
220
299
|
max-width: ${ wideSize ?? contentSize };
|
|
@@ -222,25 +301,33 @@ export default {
|
|
|
222
301
|
${ appendSelectors( selector, '> .alignfull' ) } {
|
|
223
302
|
max-width: none;
|
|
224
303
|
}
|
|
225
|
-
|
|
304
|
+
`
|
|
226
305
|
: '';
|
|
227
306
|
|
|
228
|
-
if (
|
|
307
|
+
if ( hasJustificationOverride && ! shouldOutputConstrainedSizes ) {
|
|
229
308
|
output += `${ appendSelectors(
|
|
230
309
|
selector,
|
|
231
310
|
'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'
|
|
232
311
|
) }
|
|
312
|
+
{ margin-left: ${ marginLeft }; margin-right: ${ marginRight }; }`;
|
|
313
|
+
} else if ( ! hasViewportOverrides ) {
|
|
314
|
+
if ( justifyContent === 'left' ) {
|
|
315
|
+
output += `${ appendSelectors(
|
|
316
|
+
selector,
|
|
317
|
+
'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'
|
|
318
|
+
) }
|
|
233
319
|
{ margin-left: ${ marginLeft }; }`;
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
320
|
+
} else if ( justifyContent === 'right' ) {
|
|
321
|
+
output += `${ appendSelectors(
|
|
322
|
+
selector,
|
|
323
|
+
'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'
|
|
324
|
+
) }
|
|
239
325
|
{ margin-right: ${ marginRight }; }`;
|
|
326
|
+
}
|
|
240
327
|
}
|
|
241
328
|
|
|
242
329
|
// If there is custom padding, add negative margins for alignfull blocks.
|
|
243
|
-
if ( style?.spacing?.padding ) {
|
|
330
|
+
if ( hasBlockSpacingOverride && style?.spacing?.padding ) {
|
|
244
331
|
// The style object might be storing a preset so we need to make sure we get a usable value.
|
|
245
332
|
const paddingValues = getCSSRules( style );
|
|
246
333
|
paddingValues.forEach( ( rule ) => {
|
|
@@ -269,7 +356,7 @@ export default {
|
|
|
269
356
|
}
|
|
270
357
|
|
|
271
358
|
// Output blockGap styles based on rules contained in layout definitions in theme.json.
|
|
272
|
-
if ( hasBlockGapSupport && blockGapValue ) {
|
|
359
|
+
if ( hasBlockGapSupport && hasBlockGapOverride && blockGapValue ) {
|
|
273
360
|
output += getBlockGapCSS(
|
|
274
361
|
selector,
|
|
275
362
|
layoutDefinitions,
|
package/src/layouts/flex.js
CHANGED
|
@@ -12,11 +12,11 @@ import {
|
|
|
12
12
|
arrowDown,
|
|
13
13
|
} from '@wordpress/icons';
|
|
14
14
|
import {
|
|
15
|
-
ToggleControl,
|
|
16
15
|
Flex,
|
|
17
|
-
|
|
16
|
+
ToggleControl,
|
|
18
17
|
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
19
18
|
__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,
|
|
19
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
20
20
|
} from '@wordpress/components';
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
JustifyContentControl,
|
|
31
31
|
BlockVerticalAlignmentControl,
|
|
32
32
|
} from '../components';
|
|
33
|
-
import { shouldSkipSerialization } from '../hooks/utils';
|
|
33
|
+
import { cleanEmptyObject, shouldSkipSerialization } from '../hooks/utils';
|
|
34
34
|
import { LAYOUT_DEFINITIONS } from './definitions';
|
|
35
35
|
|
|
36
36
|
// Used with the default, horizontal flex orientation.
|
|
@@ -71,34 +71,110 @@ export default {
|
|
|
71
71
|
layout = {},
|
|
72
72
|
onChange,
|
|
73
73
|
layoutBlockSupport = {},
|
|
74
|
+
resetLayout = {},
|
|
75
|
+
clientId,
|
|
74
76
|
} ) {
|
|
75
77
|
const {
|
|
76
78
|
allowOrientation = true,
|
|
77
79
|
allowJustification = true,
|
|
78
80
|
allowWrap = true,
|
|
79
81
|
} = layoutBlockSupport;
|
|
82
|
+
const hasLayoutValue = ( key, defaultValue ) =>
|
|
83
|
+
( layout?.[ key ] ?? defaultValue ) !==
|
|
84
|
+
( resetLayout?.[ key ] ?? defaultValue );
|
|
85
|
+
const hasJustificationValue = () =>
|
|
86
|
+
hasLayoutValue( 'justifyContent', 'left' );
|
|
87
|
+
const hasOrientationValue = () =>
|
|
88
|
+
hasLayoutValue( 'orientation', 'horizontal' );
|
|
89
|
+
const hasWrapValue = () => hasLayoutValue( 'flexWrap', 'wrap' );
|
|
90
|
+
const resetJustification = () =>
|
|
91
|
+
onChange(
|
|
92
|
+
cleanEmptyObject( {
|
|
93
|
+
...layout,
|
|
94
|
+
justifyContent: resetLayout?.justifyContent,
|
|
95
|
+
} )
|
|
96
|
+
);
|
|
97
|
+
const resetOrientation = () => {
|
|
98
|
+
const { verticalAlignment, justifyContent } = layout;
|
|
99
|
+
const nextOrientation = resetLayout?.orientation;
|
|
100
|
+
const isHorizontal =
|
|
101
|
+
! nextOrientation || nextOrientation === 'horizontal';
|
|
102
|
+
onChange(
|
|
103
|
+
cleanEmptyObject( {
|
|
104
|
+
...layout,
|
|
105
|
+
orientation: nextOrientation,
|
|
106
|
+
verticalAlignment:
|
|
107
|
+
resetLayout?.verticalAlignment ??
|
|
108
|
+
( isHorizontal && verticalAlignment === 'space-between'
|
|
109
|
+
? 'center'
|
|
110
|
+
: verticalAlignment ),
|
|
111
|
+
justifyContent:
|
|
112
|
+
resetLayout?.justifyContent ??
|
|
113
|
+
( isHorizontal && justifyContent === 'stretch'
|
|
114
|
+
? 'left'
|
|
115
|
+
: justifyContent ),
|
|
116
|
+
} )
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
const resetWrap = () =>
|
|
120
|
+
onChange(
|
|
121
|
+
cleanEmptyObject( {
|
|
122
|
+
...layout,
|
|
123
|
+
flexWrap: resetLayout?.flexWrap,
|
|
124
|
+
} )
|
|
125
|
+
);
|
|
126
|
+
|
|
80
127
|
return (
|
|
81
128
|
<>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
129
|
+
{ ( allowJustification || allowOrientation ) && (
|
|
130
|
+
<Flex
|
|
131
|
+
align="flex-start"
|
|
132
|
+
className="block-editor-hooks__flex-layout-controls"
|
|
133
|
+
gap={ 4 }
|
|
134
|
+
justify="flex-start"
|
|
135
|
+
>
|
|
136
|
+
{ allowJustification && (
|
|
137
|
+
<ToolsPanelItem
|
|
138
|
+
label={ __( 'Justification' ) }
|
|
139
|
+
hasValue={ hasJustificationValue }
|
|
140
|
+
onDeselect={ resetJustification }
|
|
141
|
+
isShownByDefault
|
|
142
|
+
panelId={ clientId }
|
|
143
|
+
>
|
|
144
|
+
<FlexLayoutJustifyContentControl
|
|
145
|
+
layout={ layout }
|
|
146
|
+
onChange={ onChange }
|
|
147
|
+
/>
|
|
148
|
+
</ToolsPanelItem>
|
|
149
|
+
) }
|
|
150
|
+
{ allowOrientation && (
|
|
151
|
+
<ToolsPanelItem
|
|
152
|
+
label={ __( 'Orientation' ) }
|
|
153
|
+
hasValue={ hasOrientationValue }
|
|
154
|
+
onDeselect={ resetOrientation }
|
|
155
|
+
isShownByDefault
|
|
156
|
+
panelId={ clientId }
|
|
157
|
+
>
|
|
158
|
+
<OrientationControl
|
|
159
|
+
layout={ layout }
|
|
160
|
+
onChange={ onChange }
|
|
161
|
+
/>
|
|
162
|
+
</ToolsPanelItem>
|
|
163
|
+
) }
|
|
164
|
+
</Flex>
|
|
165
|
+
) }
|
|
100
166
|
{ allowWrap && (
|
|
101
|
-
<
|
|
167
|
+
<ToolsPanelItem
|
|
168
|
+
label={ __( 'Wrapping' ) }
|
|
169
|
+
hasValue={ hasWrapValue }
|
|
170
|
+
onDeselect={ resetWrap }
|
|
171
|
+
panelId={ clientId }
|
|
172
|
+
>
|
|
173
|
+
<FlexWrapControl
|
|
174
|
+
layout={ layout }
|
|
175
|
+
onChange={ onChange }
|
|
176
|
+
/>
|
|
177
|
+
</ToolsPanelItem>
|
|
102
178
|
) }
|
|
103
179
|
</>
|
|
104
180
|
);
|
|
@@ -135,14 +211,21 @@ export default {
|
|
|
135
211
|
},
|
|
136
212
|
getLayoutStyle: function getLayoutStyle( {
|
|
137
213
|
selector,
|
|
138
|
-
layout,
|
|
214
|
+
layout = {},
|
|
215
|
+
viewportOverrides,
|
|
139
216
|
style,
|
|
140
217
|
blockName,
|
|
141
218
|
hasBlockGapSupport,
|
|
142
219
|
globalBlockGapValue,
|
|
143
220
|
layoutDefinitions = LAYOUT_DEFINITIONS,
|
|
144
221
|
} ) {
|
|
145
|
-
const
|
|
222
|
+
const hasViewportOverrides = viewportOverrides !== undefined;
|
|
223
|
+
const effectiveLayout = hasViewportOverrides
|
|
224
|
+
? { ...layout, ...viewportOverrides }
|
|
225
|
+
: layout;
|
|
226
|
+
const hasViewportOverride = ( key ) =>
|
|
227
|
+
Object.hasOwn( viewportOverrides || {}, key );
|
|
228
|
+
const { orientation = 'horizontal' } = effectiveLayout;
|
|
146
229
|
|
|
147
230
|
// Determine the fallback gap value using global styles (theme.json),
|
|
148
231
|
// falling back to '0.5em' for backwards compatibility.
|
|
@@ -163,35 +246,57 @@ export default {
|
|
|
163
246
|
! shouldSkipSerialization( blockName, 'spacing', 'blockGap' )
|
|
164
247
|
? getGapCSSValue( style?.spacing?.blockGap, fallbackGapValue )
|
|
165
248
|
: undefined;
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
249
|
+
const hasBlockGapOverride =
|
|
250
|
+
! hasViewportOverrides ||
|
|
251
|
+
Object.hasOwn( style?.spacing || {}, 'blockGap' );
|
|
252
|
+
const justifyContent =
|
|
253
|
+
justifyContentMap[ effectiveLayout.justifyContent ];
|
|
254
|
+
const flexWrap = flexWrapOptions.includes( effectiveLayout.flexWrap )
|
|
255
|
+
? effectiveLayout.flexWrap
|
|
169
256
|
: 'wrap';
|
|
170
257
|
const verticalAlignment =
|
|
171
|
-
verticalAlignmentMap[
|
|
258
|
+
verticalAlignmentMap[ effectiveLayout.verticalAlignment ];
|
|
172
259
|
const alignItems =
|
|
173
|
-
alignItemsMap[
|
|
260
|
+
alignItemsMap[ effectiveLayout.justifyContent ] ||
|
|
261
|
+
alignItemsMap.left;
|
|
174
262
|
|
|
175
263
|
let output = '';
|
|
176
264
|
const rules = [];
|
|
177
265
|
|
|
178
|
-
|
|
266
|
+
const shouldOutputFlexWrap =
|
|
267
|
+
! hasViewportOverrides || hasViewportOverride( 'flexWrap' );
|
|
268
|
+
const shouldOutputFlexOrientation =
|
|
269
|
+
! hasViewportOverrides || hasViewportOverride( 'orientation' );
|
|
270
|
+
const shouldOutputFlexJustification =
|
|
271
|
+
! hasViewportOverrides ||
|
|
272
|
+
hasViewportOverride( 'justifyContent' ) ||
|
|
273
|
+
hasViewportOverride( 'orientation' );
|
|
274
|
+
const shouldOutputFlexAlignment =
|
|
275
|
+
! hasViewportOverrides ||
|
|
276
|
+
hasViewportOverride( 'verticalAlignment' ) ||
|
|
277
|
+
hasViewportOverride( 'orientation' );
|
|
278
|
+
|
|
279
|
+
if ( shouldOutputFlexWrap && flexWrap && flexWrap !== 'wrap' ) {
|
|
179
280
|
rules.push( `flex-wrap: ${ flexWrap }` );
|
|
180
281
|
}
|
|
181
282
|
|
|
182
283
|
if ( orientation === 'horizontal' ) {
|
|
183
|
-
if ( verticalAlignment ) {
|
|
284
|
+
if ( shouldOutputFlexAlignment && verticalAlignment ) {
|
|
184
285
|
rules.push( `align-items: ${ verticalAlignment }` );
|
|
185
286
|
}
|
|
186
|
-
if ( justifyContent ) {
|
|
287
|
+
if ( shouldOutputFlexJustification && justifyContent ) {
|
|
187
288
|
rules.push( `justify-content: ${ justifyContent }` );
|
|
188
289
|
}
|
|
189
290
|
} else {
|
|
190
|
-
if ( verticalAlignment ) {
|
|
291
|
+
if ( shouldOutputFlexAlignment && verticalAlignment ) {
|
|
191
292
|
rules.push( `justify-content: ${ verticalAlignment }` );
|
|
192
293
|
}
|
|
193
|
-
|
|
194
|
-
|
|
294
|
+
if ( shouldOutputFlexOrientation ) {
|
|
295
|
+
rules.push( 'flex-direction: column' );
|
|
296
|
+
}
|
|
297
|
+
if ( shouldOutputFlexJustification ) {
|
|
298
|
+
rules.push( `align-items: ${ alignItems }` );
|
|
299
|
+
}
|
|
195
300
|
}
|
|
196
301
|
|
|
197
302
|
if ( rules.length ) {
|
|
@@ -201,7 +306,7 @@ export default {
|
|
|
201
306
|
}
|
|
202
307
|
|
|
203
308
|
// Output blockGap styles based on rules contained in layout definitions in theme.json.
|
|
204
|
-
if ( hasBlockGapSupport && blockGapValue ) {
|
|
309
|
+
if ( hasBlockGapSupport && hasBlockGapOverride && blockGapValue ) {
|
|
205
310
|
output += getBlockGapCSS(
|
|
206
311
|
selector,
|
|
207
312
|
layoutDefinitions,
|