@wordpress/block-editor 15.19.1-next.v.202605131006.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
|
@@ -40,7 +40,9 @@ var constrained_default = {
|
|
|
40
40
|
inspectorControls: function DefaultLayoutInspectorControls({
|
|
41
41
|
layout,
|
|
42
42
|
onChange,
|
|
43
|
-
layoutBlockSupport = {}
|
|
43
|
+
layoutBlockSupport = {},
|
|
44
|
+
resetLayout = {},
|
|
45
|
+
clientId
|
|
44
46
|
}) {
|
|
45
47
|
const { wideSize, contentSize, justifyContent = "center" } = layout;
|
|
46
48
|
const {
|
|
@@ -74,14 +76,38 @@ var constrained_default = {
|
|
|
74
76
|
const units = (0, import_components.__experimentalUseCustomUnits)({
|
|
75
77
|
availableUnits: availableUnits || ["%", "px", "em", "rem", "vw"]
|
|
76
78
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
{
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
const hasLayoutValue = (key, defaultValue) => (layout?.[key] ?? defaultValue) !== (resetLayout?.[key] ?? defaultValue);
|
|
80
|
+
const resetContentSize = () => onChange(
|
|
81
|
+
(0, import_utils2.cleanEmptyObject)({
|
|
82
|
+
...layout,
|
|
83
|
+
contentSize: resetLayout?.contentSize
|
|
84
|
+
})
|
|
85
|
+
);
|
|
86
|
+
const resetWideSize = () => onChange(
|
|
87
|
+
(0, import_utils2.cleanEmptyObject)({
|
|
88
|
+
...layout,
|
|
89
|
+
wideSize: resetLayout?.wideSize
|
|
90
|
+
})
|
|
91
|
+
);
|
|
92
|
+
const resetJustification = () => onChange(
|
|
93
|
+
(0, import_utils2.cleanEmptyObject)({
|
|
94
|
+
...layout,
|
|
95
|
+
justifyContent: resetLayout?.justifyContent
|
|
96
|
+
})
|
|
97
|
+
);
|
|
98
|
+
const hasContentSizeValue = () => hasLayoutValue("contentSize");
|
|
99
|
+
const hasWideSizeValue = () => hasLayoutValue("wideSize");
|
|
100
|
+
const hasJustificationValue = () => hasLayoutValue("justifyContent", "center");
|
|
101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
102
|
+
allowCustomContentAndWideSize && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
103
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
104
|
+
import_components.__experimentalToolsPanelItem,
|
|
105
|
+
{
|
|
106
|
+
label: (0, import_i18n.__)("Content width"),
|
|
107
|
+
hasValue: hasContentSizeValue,
|
|
108
|
+
onDeselect: resetContentSize,
|
|
109
|
+
panelId: clientId,
|
|
110
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
85
111
|
import_components.__experimentalUnitControl,
|
|
86
112
|
{
|
|
87
113
|
__next40pxDefaultSize: true,
|
|
@@ -90,38 +116,62 @@ var constrained_default = {
|
|
|
90
116
|
value: contentSize || wideSize || "",
|
|
91
117
|
onChange: (nextWidth) => {
|
|
92
118
|
nextWidth = 0 > parseFloat(nextWidth) ? "0" : nextWidth;
|
|
93
|
-
onChange(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
119
|
+
onChange(
|
|
120
|
+
(0, import_utils2.cleanEmptyObject)({
|
|
121
|
+
...layout,
|
|
122
|
+
contentSize: nextWidth !== "" ? nextWidth : void 0
|
|
123
|
+
})
|
|
124
|
+
);
|
|
97
125
|
},
|
|
98
126
|
units,
|
|
99
127
|
prefix: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.Icon, { icon: import_icons.alignNone }) })
|
|
100
128
|
}
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
133
|
+
import_components.__experimentalToolsPanelItem,
|
|
134
|
+
{
|
|
135
|
+
label: (0, import_i18n.__)("Wide width"),
|
|
136
|
+
hasValue: hasWideSizeValue,
|
|
137
|
+
onDeselect: resetWideSize,
|
|
138
|
+
panelId: clientId,
|
|
139
|
+
children: [
|
|
140
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
141
|
+
import_components.__experimentalUnitControl,
|
|
142
|
+
{
|
|
143
|
+
__next40pxDefaultSize: true,
|
|
144
|
+
label: (0, import_i18n.__)("Wide width"),
|
|
145
|
+
labelPosition: "top",
|
|
146
|
+
value: wideSize || contentSize || "",
|
|
147
|
+
onChange: (nextWidth) => {
|
|
148
|
+
nextWidth = 0 > parseFloat(nextWidth) ? "0" : nextWidth;
|
|
149
|
+
onChange(
|
|
150
|
+
(0, import_utils2.cleanEmptyObject)({
|
|
151
|
+
...layout,
|
|
152
|
+
wideSize: nextWidth !== "" ? nextWidth : void 0
|
|
153
|
+
})
|
|
154
|
+
);
|
|
155
|
+
},
|
|
156
|
+
units,
|
|
157
|
+
prefix: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.Icon, { icon: import_icons.stretchWide }) })
|
|
158
|
+
}
|
|
159
|
+
),
|
|
160
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "block-editor-hooks__layout-constrained-helptext", children: (0, import_i18n.__)(
|
|
161
|
+
"Customize the width for all elements that are assigned to the center or wide columns."
|
|
162
|
+
) })
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
] }),
|
|
167
|
+
allowJustification && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
168
|
+
import_components.__experimentalToolsPanelItem,
|
|
169
|
+
{
|
|
170
|
+
label: (0, import_i18n.__)("Justification"),
|
|
171
|
+
hasValue: hasJustificationValue,
|
|
172
|
+
onDeselect: resetJustification,
|
|
173
|
+
panelId: clientId,
|
|
174
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
125
175
|
import_components.__experimentalToggleGroupControl,
|
|
126
176
|
{
|
|
127
177
|
__next40pxDefaultSize: true,
|
|
@@ -143,9 +193,9 @@ var constrained_default = {
|
|
|
143
193
|
)
|
|
144
194
|
}
|
|
145
195
|
)
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
);
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
] });
|
|
149
199
|
},
|
|
150
200
|
toolBarControls: function DefaultLayoutToolbarControls({
|
|
151
201
|
layout = {},
|
|
@@ -167,13 +217,19 @@ var constrained_default = {
|
|
|
167
217
|
getLayoutStyle: function getLayoutStyle({
|
|
168
218
|
selector,
|
|
169
219
|
layout = {},
|
|
220
|
+
viewportOverrides,
|
|
170
221
|
style,
|
|
171
222
|
blockName,
|
|
172
223
|
hasBlockGapSupport,
|
|
173
224
|
layoutDefinitions = import_definitions.LAYOUT_DEFINITIONS
|
|
174
225
|
}) {
|
|
175
|
-
const
|
|
226
|
+
const hasViewportOverrides = viewportOverrides !== void 0;
|
|
227
|
+
const effectiveLayout = hasViewportOverrides ? { ...layout, ...viewportOverrides } : layout;
|
|
228
|
+
const hasViewportOverride = (key) => Object.hasOwn(viewportOverrides || {}, key);
|
|
229
|
+
const { contentSize, wideSize, justifyContent } = effectiveLayout;
|
|
176
230
|
const blockGapStyleValue = (0, import_gap.getGapCSSValue)(style?.spacing?.blockGap);
|
|
231
|
+
const hasBlockGapOverride = !hasViewportOverrides || Object.hasOwn(style?.spacing || {}, "blockGap");
|
|
232
|
+
const hasBlockSpacingOverride = !hasViewportOverrides || Object.hasOwn(style?.spacing || {}, "padding");
|
|
177
233
|
let blockGapValue = "";
|
|
178
234
|
if (!(0, import_utils2.shouldSkipSerialization)(blockName, "spacing", "blockGap")) {
|
|
179
235
|
if (blockGapStyleValue?.top) {
|
|
@@ -184,14 +240,23 @@ var constrained_default = {
|
|
|
184
240
|
}
|
|
185
241
|
const marginLeft = justifyContent === "left" ? "0 !important" : "auto !important";
|
|
186
242
|
const marginRight = justifyContent === "right" ? "0 !important" : "auto !important";
|
|
187
|
-
|
|
188
|
-
|
|
243
|
+
const hasJustificationOverride = hasViewportOverrides && hasViewportOverride("justifyContent");
|
|
244
|
+
const shouldOutputConstrainedSizes = !hasViewportOverrides || hasViewportOverride("contentSize") || hasViewportOverride("wideSize");
|
|
245
|
+
const constrainedSizeDeclarations = [
|
|
246
|
+
`max-width: ${contentSize ?? wideSize}`
|
|
247
|
+
];
|
|
248
|
+
if (!hasViewportOverrides || hasJustificationOverride) {
|
|
249
|
+
constrainedSizeDeclarations.push(
|
|
250
|
+
`margin-left: ${marginLeft}`,
|
|
251
|
+
`margin-right: ${marginRight}`
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
let output = shouldOutputConstrainedSizes && (!!contentSize || !!wideSize) ? `
|
|
255
|
+
${(0, import_utils.appendSelectors)(
|
|
189
256
|
selector,
|
|
190
257
|
"> :where(:not(.alignleft):not(.alignright):not(.alignfull))"
|
|
191
258
|
)} {
|
|
192
|
-
|
|
193
|
-
margin-left: ${marginLeft};
|
|
194
|
-
margin-right: ${marginRight};
|
|
259
|
+
${constrainedSizeDeclarations.join("; ")};
|
|
195
260
|
}
|
|
196
261
|
${(0, import_utils.appendSelectors)(selector, "> .alignwide")} {
|
|
197
262
|
max-width: ${wideSize ?? contentSize};
|
|
@@ -199,21 +264,29 @@ var constrained_default = {
|
|
|
199
264
|
${(0, import_utils.appendSelectors)(selector, "> .alignfull")} {
|
|
200
265
|
max-width: none;
|
|
201
266
|
}
|
|
202
|
-
|
|
203
|
-
if (
|
|
267
|
+
` : "";
|
|
268
|
+
if (hasJustificationOverride && !shouldOutputConstrainedSizes) {
|
|
204
269
|
output += `${(0, import_utils.appendSelectors)(
|
|
205
270
|
selector,
|
|
206
271
|
"> :where(:not(.alignleft):not(.alignright):not(.alignfull))"
|
|
207
272
|
)}
|
|
273
|
+
{ margin-left: ${marginLeft}; margin-right: ${marginRight}; }`;
|
|
274
|
+
} else if (!hasViewportOverrides) {
|
|
275
|
+
if (justifyContent === "left") {
|
|
276
|
+
output += `${(0, import_utils.appendSelectors)(
|
|
277
|
+
selector,
|
|
278
|
+
"> :where(:not(.alignleft):not(.alignright):not(.alignfull))"
|
|
279
|
+
)}
|
|
208
280
|
{ margin-left: ${marginLeft}; }`;
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
281
|
+
} else if (justifyContent === "right") {
|
|
282
|
+
output += `${(0, import_utils.appendSelectors)(
|
|
283
|
+
selector,
|
|
284
|
+
"> :where(:not(.alignleft):not(.alignright):not(.alignfull))"
|
|
285
|
+
)}
|
|
214
286
|
{ margin-right: ${marginRight}; }`;
|
|
287
|
+
}
|
|
215
288
|
}
|
|
216
|
-
if (style?.spacing?.padding) {
|
|
289
|
+
if (hasBlockSpacingOverride && style?.spacing?.padding) {
|
|
217
290
|
const paddingValues = (0, import_style_engine.getCSSRules)(style);
|
|
218
291
|
paddingValues.forEach((rule) => {
|
|
219
292
|
if (rule.key === "paddingRight") {
|
|
@@ -233,7 +306,7 @@ var constrained_default = {
|
|
|
233
306
|
}
|
|
234
307
|
});
|
|
235
308
|
}
|
|
236
|
-
if (hasBlockGapSupport && blockGapValue) {
|
|
309
|
+
if (hasBlockGapSupport && hasBlockGapOverride && blockGapValue) {
|
|
237
310
|
output += (0, import_utils.getBlockGapCSS)(
|
|
238
311
|
selector,
|
|
239
312
|
layoutDefinitions,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/layouts/constrained.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n\t__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tIcon,\n\talignNone,\n\tstretchWide,\n\tjustifyLeft,\n\tjustifyCenter,\n\tjustifyRight,\n} from '@wordpress/icons';\nimport { getCSSRules } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../components/use-settings';\nimport { appendSelectors, getBlockGapCSS, getAlignmentsInfo } from './utils';\nimport { getGapCSSValue } from '../hooks/gap';\nimport { BlockControls, JustifyContentControl } from '../components';\nimport { shouldSkipSerialization } from '../hooks/utils';\nimport { LAYOUT_DEFINITIONS } from './definitions';\n\nexport default {\n\tname: 'constrained',\n\tlabel: __( 'Constrained' ),\n\tinspectorControls: function DefaultLayoutInspectorControls( {\n\t\tlayout,\n\t\tonChange,\n\t\tlayoutBlockSupport = {},\n\t} ) {\n\t\tconst { wideSize, contentSize, justifyContent = 'center' } = layout;\n\t\tconst {\n\t\t\tallowJustification = true,\n\t\t\tallowCustomContentAndWideSize = true,\n\t\t} = layoutBlockSupport;\n\t\tconst onJustificationChange = ( value ) => {\n\t\t\tonChange( {\n\t\t\t\t...layout,\n\t\t\t\tjustifyContent: value,\n\t\t\t} );\n\t\t};\n\t\tconst justificationOptions = [\n\t\t\t{\n\t\t\t\tvalue: 'left',\n\t\t\t\ticon: justifyLeft,\n\t\t\t\tlabel: __( 'Justify items left' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalue: 'center',\n\t\t\t\ticon: justifyCenter,\n\t\t\t\tlabel: __( 'Justify items center' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalue: 'right',\n\t\t\t\ticon: justifyRight,\n\t\t\t\tlabel: __( 'Justify items right' ),\n\t\t\t},\n\t\t];\n\t\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\t\tconst units = useCustomUnits( {\n\t\t\tavailableUnits: availableUnits || [ '%', 'px', 'em', 'rem', 'vw' ],\n\t\t} );\n\t\treturn (\n\t\t\t<VStack\n\t\t\t\tspacing={ 4 }\n\t\t\t\tclassName=\"block-editor-hooks__layout-constrained\"\n\t\t\t>\n\t\t\t\t{ allowCustomContentAndWideSize && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Content width' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\tvalue={ contentSize || wideSize || '' }\n\t\t\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t\t\t0 > parseFloat( nextWidth )\n\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t: nextWidth;\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\tcontentSize:\n\t\t\t\t\t\t\t\t\t\tnextWidth !== ''\n\t\t\t\t\t\t\t\t\t\t\t? nextWidth\n\t\t\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\tprefix={\n\t\t\t\t\t\t\t\t<InputControlPrefixWrapper variant=\"icon\">\n\t\t\t\t\t\t\t\t\t<Icon icon={ alignNone } />\n\t\t\t\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Wide width' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\tvalue={ wideSize || contentSize || '' }\n\t\t\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t\t\t0 > parseFloat( nextWidth )\n\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t: nextWidth;\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\twideSize:\n\t\t\t\t\t\t\t\t\t\tnextWidth !== ''\n\t\t\t\t\t\t\t\t\t\t\t? nextWidth\n\t\t\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\tprefix={\n\t\t\t\t\t\t\t\t<InputControlPrefixWrapper variant=\"icon\">\n\t\t\t\t\t\t\t\t\t<Icon icon={ stretchWide } />\n\t\t\t\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<p className=\"block-editor-hooks__layout-constrained-helptext\">\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Customize the width for all elements that are assigned to the center or wide columns.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t{ allowJustification && (\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Justification' ) }\n\t\t\t\t\t\tvalue={ justifyContent }\n\t\t\t\t\t\tonChange={ onJustificationChange }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ justificationOptions.map(\n\t\t\t\t\t\t\t( { value, icon, label } ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t);\n\t},\n\ttoolBarControls: function DefaultLayoutToolbarControls( {\n\t\tlayout = {},\n\t\tonChange,\n\t\tlayoutBlockSupport,\n\t} ) {\n\t\tconst { allowJustification = true } = layoutBlockSupport;\n\n\t\tif ( ! allowJustification ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn (\n\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t<DefaultLayoutJustifyContentControl\n\t\t\t\t\tlayout={ layout }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t);\n\t},\n\tgetLayoutStyle: function getLayoutStyle( {\n\t\tselector,\n\t\tlayout = {},\n\t\tstyle,\n\t\tblockName,\n\t\thasBlockGapSupport,\n\t\tlayoutDefinitions = LAYOUT_DEFINITIONS,\n\t} ) {\n\t\tconst { contentSize, wideSize, justifyContent } = layout;\n\t\tconst blockGapStyleValue = getGapCSSValue( style?.spacing?.blockGap );\n\n\t\t// If a block's block.json skips serialization for spacing or\n\t\t// spacing.blockGap, don't apply the user-defined value to the styles.\n\t\tlet blockGapValue = '';\n\t\tif ( ! shouldSkipSerialization( blockName, 'spacing', 'blockGap' ) ) {\n\t\t\t// If an object is provided only use the 'top' value for this kind of gap.\n\t\t\tif ( blockGapStyleValue?.top ) {\n\t\t\t\tblockGapValue = getGapCSSValue( blockGapStyleValue?.top );\n\t\t\t} else if ( typeof blockGapStyleValue === 'string' ) {\n\t\t\t\tblockGapValue = getGapCSSValue( blockGapStyleValue );\n\t\t\t}\n\t\t}\n\n\t\tconst marginLeft =\n\t\t\tjustifyContent === 'left' ? '0 !important' : 'auto !important';\n\t\tconst marginRight =\n\t\t\tjustifyContent === 'right' ? '0 !important' : 'auto !important';\n\n\t\tlet output =\n\t\t\t!! contentSize || !! wideSize\n\t\t\t\t? `\n\t\t\t\t\t${ appendSelectors(\n\t\t\t\t\t\tselector,\n\t\t\t\t\t\t'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'\n\t\t\t\t\t) } {\n\t\t\t\t\t\tmax-width: ${ contentSize ?? wideSize };\n\t\t\t\t\t\tmargin-left: ${ marginLeft };\n\t\t\t\t\t\tmargin-right: ${ marginRight };\n\t\t\t\t\t}\n\t\t\t\t\t${ appendSelectors( selector, '> .alignwide' ) } {\n\t\t\t\t\t\tmax-width: ${ wideSize ?? contentSize };\n\t\t\t\t\t}\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmax-width: none;\n\t\t\t\t\t}\n\t\t\t\t`\n\t\t\t\t: '';\n\n\t\tif ( justifyContent === 'left' ) {\n\t\t\toutput += `${ appendSelectors(\n\t\t\t\tselector,\n\t\t\t\t'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'\n\t\t\t) }\n\t\t\t{ margin-left: ${ marginLeft }; }`;\n\t\t} else if ( justifyContent === 'right' ) {\n\t\t\toutput += `${ appendSelectors(\n\t\t\t\tselector,\n\t\t\t\t'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'\n\t\t\t) }\n\t\t\t{ margin-right: ${ marginRight }; }`;\n\t\t}\n\n\t\t// If there is custom padding, add negative margins for alignfull blocks.\n\t\tif ( style?.spacing?.padding ) {\n\t\t\t// The style object might be storing a preset so we need to make sure we get a usable value.\n\t\t\tconst paddingValues = getCSSRules( style );\n\t\t\tpaddingValues.forEach( ( rule ) => {\n\t\t\t\tif ( rule.key === 'paddingRight' ) {\n\t\t\t\t\t// Add unit if 0, to avoid calc(0 * -1) which is invalid.\n\t\t\t\t\tconst paddingRightValue =\n\t\t\t\t\t\trule.value === '0' ? '0px' : rule.value;\n\n\t\t\t\t\toutput += `\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmargin-right: calc(${ paddingRightValue } * -1);\n\t\t\t\t\t}\n\t\t\t\t\t`;\n\t\t\t\t} else if ( rule.key === 'paddingLeft' ) {\n\t\t\t\t\t// Add unit if 0, to avoid calc(0 * -1) which is invalid.\n\t\t\t\t\tconst paddingLeftValue =\n\t\t\t\t\t\trule.value === '0' ? '0px' : rule.value;\n\n\t\t\t\t\toutput += `\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmargin-left: calc(${ paddingLeftValue } * -1);\n\t\t\t\t\t}\n\t\t\t\t\t`;\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t// Output blockGap styles based on rules contained in layout definitions in theme.json.\n\t\tif ( hasBlockGapSupport && blockGapValue ) {\n\t\t\toutput += getBlockGapCSS(\n\t\t\t\tselector,\n\t\t\t\tlayoutDefinitions,\n\t\t\t\t'constrained',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation() {\n\t\treturn 'vertical';\n\t},\n\tgetAlignments( layout ) {\n\t\tconst alignmentInfo = getAlignmentsInfo( layout );\n\t\tif ( layout.alignments !== undefined ) {\n\t\t\tif ( ! layout.alignments.includes( 'none' ) ) {\n\t\t\t\tlayout.alignments.unshift( 'none' );\n\t\t\t}\n\t\t\treturn layout.alignments.map( ( alignment ) => ( {\n\t\t\t\tname: alignment,\n\t\t\t\tinfo: alignmentInfo[ alignment ],\n\t\t\t} ) );\n\t\t}\n\t\tconst { contentSize, wideSize } = layout;\n\n\t\tconst alignments = [\n\t\t\t{ name: 'left' },\n\t\t\t{ name: 'center' },\n\t\t\t{ name: 'right' },\n\t\t];\n\n\t\tif ( contentSize ) {\n\t\t\talignments.unshift( { name: 'full' } );\n\t\t}\n\n\t\tif ( wideSize ) {\n\t\t\talignments.unshift( { name: 'wide', info: alignmentInfo.wide } );\n\t\t}\n\n\t\talignments.unshift( { name: 'none', info: alignmentInfo.none } );\n\n\t\treturn alignments;\n\t},\n};\n\nconst POPOVER_PROPS = {\n\tplacement: 'bottom-start',\n};\n\nfunction DefaultLayoutJustifyContentControl( { layout, onChange } ) {\n\tconst { justifyContent = 'center' } = layout;\n\tconst onJustificationChange = ( value ) => {\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tjustifyContent: value,\n\t\t} );\n\t};\n\tconst allowedControls = [ 'left', 'center', 'right' ];\n\n\treturn (\n\t\t<JustifyContentControl\n\t\t\tallowedControls={ allowedControls }\n\t\t\tvalue={ justifyContent }\n\t\t\tonChange={ onJustificationChange }\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAOO;AACP,kBAAmB;AACnB,mBAOO;AACP,0BAA4B;AAK5B,0BAA4B;AAC5B,mBAAmE;AACnE,iBAA+B;AAC/B,IAAAA,qBAAqD;AACrD,IAAAC,
|
|
6
|
-
"names": ["import_components", "import_utils", "useCustomUnits", "
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n\t__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tIcon,\n\talignNone,\n\tstretchWide,\n\tjustifyLeft,\n\tjustifyCenter,\n\tjustifyRight,\n} from '@wordpress/icons';\nimport { getCSSRules } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../components/use-settings';\nimport { appendSelectors, getBlockGapCSS, getAlignmentsInfo } from './utils';\nimport { getGapCSSValue } from '../hooks/gap';\nimport { BlockControls, JustifyContentControl } from '../components';\nimport { cleanEmptyObject, shouldSkipSerialization } from '../hooks/utils';\nimport { LAYOUT_DEFINITIONS } from './definitions';\n\nexport default {\n\tname: 'constrained',\n\tlabel: __( 'Constrained' ),\n\tinspectorControls: function DefaultLayoutInspectorControls( {\n\t\tlayout,\n\t\tonChange,\n\t\tlayoutBlockSupport = {},\n\t\tresetLayout = {},\n\t\tclientId,\n\t} ) {\n\t\tconst { wideSize, contentSize, justifyContent = 'center' } = layout;\n\t\tconst {\n\t\t\tallowJustification = true,\n\t\t\tallowCustomContentAndWideSize = true,\n\t\t} = layoutBlockSupport;\n\t\tconst onJustificationChange = ( value ) => {\n\t\t\tonChange( {\n\t\t\t\t...layout,\n\t\t\t\tjustifyContent: value,\n\t\t\t} );\n\t\t};\n\t\tconst justificationOptions = [\n\t\t\t{\n\t\t\t\tvalue: 'left',\n\t\t\t\ticon: justifyLeft,\n\t\t\t\tlabel: __( 'Justify items left' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalue: 'center',\n\t\t\t\ticon: justifyCenter,\n\t\t\t\tlabel: __( 'Justify items center' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalue: 'right',\n\t\t\t\ticon: justifyRight,\n\t\t\t\tlabel: __( 'Justify items right' ),\n\t\t\t},\n\t\t];\n\t\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\t\tconst units = useCustomUnits( {\n\t\t\tavailableUnits: availableUnits || [ '%', 'px', 'em', 'rem', 'vw' ],\n\t\t} );\n\t\tconst hasLayoutValue = ( key, defaultValue ) =>\n\t\t\t( layout?.[ key ] ?? defaultValue ) !==\n\t\t\t( resetLayout?.[ key ] ?? defaultValue );\n\t\tconst resetContentSize = () =>\n\t\t\tonChange(\n\t\t\t\tcleanEmptyObject( {\n\t\t\t\t\t...layout,\n\t\t\t\t\tcontentSize: resetLayout?.contentSize,\n\t\t\t\t} )\n\t\t\t);\n\t\tconst resetWideSize = () =>\n\t\t\tonChange(\n\t\t\t\tcleanEmptyObject( {\n\t\t\t\t\t...layout,\n\t\t\t\t\twideSize: resetLayout?.wideSize,\n\t\t\t\t} )\n\t\t\t);\n\t\tconst resetJustification = () =>\n\t\t\tonChange(\n\t\t\t\tcleanEmptyObject( {\n\t\t\t\t\t...layout,\n\t\t\t\t\tjustifyContent: resetLayout?.justifyContent,\n\t\t\t\t} )\n\t\t\t);\n\t\tconst hasContentSizeValue = () => hasLayoutValue( 'contentSize' );\n\t\tconst hasWideSizeValue = () => hasLayoutValue( 'wideSize' );\n\t\tconst hasJustificationValue = () =>\n\t\t\thasLayoutValue( 'justifyContent', 'center' );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ allowCustomContentAndWideSize && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Content width' ) }\n\t\t\t\t\t\t\thasValue={ hasContentSizeValue }\n\t\t\t\t\t\t\tonDeselect={ resetContentSize }\n\t\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Content width' ) }\n\t\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t\tvalue={ contentSize || wideSize || '' }\n\t\t\t\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t\t\t\t0 > parseFloat( nextWidth )\n\t\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t\t: nextWidth;\n\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\tcleanEmptyObject( {\n\t\t\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\t\t\tcontentSize:\n\t\t\t\t\t\t\t\t\t\t\t\tnextWidth !== ''\n\t\t\t\t\t\t\t\t\t\t\t\t\t? nextWidth\n\t\t\t\t\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t\tprefix={\n\t\t\t\t\t\t\t\t\t<InputControlPrefixWrapper variant=\"icon\">\n\t\t\t\t\t\t\t\t\t\t<Icon icon={ alignNone } />\n\t\t\t\t\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Wide width' ) }\n\t\t\t\t\t\t\thasValue={ hasWideSizeValue }\n\t\t\t\t\t\t\tonDeselect={ resetWideSize }\n\t\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Wide width' ) }\n\t\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t\tvalue={ wideSize || contentSize || '' }\n\t\t\t\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t\t\t\t0 > parseFloat( nextWidth )\n\t\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t\t: nextWidth;\n\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\tcleanEmptyObject( {\n\t\t\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\t\t\twideSize:\n\t\t\t\t\t\t\t\t\t\t\t\tnextWidth !== ''\n\t\t\t\t\t\t\t\t\t\t\t\t\t? nextWidth\n\t\t\t\t\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t\tprefix={\n\t\t\t\t\t\t\t\t\t<InputControlPrefixWrapper variant=\"icon\">\n\t\t\t\t\t\t\t\t\t\t<Icon icon={ stretchWide } />\n\t\t\t\t\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<p className=\"block-editor-hooks__layout-constrained-helptext\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Customize the width for all elements that are assigned to the center or wide columns.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t{ allowJustification && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Justification' ) }\n\t\t\t\t\t\thasValue={ hasJustificationValue }\n\t\t\t\t\t\tonDeselect={ resetJustification }\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Justification' ) }\n\t\t\t\t\t\t\tvalue={ justifyContent }\n\t\t\t\t\t\t\tonChange={ onJustificationChange }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ justificationOptions.map(\n\t\t\t\t\t\t\t\t( { value, icon, label } ) => {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\ttoolBarControls: function DefaultLayoutToolbarControls( {\n\t\tlayout = {},\n\t\tonChange,\n\t\tlayoutBlockSupport,\n\t} ) {\n\t\tconst { allowJustification = true } = layoutBlockSupport;\n\n\t\tif ( ! allowJustification ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn (\n\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t<DefaultLayoutJustifyContentControl\n\t\t\t\t\tlayout={ layout }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t);\n\t},\n\tgetLayoutStyle: function getLayoutStyle( {\n\t\tselector,\n\t\tlayout = {},\n\t\tviewportOverrides,\n\t\tstyle,\n\t\tblockName,\n\t\thasBlockGapSupport,\n\t\tlayoutDefinitions = LAYOUT_DEFINITIONS,\n\t} ) {\n\t\tconst hasViewportOverrides = viewportOverrides !== undefined;\n\t\tconst effectiveLayout = hasViewportOverrides\n\t\t\t? { ...layout, ...viewportOverrides }\n\t\t\t: layout;\n\t\tconst hasViewportOverride = ( key ) =>\n\t\t\tObject.hasOwn( viewportOverrides || {}, key );\n\t\tconst { contentSize, wideSize, justifyContent } = effectiveLayout;\n\t\tconst blockGapStyleValue = getGapCSSValue( style?.spacing?.blockGap );\n\t\tconst hasBlockGapOverride =\n\t\t\t! hasViewportOverrides ||\n\t\t\tObject.hasOwn( style?.spacing || {}, 'blockGap' );\n\t\tconst hasBlockSpacingOverride =\n\t\t\t! hasViewportOverrides ||\n\t\t\tObject.hasOwn( style?.spacing || {}, 'padding' );\n\n\t\t// If a block's block.json skips serialization for spacing or\n\t\t// spacing.blockGap, don't apply the user-defined value to the styles.\n\t\tlet blockGapValue = '';\n\t\tif ( ! shouldSkipSerialization( blockName, 'spacing', 'blockGap' ) ) {\n\t\t\t// If an object is provided only use the 'top' value for this kind of gap.\n\t\t\tif ( blockGapStyleValue?.top ) {\n\t\t\t\tblockGapValue = getGapCSSValue( blockGapStyleValue?.top );\n\t\t\t} else if ( typeof blockGapStyleValue === 'string' ) {\n\t\t\t\tblockGapValue = getGapCSSValue( blockGapStyleValue );\n\t\t\t}\n\t\t}\n\n\t\tconst marginLeft =\n\t\t\tjustifyContent === 'left' ? '0 !important' : 'auto !important';\n\t\tconst marginRight =\n\t\t\tjustifyContent === 'right' ? '0 !important' : 'auto !important';\n\n\t\tconst hasJustificationOverride =\n\t\t\thasViewportOverrides && hasViewportOverride( 'justifyContent' );\n\t\tconst shouldOutputConstrainedSizes =\n\t\t\t! hasViewportOverrides ||\n\t\t\thasViewportOverride( 'contentSize' ) ||\n\t\t\thasViewportOverride( 'wideSize' );\n\t\tconst constrainedSizeDeclarations = [\n\t\t\t`max-width: ${ contentSize ?? wideSize }`,\n\t\t];\n\t\tif ( ! hasViewportOverrides || hasJustificationOverride ) {\n\t\t\tconstrainedSizeDeclarations.push(\n\t\t\t\t`margin-left: ${ marginLeft }`,\n\t\t\t\t`margin-right: ${ marginRight }`\n\t\t\t);\n\t\t}\n\t\tlet output =\n\t\t\tshouldOutputConstrainedSizes && ( !! contentSize || !! wideSize )\n\t\t\t\t? `\n\t\t\t\t\t\t${ appendSelectors(\n\t\t\t\t\t\t\tselector,\n\t\t\t\t\t\t\t'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'\n\t\t\t\t\t\t) } {\n\t\t\t\t\t\t${ constrainedSizeDeclarations.join( '; ' ) };\n\t\t\t\t\t}\n\t\t\t\t\t${ appendSelectors( selector, '> .alignwide' ) } {\n\t\t\t\t\t\tmax-width: ${ wideSize ?? contentSize };\n\t\t\t\t\t}\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmax-width: none;\n\t\t\t\t\t}\n\t\t\t\t\t`\n\t\t\t\t: '';\n\n\t\tif ( hasJustificationOverride && ! shouldOutputConstrainedSizes ) {\n\t\t\toutput += `${ appendSelectors(\n\t\t\t\tselector,\n\t\t\t\t'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'\n\t\t\t) }\n\t\t\t\t{ margin-left: ${ marginLeft }; margin-right: ${ marginRight }; }`;\n\t\t} else if ( ! hasViewportOverrides ) {\n\t\t\tif ( justifyContent === 'left' ) {\n\t\t\t\toutput += `${ appendSelectors(\n\t\t\t\t\tselector,\n\t\t\t\t\t'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'\n\t\t\t\t) }\n\t\t\t{ margin-left: ${ marginLeft }; }`;\n\t\t\t} else if ( justifyContent === 'right' ) {\n\t\t\t\toutput += `${ appendSelectors(\n\t\t\t\t\tselector,\n\t\t\t\t\t'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'\n\t\t\t\t) }\n\t\t\t{ margin-right: ${ marginRight }; }`;\n\t\t\t}\n\t\t}\n\n\t\t// If there is custom padding, add negative margins for alignfull blocks.\n\t\tif ( hasBlockSpacingOverride && style?.spacing?.padding ) {\n\t\t\t// The style object might be storing a preset so we need to make sure we get a usable value.\n\t\t\tconst paddingValues = getCSSRules( style );\n\t\t\tpaddingValues.forEach( ( rule ) => {\n\t\t\t\tif ( rule.key === 'paddingRight' ) {\n\t\t\t\t\t// Add unit if 0, to avoid calc(0 * -1) which is invalid.\n\t\t\t\t\tconst paddingRightValue =\n\t\t\t\t\t\trule.value === '0' ? '0px' : rule.value;\n\n\t\t\t\t\toutput += `\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmargin-right: calc(${ paddingRightValue } * -1);\n\t\t\t\t\t}\n\t\t\t\t\t`;\n\t\t\t\t} else if ( rule.key === 'paddingLeft' ) {\n\t\t\t\t\t// Add unit if 0, to avoid calc(0 * -1) which is invalid.\n\t\t\t\t\tconst paddingLeftValue =\n\t\t\t\t\t\trule.value === '0' ? '0px' : rule.value;\n\n\t\t\t\t\toutput += `\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmargin-left: calc(${ paddingLeftValue } * -1);\n\t\t\t\t\t}\n\t\t\t\t\t`;\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t// Output blockGap styles based on rules contained in layout definitions in theme.json.\n\t\tif ( hasBlockGapSupport && hasBlockGapOverride && blockGapValue ) {\n\t\t\toutput += getBlockGapCSS(\n\t\t\t\tselector,\n\t\t\t\tlayoutDefinitions,\n\t\t\t\t'constrained',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation() {\n\t\treturn 'vertical';\n\t},\n\tgetAlignments( layout ) {\n\t\tconst alignmentInfo = getAlignmentsInfo( layout );\n\t\tif ( layout.alignments !== undefined ) {\n\t\t\tif ( ! layout.alignments.includes( 'none' ) ) {\n\t\t\t\tlayout.alignments.unshift( 'none' );\n\t\t\t}\n\t\t\treturn layout.alignments.map( ( alignment ) => ( {\n\t\t\t\tname: alignment,\n\t\t\t\tinfo: alignmentInfo[ alignment ],\n\t\t\t} ) );\n\t\t}\n\t\tconst { contentSize, wideSize } = layout;\n\n\t\tconst alignments = [\n\t\t\t{ name: 'left' },\n\t\t\t{ name: 'center' },\n\t\t\t{ name: 'right' },\n\t\t];\n\n\t\tif ( contentSize ) {\n\t\t\talignments.unshift( { name: 'full' } );\n\t\t}\n\n\t\tif ( wideSize ) {\n\t\t\talignments.unshift( { name: 'wide', info: alignmentInfo.wide } );\n\t\t}\n\n\t\talignments.unshift( { name: 'none', info: alignmentInfo.none } );\n\n\t\treturn alignments;\n\t},\n};\n\nconst POPOVER_PROPS = {\n\tplacement: 'bottom-start',\n};\n\nfunction DefaultLayoutJustifyContentControl( { layout, onChange } ) {\n\tconst { justifyContent = 'center' } = layout;\n\tconst onJustificationChange = ( value ) => {\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tjustifyContent: value,\n\t\t} );\n\t};\n\tconst allowedControls = [ 'left', 'center', 'right' ];\n\n\treturn (\n\t\t<JustifyContentControl\n\t\t\tallowedControls={ allowedControls }\n\t\t\tvalue={ justifyContent }\n\t\t\tonChange={ onJustificationChange }\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAOO;AACP,kBAAmB;AACnB,mBAOO;AACP,0BAA4B;AAK5B,0BAA4B;AAC5B,mBAAmE;AACnE,iBAA+B;AAC/B,IAAAA,qBAAqD;AACrD,IAAAC,gBAA0D;AAC1D,yBAAmC;AA4E9B;AA1EL,IAAO,sBAAQ;AAAA,EACd,MAAM;AAAA,EACN,WAAO,gBAAI,aAAc;AAAA,EACzB,mBAAmB,SAAS,+BAAgC;AAAA,IAC3D;AAAA,IACA;AAAA,IACA,qBAAqB,CAAC;AAAA,IACtB,cAAc,CAAC;AAAA,IACf;AAAA,EACD,GAAI;AACH,UAAM,EAAE,UAAU,aAAa,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,eAAiB;AAAA,QAChD,MAAM;AAAA,QACN,MAAM,cAAe,SAAU;AAAA,MAChC,EAAI;AAAA,IACL;AACA,UAAM,EAAE,aAAa,SAAS,IAAI;AAElC,UAAM,aAAa;AAAA,MAClB,EAAE,MAAM,OAAO;AAAA,MACf,EAAE,MAAM,SAAS;AAAA,MACjB,EAAE,MAAM,QAAQ;AAAA,IACjB;AAEA,QAAK,aAAc;AAClB,iBAAW,QAAS,EAAE,MAAM,OAAO,CAAE;AAAA,IACtC;AAEA,QAAK,UAAW;AACf,iBAAW,QAAS,EAAE,MAAM,QAAQ,MAAM,cAAc,KAAK,CAAE;AAAA,IAChE;AAEA,eAAW,QAAS,EAAE,MAAM,QAAQ,MAAM,cAAc,KAAK,CAAE;AAE/D,WAAO;AAAA,EACR;AACD;AAEA,IAAM,gBAAgB;AAAA,EACrB,WAAW;AACZ;AAEA,SAAS,mCAAoC,EAAE,QAAQ,SAAS,GAAI;AACnE,QAAM,EAAE,iBAAiB,SAAS,IAAI;AACtC,QAAM,wBAAwB,CAAE,UAAW;AAC1C,aAAU;AAAA,MACT,GAAG;AAAA,MACH,gBAAgB;AAAA,IACjB,CAAE;AAAA,EACH;AACA,QAAM,kBAAkB,CAAE,QAAQ,UAAU,OAAQ;AAEpD,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,OAAQ;AAAA,MACR,UAAW;AAAA,MACX,cAAe;AAAA;AAAA,EAChB;AAEF;",
|
|
6
|
+
"names": ["import_components", "import_utils", "useCustomUnits", "ToolsPanelItem", "UnitControl", "InputControlPrefixWrapper", "ToggleGroupControl", "ToggleGroupControlOptionIcon"]
|
|
7
7
|
}
|
package/build/layouts/flex.cjs
CHANGED
|
@@ -63,31 +63,106 @@ var flex_default = {
|
|
|
63
63
|
inspectorControls: function FlexLayoutInspectorControls({
|
|
64
64
|
layout = {},
|
|
65
65
|
onChange,
|
|
66
|
-
layoutBlockSupport = {}
|
|
66
|
+
layoutBlockSupport = {},
|
|
67
|
+
resetLayout = {},
|
|
68
|
+
clientId
|
|
67
69
|
}) {
|
|
68
70
|
const {
|
|
69
71
|
allowOrientation = true,
|
|
70
72
|
allowJustification = true,
|
|
71
73
|
allowWrap = true
|
|
72
74
|
} = layoutBlockSupport;
|
|
75
|
+
const hasLayoutValue = (key, defaultValue) => (layout?.[key] ?? defaultValue) !== (resetLayout?.[key] ?? defaultValue);
|
|
76
|
+
const hasJustificationValue = () => hasLayoutValue("justifyContent", "left");
|
|
77
|
+
const hasOrientationValue = () => hasLayoutValue("orientation", "horizontal");
|
|
78
|
+
const hasWrapValue = () => hasLayoutValue("flexWrap", "wrap");
|
|
79
|
+
const resetJustification = () => onChange(
|
|
80
|
+
(0, import_utils3.cleanEmptyObject)({
|
|
81
|
+
...layout,
|
|
82
|
+
justifyContent: resetLayout?.justifyContent
|
|
83
|
+
})
|
|
84
|
+
);
|
|
85
|
+
const resetOrientation = () => {
|
|
86
|
+
const { verticalAlignment, justifyContent } = layout;
|
|
87
|
+
const nextOrientation = resetLayout?.orientation;
|
|
88
|
+
const isHorizontal = !nextOrientation || nextOrientation === "horizontal";
|
|
89
|
+
onChange(
|
|
90
|
+
(0, import_utils3.cleanEmptyObject)({
|
|
91
|
+
...layout,
|
|
92
|
+
orientation: nextOrientation,
|
|
93
|
+
verticalAlignment: resetLayout?.verticalAlignment ?? (isHorizontal && verticalAlignment === "space-between" ? "center" : verticalAlignment),
|
|
94
|
+
justifyContent: resetLayout?.justifyContent ?? (isHorizontal && justifyContent === "stretch" ? "left" : justifyContent)
|
|
95
|
+
})
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
const resetWrap = () => onChange(
|
|
99
|
+
(0, import_utils3.cleanEmptyObject)({
|
|
100
|
+
...layout,
|
|
101
|
+
flexWrap: resetLayout?.flexWrap
|
|
102
|
+
})
|
|
103
|
+
);
|
|
73
104
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
74
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
105
|
+
(allowJustification || allowOrientation) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
106
|
+
import_components.Flex,
|
|
107
|
+
{
|
|
108
|
+
align: "flex-start",
|
|
109
|
+
className: "block-editor-hooks__flex-layout-controls",
|
|
110
|
+
gap: 4,
|
|
111
|
+
justify: "flex-start",
|
|
112
|
+
children: [
|
|
113
|
+
allowJustification && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
114
|
+
import_components.__experimentalToolsPanelItem,
|
|
115
|
+
{
|
|
116
|
+
label: (0, import_i18n.__)("Justification"),
|
|
117
|
+
hasValue: hasJustificationValue,
|
|
118
|
+
onDeselect: resetJustification,
|
|
119
|
+
isShownByDefault: true,
|
|
120
|
+
panelId: clientId,
|
|
121
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
122
|
+
FlexLayoutJustifyContentControl,
|
|
123
|
+
{
|
|
124
|
+
layout,
|
|
125
|
+
onChange
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
allowOrientation && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
131
|
+
import_components.__experimentalToolsPanelItem,
|
|
132
|
+
{
|
|
133
|
+
label: (0, import_i18n.__)("Orientation"),
|
|
134
|
+
hasValue: hasOrientationValue,
|
|
135
|
+
onDeselect: resetOrientation,
|
|
136
|
+
isShownByDefault: true,
|
|
137
|
+
panelId: clientId,
|
|
138
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
139
|
+
OrientationControl,
|
|
140
|
+
{
|
|
141
|
+
layout,
|
|
142
|
+
onChange
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
allowWrap && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
151
|
+
import_components.__experimentalToolsPanelItem,
|
|
152
|
+
{
|
|
153
|
+
label: (0, import_i18n.__)("Wrapping"),
|
|
154
|
+
hasValue: hasWrapValue,
|
|
155
|
+
onDeselect: resetWrap,
|
|
156
|
+
panelId: clientId,
|
|
157
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
158
|
+
FlexWrapControl,
|
|
159
|
+
{
|
|
160
|
+
layout,
|
|
161
|
+
onChange
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
)
|
|
91
166
|
] });
|
|
92
167
|
},
|
|
93
168
|
toolBarControls: function FlexLayoutToolbarControls({
|
|
@@ -119,49 +194,62 @@ var flex_default = {
|
|
|
119
194
|
},
|
|
120
195
|
getLayoutStyle: function getLayoutStyle({
|
|
121
196
|
selector,
|
|
122
|
-
layout,
|
|
197
|
+
layout = {},
|
|
198
|
+
viewportOverrides,
|
|
123
199
|
style,
|
|
124
200
|
blockName,
|
|
125
201
|
hasBlockGapSupport,
|
|
126
202
|
globalBlockGapValue,
|
|
127
203
|
layoutDefinitions = import_definitions.LAYOUT_DEFINITIONS
|
|
128
204
|
}) {
|
|
129
|
-
const
|
|
205
|
+
const hasViewportOverrides = viewportOverrides !== void 0;
|
|
206
|
+
const effectiveLayout = hasViewportOverrides ? { ...layout, ...viewportOverrides } : layout;
|
|
207
|
+
const hasViewportOverride = (key) => Object.hasOwn(viewportOverrides || {}, key);
|
|
208
|
+
const { orientation = "horizontal" } = effectiveLayout;
|
|
130
209
|
let fallbackGapValue = "0.5em";
|
|
131
210
|
if (globalBlockGapValue) {
|
|
132
211
|
const gapBox = (0, import_gap.getGapBoxControlValueFromStyle)(globalBlockGapValue);
|
|
133
212
|
fallbackGapValue = (0, import_utils2.getSpacingPresetCssVar)(gapBox?.left) || (0, import_utils2.getSpacingPresetCssVar)(gapBox?.top) || "0.5em";
|
|
134
213
|
}
|
|
135
214
|
const blockGapValue = style?.spacing?.blockGap && !(0, import_utils3.shouldSkipSerialization)(blockName, "spacing", "blockGap") ? (0, import_gap.getGapCSSValue)(style?.spacing?.blockGap, fallbackGapValue) : void 0;
|
|
136
|
-
const
|
|
137
|
-
const
|
|
138
|
-
const
|
|
139
|
-
const
|
|
215
|
+
const hasBlockGapOverride = !hasViewportOverrides || Object.hasOwn(style?.spacing || {}, "blockGap");
|
|
216
|
+
const justifyContent = justifyContentMap[effectiveLayout.justifyContent];
|
|
217
|
+
const flexWrap = flexWrapOptions.includes(effectiveLayout.flexWrap) ? effectiveLayout.flexWrap : "wrap";
|
|
218
|
+
const verticalAlignment = verticalAlignmentMap[effectiveLayout.verticalAlignment];
|
|
219
|
+
const alignItems = alignItemsMap[effectiveLayout.justifyContent] || alignItemsMap.left;
|
|
140
220
|
let output = "";
|
|
141
221
|
const rules = [];
|
|
142
|
-
|
|
222
|
+
const shouldOutputFlexWrap = !hasViewportOverrides || hasViewportOverride("flexWrap");
|
|
223
|
+
const shouldOutputFlexOrientation = !hasViewportOverrides || hasViewportOverride("orientation");
|
|
224
|
+
const shouldOutputFlexJustification = !hasViewportOverrides || hasViewportOverride("justifyContent") || hasViewportOverride("orientation");
|
|
225
|
+
const shouldOutputFlexAlignment = !hasViewportOverrides || hasViewportOverride("verticalAlignment") || hasViewportOverride("orientation");
|
|
226
|
+
if (shouldOutputFlexWrap && flexWrap && flexWrap !== "wrap") {
|
|
143
227
|
rules.push(`flex-wrap: ${flexWrap}`);
|
|
144
228
|
}
|
|
145
229
|
if (orientation === "horizontal") {
|
|
146
|
-
if (verticalAlignment) {
|
|
230
|
+
if (shouldOutputFlexAlignment && verticalAlignment) {
|
|
147
231
|
rules.push(`align-items: ${verticalAlignment}`);
|
|
148
232
|
}
|
|
149
|
-
if (justifyContent) {
|
|
233
|
+
if (shouldOutputFlexJustification && justifyContent) {
|
|
150
234
|
rules.push(`justify-content: ${justifyContent}`);
|
|
151
235
|
}
|
|
152
236
|
} else {
|
|
153
|
-
if (verticalAlignment) {
|
|
237
|
+
if (shouldOutputFlexAlignment && verticalAlignment) {
|
|
154
238
|
rules.push(`justify-content: ${verticalAlignment}`);
|
|
155
239
|
}
|
|
156
|
-
|
|
157
|
-
|
|
240
|
+
if (shouldOutputFlexOrientation) {
|
|
241
|
+
rules.push("flex-direction: column");
|
|
242
|
+
}
|
|
243
|
+
if (shouldOutputFlexJustification) {
|
|
244
|
+
rules.push(`align-items: ${alignItems}`);
|
|
245
|
+
}
|
|
158
246
|
}
|
|
159
247
|
if (rules.length) {
|
|
160
248
|
output = `${(0, import_utils.appendSelectors)(selector)} {
|
|
161
249
|
${rules.join("; ")};
|
|
162
250
|
}`;
|
|
163
251
|
}
|
|
164
|
-
if (hasBlockGapSupport && blockGapValue) {
|
|
252
|
+
if (hasBlockGapSupport && hasBlockGapOverride && blockGapValue) {
|
|
165
253
|
output += (0, import_utils.getBlockGapCSS)(
|
|
166
254
|
selector,
|
|
167
255
|
layoutDefinitions,
|