@wordpress/block-editor 15.22.1-next.v.202606191442.0 → 15.23.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 +3 -1
- package/README.md +2 -2
- package/build/components/block-editing-mode/index.cjs +13 -7
- package/build/components/block-editing-mode/index.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +50 -51
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-rename/modal.cjs +0 -1
- package/build/components/block-rename/modal.cjs.map +2 -2
- package/build/components/block-toolbar/block-toolbar-icon.cjs +14 -6
- package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
- package/build/components/colors-gradients/control.cjs +25 -14
- package/build/components/colors-gradients/control.cjs.map +2 -2
- package/build/components/colors-gradients/dropdown.cjs +4 -1
- package/build/components/colors-gradients/dropdown.cjs.map +3 -3
- package/build/components/contrast-checker/index.cjs +22 -4
- package/build/components/contrast-checker/index.cjs.map +2 -2
- package/build/components/date-format-picker/index.cjs +0 -1
- package/build/components/date-format-picker/index.cjs.map +2 -2
- package/build/components/global-styles/background-panel.cjs +153 -25
- package/build/components/global-styles/background-panel.cjs.map +3 -3
- package/build/components/global-styles/color-gradient-dropdown-item.cjs +227 -0
- package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +7 -0
- package/build/components/global-styles/color-panel.cjs +98 -375
- package/build/components/global-styles/color-panel.cjs.map +3 -3
- package/build/components/global-styles/dimensions-panel.cjs +0 -3
- package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
- package/build/components/global-styles/hooks.cjs +34 -0
- package/build/components/global-styles/hooks.cjs.map +2 -2
- package/build/components/global-styles/typography-panel.cjs +82 -10
- package/build/components/global-styles/typography-panel.cjs.map +3 -3
- 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/styles-tab.cjs +75 -31
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/link-control/index.cjs +1 -2
- package/build/components/link-control/index.cjs.map +2 -2
- package/build/components/list-view/block-select-button.cjs +1 -10
- package/build/components/list-view/block-select-button.cjs.map +3 -3
- package/build/components/provider/use-block-sync.cjs +3 -1
- package/build/components/provider/use-block-sync.cjs.map +2 -2
- package/build/components/url-popover/image-url-input-ui.cjs +0 -2
- package/build/components/url-popover/image-url-input-ui.cjs.map +2 -2
- package/build/components/use-block-display-information/index.cjs +10 -3
- package/build/components/use-block-display-information/index.cjs.map +2 -2
- package/build/components/use-resize-canvas/index.cjs +16 -53
- package/build/components/use-resize-canvas/index.cjs.map +3 -3
- package/build/hooks/anchor.cjs +0 -1
- package/build/hooks/anchor.cjs.map +2 -2
- package/build/hooks/background.cjs +124 -75
- package/build/hooks/background.cjs.map +3 -3
- package/build/hooks/color.cjs +0 -162
- package/build/hooks/color.cjs.map +3 -3
- package/build/hooks/contrast-checker.cjs +31 -28
- package/build/hooks/contrast-checker.cjs.map +3 -3
- package/build/hooks/custom-class-name.cjs +0 -1
- package/build/hooks/custom-class-name.cjs.map +2 -2
- package/build/hooks/elements.cjs +142 -0
- package/build/hooks/elements.cjs.map +7 -0
- package/build/hooks/grid-visualizer.cjs +21 -11
- package/build/hooks/grid-visualizer.cjs.map +2 -2
- package/build/hooks/layout-child.cjs +38 -8
- package/build/hooks/layout-child.cjs.map +2 -2
- package/build/hooks/layout.cjs +6 -3
- package/build/hooks/layout.cjs.map +2 -2
- package/build/hooks/states.cjs +15 -23
- package/build/hooks/states.cjs.map +2 -2
- package/build/hooks/style.cjs +8 -4
- package/build/hooks/style.cjs.map +2 -2
- package/build/hooks/typography.cjs +62 -10
- package/build/hooks/typography.cjs.map +3 -3
- package/build/layouts/flex.cjs +99 -6
- package/build/layouts/flex.cjs.map +2 -2
- package/build/private-apis.cjs +0 -1
- package/build/private-apis.cjs.map +2 -2
- package/build/store/private-actions.cjs +16 -0
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-keys.cjs +0 -3
- package/build/store/private-keys.cjs.map +2 -2
- package/build/store/private-selectors.cjs +24 -6
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +19 -3
- package/build/store/reducer.cjs.map +2 -2
- package/build/utils/block-bindings.cjs +9 -9
- package/build/utils/block-bindings.cjs.map +3 -3
- package/build/utils/color-values.cjs +10 -1
- package/build/utils/color-values.cjs.map +3 -3
- package/build/utils/dom.cjs +2 -5
- package/build/utils/dom.cjs.map +3 -3
- package/build/utils/fit-text-frontend.cjs +6 -2
- package/build/utils/fit-text-frontend.cjs.map +3 -3
- package/build/utils/fit-text-utils.cjs +1 -1
- package/build/utils/fit-text-utils.cjs.map +3 -3
- package/build/utils/format-font-style.cjs +1 -1
- package/build/utils/format-font-style.cjs.map +3 -3
- package/build/utils/format-font-weight.cjs +1 -1
- package/build/utils/format-font-weight.cjs.map +3 -3
- package/build/utils/get-editor-region.cjs +4 -2
- package/build/utils/get-editor-region.cjs.map +3 -3
- package/build/utils/get-font-styles-and-weights.cjs +8 -12
- package/build/utils/get-font-styles-and-weights.cjs.map +3 -3
- package/build/utils/get-px-from-css-unit.cjs +1 -1
- package/build/utils/get-px-from-css-unit.cjs.map +1 -1
- package/build/utils/index.cjs +1 -1
- package/build/utils/index.cjs.map +1 -1
- package/build/utils/math.cjs +1 -1
- package/build/utils/math.cjs.map +3 -3
- package/build/utils/object.cjs +8 -8
- package/build/utils/object.cjs.map +3 -3
- package/build/utils/order-inserter-block-items.cjs +1 -1
- package/build/utils/order-inserter-block-items.cjs.map +3 -3
- package/build/utils/pasting.cjs +4 -2
- package/build/utils/pasting.cjs.map +3 -3
- package/build/utils/selection.cjs +2 -1
- package/build/utils/selection.cjs.map +3 -3
- package/build/utils/sorting.cjs +9 -3
- package/build/utils/sorting.cjs.map +3 -3
- package/build/utils/transform-styles/index.cjs +3 -2
- package/build/utils/transform-styles/index.cjs.map +3 -3
- package/build/utils/transform-styles/postcss-urlrebase.d.cjs +2 -0
- package/build/utils/transform-styles/postcss-urlrebase.d.cjs.map +7 -0
- package/build/utils/transform-styles/types.cjs +19 -0
- package/build/utils/transform-styles/types.cjs.map +7 -0
- package/build/utils/types.cjs +19 -0
- package/build/utils/types.cjs.map +7 -0
- package/build-module/components/block-editing-mode/index.mjs +14 -8
- package/build-module/components/block-editing-mode/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +50 -51
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-rename/modal.mjs +0 -1
- package/build-module/components/block-rename/modal.mjs.map +2 -2
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs +14 -6
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
- package/build-module/components/colors-gradients/control.mjs +27 -15
- package/build-module/components/colors-gradients/control.mjs.map +2 -2
- package/build-module/components/colors-gradients/dropdown.mjs +4 -1
- package/build-module/components/colors-gradients/dropdown.mjs.map +2 -2
- package/build-module/components/contrast-checker/index.mjs +18 -4
- package/build-module/components/contrast-checker/index.mjs.map +2 -2
- package/build-module/components/date-format-picker/index.mjs +0 -1
- package/build-module/components/date-format-picker/index.mjs.map +2 -2
- package/build-module/components/global-styles/background-panel.mjs +155 -27
- package/build-module/components/global-styles/background-panel.mjs.map +2 -2
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +207 -0
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +7 -0
- package/build-module/components/global-styles/color-panel.mjs +106 -387
- package/build-module/components/global-styles/color-panel.mjs.map +3 -3
- package/build-module/components/global-styles/dimensions-panel.mjs +0 -3
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/hooks.mjs +33 -0
- package/build-module/components/global-styles/hooks.mjs.map +2 -2
- package/build-module/components/global-styles/typography-panel.mjs +84 -10
- package/build-module/components/global-styles/typography-panel.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/styles-tab.mjs +75 -31
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/link-control/index.mjs +1 -2
- package/build-module/components/link-control/index.mjs.map +2 -2
- package/build-module/components/list-view/block-select-button.mjs +2 -17
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/provider/use-block-sync.mjs +3 -1
- package/build-module/components/provider/use-block-sync.mjs.map +2 -2
- package/build-module/components/url-popover/image-url-input-ui.mjs +0 -2
- package/build-module/components/url-popover/image-url-input-ui.mjs.map +2 -2
- package/build-module/components/use-block-display-information/index.mjs +10 -3
- package/build-module/components/use-block-display-information/index.mjs.map +2 -2
- package/build-module/components/use-resize-canvas/index.mjs +6 -53
- package/build-module/components/use-resize-canvas/index.mjs.map +2 -2
- package/build-module/hooks/anchor.mjs +0 -1
- package/build-module/hooks/anchor.mjs.map +2 -2
- package/build-module/hooks/background.mjs +123 -75
- package/build-module/hooks/background.mjs.map +2 -2
- package/build-module/hooks/color.mjs +2 -175
- package/build-module/hooks/color.mjs.map +2 -2
- package/build-module/hooks/contrast-checker.mjs +32 -19
- package/build-module/hooks/contrast-checker.mjs.map +2 -2
- package/build-module/hooks/custom-class-name.mjs +0 -1
- package/build-module/hooks/custom-class-name.mjs.map +2 -2
- package/build-module/hooks/elements.mjs +115 -0
- package/build-module/hooks/elements.mjs.map +7 -0
- package/build-module/hooks/grid-visualizer.mjs +21 -11
- package/build-module/hooks/grid-visualizer.mjs.map +2 -2
- package/build-module/hooks/layout-child.mjs +41 -8
- package/build-module/hooks/layout-child.mjs.map +2 -2
- package/build-module/hooks/layout.mjs +6 -3
- package/build-module/hooks/layout.mjs.map +2 -2
- package/build-module/hooks/states.mjs +15 -23
- package/build-module/hooks/states.mjs.map +2 -2
- package/build-module/hooks/style.mjs +9 -5
- package/build-module/hooks/style.mjs.map +2 -2
- package/build-module/hooks/typography.mjs +62 -10
- package/build-module/hooks/typography.mjs.map +2 -2
- package/build-module/layouts/flex.mjs +105 -7
- package/build-module/layouts/flex.mjs.map +2 -2
- package/build-module/private-apis.mjs +0 -2
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +14 -0
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-keys.mjs +0 -2
- package/build-module/store/private-keys.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +22 -6
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +17 -3
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/utils/block-bindings.mjs +9 -9
- package/build-module/utils/block-bindings.mjs.map +3 -3
- package/build-module/utils/color-values.mjs +9 -1
- package/build-module/utils/color-values.mjs.map +3 -3
- package/build-module/utils/dom.mjs +2 -5
- package/build-module/utils/dom.mjs.map +3 -3
- package/build-module/utils/fit-text-frontend.mjs +6 -2
- package/build-module/utils/fit-text-frontend.mjs.map +3 -3
- package/build-module/utils/fit-text-utils.mjs +1 -1
- package/build-module/utils/fit-text-utils.mjs.map +3 -3
- package/build-module/utils/format-font-style.mjs +1 -1
- package/build-module/utils/format-font-style.mjs.map +3 -3
- package/build-module/utils/format-font-weight.mjs +1 -1
- package/build-module/utils/format-font-weight.mjs.map +3 -3
- package/build-module/utils/get-editor-region.mjs +4 -2
- package/build-module/utils/get-editor-region.mjs.map +3 -3
- package/build-module/utils/get-font-styles-and-weights.mjs +8 -12
- package/build-module/utils/get-font-styles-and-weights.mjs.map +3 -3
- package/build-module/utils/get-px-from-css-unit.mjs +1 -1
- package/build-module/utils/get-px-from-css-unit.mjs.map +1 -1
- package/build-module/utils/index.mjs +1 -1
- package/build-module/utils/index.mjs.map +1 -1
- package/build-module/utils/math.mjs +1 -1
- package/build-module/utils/math.mjs.map +3 -3
- package/build-module/utils/object.mjs +8 -8
- package/build-module/utils/object.mjs.map +3 -3
- package/build-module/utils/order-inserter-block-items.mjs +1 -1
- package/build-module/utils/order-inserter-block-items.mjs.map +3 -3
- package/build-module/utils/pasting.mjs +4 -2
- package/build-module/utils/pasting.mjs.map +3 -3
- package/build-module/utils/selection.mjs +2 -1
- package/build-module/utils/selection.mjs.map +3 -3
- package/build-module/utils/sorting.mjs +9 -3
- package/build-module/utils/sorting.mjs.map +3 -3
- package/build-module/utils/transform-styles/index.mjs +3 -2
- package/build-module/utils/transform-styles/index.mjs.map +3 -3
- package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs +1 -0
- package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs.map +7 -0
- package/build-module/utils/transform-styles/types.mjs +1 -0
- package/build-module/utils/transform-styles/types.mjs.map +7 -0
- package/build-module/utils/types.mjs +1 -0
- package/build-module/utils/types.mjs.map +7 -0
- package/build-style/content-rtl.css +2 -0
- package/build-style/content.css +2 -0
- package/build-style/style-rtl.css +34 -41
- package/build-style/style.css +34 -41
- package/build-types/utils/block-bindings.d.ts +27 -0
- package/build-types/utils/block-bindings.d.ts.map +1 -0
- package/build-types/utils/color-values.d.ts +40 -0
- package/build-types/utils/color-values.d.ts.map +1 -0
- package/build-types/utils/dom.d.ts +19 -19
- package/build-types/utils/dom.d.ts.map +1 -1
- package/build-types/utils/fit-text-frontend.d.ts +7 -0
- package/build-types/utils/fit-text-frontend.d.ts.map +1 -0
- package/build-types/utils/fit-text-utils.d.ts +15 -0
- package/build-types/utils/fit-text-utils.d.ts.map +1 -0
- package/build-types/utils/format-font-style.d.ts +12 -0
- package/build-types/utils/format-font-style.d.ts.map +1 -0
- package/build-types/utils/format-font-weight.d.ts +12 -0
- package/build-types/utils/format-font-weight.d.ts.map +1 -0
- package/build-types/utils/get-editor-region.d.ts +9 -0
- package/build-types/utils/get-editor-region.d.ts.map +1 -0
- package/build-types/utils/get-font-styles-and-weights.d.ts +16 -0
- package/build-types/utils/get-font-styles-and-weights.d.ts.map +1 -0
- package/build-types/utils/get-px-from-css-unit.d.ts +10 -0
- package/build-types/utils/get-px-from-css-unit.d.ts.map +1 -0
- package/build-types/utils/index.d.ts +3 -0
- package/build-types/utils/index.d.ts.map +1 -0
- package/build-types/utils/math.d.ts +61 -0
- package/build-types/utils/math.d.ts.map +1 -0
- package/build-types/utils/object.d.ts +39 -0
- package/build-types/utils/object.d.ts.map +1 -0
- package/build-types/utils/order-inserter-block-items.d.ts +13 -0
- package/build-types/utils/order-inserter-block-items.d.ts.map +1 -0
- package/build-types/utils/pasting.d.ts +28 -0
- package/build-types/utils/pasting.d.ts.map +1 -0
- package/build-types/utils/selection.d.ts +21 -0
- package/build-types/utils/selection.d.ts.map +1 -0
- package/build-types/utils/sorting.d.ts +17 -0
- package/build-types/utils/sorting.d.ts.map +1 -0
- package/build-types/utils/transform-styles/index.d.ts +15 -0
- package/build-types/utils/transform-styles/index.d.ts.map +1 -0
- package/build-types/utils/transform-styles/types.d.ts +13 -0
- package/build-types/utils/transform-styles/types.d.ts.map +1 -0
- package/build-types/utils/types.d.ts +28 -0
- package/build-types/utils/types.d.ts.map +1 -0
- package/package.json +40 -39
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -0
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -0
- package/src/components/block-editing-mode/index.js +17 -9
- package/src/components/block-icon/test/__snapshots__/index.js.snap +1 -0
- package/src/components/block-inspector/index.js +43 -53
- package/src/components/block-rename/modal.js +0 -1
- package/src/components/block-toolbar/block-toolbar-icon.js +22 -6
- package/src/components/block-toolbar/test/block-toolbar-icon.js +99 -0
- package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +4 -0
- package/src/components/colors-gradients/control.js +29 -12
- package/src/components/colors-gradients/dropdown.js +4 -1
- package/src/components/colors-gradients/style.scss +39 -2
- package/src/components/contrast-checker/README.md +9 -0
- package/src/components/contrast-checker/index.js +42 -3
- package/src/components/date-format-picker/index.js +0 -1
- package/src/components/default-block-appender/content.scss +3 -0
- package/src/components/global-styles/background-panel.js +201 -34
- package/src/components/global-styles/color-gradient-dropdown-item.js +258 -0
- package/src/components/global-styles/color-panel.js +125 -487
- package/src/components/global-styles/dimensions-panel.js +0 -3
- package/src/components/global-styles/hooks.js +45 -0
- package/src/components/global-styles/test/background-panel.js +56 -0
- package/src/components/global-styles/test/color-panel.js +172 -118
- package/src/components/global-styles/test/typography-panel.js +167 -0
- package/src/components/global-styles/typography-panel.js +100 -11
- package/src/components/inspector-controls/README.md +0 -2
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/styles-tab.js +74 -28
- package/src/components/link-control/index.js +0 -1
- package/src/components/link-control/test/index.js +2 -3
- package/src/components/list-view/block-select-button.js +2 -17
- package/src/components/provider/use-block-sync.js +3 -1
- package/src/components/rich-text/content.scss +2 -0
- package/src/components/url-popover/image-url-input-ui.js +0 -2
- package/src/components/use-block-display-information/index.js +15 -2
- package/src/components/use-block-display-information/test/index.js +140 -0
- package/src/components/use-resize-canvas/index.js +10 -71
- package/src/hooks/anchor.js +0 -1
- package/src/hooks/background.js +210 -133
- package/src/hooks/background.scss +0 -35
- package/src/hooks/color.js +2 -205
- package/src/hooks/color.scss +3 -9
- package/src/hooks/contrast-checker.js +60 -17
- package/src/hooks/custom-class-name.js +0 -1
- package/src/hooks/elements.js +140 -0
- package/src/hooks/elements.scss +8 -0
- package/src/hooks/grid-visualizer.js +59 -45
- package/src/hooks/layout-child.js +51 -12
- package/src/hooks/layout.js +6 -3
- package/src/hooks/states.js +32 -28
- package/src/hooks/style.js +11 -7
- package/src/hooks/test/background.js +59 -0
- package/src/hooks/test/block-style-state.js +14 -14
- package/src/hooks/test/layout.js +6 -6
- package/src/hooks/test/style.js +8 -8
- package/src/hooks/typography.js +70 -6
- package/src/layouts/flex.js +118 -15
- package/src/private-apis.js +0 -2
- package/src/store/private-actions.js +31 -0
- package/src/store/private-keys.js +0 -1
- package/src/store/private-selectors.js +43 -7
- package/src/store/reducer.js +37 -2
- package/src/store/test/private-selectors.js +39 -14
- package/src/store/test/reducer.js +91 -12
- package/src/style.scss +1 -0
- package/src/utils/block-bindings.ts +51 -0
- package/src/utils/color-values.ts +63 -0
- package/src/utils/{dom.js → dom.ts} +27 -27
- package/src/utils/{fit-text-frontend.js → fit-text-frontend.ts} +12 -4
- package/src/utils/{fit-text-utils.js → fit-text-utils.ts} +15 -7
- package/src/utils/{format-font-style.js → format-font-style.ts} +10 -3
- package/src/utils/{format-font-weight.js → format-font-weight.ts} +10 -3
- package/src/utils/{get-editor-region.js → get-editor-region.ts} +10 -6
- package/src/utils/{get-font-styles-and-weights.js → get-font-styles-and-weights.ts} +21 -17
- package/src/utils/{math.js → math.ts} +37 -30
- package/src/utils/object.ts +89 -0
- package/src/utils/{order-inserter-block-items.js → order-inserter-block-items.ts} +8 -5
- package/src/utils/{pasting.js → pasting.ts} +18 -11
- package/src/utils/{selection.js → selection.ts} +11 -4
- package/src/utils/sorting.ts +81 -0
- package/src/utils/test/color-values.js +44 -1
- package/src/utils/transform-styles/{index.js → index.ts} +25 -25
- package/src/utils/transform-styles/postcss-urlrebase.d.ts +15 -0
- package/src/utils/transform-styles/types.ts +13 -0
- package/src/utils/types.ts +29 -0
- package/src/components/use-resize-canvas/README.md +0 -37
- package/src/utils/block-bindings.js +0 -46
- package/src/utils/color-values.js +0 -28
- package/src/utils/object.js +0 -67
- package/src/utils/sorting.js +0 -54
- /package/src/utils/{get-px-from-css-unit.js → get-px-from-css-unit.ts} +0 -0
- /package/src/utils/{index.js → index.ts} +0 -0
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
// packages/block-editor/src/layouts/flex.js
|
|
2
|
-
import { __ } from "@wordpress/i18n";
|
|
2
|
+
import { __, _x } from "@wordpress/i18n";
|
|
3
3
|
import {
|
|
4
4
|
justifyLeft,
|
|
5
5
|
justifyCenter,
|
|
6
6
|
justifyRight,
|
|
7
7
|
justifySpaceBetween,
|
|
8
8
|
justifyStretch,
|
|
9
|
+
justifyTop,
|
|
10
|
+
justifyCenterVertical,
|
|
11
|
+
justifyBottom,
|
|
12
|
+
justifyStretchVertical,
|
|
13
|
+
justifySpaceBetweenVertical,
|
|
9
14
|
arrowRight,
|
|
10
15
|
arrowDown
|
|
11
16
|
} from "@wordpress/icons";
|
|
@@ -50,6 +55,28 @@ var defaultAlignments = {
|
|
|
50
55
|
horizontal: "center",
|
|
51
56
|
vertical: "top"
|
|
52
57
|
};
|
|
58
|
+
var verticalAlignmentOptions = {
|
|
59
|
+
top: {
|
|
60
|
+
icon: justifyTop,
|
|
61
|
+
label: _x("Align top", "Block vertical alignment setting")
|
|
62
|
+
},
|
|
63
|
+
center: {
|
|
64
|
+
icon: justifyCenterVertical,
|
|
65
|
+
label: _x("Align middle", "Block vertical alignment setting")
|
|
66
|
+
},
|
|
67
|
+
bottom: {
|
|
68
|
+
icon: justifyBottom,
|
|
69
|
+
label: _x("Align bottom", "Block vertical alignment setting")
|
|
70
|
+
},
|
|
71
|
+
stretch: {
|
|
72
|
+
icon: justifyStretchVertical,
|
|
73
|
+
label: _x("Stretch to fill", "Block vertical alignment setting")
|
|
74
|
+
},
|
|
75
|
+
"space-between": {
|
|
76
|
+
icon: justifySpaceBetweenVertical,
|
|
77
|
+
label: _x("Space between", "Block vertical alignment setting")
|
|
78
|
+
}
|
|
79
|
+
};
|
|
53
80
|
var flexWrapOptions = ["wrap", "nowrap"];
|
|
54
81
|
var flex_default = {
|
|
55
82
|
name: "flex",
|
|
@@ -64,10 +91,15 @@ var flex_default = {
|
|
|
64
91
|
const {
|
|
65
92
|
allowOrientation = true,
|
|
66
93
|
allowJustification = true,
|
|
94
|
+
allowVerticalAlignment = true,
|
|
67
95
|
allowWrap = true
|
|
68
96
|
} = layoutBlockSupport;
|
|
69
97
|
const hasLayoutValue = (key, defaultValue) => (layout?.[key] ?? defaultValue) !== (resetLayout?.[key] ?? defaultValue);
|
|
70
98
|
const hasJustificationValue = () => hasLayoutValue("justifyContent", "left");
|
|
99
|
+
const hasVerticalAlignmentValue = () => hasLayoutValue(
|
|
100
|
+
"verticalAlignment",
|
|
101
|
+
getDefaultVerticalAlignment(layout)
|
|
102
|
+
);
|
|
71
103
|
const hasOrientationValue = () => hasLayoutValue("orientation", "horizontal");
|
|
72
104
|
const hasWrapValue = () => hasLayoutValue("flexWrap", "wrap");
|
|
73
105
|
const resetJustification = () => onChange(
|
|
@@ -76,6 +108,15 @@ var flex_default = {
|
|
|
76
108
|
justifyContent: resetLayout?.justifyContent
|
|
77
109
|
})
|
|
78
110
|
);
|
|
111
|
+
const resetVerticalAlignment = () => onChange(
|
|
112
|
+
cleanEmptyObject({
|
|
113
|
+
...layout,
|
|
114
|
+
verticalAlignment: getCompatibleVerticalAlignment(
|
|
115
|
+
resetLayout?.verticalAlignment,
|
|
116
|
+
layout?.orientation
|
|
117
|
+
)
|
|
118
|
+
})
|
|
119
|
+
);
|
|
79
120
|
const resetOrientation = () => {
|
|
80
121
|
const { verticalAlignment, justifyContent } = layout;
|
|
81
122
|
const nextOrientation = resetLayout?.orientation;
|
|
@@ -141,6 +182,22 @@ var flex_default = {
|
|
|
141
182
|
]
|
|
142
183
|
}
|
|
143
184
|
),
|
|
185
|
+
allowVerticalAlignment && /* @__PURE__ */ jsx(
|
|
186
|
+
ToolsPanelItem,
|
|
187
|
+
{
|
|
188
|
+
label: __("Alignment"),
|
|
189
|
+
hasValue: hasVerticalAlignmentValue,
|
|
190
|
+
onDeselect: resetVerticalAlignment,
|
|
191
|
+
panelId: clientId,
|
|
192
|
+
children: /* @__PURE__ */ jsx(
|
|
193
|
+
FlexLayoutVerticalAlignmentControl,
|
|
194
|
+
{
|
|
195
|
+
layout,
|
|
196
|
+
onChange
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
),
|
|
144
201
|
allowWrap && /* @__PURE__ */ jsx(
|
|
145
202
|
ToolsPanelItem,
|
|
146
203
|
{
|
|
@@ -181,7 +238,8 @@ var flex_default = {
|
|
|
181
238
|
FlexLayoutVerticalAlignmentControl,
|
|
182
239
|
{
|
|
183
240
|
layout,
|
|
184
|
-
onChange
|
|
241
|
+
onChange,
|
|
242
|
+
isToolbar: true
|
|
185
243
|
}
|
|
186
244
|
)
|
|
187
245
|
] });
|
|
@@ -261,22 +319,62 @@ var flex_default = {
|
|
|
261
319
|
return [];
|
|
262
320
|
}
|
|
263
321
|
};
|
|
264
|
-
function
|
|
322
|
+
function getDefaultVerticalAlignment({ orientation = "horizontal" } = {}) {
|
|
323
|
+
return orientation === "horizontal" ? defaultAlignments.horizontal : defaultAlignments.vertical;
|
|
324
|
+
}
|
|
325
|
+
function getCompatibleVerticalAlignment(verticalAlignment, orientation) {
|
|
326
|
+
if (orientation === "horizontal" && verticalAlignment === "space-between" || orientation === "vertical" && verticalAlignment === "stretch") {
|
|
327
|
+
return void 0;
|
|
328
|
+
}
|
|
329
|
+
return verticalAlignment;
|
|
330
|
+
}
|
|
331
|
+
function getVerticalAlignmentControls(orientation) {
|
|
332
|
+
return orientation === "horizontal" ? ["top", "center", "bottom", "stretch"] : ["top", "center", "bottom", "space-between"];
|
|
333
|
+
}
|
|
334
|
+
function FlexLayoutVerticalAlignmentControl({
|
|
335
|
+
layout,
|
|
336
|
+
onChange,
|
|
337
|
+
isToolbar = false
|
|
338
|
+
}) {
|
|
265
339
|
const { orientation = "horizontal" } = layout;
|
|
266
|
-
const
|
|
267
|
-
const { verticalAlignment = defaultVerticalAlignment } = layout;
|
|
340
|
+
const { verticalAlignment = getDefaultVerticalAlignment(layout) } = layout;
|
|
268
341
|
const onVerticalAlignmentChange = (value) => {
|
|
269
342
|
onChange({
|
|
270
343
|
...layout,
|
|
271
344
|
verticalAlignment: value
|
|
272
345
|
});
|
|
273
346
|
};
|
|
347
|
+
const controls = getVerticalAlignmentControls(orientation);
|
|
348
|
+
if (isToolbar) {
|
|
349
|
+
return /* @__PURE__ */ jsx(
|
|
350
|
+
BlockVerticalAlignmentControl,
|
|
351
|
+
{
|
|
352
|
+
onChange: onVerticalAlignmentChange,
|
|
353
|
+
value: verticalAlignment,
|
|
354
|
+
controls
|
|
355
|
+
}
|
|
356
|
+
);
|
|
357
|
+
}
|
|
274
358
|
return /* @__PURE__ */ jsx(
|
|
275
|
-
|
|
359
|
+
ToggleGroupControl,
|
|
276
360
|
{
|
|
361
|
+
__next40pxDefaultSize: true,
|
|
362
|
+
label: __("Alignment"),
|
|
277
363
|
onChange: onVerticalAlignmentChange,
|
|
278
364
|
value: verticalAlignment,
|
|
279
|
-
|
|
365
|
+
className: "block-editor-hooks__flex-layout-alignment-controls",
|
|
366
|
+
children: controls.map((control) => {
|
|
367
|
+
const { icon, label } = verticalAlignmentOptions[control];
|
|
368
|
+
return /* @__PURE__ */ jsx(
|
|
369
|
+
ToggleGroupControlOptionIcon,
|
|
370
|
+
{
|
|
371
|
+
value: control,
|
|
372
|
+
icon,
|
|
373
|
+
label
|
|
374
|
+
},
|
|
375
|
+
control
|
|
376
|
+
);
|
|
377
|
+
})
|
|
280
378
|
}
|
|
281
379
|
);
|
|
282
380
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/layouts/flex.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tjustifyLeft,\n\tjustifyCenter,\n\tjustifyRight,\n\tjustifySpaceBetween,\n\tjustifyStretch,\n\tarrowRight,\n\tarrowDown,\n} from '@wordpress/icons';\nimport {\n\tFlex,\n\tToggleControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { appendSelectors, getBlockGapCSS } from './utils';\nimport { getGapCSSValue, getGapBoxControlValueFromStyle } from '../hooks/gap';\nimport { getSpacingPresetCssVar } from '../components/spacing-sizes-control/utils';\nimport {\n\tBlockControls,\n\tJustifyContentControl,\n\tBlockVerticalAlignmentControl,\n} from '../components';\nimport { cleanEmptyObject, shouldSkipSerialization } from '../hooks/utils';\nimport { LAYOUT_DEFINITIONS } from './definitions';\n\n// Used with the default, horizontal flex orientation.\nconst justifyContentMap = {\n\tleft: 'flex-start',\n\tright: 'flex-end',\n\tcenter: 'center',\n\t'space-between': 'space-between',\n};\n\n// Used with the vertical (column) flex orientation.\nconst alignItemsMap = {\n\tleft: 'flex-start',\n\tright: 'flex-end',\n\tcenter: 'center',\n\tstretch: 'stretch',\n};\n\nconst verticalAlignmentMap = {\n\ttop: 'flex-start',\n\tcenter: 'center',\n\tbottom: 'flex-end',\n\tstretch: 'stretch',\n\t'space-between': 'space-between',\n};\n\nconst defaultAlignments = {\n\thorizontal: 'center',\n\tvertical: 'top',\n};\n\nconst flexWrapOptions = [ 'wrap', 'nowrap' ];\n\nexport default {\n\tname: 'flex',\n\tlabel: __( 'Flex' ),\n\tinspectorControls: function FlexLayoutInspectorControls( {\n\t\tlayout = {},\n\t\tonChange,\n\t\tlayoutBlockSupport = {},\n\t\tresetLayout = {},\n\t\tclientId,\n\t} ) {\n\t\tconst {\n\t\t\tallowOrientation = true,\n\t\t\tallowJustification = true,\n\t\t\tallowWrap = true,\n\t\t} = layoutBlockSupport;\n\t\tconst hasLayoutValue = ( key, defaultValue ) =>\n\t\t\t( layout?.[ key ] ?? defaultValue ) !==\n\t\t\t( resetLayout?.[ key ] ?? defaultValue );\n\t\tconst hasJustificationValue = () =>\n\t\t\thasLayoutValue( 'justifyContent', 'left' );\n\t\tconst hasOrientationValue = () =>\n\t\t\thasLayoutValue( 'orientation', 'horizontal' );\n\t\tconst hasWrapValue = () => hasLayoutValue( 'flexWrap', 'wrap' );\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 resetOrientation = () => {\n\t\t\tconst { verticalAlignment, justifyContent } = layout;\n\t\t\tconst nextOrientation = resetLayout?.orientation;\n\t\t\tconst isHorizontal =\n\t\t\t\t! nextOrientation || nextOrientation === 'horizontal';\n\t\t\tonChange(\n\t\t\t\tcleanEmptyObject( {\n\t\t\t\t\t...layout,\n\t\t\t\t\torientation: nextOrientation,\n\t\t\t\t\tverticalAlignment:\n\t\t\t\t\t\tresetLayout?.verticalAlignment ??\n\t\t\t\t\t\t( isHorizontal && verticalAlignment === 'space-between'\n\t\t\t\t\t\t\t? 'center'\n\t\t\t\t\t\t\t: verticalAlignment ),\n\t\t\t\t\tjustifyContent:\n\t\t\t\t\t\tresetLayout?.justifyContent ??\n\t\t\t\t\t\t( isHorizontal && justifyContent === 'stretch'\n\t\t\t\t\t\t\t? 'left'\n\t\t\t\t\t\t\t: justifyContent ),\n\t\t\t\t} )\n\t\t\t);\n\t\t};\n\t\tconst resetWrap = () =>\n\t\t\tonChange(\n\t\t\t\tcleanEmptyObject( {\n\t\t\t\t\t...layout,\n\t\t\t\t\tflexWrap: resetLayout?.flexWrap,\n\t\t\t\t} )\n\t\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ ( allowJustification || allowOrientation ) && (\n\t\t\t\t\t<Flex\n\t\t\t\t\t\talign=\"flex-start\"\n\t\t\t\t\t\tclassName=\"block-editor-hooks__flex-layout-controls\"\n\t\t\t\t\t\tgap={ 4 }\n\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ allowJustification && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Justification' ) }\n\t\t\t\t\t\t\t\thasValue={ hasJustificationValue }\n\t\t\t\t\t\t\t\tonDeselect={ resetJustification }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<FlexLayoutJustifyContentControl\n\t\t\t\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ allowOrientation && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Orientation' ) }\n\t\t\t\t\t\t\t\thasValue={ hasOrientationValue }\n\t\t\t\t\t\t\t\tonDeselect={ resetOrientation }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<OrientationControl\n\t\t\t\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Flex>\n\t\t\t\t) }\n\t\t\t\t{ allowWrap && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Wrapping' ) }\n\t\t\t\t\t\thasValue={ hasWrapValue }\n\t\t\t\t\t\tonDeselect={ resetWrap }\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlexWrapControl\n\t\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\ttoolBarControls: function FlexLayoutToolbarControls( {\n\t\tlayout = {},\n\t\tonChange,\n\t\tlayoutBlockSupport,\n\t} ) {\n\t\tconst { allowVerticalAlignment = true, allowJustification = true } =\n\t\t\tlayoutBlockSupport;\n\n\t\tif ( ! allowJustification && ! allowVerticalAlignment ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t{ allowJustification && (\n\t\t\t\t\t<FlexLayoutJustifyContentControl\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tisToolbar\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ allowVerticalAlignment && (\n\t\t\t\t\t<FlexLayoutVerticalAlignmentControl\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\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\tglobalBlockGapValue,\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 { orientation = 'horizontal' } = effectiveLayout;\n\n\t\t// Determine the fallback gap value using global styles (theme.json),\n\t\t// falling back to '0.5em' for backwards compatibility.\n\t\tlet fallbackGapValue = '0.5em';\n\t\tif ( globalBlockGapValue ) {\n\t\t\tconst gapBox =\n\t\t\t\tgetGapBoxControlValueFromStyle( globalBlockGapValue );\n\t\t\tfallbackGapValue =\n\t\t\t\tgetSpacingPresetCssVar( gapBox?.left ) ||\n\t\t\t\tgetSpacingPresetCssVar( gapBox?.top ) ||\n\t\t\t\t'0.5em';\n\t\t}\n\n\t\t// If a block's block.json skips serialization for spacing or spacing.blockGap,\n\t\t// don't apply the user-defined value to the styles.\n\t\tconst blockGapValue =\n\t\t\tstyle?.spacing?.blockGap &&\n\t\t\t! shouldSkipSerialization( blockName, 'spacing', 'blockGap' )\n\t\t\t\t? getGapCSSValue( style?.spacing?.blockGap, fallbackGapValue )\n\t\t\t\t: undefined;\n\t\tconst hasBlockGapOverride =\n\t\t\t! hasViewportOverrides ||\n\t\t\tObject.hasOwn( style?.spacing || {}, 'blockGap' );\n\t\tconst justifyContent =\n\t\t\tjustifyContentMap[ effectiveLayout.justifyContent ];\n\t\tconst flexWrap = flexWrapOptions.includes( effectiveLayout.flexWrap )\n\t\t\t? effectiveLayout.flexWrap\n\t\t\t: 'wrap';\n\t\tconst verticalAlignment =\n\t\t\tverticalAlignmentMap[ effectiveLayout.verticalAlignment ];\n\t\tconst alignItems =\n\t\t\talignItemsMap[ effectiveLayout.justifyContent ] ||\n\t\t\talignItemsMap.left;\n\n\t\tlet output = '';\n\t\tconst rules = [];\n\n\t\tconst shouldOutputFlexWrap =\n\t\t\t! hasViewportOverrides || hasViewportOverride( 'flexWrap' );\n\t\tconst shouldOutputFlexOrientation =\n\t\t\t! hasViewportOverrides || hasViewportOverride( 'orientation' );\n\t\tconst shouldOutputFlexJustification =\n\t\t\t! hasViewportOverrides ||\n\t\t\thasViewportOverride( 'justifyContent' ) ||\n\t\t\thasViewportOverride( 'orientation' );\n\t\tconst shouldOutputFlexAlignment =\n\t\t\t! hasViewportOverrides ||\n\t\t\thasViewportOverride( 'verticalAlignment' ) ||\n\t\t\thasViewportOverride( 'orientation' );\n\n\t\tif ( shouldOutputFlexWrap && flexWrap && flexWrap !== 'wrap' ) {\n\t\t\trules.push( `flex-wrap: ${ flexWrap }` );\n\t\t}\n\n\t\tif ( orientation === 'horizontal' ) {\n\t\t\tif ( shouldOutputFlexAlignment && verticalAlignment ) {\n\t\t\t\trules.push( `align-items: ${ verticalAlignment }` );\n\t\t\t}\n\t\t\tif ( shouldOutputFlexJustification && justifyContent ) {\n\t\t\t\trules.push( `justify-content: ${ justifyContent }` );\n\t\t\t}\n\t\t} else {\n\t\t\tif ( shouldOutputFlexAlignment && verticalAlignment ) {\n\t\t\t\trules.push( `justify-content: ${ verticalAlignment }` );\n\t\t\t}\n\t\t\tif ( shouldOutputFlexOrientation ) {\n\t\t\t\trules.push( 'flex-direction: column' );\n\t\t\t}\n\t\t\tif ( shouldOutputFlexJustification ) {\n\t\t\t\trules.push( `align-items: ${ alignItems }` );\n\t\t\t}\n\t\t}\n\n\t\tif ( rules.length ) {\n\t\t\toutput = `${ appendSelectors( selector ) } {\n\t\t\t\t${ rules.join( '; ' ) };\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'flex',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation( layout ) {\n\t\tconst { orientation = 'horizontal' } = layout;\n\t\treturn orientation;\n\t},\n\tgetAlignments() {\n\t\treturn [];\n\t},\n};\n\nfunction FlexLayoutVerticalAlignmentControl( { layout, onChange } ) {\n\tconst { orientation = 'horizontal' } = layout;\n\n\tconst defaultVerticalAlignment =\n\t\torientation === 'horizontal'\n\t\t\t? defaultAlignments.horizontal\n\t\t\t: defaultAlignments.vertical;\n\n\tconst { verticalAlignment = defaultVerticalAlignment } = layout;\n\n\tconst onVerticalAlignmentChange = ( value ) => {\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tverticalAlignment: value,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<BlockVerticalAlignmentControl\n\t\t\tonChange={ onVerticalAlignmentChange }\n\t\t\tvalue={ verticalAlignment }\n\t\t\tcontrols={\n\t\t\t\torientation === 'horizontal'\n\t\t\t\t\t? [ 'top', 'center', 'bottom', 'stretch' ]\n\t\t\t\t\t: [ 'top', 'center', 'bottom', 'space-between' ]\n\t\t\t}\n\t\t/>\n\t);\n}\n\nconst POPOVER_PROPS = {\n\tplacement: 'bottom-start',\n};\n\nfunction FlexLayoutJustifyContentControl( {\n\tlayout,\n\tonChange,\n\tisToolbar = false,\n} ) {\n\tconst { justifyContent = 'left', orientation = 'horizontal' } = 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\tif ( orientation === 'horizontal' ) {\n\t\tallowedControls.push( 'space-between' );\n\t} else {\n\t\tallowedControls.push( 'stretch' );\n\t}\n\tif ( isToolbar ) {\n\t\treturn (\n\t\t\t<JustifyContentControl\n\t\t\t\tallowedControls={ allowedControls }\n\t\t\t\tvalue={ justifyContent }\n\t\t\t\tonChange={ onJustificationChange }\n\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst justificationOptions = [\n\t\t{\n\t\t\tvalue: 'left',\n\t\t\ticon: justifyLeft,\n\t\t\tlabel: __( 'Justify items left' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'center',\n\t\t\ticon: justifyCenter,\n\t\t\tlabel: __( 'Justify items center' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'right',\n\t\t\ticon: justifyRight,\n\t\t\tlabel: __( 'Justify items right' ),\n\t\t},\n\t];\n\tif ( orientation === 'horizontal' ) {\n\t\tjustificationOptions.push( {\n\t\t\tvalue: 'space-between',\n\t\t\ticon: justifySpaceBetween,\n\t\t\tlabel: __( 'Space between items' ),\n\t\t} );\n\t} else {\n\t\tjustificationOptions.push( {\n\t\t\tvalue: 'stretch',\n\t\t\ticon: justifyStretch,\n\t\t\tlabel: __( 'Stretch items' ),\n\t\t} );\n\t}\n\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Justification' ) }\n\t\t\tvalue={ justifyContent }\n\t\t\tonChange={ onJustificationChange }\n\t\t\tclassName=\"block-editor-hooks__flex-layout-justification-controls\"\n\t\t>\n\t\t\t{ justificationOptions.map( ( { value, icon, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ToggleGroupControl>\n\t);\n}\n\nfunction FlexWrapControl( { layout, onChange } ) {\n\tconst { flexWrap = 'wrap' } = layout;\n\treturn (\n\t\t<ToggleControl\n\t\t\tlabel={ __( 'Allow to wrap to multiple lines' ) }\n\t\t\tonChange={ ( value ) => {\n\t\t\t\tonChange( {\n\t\t\t\t\t...layout,\n\t\t\t\t\tflexWrap: value ? 'wrap' : 'nowrap',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tchecked={ flexWrap === 'wrap' }\n\t\t/>\n\t);\n}\n\nfunction OrientationControl( { layout, onChange } ) {\n\tconst {\n\t\torientation = 'horizontal',\n\t\tverticalAlignment,\n\t\tjustifyContent,\n\t} = layout;\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName=\"block-editor-hooks__flex-layout-orientation-controls\"\n\t\t\tlabel={ __( 'Orientation' ) }\n\t\t\tvalue={ orientation }\n\t\t\tonChange={ ( value ) => {\n\t\t\t\t// Make sure the vertical alignment and justification are compatible with the new orientation.\n\t\t\t\tlet newVerticalAlignment = verticalAlignment;\n\t\t\t\tlet newJustification = justifyContent;\n\t\t\t\tif ( value === 'horizontal' ) {\n\t\t\t\t\tif ( verticalAlignment === 'space-between' ) {\n\t\t\t\t\t\tnewVerticalAlignment = 'center';\n\t\t\t\t\t}\n\t\t\t\t\tif ( justifyContent === 'stretch' ) {\n\t\t\t\t\t\tnewJustification = 'left';\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif ( verticalAlignment === 'stretch' ) {\n\t\t\t\t\t\tnewVerticalAlignment = 'top';\n\t\t\t\t\t}\n\t\t\t\t\tif ( justifyContent === 'space-between' ) {\n\t\t\t\t\t\tnewJustification = 'left';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn onChange( {\n\t\t\t\t\t...layout,\n\t\t\t\t\torientation: value,\n\t\t\t\t\tverticalAlignment: newVerticalAlignment,\n\t\t\t\t\tjustifyContent: newJustification,\n\t\t\t\t} );\n\t\t\t} }\n\t\t>\n\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\ticon={ arrowRight }\n\t\t\t\tvalue=\"horizontal\"\n\t\t\t\tlabel={ __( 'Horizontal' ) }\n\t\t\t/>\n\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\ticon={ arrowDown }\n\t\t\t\tvalue=\"vertical\"\n\t\t\t\tlabel={ __( 'Vertical' ) }\n\t\t\t/>\n\t\t</ToggleGroupControl>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tjustifyLeft,\n\tjustifyCenter,\n\tjustifyRight,\n\tjustifySpaceBetween,\n\tjustifyStretch,\n\tjustifyTop,\n\tjustifyCenterVertical,\n\tjustifyBottom,\n\tjustifyStretchVertical,\n\tjustifySpaceBetweenVertical,\n\tarrowRight,\n\tarrowDown,\n} from '@wordpress/icons';\nimport {\n\tFlex,\n\tToggleControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { appendSelectors, getBlockGapCSS } from './utils';\nimport { getGapCSSValue, getGapBoxControlValueFromStyle } from '../hooks/gap';\nimport { getSpacingPresetCssVar } from '../components/spacing-sizes-control/utils';\nimport {\n\tBlockControls,\n\tJustifyContentControl,\n\tBlockVerticalAlignmentControl,\n} from '../components';\nimport { cleanEmptyObject, shouldSkipSerialization } from '../hooks/utils';\nimport { LAYOUT_DEFINITIONS } from './definitions';\n\n// Used with the default, horizontal flex orientation.\nconst justifyContentMap = {\n\tleft: 'flex-start',\n\tright: 'flex-end',\n\tcenter: 'center',\n\t'space-between': 'space-between',\n};\n\n// Used with the vertical (column) flex orientation.\nconst alignItemsMap = {\n\tleft: 'flex-start',\n\tright: 'flex-end',\n\tcenter: 'center',\n\tstretch: 'stretch',\n};\n\nconst verticalAlignmentMap = {\n\ttop: 'flex-start',\n\tcenter: 'center',\n\tbottom: 'flex-end',\n\tstretch: 'stretch',\n\t'space-between': 'space-between',\n};\n\nconst defaultAlignments = {\n\thorizontal: 'center',\n\tvertical: 'top',\n};\n\nconst verticalAlignmentOptions = {\n\ttop: {\n\t\ticon: justifyTop,\n\t\tlabel: _x( 'Align top', 'Block vertical alignment setting' ),\n\t},\n\tcenter: {\n\t\ticon: justifyCenterVertical,\n\t\tlabel: _x( 'Align middle', 'Block vertical alignment setting' ),\n\t},\n\tbottom: {\n\t\ticon: justifyBottom,\n\t\tlabel: _x( 'Align bottom', 'Block vertical alignment setting' ),\n\t},\n\tstretch: {\n\t\ticon: justifyStretchVertical,\n\t\tlabel: _x( 'Stretch to fill', 'Block vertical alignment setting' ),\n\t},\n\t'space-between': {\n\t\ticon: justifySpaceBetweenVertical,\n\t\tlabel: _x( 'Space between', 'Block vertical alignment setting' ),\n\t},\n};\n\nconst flexWrapOptions = [ 'wrap', 'nowrap' ];\n\nexport default {\n\tname: 'flex',\n\tlabel: __( 'Flex' ),\n\tinspectorControls: function FlexLayoutInspectorControls( {\n\t\tlayout = {},\n\t\tonChange,\n\t\tlayoutBlockSupport = {},\n\t\tresetLayout = {},\n\t\tclientId,\n\t} ) {\n\t\tconst {\n\t\t\tallowOrientation = true,\n\t\t\tallowJustification = true,\n\t\t\tallowVerticalAlignment = true,\n\t\t\tallowWrap = true,\n\t\t} = layoutBlockSupport;\n\t\tconst hasLayoutValue = ( key, defaultValue ) =>\n\t\t\t( layout?.[ key ] ?? defaultValue ) !==\n\t\t\t( resetLayout?.[ key ] ?? defaultValue );\n\t\tconst hasJustificationValue = () =>\n\t\t\thasLayoutValue( 'justifyContent', 'left' );\n\t\tconst hasVerticalAlignmentValue = () =>\n\t\t\thasLayoutValue(\n\t\t\t\t'verticalAlignment',\n\t\t\t\tgetDefaultVerticalAlignment( layout )\n\t\t\t);\n\t\tconst hasOrientationValue = () =>\n\t\t\thasLayoutValue( 'orientation', 'horizontal' );\n\t\tconst hasWrapValue = () => hasLayoutValue( 'flexWrap', 'wrap' );\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 resetVerticalAlignment = () =>\n\t\t\tonChange(\n\t\t\t\tcleanEmptyObject( {\n\t\t\t\t\t...layout,\n\t\t\t\t\tverticalAlignment: getCompatibleVerticalAlignment(\n\t\t\t\t\t\tresetLayout?.verticalAlignment,\n\t\t\t\t\t\tlayout?.orientation\n\t\t\t\t\t),\n\t\t\t\t} )\n\t\t\t);\n\t\tconst resetOrientation = () => {\n\t\t\tconst { verticalAlignment, justifyContent } = layout;\n\t\t\tconst nextOrientation = resetLayout?.orientation;\n\t\t\tconst isHorizontal =\n\t\t\t\t! nextOrientation || nextOrientation === 'horizontal';\n\t\t\tonChange(\n\t\t\t\tcleanEmptyObject( {\n\t\t\t\t\t...layout,\n\t\t\t\t\torientation: nextOrientation,\n\t\t\t\t\tverticalAlignment:\n\t\t\t\t\t\tresetLayout?.verticalAlignment ??\n\t\t\t\t\t\t( isHorizontal && verticalAlignment === 'space-between'\n\t\t\t\t\t\t\t? 'center'\n\t\t\t\t\t\t\t: verticalAlignment ),\n\t\t\t\t\tjustifyContent:\n\t\t\t\t\t\tresetLayout?.justifyContent ??\n\t\t\t\t\t\t( isHorizontal && justifyContent === 'stretch'\n\t\t\t\t\t\t\t? 'left'\n\t\t\t\t\t\t\t: justifyContent ),\n\t\t\t\t} )\n\t\t\t);\n\t\t};\n\t\tconst resetWrap = () =>\n\t\t\tonChange(\n\t\t\t\tcleanEmptyObject( {\n\t\t\t\t\t...layout,\n\t\t\t\t\tflexWrap: resetLayout?.flexWrap,\n\t\t\t\t} )\n\t\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ ( allowJustification || allowOrientation ) && (\n\t\t\t\t\t<Flex\n\t\t\t\t\t\talign=\"flex-start\"\n\t\t\t\t\t\tclassName=\"block-editor-hooks__flex-layout-controls\"\n\t\t\t\t\t\tgap={ 4 }\n\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ allowJustification && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Justification' ) }\n\t\t\t\t\t\t\t\thasValue={ hasJustificationValue }\n\t\t\t\t\t\t\t\tonDeselect={ resetJustification }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<FlexLayoutJustifyContentControl\n\t\t\t\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ allowOrientation && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Orientation' ) }\n\t\t\t\t\t\t\t\thasValue={ hasOrientationValue }\n\t\t\t\t\t\t\t\tonDeselect={ resetOrientation }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<OrientationControl\n\t\t\t\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Flex>\n\t\t\t\t) }\n\t\t\t\t{ allowVerticalAlignment && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Alignment' ) }\n\t\t\t\t\t\thasValue={ hasVerticalAlignmentValue }\n\t\t\t\t\t\tonDeselect={ resetVerticalAlignment }\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlexLayoutVerticalAlignmentControl\n\t\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t\t{ allowWrap && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Wrapping' ) }\n\t\t\t\t\t\thasValue={ hasWrapValue }\n\t\t\t\t\t\tonDeselect={ resetWrap }\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlexWrapControl\n\t\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\ttoolBarControls: function FlexLayoutToolbarControls( {\n\t\tlayout = {},\n\t\tonChange,\n\t\tlayoutBlockSupport,\n\t} ) {\n\t\tconst { allowVerticalAlignment = true, allowJustification = true } =\n\t\t\tlayoutBlockSupport;\n\n\t\tif ( ! allowJustification && ! allowVerticalAlignment ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t{ allowJustification && (\n\t\t\t\t\t<FlexLayoutJustifyContentControl\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tisToolbar\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ allowVerticalAlignment && (\n\t\t\t\t\t<FlexLayoutVerticalAlignmentControl\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tisToolbar\n\t\t\t\t\t/>\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\tglobalBlockGapValue,\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 { orientation = 'horizontal' } = effectiveLayout;\n\n\t\t// Determine the fallback gap value using global styles (theme.json),\n\t\t// falling back to '0.5em' for backwards compatibility.\n\t\tlet fallbackGapValue = '0.5em';\n\t\tif ( globalBlockGapValue ) {\n\t\t\tconst gapBox =\n\t\t\t\tgetGapBoxControlValueFromStyle( globalBlockGapValue );\n\t\t\tfallbackGapValue =\n\t\t\t\tgetSpacingPresetCssVar( gapBox?.left ) ||\n\t\t\t\tgetSpacingPresetCssVar( gapBox?.top ) ||\n\t\t\t\t'0.5em';\n\t\t}\n\n\t\t// If a block's block.json skips serialization for spacing or spacing.blockGap,\n\t\t// don't apply the user-defined value to the styles.\n\t\tconst blockGapValue =\n\t\t\tstyle?.spacing?.blockGap &&\n\t\t\t! shouldSkipSerialization( blockName, 'spacing', 'blockGap' )\n\t\t\t\t? getGapCSSValue( style?.spacing?.blockGap, fallbackGapValue )\n\t\t\t\t: undefined;\n\t\tconst hasBlockGapOverride =\n\t\t\t! hasViewportOverrides ||\n\t\t\tObject.hasOwn( style?.spacing || {}, 'blockGap' );\n\t\tconst justifyContent =\n\t\t\tjustifyContentMap[ effectiveLayout.justifyContent ];\n\t\tconst flexWrap = flexWrapOptions.includes( effectiveLayout.flexWrap )\n\t\t\t? effectiveLayout.flexWrap\n\t\t\t: 'wrap';\n\t\tconst verticalAlignment =\n\t\t\tverticalAlignmentMap[ effectiveLayout.verticalAlignment ];\n\t\tconst alignItems =\n\t\t\talignItemsMap[ effectiveLayout.justifyContent ] ||\n\t\t\talignItemsMap.left;\n\n\t\tlet output = '';\n\t\tconst rules = [];\n\n\t\tconst shouldOutputFlexWrap =\n\t\t\t! hasViewportOverrides || hasViewportOverride( 'flexWrap' );\n\t\tconst shouldOutputFlexOrientation =\n\t\t\t! hasViewportOverrides || hasViewportOverride( 'orientation' );\n\t\tconst shouldOutputFlexJustification =\n\t\t\t! hasViewportOverrides ||\n\t\t\thasViewportOverride( 'justifyContent' ) ||\n\t\t\thasViewportOverride( 'orientation' );\n\t\tconst shouldOutputFlexAlignment =\n\t\t\t! hasViewportOverrides ||\n\t\t\thasViewportOverride( 'verticalAlignment' ) ||\n\t\t\thasViewportOverride( 'orientation' );\n\n\t\tif ( shouldOutputFlexWrap && flexWrap && flexWrap !== 'wrap' ) {\n\t\t\trules.push( `flex-wrap: ${ flexWrap }` );\n\t\t}\n\n\t\tif ( orientation === 'horizontal' ) {\n\t\t\tif ( shouldOutputFlexAlignment && verticalAlignment ) {\n\t\t\t\trules.push( `align-items: ${ verticalAlignment }` );\n\t\t\t}\n\t\t\tif ( shouldOutputFlexJustification && justifyContent ) {\n\t\t\t\trules.push( `justify-content: ${ justifyContent }` );\n\t\t\t}\n\t\t} else {\n\t\t\tif ( shouldOutputFlexAlignment && verticalAlignment ) {\n\t\t\t\trules.push( `justify-content: ${ verticalAlignment }` );\n\t\t\t}\n\t\t\tif ( shouldOutputFlexOrientation ) {\n\t\t\t\trules.push( 'flex-direction: column' );\n\t\t\t}\n\t\t\tif ( shouldOutputFlexJustification ) {\n\t\t\t\trules.push( `align-items: ${ alignItems }` );\n\t\t\t}\n\t\t}\n\n\t\tif ( rules.length ) {\n\t\t\toutput = `${ appendSelectors( selector ) } {\n\t\t\t\t${ rules.join( '; ' ) };\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'flex',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation( layout ) {\n\t\tconst { orientation = 'horizontal' } = layout;\n\t\treturn orientation;\n\t},\n\tgetAlignments() {\n\t\treturn [];\n\t},\n};\n\nfunction getDefaultVerticalAlignment( { orientation = 'horizontal' } = {} ) {\n\treturn orientation === 'horizontal'\n\t\t? defaultAlignments.horizontal\n\t\t: defaultAlignments.vertical;\n}\n\nfunction getCompatibleVerticalAlignment( verticalAlignment, orientation ) {\n\tif (\n\t\t( orientation === 'horizontal' &&\n\t\t\tverticalAlignment === 'space-between' ) ||\n\t\t( orientation === 'vertical' && verticalAlignment === 'stretch' )\n\t) {\n\t\treturn undefined;\n\t}\n\n\treturn verticalAlignment;\n}\n\nfunction getVerticalAlignmentControls( orientation ) {\n\treturn orientation === 'horizontal'\n\t\t? [ 'top', 'center', 'bottom', 'stretch' ]\n\t\t: [ 'top', 'center', 'bottom', 'space-between' ];\n}\n\nfunction FlexLayoutVerticalAlignmentControl( {\n\tlayout,\n\tonChange,\n\tisToolbar = false,\n} ) {\n\tconst { orientation = 'horizontal' } = layout;\n\n\tconst { verticalAlignment = getDefaultVerticalAlignment( layout ) } =\n\t\tlayout;\n\n\tconst onVerticalAlignmentChange = ( value ) => {\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tverticalAlignment: value,\n\t\t} );\n\t};\n\tconst controls = getVerticalAlignmentControls( orientation );\n\n\tif ( isToolbar ) {\n\t\treturn (\n\t\t\t<BlockVerticalAlignmentControl\n\t\t\t\tonChange={ onVerticalAlignmentChange }\n\t\t\t\tvalue={ verticalAlignment }\n\t\t\t\tcontrols={ controls }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Alignment' ) }\n\t\t\tonChange={ onVerticalAlignmentChange }\n\t\t\tvalue={ verticalAlignment }\n\t\t\tclassName=\"block-editor-hooks__flex-layout-alignment-controls\"\n\t\t>\n\t\t\t{ controls.map( ( control ) => {\n\t\t\t\tconst { icon, label } = verticalAlignmentOptions[ control ];\n\t\t\t\treturn (\n\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\tkey={ control }\n\t\t\t\t\t\tvalue={ control }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ToggleGroupControl>\n\t);\n}\n\nconst POPOVER_PROPS = {\n\tplacement: 'bottom-start',\n};\n\nfunction FlexLayoutJustifyContentControl( {\n\tlayout,\n\tonChange,\n\tisToolbar = false,\n} ) {\n\tconst { justifyContent = 'left', orientation = 'horizontal' } = 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\tif ( orientation === 'horizontal' ) {\n\t\tallowedControls.push( 'space-between' );\n\t} else {\n\t\tallowedControls.push( 'stretch' );\n\t}\n\tif ( isToolbar ) {\n\t\treturn (\n\t\t\t<JustifyContentControl\n\t\t\t\tallowedControls={ allowedControls }\n\t\t\t\tvalue={ justifyContent }\n\t\t\t\tonChange={ onJustificationChange }\n\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst justificationOptions = [\n\t\t{\n\t\t\tvalue: 'left',\n\t\t\ticon: justifyLeft,\n\t\t\tlabel: __( 'Justify items left' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'center',\n\t\t\ticon: justifyCenter,\n\t\t\tlabel: __( 'Justify items center' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'right',\n\t\t\ticon: justifyRight,\n\t\t\tlabel: __( 'Justify items right' ),\n\t\t},\n\t];\n\tif ( orientation === 'horizontal' ) {\n\t\tjustificationOptions.push( {\n\t\t\tvalue: 'space-between',\n\t\t\ticon: justifySpaceBetween,\n\t\t\tlabel: __( 'Space between items' ),\n\t\t} );\n\t} else {\n\t\tjustificationOptions.push( {\n\t\t\tvalue: 'stretch',\n\t\t\ticon: justifyStretch,\n\t\t\tlabel: __( 'Stretch items' ),\n\t\t} );\n\t}\n\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Justification' ) }\n\t\t\tvalue={ justifyContent }\n\t\t\tonChange={ onJustificationChange }\n\t\t\tclassName=\"block-editor-hooks__flex-layout-justification-controls\"\n\t\t>\n\t\t\t{ justificationOptions.map( ( { value, icon, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ToggleGroupControl>\n\t);\n}\n\nfunction FlexWrapControl( { layout, onChange } ) {\n\tconst { flexWrap = 'wrap' } = layout;\n\treturn (\n\t\t<ToggleControl\n\t\t\tlabel={ __( 'Allow to wrap to multiple lines' ) }\n\t\t\tonChange={ ( value ) => {\n\t\t\t\tonChange( {\n\t\t\t\t\t...layout,\n\t\t\t\t\tflexWrap: value ? 'wrap' : 'nowrap',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tchecked={ flexWrap === 'wrap' }\n\t\t/>\n\t);\n}\n\nfunction OrientationControl( { layout, onChange } ) {\n\tconst {\n\t\torientation = 'horizontal',\n\t\tverticalAlignment,\n\t\tjustifyContent,\n\t} = layout;\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName=\"block-editor-hooks__flex-layout-orientation-controls\"\n\t\t\tlabel={ __( 'Orientation' ) }\n\t\t\tvalue={ orientation }\n\t\t\tonChange={ ( value ) => {\n\t\t\t\t// Make sure the vertical alignment and justification are compatible with the new orientation.\n\t\t\t\tlet newVerticalAlignment = verticalAlignment;\n\t\t\t\tlet newJustification = justifyContent;\n\t\t\t\tif ( value === 'horizontal' ) {\n\t\t\t\t\tif ( verticalAlignment === 'space-between' ) {\n\t\t\t\t\t\tnewVerticalAlignment = 'center';\n\t\t\t\t\t}\n\t\t\t\t\tif ( justifyContent === 'stretch' ) {\n\t\t\t\t\t\tnewJustification = 'left';\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif ( verticalAlignment === 'stretch' ) {\n\t\t\t\t\t\tnewVerticalAlignment = 'top';\n\t\t\t\t\t}\n\t\t\t\t\tif ( justifyContent === 'space-between' ) {\n\t\t\t\t\t\tnewJustification = 'left';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn onChange( {\n\t\t\t\t\t...layout,\n\t\t\t\t\torientation: value,\n\t\t\t\t\tverticalAlignment: newVerticalAlignment,\n\t\t\t\t\tjustifyContent: newJustification,\n\t\t\t\t} );\n\t\t\t} }\n\t\t>\n\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\ticon={ arrowRight }\n\t\t\t\tvalue=\"horizontal\"\n\t\t\t\tlabel={ __( 'Horizontal' ) }\n\t\t\t/>\n\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\ticon={ arrowDown }\n\t\t\t\tvalue=\"vertical\"\n\t\t\t\tlabel={ __( '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mBAAmB,iBAAkB;AACzC,+BAAmB;AAAA,UACpB;AAAA,QACD;AACA,eAAO,SAAU;AAAA,UAChB,GAAG;AAAA,UACH,aAAa;AAAA,UACb,mBAAmB;AAAA,UACnB,gBAAgB;AAAA,QACjB,CAAE;AAAA,MACH;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACA,MAAO;AAAA,YACP,OAAM;AAAA,YACN,OAAQ,GAAI,YAAa;AAAA;AAAA,QAC1B;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACA,MAAO;AAAA,YACP,OAAM;AAAA,YACN,OAAQ,GAAI,UAAW;AAAA;AAAA,QACxB;AAAA;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -50,7 +50,6 @@ import {
|
|
|
50
50
|
mediaEditKey,
|
|
51
51
|
getMediaSelectKey,
|
|
52
52
|
deviceTypeKey,
|
|
53
|
-
onViewportStateChangeKey,
|
|
54
53
|
isIsolatedEditorKey,
|
|
55
54
|
isNavigationOverlayContextKey,
|
|
56
55
|
isNavigationPostEditorKey,
|
|
@@ -135,7 +134,6 @@ lock(privateApis, {
|
|
|
135
134
|
mediaEditKey,
|
|
136
135
|
getMediaSelectKey,
|
|
137
136
|
deviceTypeKey,
|
|
138
|
-
onViewportStateChangeKey,
|
|
139
137
|
isIsolatedEditorKey,
|
|
140
138
|
isNavigationOverlayContextKey,
|
|
141
139
|
isNavigationPostEditorKey,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/private-apis.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { getRichTextValues } from './components/rich-text/get-rich-text-values';\nimport ResizableBoxPopover from './components/resizable-box-popover';\nimport { default as PrivateQuickInserter } from './components/inserter/quick-inserter';\nimport {\n\textractWords,\n\tgetNormalizedSearchTerms,\n\tnormalizeString,\n} from './components/inserter/search-items';\nimport { PrivateListView } from './components/list-view';\nimport InspectorControlsLastItem from './components/inspector-controls/last-item';\nimport { useHasBlockToolbar } from './components/block-toolbar/use-has-block-toolbar';\nimport { cleanEmptyObject, usePrivateStyleOverride } from './hooks/utils';\nimport {\n\tgetStyleForState,\n\tisDefaultBlockStyleState,\n\tsetStyleForState,\n} from './hooks/block-style-state';\nimport BlockQuickNavigation from './components/block-quick-navigation';\nimport { LayoutStyle } from './components/block-list/layout';\nimport BlockManager from './components/block-manager';\nimport { BlockRemovalWarningModal } from './components/block-removal-warning-modal';\nimport {\n\tsetBackgroundStyleDefaults,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tBlockStyleVariationOverridesWithConfig,\n\tuseZoomOut,\n} from './hooks';\nimport DimensionsTool from './components/dimensions-tool';\nimport ResolutionTool from './components/resolution-tool';\nimport TextAlignmentControl from './components/text-alignment-control';\nimport { usesContextKey } from './components/rich-text/format-edit';\nimport {\n\tExperimentalBlockCanvas,\n\tBlockCanvasCover,\n} from './components/block-canvas';\nimport { getDuotoneFilter } from './components/duotone/utils';\nimport { useFlashEditableBlocks } from './components/use-flash-editable-blocks';\nimport {\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n\tuserPatternCategoriesSelectKey,\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tsectionRootClientIdKey,\n\tmediaEditKey,\n\tgetMediaSelectKey,\n\tdeviceTypeKey,\n\
|
|
5
|
-
"mappings": ";AAGA,YAAY,kBAAkB;AAC9B,SAAS,uCAAuC;AAChD,SAAS,YAAY;AACrB,SAAS,yBAAyB;AAClC,OAAO,yBAAyB;AAChC,SAAS,WAAW,4BAA4B;AAChD;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,uBAAuB;AAChC,OAAO,+BAA+B;AACtC,SAAS,0BAA0B;AACnC,SAAS,kBAAkB,+BAA+B;AAC1D;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,OAAO,0BAA0B;AACjC,SAAS,mBAAmB;AAC5B,OAAO,kBAAkB;AACzB,SAAS,gCAAgC;AACzC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,OAAO,oBAAoB;AAC3B,OAAO,oBAAoB;AAC3B,OAAO,0BAA0B;AACjC,SAAS,sBAAsB;AAC/B;AAAA,EACC;AAAA,EACA;AAAA,OACM;AACP,SAAS,wBAAwB;AACjC,SAAS,8BAA8B;AACvC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { getRichTextValues } from './components/rich-text/get-rich-text-values';\nimport ResizableBoxPopover from './components/resizable-box-popover';\nimport { default as PrivateQuickInserter } from './components/inserter/quick-inserter';\nimport {\n\textractWords,\n\tgetNormalizedSearchTerms,\n\tnormalizeString,\n} from './components/inserter/search-items';\nimport { PrivateListView } from './components/list-view';\nimport InspectorControlsLastItem from './components/inspector-controls/last-item';\nimport { useHasBlockToolbar } from './components/block-toolbar/use-has-block-toolbar';\nimport { cleanEmptyObject, usePrivateStyleOverride } from './hooks/utils';\nimport {\n\tgetStyleForState,\n\tisDefaultBlockStyleState,\n\tsetStyleForState,\n} from './hooks/block-style-state';\nimport BlockQuickNavigation from './components/block-quick-navigation';\nimport { LayoutStyle } from './components/block-list/layout';\nimport BlockManager from './components/block-manager';\nimport { BlockRemovalWarningModal } from './components/block-removal-warning-modal';\nimport {\n\tsetBackgroundStyleDefaults,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tBlockStyleVariationOverridesWithConfig,\n\tuseZoomOut,\n} from './hooks';\nimport DimensionsTool from './components/dimensions-tool';\nimport ResolutionTool from './components/resolution-tool';\nimport TextAlignmentControl from './components/text-alignment-control';\nimport { usesContextKey } from './components/rich-text/format-edit';\nimport {\n\tExperimentalBlockCanvas,\n\tBlockCanvasCover,\n} from './components/block-canvas';\nimport { getDuotoneFilter } from './components/duotone/utils';\nimport { useFlashEditableBlocks } from './components/use-flash-editable-blocks';\nimport {\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n\tuserPatternCategoriesSelectKey,\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tsectionRootClientIdKey,\n\tmediaEditKey,\n\tgetMediaSelectKey,\n\tdeviceTypeKey,\n\tisIsolatedEditorKey,\n\tisNavigationOverlayContextKey,\n\tisNavigationPostEditorKey,\n\tmediaUploadOnSuccessKey,\n\topenMediaEditorModalKey,\n} from './store/private-keys';\nimport { requiresWrapperOnCopy } from './components/writing-flow/utils';\nimport { PrivateRichText } from './components/rich-text/';\nimport { PrivateBlockPopover } from './components/block-popover';\nimport { PrivateInserterLibrary } from './components/inserter/library';\nimport { PrivatePublishDateTimePicker } from './components/publish-date-time-picker';\nimport useSpacingSizes from './components/spacing-sizes-control/hooks/use-spacing-sizes';\nimport useBlockDisplayTitle from './components/block-title/use-block-display-title';\nimport TabbedSidebar from './components/tabbed-sidebar';\nimport NoteIconSlotFill from './components/collab/note-icon-slot';\nimport NoteIconToolbarSlotFill from './components/collab/note-icon-toolbar-slot';\nimport HTMLElementControl from './components/html-element-control';\nimport {\n\tuseBlockElementRef,\n\tuseBlockElement,\n} from './components/block-list/use-block-props/use-block-refs';\nimport { LinkPicker } from './components/link-picker';\nimport useRemoteUrlData from './components/link-control/use-rich-url-data';\nimport { PrivateBlockContext } from './components/block-list/private-block-context';\nimport useListViewPanelState from './components/use-list-view-panel-state';\nimport {\n\tisHashLink,\n\tisRelativePath,\n} from './components/link-control/is-url-like';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockCanvas,\n\tBlockCanvasCover,\n\tExperimentalBlockEditorProvider,\n\tgetDuotoneFilter,\n\tgetRichTextValues,\n\tPrivateQuickInserter,\n\textractWords,\n\tgetNormalizedSearchTerms,\n\tnormalizeString,\n\tPrivateListView,\n\tResizableBoxPopover,\n\tInspectorControlsLastItem,\n\tuseHasBlockToolbar,\n\tcleanEmptyObject,\n\tgetStyleForState,\n\tisDefaultBlockStyleState,\n\tsetStyleForState,\n\tusePrivateStyleOverride,\n\tBlockQuickNavigation,\n\tLayoutStyle,\n\tBlockManager,\n\tBlockRemovalWarningModal,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tDimensionsTool,\n\tResolutionTool,\n\tTabbedSidebar,\n\tTextAlignmentControl,\n\tusesContextKey,\n\tuseFlashEditableBlocks,\n\tHTMLElementControl,\n\tuseZoomOut,\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tselectBlockPatternsKey,\n\trequiresWrapperOnCopy,\n\tPrivateRichText,\n\tPrivateInserterLibrary,\n\treusableBlocksSelectKey,\n\tuserPatternCategoriesSelectKey,\n\tPrivateBlockPopover,\n\tPrivatePublishDateTimePicker,\n\tuseSpacingSizes,\n\tuseBlockDisplayTitle,\n\tBlockStyleVariationOverridesWithConfig,\n\tsetBackgroundStyleDefaults,\n\tsectionRootClientIdKey,\n\tNoteIconSlotFill,\n\tNoteIconToolbarSlotFill,\n\tmediaEditKey,\n\tgetMediaSelectKey,\n\tdeviceTypeKey,\n\tisIsolatedEditorKey,\n\tisNavigationOverlayContextKey,\n\tisNavigationPostEditorKey,\n\tmediaUploadOnSuccessKey,\n\topenMediaEditorModalKey,\n\tuseBlockElement,\n\tuseBlockElementRef,\n\tLinkPicker,\n\tuseRemoteUrlData,\n\tPrivateBlockContext,\n\tuseListViewPanelState,\n\tisHashLink,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M;AAKA,IAAM,cAAc,CAAC;AAC5B,KAAM,aAAa;AAAA,EAClB,GAAG;AAAA,EACH;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -268,6 +268,18 @@ function setSelectedBlockStyleStateCanvasPreview(clientId, value) {
|
|
|
268
268
|
value
|
|
269
269
|
};
|
|
270
270
|
}
|
|
271
|
+
function setStyleStateViewport(viewport) {
|
|
272
|
+
return {
|
|
273
|
+
type: "SET_STYLE_STATE_VIEWPORT",
|
|
274
|
+
viewport
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
function setResponsiveEditing(enabled) {
|
|
278
|
+
return {
|
|
279
|
+
type: "SET_RESPONSIVE_EDITING",
|
|
280
|
+
enabled
|
|
281
|
+
};
|
|
282
|
+
}
|
|
271
283
|
export {
|
|
272
284
|
__experimentalUpdateSettings,
|
|
273
285
|
clearBlockRemovalPrompt,
|
|
@@ -286,9 +298,11 @@ export {
|
|
|
286
298
|
setBlockRemovalRules,
|
|
287
299
|
setInsertionPoint,
|
|
288
300
|
setLastFocus,
|
|
301
|
+
setResponsiveEditing,
|
|
289
302
|
setSelectedBlockStyleState,
|
|
290
303
|
setSelectedBlockStyleStateCanvasPreview,
|
|
291
304
|
setStyleOverride,
|
|
305
|
+
setStyleStateViewport,
|
|
292
306
|
setZoomLevel,
|
|
293
307
|
showBlockInterface,
|
|
294
308
|
showViewportModal,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/private-actions.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { speak } from '@wordpress/a11y';\nimport { __ } from '@wordpress/i18n';\n\nconst castArray = ( maybeArray ) =>\n\tArray.isArray( maybeArray ) ? maybeArray : [ maybeArray ];\n\n/**\n * A list of private/experimental block editor settings that\n * should not become a part of the WordPress public API.\n * BlockEditorProvider will remove these settings from the\n * settings object it receives.\n *\n * @see https://github.com/WordPress/gutenberg/pull/46131\n */\nconst privateSettings = [\n\t'inserterMediaCategories',\n\t'blockInspectorAnimation',\n\t'mediaSideload',\n];\n\n/**\n * Action that updates the block editor settings and\n * conditionally preserves the experimental ones.\n *\n * @param {Object} settings Updated settings\n * @param {Object} options Options object.\n * @param {boolean} options.stripExperimentalSettings Whether to strip experimental settings.\n * @param {boolean} options.reset Whether to reset the settings.\n * @return {Object} Action object\n */\nexport function __experimentalUpdateSettings(\n\tsettings,\n\t{ stripExperimentalSettings = false, reset = false } = {}\n) {\n\tlet incomingSettings = settings;\n\n\tif ( Object.hasOwn( incomingSettings, '__unstableIsPreviewMode' ) ) {\n\t\tdeprecated(\n\t\t\t\"__unstableIsPreviewMode argument in wp.data.dispatch('core/block-editor').updateSettings\",\n\t\t\t{\n\t\t\t\tsince: '6.8',\n\t\t\t\talternative: 'isPreviewMode',\n\t\t\t}\n\t\t);\n\n\t\tincomingSettings = { ...incomingSettings };\n\t\tincomingSettings.isPreviewMode =\n\t\t\tincomingSettings.__unstableIsPreviewMode;\n\t\tdelete incomingSettings.__unstableIsPreviewMode;\n\t}\n\n\tlet cleanSettings = incomingSettings;\n\n\tif ( stripExperimentalSettings ) {\n\t\tcleanSettings = {};\n\t\tfor ( const key in incomingSettings ) {\n\t\t\tif ( ! privateSettings.includes( key ) ) {\n\t\t\t\tcleanSettings[ key ] = incomingSettings[ key ];\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings: cleanSettings,\n\t\treset,\n\t};\n}\n\n/**\n * Hides the block interface (eg. toolbar, outline, etc.)\n *\n * @return {Object} Action object.\n */\nexport function hideBlockInterface() {\n\treturn {\n\t\ttype: 'HIDE_BLOCK_INTERFACE',\n\t};\n}\n\n/**\n * Shows the block interface (eg. toolbar, outline, etc.)\n *\n * @return {Object} Action object.\n */\nexport function showBlockInterface() {\n\treturn {\n\t\ttype: 'SHOW_BLOCK_INTERFACE',\n\t};\n}\n\n/**\n * Yields action objects used in signalling that the blocks corresponding to\n * the set of specified client IDs are to be removed.\n *\n * Compared to `removeBlocks`, this private interface exposes an additional\n * parameter; see `forceRemove`.\n *\n * @param {string|string[]} clientIds Client IDs of blocks to remove.\n * @param {boolean} selectPrevious True if the previous block\n * or the immediate parent\n * (if no previous block exists)\n * should be selected\n * when a block is removed.\n * @param {boolean} forceRemove Whether to force the operation,\n * bypassing any checks for certain\n * block types.\n */\nexport const privateRemoveBlocks =\n\t( clientIds, selectPrevious = true, forceRemove = false ) =>\n\t( { select, dispatch, registry } ) => {\n\t\tif ( ! clientIds || ! clientIds.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tclientIds = castArray( clientIds );\n\t\tconst canRemoveBlocks = select.canRemoveBlocks( clientIds );\n\n\t\tif ( ! canRemoveBlocks ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// In certain editing contexts, we'd like to prevent accidental removal\n\t\t// of important blocks. For example, in the site editor, the Query Loop\n\t\t// block is deemed important. In such cases, we'll ask the user for\n\t\t// confirmation that they intended to remove such block(s). However,\n\t\t// the editor instance is responsible for presenting those confirmation\n\t\t// prompts to the user. Any instance opting into removal prompts must\n\t\t// register using `setBlockRemovalRules()`.\n\t\t//\n\t\t// @see https://github.com/WordPress/gutenberg/pull/51145\n\t\tconst rules = ! forceRemove && select.getBlockRemovalRules();\n\n\t\tif ( rules ) {\n\t\t\tfunction flattenBlocks( blocks ) {\n\t\t\t\tconst result = [];\n\t\t\t\tconst stack = [ ...blocks ];\n\t\t\t\twhile ( stack.length ) {\n\t\t\t\t\tconst { innerBlocks, ...block } = stack.shift();\n\t\t\t\t\tstack.push( ...innerBlocks );\n\t\t\t\t\tresult.push( block );\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tconst blockList = clientIds.map( select.getBlock );\n\t\t\tconst flattenedBlocks = flattenBlocks( blockList );\n\n\t\t\t// Find the first message and use it.\n\t\t\tlet message;\n\t\t\tfor ( const rule of rules ) {\n\t\t\t\tmessage = rule.callback( flattenedBlocks );\n\t\t\t\tif ( message ) {\n\t\t\t\t\tdispatch(\n\t\t\t\t\t\tdisplayBlockRemovalPrompt(\n\t\t\t\t\t\t\tclientIds,\n\t\t\t\t\t\t\tselectPrevious,\n\t\t\t\t\t\t\tmessage\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( selectPrevious ) {\n\t\t\tdispatch.selectPreviousBlock( clientIds[ 0 ], selectPrevious );\n\t\t}\n\n\t\t// We're batching these two actions because an extra `undo/redo` step can\n\t\t// be created, based on whether we insert a default block or not.\n\t\tregistry.batch( () => {\n\t\t\tdispatch( { type: 'REMOVE_BLOCKS', clientIds } );\n\t\t\t// To avoid a focus loss when removing the last block, assure there is\n\t\t\t// always a default block if the last of the blocks have been removed.\n\t\t\tdispatch( ensureDefaultBlock() );\n\t\t} );\n\t};\n\n/**\n * Action which will insert a default block insert action if there\n * are no other blocks at the root of the editor. This action should be used\n * in actions which may result in no blocks remaining in the editor (removal,\n * replacement, etc).\n */\nexport const ensureDefaultBlock =\n\t() =>\n\t( { select, dispatch } ) => {\n\t\t// To avoid a focus loss when removing the last block, assure there is\n\t\t// always a default block if the last of the blocks have been removed.\n\t\tconst count = select.getBlockCount();\n\t\tif ( count > 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If there's an custom appender, don't insert default block.\n\t\t// We have to remember to manually move the focus elsewhere to\n\t\t// prevent it from being lost though.\n\t\tconst { __unstableHasCustomAppender } = select.getSettings();\n\t\tif ( __unstableHasCustomAppender ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch.insertDefaultBlock();\n\t};\n\n/**\n * Returns an action object used in signalling that a block removal prompt must\n * be displayed.\n *\n * Contrast with `setBlockRemovalRules`.\n *\n * @param {string|string[]} clientIds Client IDs of blocks to remove.\n * @param {boolean} selectPrevious True if the previous block or the\n * immediate parent (if no previous\n * block exists) should be selected\n * when a block is removed.\n * @param {string} message Message to display in the prompt.\n *\n * @return {Object} Action object.\n */\nfunction displayBlockRemovalPrompt( clientIds, selectPrevious, message ) {\n\treturn {\n\t\ttype: 'DISPLAY_BLOCK_REMOVAL_PROMPT',\n\t\tclientIds,\n\t\tselectPrevious,\n\t\tmessage,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a block removal prompt must\n * be cleared, either be cause the user has confirmed or canceled the request\n * for removal.\n *\n * @return {Object} Action object.\n */\nexport function clearBlockRemovalPrompt() {\n\treturn {\n\t\ttype: 'CLEAR_BLOCK_REMOVAL_PROMPT',\n\t};\n}\n\n/**\n * Returns an action object used to set up any rules that a block editor may\n * provide in order to prevent a user from accidentally removing certain\n * blocks. These rules are then used to display a confirmation prompt to the\n * user. For instance, in the Site Editor, the Query Loop block is important\n * enough to warrant such confirmation.\n *\n * IMPORTANT: Registering rules implicitly signals to the `privateRemoveBlocks`\n * action that the editor will be responsible for displaying block removal\n * prompts and confirming deletions. This action is meant to be used by\n * component `BlockRemovalWarningModal` only.\n *\n * The data is a record whose keys are block types (e.g. 'core/query') and\n * whose values are the explanation to be shown to users (e.g. 'Query Loop\n * displays a list of posts or pages.').\n *\n * Contrast with `displayBlockRemovalPrompt`.\n *\n * @param {Record<string,string>|false} rules Block removal rules.\n * @return {Object} Action object.\n */\nexport function setBlockRemovalRules( rules = false ) {\n\treturn {\n\t\ttype: 'SET_BLOCK_REMOVAL_RULES',\n\t\trules,\n\t};\n}\n\nexport function setStyleOverride( id, style ) {\n\treturn {\n\t\ttype: 'SET_STYLE_OVERRIDE',\n\t\tid,\n\t\tstyle,\n\t};\n}\n\nexport function deleteStyleOverride( id ) {\n\treturn {\n\t\ttype: 'DELETE_STYLE_OVERRIDE',\n\t\tid,\n\t};\n}\n\n/**\n * Action that sets the element that had focus when focus leaves the editor canvas.\n *\n * @param {Object} lastFocus The last focused element.\n *\n *\n * @return {Object} Action object.\n */\nexport function setLastFocus( lastFocus = null ) {\n\treturn {\n\t\ttype: 'LAST_FOCUS',\n\t\tlastFocus,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user has begun to drag.\n *\n * @return {Object} Action object.\n */\nexport function startDragging() {\n\treturn {\n\t\ttype: 'START_DRAGGING',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user has stopped dragging.\n *\n * @return {Object} Action object.\n */\nexport function stopDragging() {\n\treturn {\n\t\ttype: 'STOP_DRAGGING',\n\t};\n}\n\n/**\n * @param {string|null} clientId The block's clientId, or `null` to clear.\n *\n * @return {Object} Action object.\n */\nexport function expandBlock( clientId ) {\n\treturn {\n\t\ttype: 'SET_BLOCK_EXPANDED_IN_LIST_VIEW',\n\t\tclientId,\n\t};\n}\n\n/**\n * @param {Object} value\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.index The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setInsertionPoint( value ) {\n\treturn {\n\t\ttype: 'SET_INSERTION_POINT',\n\t\tvalue,\n\t};\n}\n\n/**\n * Mark a contentOnly section as being edited.\n *\n * @param {string} clientId The client id of the block.\n */\nexport function editContentOnlySection( clientId ) {\n\treturn {\n\t\ttype: 'EDIT_CONTENT_ONLY_SECTION',\n\t\tclientId,\n\t};\n}\n\n/**\n * Action that stops editing a contentOnly section.\n */\nexport function stopEditingContentOnlySection() {\n\treturn {\n\t\ttype: 'EDIT_CONTENT_ONLY_SECTION',\n\t};\n}\n\n/**\n * Sets the zoom level.\n *\n * @param {number} zoom the new zoom level\n * @return {Object} Action object.\n */\nexport const setZoomLevel =\n\t( zoom = 100 ) =>\n\t( { select, dispatch } ) => {\n\t\t// When switching to zoom-out mode, we need to select the parent section\n\t\tif ( zoom !== 100 ) {\n\t\t\tconst firstSelectedClientId = select.getBlockSelectionStart();\n\t\t\tconst sectionRootClientId = select.getSectionRootClientId();\n\n\t\t\tif ( firstSelectedClientId ) {\n\t\t\t\tlet sectionClientId;\n\n\t\t\t\tif ( sectionRootClientId ) {\n\t\t\t\t\tconst sectionClientIds =\n\t\t\t\t\t\tselect.getBlockOrder( sectionRootClientId );\n\n\t\t\t\t\t// If the selected block is a section block, use it.\n\t\t\t\t\tif ( sectionClientIds?.includes( firstSelectedClientId ) ) {\n\t\t\t\t\t\tsectionClientId = firstSelectedClientId;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If the selected block is not a section block, find\n\t\t\t\t\t\t// the parent section that contains the selected block.\n\t\t\t\t\t\tsectionClientId = select\n\t\t\t\t\t\t\t.getBlockParents( firstSelectedClientId )\n\t\t\t\t\t\t\t.find( ( parent ) =>\n\t\t\t\t\t\t\t\tsectionClientIds.includes( parent )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tsectionClientId = select.getBlockHierarchyRootClientId(\n\t\t\t\t\t\tfirstSelectedClientId\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif ( sectionClientId ) {\n\t\t\t\t\tdispatch.selectBlock( sectionClientId );\n\t\t\t\t} else {\n\t\t\t\t\tdispatch.clearSelectedBlock();\n\t\t\t\t}\n\n\t\t\t\tspeak( __( 'You are currently in zoom-out mode.' ) );\n\t\t\t}\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_ZOOM_LEVEL',\n\t\t\tzoom,\n\t\t} );\n\t};\n\n/**\n * Resets the Zoom state.\n * @return {Object} Action object.\n */\nexport function resetZoomLevel() {\n\treturn {\n\t\ttype: 'RESET_ZOOM_LEVEL',\n\t};\n}\n\n/**\n * Action that toggles the spotlighted block state.\n *\n * @param {string} clientId The block's clientId.\n * @param {boolean} hasBlockSpotlight The spotlight state.\n * @return {Object} Action object.\n */\nexport function toggleBlockSpotlight( clientId, hasBlockSpotlight ) {\n\treturn {\n\t\ttype: 'TOGGLE_BLOCK_SPOTLIGHT',\n\t\tclientId,\n\t\thasBlockSpotlight,\n\t};\n}\n\n/**\n * Opens the list view content panel popover.\n *\n * @return {Object} Action object.\n */\nexport function openListViewContentPanel() {\n\treturn {\n\t\ttype: 'OPEN_LIST_VIEW_CONTENT_PANEL',\n\t};\n}\n\n/**\n * Closes the list view content panel popover.\n *\n * @return {Object} Action object.\n */\nexport function closeListViewContentPanel() {\n\treturn {\n\t\ttype: 'CLOSE_LIST_VIEW_CONTENT_PANEL',\n\t};\n}\n\n/**\n * Returns an action object used to open the viewport modal\n * for the given client IDs.\n *\n * @param {string[]} clientIds Client IDs of blocks to configure viewport settings for.\n * @return {Object} Action object.\n */\nexport function showViewportModal( clientIds ) {\n\treturn {\n\t\ttype: 'SHOW_VIEWPORT_MODAL',\n\t\tclientIds,\n\t};\n}\n\n/**\n * Returns an action object used to close the viewport modal.\n *\n * @return {Object} Action object.\n */\nexport function hideViewportModal() {\n\treturn {\n\t\ttype: 'HIDE_VIEWPORT_MODAL',\n\t};\n}\n\n/**\n * Requests to open a specific inspector tab, optionally with additional options.\n * This action signals intent to switch to a particular tab in the block inspector.\n *\n * @param {string} tabName The name of the tab to open (e.g., 'list-view', 'settings', 'styles').\n * @param {Object} [options] Optional configuration.\n * @param {string} [options.openPanel] Client ID of a specific panel to open (for tabs that support panels).\n *\n * @return {Object} Action object.\n */\nexport function requestInspectorTab( tabName, options = {} ) {\n\treturn {\n\t\ttype: 'REQUEST_INSPECTOR_TAB',\n\t\ttabName,\n\t\toptions,\n\t};\n}\n\n/**\n * Clears the requested inspector tab state after it has been handled.\n *\n * @return {Object} Action object.\n */\nexport function clearRequestedInspectorTab() {\n\treturn {\n\t\ttype: 'CLEAR_REQUESTED_INSPECTOR_TAB',\n\t};\n}\n\n/**\n * Sets the selected style state for a block's style controls.\n *\n * @param {string} clientId The block client ID.\n * @param {Object} value The selected state value.\n *\n * @return {Object} Action object.\n */\nexport function setSelectedBlockStyleState( clientId, value ) {\n\treturn {\n\t\ttype: 'SET_SELECTED_BLOCK_STYLE_STATE',\n\t\tclientId,\n\t\tvalue,\n\t};\n}\n\n/**\n * Sets whether the selected style state is shown on the canvas.\n *\n * @param {string} clientId The block client ID.\n * @param {boolean} value Whether to show the selected state on the canvas.\n *\n * @return {Object} Action object.\n */\nexport function setSelectedBlockStyleStateCanvasPreview( clientId, value ) {\n\treturn {\n\t\ttype: 'SET_SELECTED_BLOCK_STYLE_STATE_CANVAS_PREVIEW',\n\t\tclientId,\n\t\tvalue,\n\t};\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,gBAAgB;AACvB,SAAS,aAAa;AACtB,SAAS,UAAU;AAEnB,IAAM,YAAY,CAAE,eACnB,MAAM,QAAS,UAAW,IAAI,aAAa,CAAE,UAAW;AAUzD,IAAM,kBAAkB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AACD;AAYO,SAAS,6BACf,UACA,EAAE,4BAA4B,OAAO,QAAQ,MAAM,IAAI,CAAC,GACvD;AACD,MAAI,mBAAmB;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C,SAAO;AAAA,IACN,MAAM;AAAA,EACP;AACD;AASO,SAAS,qBAAsB,UAAU,mBAAoB;AACnE,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AAOO,SAAS,2BAA2B;AAC1C,SAAO;AAAA,IACN,MAAM;AAAA,EACP;AACD;AAOO,SAAS,4BAA4B;AAC3C,SAAO;AAAA,IACN,MAAM;AAAA,EACP;AACD;AASO,SAAS,kBAAmB,WAAY;AAC9C,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AAOO,SAAS,oBAAoB;AACnC,SAAO;AAAA,IACN,MAAM;AAAA,EACP;AACD;AAYO,SAAS,oBAAqB,SAAS,UAAU,CAAC,GAAI;AAC5D,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AAOO,SAAS,6BAA6B;AAC5C,SAAO;AAAA,IACN,MAAM;AAAA,EACP;AACD;AAUO,SAAS,2BAA4B,UAAU,OAAQ;AAC7D,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AAUO,SAAS,wCAAyC,UAAU,OAAQ;AAC1E,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;",
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { speak } from '@wordpress/a11y';\nimport { __ } from '@wordpress/i18n';\n\nconst castArray = ( maybeArray ) =>\n\tArray.isArray( maybeArray ) ? maybeArray : [ maybeArray ];\n\n/**\n * A list of private/experimental block editor settings that\n * should not become a part of the WordPress public API.\n * BlockEditorProvider will remove these settings from the\n * settings object it receives.\n *\n * @see https://github.com/WordPress/gutenberg/pull/46131\n */\nconst privateSettings = [\n\t'inserterMediaCategories',\n\t'blockInspectorAnimation',\n\t'mediaSideload',\n];\n\n/**\n * Action that updates the block editor settings and\n * conditionally preserves the experimental ones.\n *\n * @param {Object} settings Updated settings\n * @param {Object} options Options object.\n * @param {boolean} options.stripExperimentalSettings Whether to strip experimental settings.\n * @param {boolean} options.reset Whether to reset the settings.\n * @return {Object} Action object\n */\nexport function __experimentalUpdateSettings(\n\tsettings,\n\t{ stripExperimentalSettings = false, reset = false } = {}\n) {\n\tlet incomingSettings = settings;\n\n\tif ( Object.hasOwn( incomingSettings, '__unstableIsPreviewMode' ) ) {\n\t\tdeprecated(\n\t\t\t\"__unstableIsPreviewMode argument in wp.data.dispatch('core/block-editor').updateSettings\",\n\t\t\t{\n\t\t\t\tsince: '6.8',\n\t\t\t\talternative: 'isPreviewMode',\n\t\t\t}\n\t\t);\n\n\t\tincomingSettings = { ...incomingSettings };\n\t\tincomingSettings.isPreviewMode =\n\t\t\tincomingSettings.__unstableIsPreviewMode;\n\t\tdelete incomingSettings.__unstableIsPreviewMode;\n\t}\n\n\tlet cleanSettings = incomingSettings;\n\n\tif ( stripExperimentalSettings ) {\n\t\tcleanSettings = {};\n\t\tfor ( const key in incomingSettings ) {\n\t\t\tif ( ! privateSettings.includes( key ) ) {\n\t\t\t\tcleanSettings[ key ] = incomingSettings[ key ];\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings: cleanSettings,\n\t\treset,\n\t};\n}\n\n/**\n * Hides the block interface (eg. toolbar, outline, etc.)\n *\n * @return {Object} Action object.\n */\nexport function hideBlockInterface() {\n\treturn {\n\t\ttype: 'HIDE_BLOCK_INTERFACE',\n\t};\n}\n\n/**\n * Shows the block interface (eg. toolbar, outline, etc.)\n *\n * @return {Object} Action object.\n */\nexport function showBlockInterface() {\n\treturn {\n\t\ttype: 'SHOW_BLOCK_INTERFACE',\n\t};\n}\n\n/**\n * Yields action objects used in signalling that the blocks corresponding to\n * the set of specified client IDs are to be removed.\n *\n * Compared to `removeBlocks`, this private interface exposes an additional\n * parameter; see `forceRemove`.\n *\n * @param {string|string[]} clientIds Client IDs of blocks to remove.\n * @param {boolean} selectPrevious True if the previous block\n * or the immediate parent\n * (if no previous block exists)\n * should be selected\n * when a block is removed.\n * @param {boolean} forceRemove Whether to force the operation,\n * bypassing any checks for certain\n * block types.\n */\nexport const privateRemoveBlocks =\n\t( clientIds, selectPrevious = true, forceRemove = false ) =>\n\t( { select, dispatch, registry } ) => {\n\t\tif ( ! clientIds || ! clientIds.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tclientIds = castArray( clientIds );\n\t\tconst canRemoveBlocks = select.canRemoveBlocks( clientIds );\n\n\t\tif ( ! canRemoveBlocks ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// In certain editing contexts, we'd like to prevent accidental removal\n\t\t// of important blocks. For example, in the site editor, the Query Loop\n\t\t// block is deemed important. In such cases, we'll ask the user for\n\t\t// confirmation that they intended to remove such block(s). However,\n\t\t// the editor instance is responsible for presenting those confirmation\n\t\t// prompts to the user. Any instance opting into removal prompts must\n\t\t// register using `setBlockRemovalRules()`.\n\t\t//\n\t\t// @see https://github.com/WordPress/gutenberg/pull/51145\n\t\tconst rules = ! forceRemove && select.getBlockRemovalRules();\n\n\t\tif ( rules ) {\n\t\t\tfunction flattenBlocks( blocks ) {\n\t\t\t\tconst result = [];\n\t\t\t\tconst stack = [ ...blocks ];\n\t\t\t\twhile ( stack.length ) {\n\t\t\t\t\tconst { innerBlocks, ...block } = stack.shift();\n\t\t\t\t\tstack.push( ...innerBlocks );\n\t\t\t\t\tresult.push( block );\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tconst blockList = clientIds.map( select.getBlock );\n\t\t\tconst flattenedBlocks = flattenBlocks( blockList );\n\n\t\t\t// Find the first message and use it.\n\t\t\tlet message;\n\t\t\tfor ( const rule of rules ) {\n\t\t\t\tmessage = rule.callback( flattenedBlocks );\n\t\t\t\tif ( message ) {\n\t\t\t\t\tdispatch(\n\t\t\t\t\t\tdisplayBlockRemovalPrompt(\n\t\t\t\t\t\t\tclientIds,\n\t\t\t\t\t\t\tselectPrevious,\n\t\t\t\t\t\t\tmessage\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( selectPrevious ) {\n\t\t\tdispatch.selectPreviousBlock( clientIds[ 0 ], selectPrevious );\n\t\t}\n\n\t\t// We're batching these two actions because an extra `undo/redo` step can\n\t\t// be created, based on whether we insert a default block or not.\n\t\tregistry.batch( () => {\n\t\t\tdispatch( { type: 'REMOVE_BLOCKS', clientIds } );\n\t\t\t// To avoid a focus loss when removing the last block, assure there is\n\t\t\t// always a default block if the last of the blocks have been removed.\n\t\t\tdispatch( ensureDefaultBlock() );\n\t\t} );\n\t};\n\n/**\n * Action which will insert a default block insert action if there\n * are no other blocks at the root of the editor. This action should be used\n * in actions which may result in no blocks remaining in the editor (removal,\n * replacement, etc).\n */\nexport const ensureDefaultBlock =\n\t() =>\n\t( { select, dispatch } ) => {\n\t\t// To avoid a focus loss when removing the last block, assure there is\n\t\t// always a default block if the last of the blocks have been removed.\n\t\tconst count = select.getBlockCount();\n\t\tif ( count > 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If there's an custom appender, don't insert default block.\n\t\t// We have to remember to manually move the focus elsewhere to\n\t\t// prevent it from being lost though.\n\t\tconst { __unstableHasCustomAppender } = select.getSettings();\n\t\tif ( __unstableHasCustomAppender ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch.insertDefaultBlock();\n\t};\n\n/**\n * Returns an action object used in signalling that a block removal prompt must\n * be displayed.\n *\n * Contrast with `setBlockRemovalRules`.\n *\n * @param {string|string[]} clientIds Client IDs of blocks to remove.\n * @param {boolean} selectPrevious True if the previous block or the\n * immediate parent (if no previous\n * block exists) should be selected\n * when a block is removed.\n * @param {string} message Message to display in the prompt.\n *\n * @return {Object} Action object.\n */\nfunction displayBlockRemovalPrompt( clientIds, selectPrevious, message ) {\n\treturn {\n\t\ttype: 'DISPLAY_BLOCK_REMOVAL_PROMPT',\n\t\tclientIds,\n\t\tselectPrevious,\n\t\tmessage,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a block removal prompt must\n * be cleared, either be cause the user has confirmed or canceled the request\n * for removal.\n *\n * @return {Object} Action object.\n */\nexport function clearBlockRemovalPrompt() {\n\treturn {\n\t\ttype: 'CLEAR_BLOCK_REMOVAL_PROMPT',\n\t};\n}\n\n/**\n * Returns an action object used to set up any rules that a block editor may\n * provide in order to prevent a user from accidentally removing certain\n * blocks. These rules are then used to display a confirmation prompt to the\n * user. For instance, in the Site Editor, the Query Loop block is important\n * enough to warrant such confirmation.\n *\n * IMPORTANT: Registering rules implicitly signals to the `privateRemoveBlocks`\n * action that the editor will be responsible for displaying block removal\n * prompts and confirming deletions. This action is meant to be used by\n * component `BlockRemovalWarningModal` only.\n *\n * The data is a record whose keys are block types (e.g. 'core/query') and\n * whose values are the explanation to be shown to users (e.g. 'Query Loop\n * displays a list of posts or pages.').\n *\n * Contrast with `displayBlockRemovalPrompt`.\n *\n * @param {Record<string,string>|false} rules Block removal rules.\n * @return {Object} Action object.\n */\nexport function setBlockRemovalRules( rules = false ) {\n\treturn {\n\t\ttype: 'SET_BLOCK_REMOVAL_RULES',\n\t\trules,\n\t};\n}\n\nexport function setStyleOverride( id, style ) {\n\treturn {\n\t\ttype: 'SET_STYLE_OVERRIDE',\n\t\tid,\n\t\tstyle,\n\t};\n}\n\nexport function deleteStyleOverride( id ) {\n\treturn {\n\t\ttype: 'DELETE_STYLE_OVERRIDE',\n\t\tid,\n\t};\n}\n\n/**\n * Action that sets the element that had focus when focus leaves the editor canvas.\n *\n * @param {Object} lastFocus The last focused element.\n *\n *\n * @return {Object} Action object.\n */\nexport function setLastFocus( lastFocus = null ) {\n\treturn {\n\t\ttype: 'LAST_FOCUS',\n\t\tlastFocus,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user has begun to drag.\n *\n * @return {Object} Action object.\n */\nexport function startDragging() {\n\treturn {\n\t\ttype: 'START_DRAGGING',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user has stopped dragging.\n *\n * @return {Object} Action object.\n */\nexport function stopDragging() {\n\treturn {\n\t\ttype: 'STOP_DRAGGING',\n\t};\n}\n\n/**\n * @param {string|null} clientId The block's clientId, or `null` to clear.\n *\n * @return {Object} Action object.\n */\nexport function expandBlock( clientId ) {\n\treturn {\n\t\ttype: 'SET_BLOCK_EXPANDED_IN_LIST_VIEW',\n\t\tclientId,\n\t};\n}\n\n/**\n * @param {Object} value\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.index The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setInsertionPoint( value ) {\n\treturn {\n\t\ttype: 'SET_INSERTION_POINT',\n\t\tvalue,\n\t};\n}\n\n/**\n * Mark a contentOnly section as being edited.\n *\n * @param {string} clientId The client id of the block.\n */\nexport function editContentOnlySection( clientId ) {\n\treturn {\n\t\ttype: 'EDIT_CONTENT_ONLY_SECTION',\n\t\tclientId,\n\t};\n}\n\n/**\n * Action that stops editing a contentOnly section.\n */\nexport function stopEditingContentOnlySection() {\n\treturn {\n\t\ttype: 'EDIT_CONTENT_ONLY_SECTION',\n\t};\n}\n\n/**\n * Sets the zoom level.\n *\n * @param {number} zoom the new zoom level\n * @return {Object} Action object.\n */\nexport const setZoomLevel =\n\t( zoom = 100 ) =>\n\t( { select, dispatch } ) => {\n\t\t// When switching to zoom-out mode, we need to select the parent section\n\t\tif ( zoom !== 100 ) {\n\t\t\tconst firstSelectedClientId = select.getBlockSelectionStart();\n\t\t\tconst sectionRootClientId = select.getSectionRootClientId();\n\n\t\t\tif ( firstSelectedClientId ) {\n\t\t\t\tlet sectionClientId;\n\n\t\t\t\tif ( sectionRootClientId ) {\n\t\t\t\t\tconst sectionClientIds =\n\t\t\t\t\t\tselect.getBlockOrder( sectionRootClientId );\n\n\t\t\t\t\t// If the selected block is a section block, use it.\n\t\t\t\t\tif ( sectionClientIds?.includes( firstSelectedClientId ) ) {\n\t\t\t\t\t\tsectionClientId = firstSelectedClientId;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If the selected block is not a section block, find\n\t\t\t\t\t\t// the parent section that contains the selected block.\n\t\t\t\t\t\tsectionClientId = select\n\t\t\t\t\t\t\t.getBlockParents( firstSelectedClientId )\n\t\t\t\t\t\t\t.find( ( parent ) =>\n\t\t\t\t\t\t\t\tsectionClientIds.includes( parent )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tsectionClientId = select.getBlockHierarchyRootClientId(\n\t\t\t\t\t\tfirstSelectedClientId\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif ( sectionClientId ) {\n\t\t\t\t\tdispatch.selectBlock( sectionClientId );\n\t\t\t\t} else {\n\t\t\t\t\tdispatch.clearSelectedBlock();\n\t\t\t\t}\n\n\t\t\t\tspeak( __( 'You are currently in zoom-out mode.' ) );\n\t\t\t}\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_ZOOM_LEVEL',\n\t\t\tzoom,\n\t\t} );\n\t};\n\n/**\n * Resets the Zoom state.\n * @return {Object} Action object.\n */\nexport function resetZoomLevel() {\n\treturn {\n\t\ttype: 'RESET_ZOOM_LEVEL',\n\t};\n}\n\n/**\n * Action that toggles the spotlighted block state.\n *\n * @param {string} clientId The block's clientId.\n * @param {boolean} hasBlockSpotlight The spotlight state.\n * @return {Object} Action object.\n */\nexport function toggleBlockSpotlight( clientId, hasBlockSpotlight ) {\n\treturn {\n\t\ttype: 'TOGGLE_BLOCK_SPOTLIGHT',\n\t\tclientId,\n\t\thasBlockSpotlight,\n\t};\n}\n\n/**\n * Opens the list view content panel popover.\n *\n * @return {Object} Action object.\n */\nexport function openListViewContentPanel() {\n\treturn {\n\t\ttype: 'OPEN_LIST_VIEW_CONTENT_PANEL',\n\t};\n}\n\n/**\n * Closes the list view content panel popover.\n *\n * @return {Object} Action object.\n */\nexport function closeListViewContentPanel() {\n\treturn {\n\t\ttype: 'CLOSE_LIST_VIEW_CONTENT_PANEL',\n\t};\n}\n\n/**\n * Returns an action object used to open the viewport modal\n * for the given client IDs.\n *\n * @param {string[]} clientIds Client IDs of blocks to configure viewport settings for.\n * @return {Object} Action object.\n */\nexport function showViewportModal( clientIds ) {\n\treturn {\n\t\ttype: 'SHOW_VIEWPORT_MODAL',\n\t\tclientIds,\n\t};\n}\n\n/**\n * Returns an action object used to close the viewport modal.\n *\n * @return {Object} Action object.\n */\nexport function hideViewportModal() {\n\treturn {\n\t\ttype: 'HIDE_VIEWPORT_MODAL',\n\t};\n}\n\n/**\n * Requests to open a specific inspector tab, optionally with additional options.\n * This action signals intent to switch to a particular tab in the block inspector.\n *\n * @param {string} tabName The name of the tab to open (e.g., 'list-view', 'settings', 'styles').\n * @param {Object} [options] Optional configuration.\n * @param {string} [options.openPanel] Client ID of a specific panel to open (for tabs that support panels).\n *\n * @return {Object} Action object.\n */\nexport function requestInspectorTab( tabName, options = {} ) {\n\treturn {\n\t\ttype: 'REQUEST_INSPECTOR_TAB',\n\t\ttabName,\n\t\toptions,\n\t};\n}\n\n/**\n * Clears the requested inspector tab state after it has been handled.\n *\n * @return {Object} Action object.\n */\nexport function clearRequestedInspectorTab() {\n\treturn {\n\t\ttype: 'CLEAR_REQUESTED_INSPECTOR_TAB',\n\t};\n}\n\n/**\n * Sets the selected style state for a block's style controls.\n *\n * @param {string} clientId The block client ID.\n * @param {Object} value The selected state value.\n *\n * @return {Object} Action object.\n */\nexport function setSelectedBlockStyleState( clientId, value ) {\n\treturn {\n\t\ttype: 'SET_SELECTED_BLOCK_STYLE_STATE',\n\t\tclientId,\n\t\tvalue,\n\t};\n}\n\n/**\n * Sets whether the selected style state is shown on the canvas.\n *\n * @param {string} clientId The block client ID.\n * @param {boolean} value Whether to show the selected state on the canvas.\n *\n * @return {Object} Action object.\n */\nexport function setSelectedBlockStyleStateCanvasPreview( clientId, value ) {\n\treturn {\n\t\ttype: 'SET_SELECTED_BLOCK_STYLE_STATE_CANVAS_PREVIEW',\n\t\tclientId,\n\t\tvalue,\n\t};\n}\n\n/**\n * Sets the globally selected viewport style state. When set to a value other\n * than 'default', block style edits in the inspector apply to that viewport.\n * Driven by the editor's device preview while Responsive editing is enabled.\n *\n * @param {string} viewport The selected viewport state (e.g. 'default', 'tablet', 'mobile').\n *\n * @return {Object} Action object.\n */\nexport function setStyleStateViewport( viewport ) {\n\treturn {\n\t\ttype: 'SET_STYLE_STATE_VIEWPORT',\n\t\tviewport,\n\t};\n}\n\n/**\n * Sets whether Responsive editing is enabled. When enabled, the device preview\n * also drives which viewport block style edits are applied to. Session-only.\n *\n * @param {boolean} enabled Whether Responsive editing is enabled.\n *\n * @return {Object} Action object.\n */\nexport function setResponsiveEditing( enabled ) {\n\treturn {\n\t\ttype: 'SET_RESPONSIVE_EDITING',\n\t\tenabled,\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,gBAAgB;AACvB,SAAS,aAAa;AACtB,SAAS,UAAU;AAEnB,IAAM,YAAY,CAAE,eACnB,MAAM,QAAS,UAAW,IAAI,aAAa,CAAE,UAAW;AAUzD,IAAM,kBAAkB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AACD;AAYO,SAAS,6BACf,UACA,EAAE,4BAA4B,OAAO,QAAQ,MAAM,IAAI,CAAC,GACvD;AACD,MAAI,mBAAmB;AAEvB,MAAK,OAAO,OAAQ,kBAAkB,yBAA0B,GAAI;AACnE;AAAA,MACC;AAAA,MACA;AAAA,QACC,OAAO;AAAA,QACP,aAAa;AAAA,MACd;AAAA,IACD;AAEA,uBAAmB,EAAE,GAAG,iBAAiB;AACzC,qBAAiB,gBAChB,iBAAiB;AAClB,WAAO,iBAAiB;AAAA,EACzB;AAEA,MAAI,gBAAgB;AAEpB,MAAK,2BAA4B;AAChC,oBAAgB,CAAC;AACjB,eAAY,OAAO,kBAAmB;AACrC,UAAK,CAAE,gBAAgB,SAAU,GAAI,GAAI;AACxC,sBAAe,GAAI,IAA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;AAAA,IACN,MAAM;AAAA,EACP;AACD;AAYO,SAAS,oBAAqB,SAAS,UAAU,CAAC,GAAI;AAC5D,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AAOO,SAAS,6BAA6B;AAC5C,SAAO;AAAA,IACN,MAAM;AAAA,EACP;AACD;AAUO,SAAS,2BAA4B,UAAU,OAAQ;AAC7D,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AAUO,SAAS,wCAAyC,UAAU,OAAQ;AAC1E,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AAWO,SAAS,sBAAuB,UAAW;AACjD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AAUO,SAAS,qBAAsB,SAAU;AAC/C,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;",
|
|
6
6
|
"names": ["flattenBlocks"]
|
|
7
7
|
}
|
|
@@ -11,7 +11,6 @@ var mediaEditKey = /* @__PURE__ */ Symbol("mediaEditKey");
|
|
|
11
11
|
var getMediaSelectKey = /* @__PURE__ */ Symbol("getMediaSelect");
|
|
12
12
|
var isIsolatedEditorKey = /* @__PURE__ */ Symbol("isIsolatedEditor");
|
|
13
13
|
var deviceTypeKey = /* @__PURE__ */ Symbol("deviceTypeKey");
|
|
14
|
-
var onViewportStateChangeKey = /* @__PURE__ */ Symbol("onViewportStateChangeKey");
|
|
15
14
|
var isNavigationOverlayContextKey = /* @__PURE__ */ Symbol(
|
|
16
15
|
"isNavigationOverlayContext"
|
|
17
16
|
);
|
|
@@ -28,7 +27,6 @@ export {
|
|
|
28
27
|
isNavigationPostEditorKey,
|
|
29
28
|
mediaEditKey,
|
|
30
29
|
mediaUploadOnSuccessKey,
|
|
31
|
-
onViewportStateChangeKey,
|
|
32
30
|
openMediaEditorModalKey,
|
|
33
31
|
reusableBlocksSelectKey,
|
|
34
32
|
sectionRootClientIdKey,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/private-keys.js"],
|
|
4
|
-
"sourcesContent": ["export const globalStylesDataKey = Symbol( 'globalStylesDataKey' );\nexport const globalStylesLinksDataKey = Symbol( 'globalStylesLinks' );\nexport const selectBlockPatternsKey = Symbol( 'selectBlockPatternsKey' );\nexport const reusableBlocksSelectKey = Symbol( 'reusableBlocksSelect' );\nexport const userPatternCategoriesSelectKey = Symbol(\n\t'userPatternCategoriesSelect'\n);\nexport const sectionRootClientIdKey = Symbol( 'sectionRootClientIdKey' );\nexport const mediaEditKey = Symbol( 'mediaEditKey' );\nexport const getMediaSelectKey = Symbol( 'getMediaSelect' );\nexport const isIsolatedEditorKey = Symbol( 'isIsolatedEditor' );\nexport const deviceTypeKey = Symbol( 'deviceTypeKey' );\nexport const
|
|
5
|
-
"mappings": ";AAAO,IAAM,sBAAsB,uBAAQ,qBAAsB;AAC1D,IAAM,2BAA2B,uBAAQ,mBAAoB;AAC7D,IAAM,yBAAyB,uBAAQ,wBAAyB;AAChE,IAAM,0BAA0B,uBAAQ,sBAAuB;AAC/D,IAAM,iCAAiC;AAAA,EAC7C;AACD;AACO,IAAM,yBAAyB,uBAAQ,wBAAyB;AAChE,IAAM,eAAe,uBAAQ,cAAe;AAC5C,IAAM,oBAAoB,uBAAQ,gBAAiB;AACnD,IAAM,sBAAsB,uBAAQ,kBAAmB;AACvD,IAAM,gBAAgB,uBAAQ,eAAgB;AAC9C,IAAM,
|
|
4
|
+
"sourcesContent": ["export const globalStylesDataKey = Symbol( 'globalStylesDataKey' );\nexport const globalStylesLinksDataKey = Symbol( 'globalStylesLinks' );\nexport const selectBlockPatternsKey = Symbol( 'selectBlockPatternsKey' );\nexport const reusableBlocksSelectKey = Symbol( 'reusableBlocksSelect' );\nexport const userPatternCategoriesSelectKey = Symbol(\n\t'userPatternCategoriesSelect'\n);\nexport const sectionRootClientIdKey = Symbol( 'sectionRootClientIdKey' );\nexport const mediaEditKey = Symbol( 'mediaEditKey' );\nexport const getMediaSelectKey = Symbol( 'getMediaSelect' );\nexport const isIsolatedEditorKey = Symbol( 'isIsolatedEditor' );\nexport const deviceTypeKey = Symbol( 'deviceTypeKey' );\nexport const isNavigationOverlayContextKey = Symbol(\n\t'isNavigationOverlayContext'\n);\nexport const isNavigationPostEditorKey = Symbol( 'isNavigationPostEditor' );\nexport const mediaUploadOnSuccessKey = Symbol( 'mediaUploadOnSuccess' );\nexport const openMediaEditorModalKey = Symbol( 'openMediaEditorModal' );\n"],
|
|
5
|
+
"mappings": ";AAAO,IAAM,sBAAsB,uBAAQ,qBAAsB;AAC1D,IAAM,2BAA2B,uBAAQ,mBAAoB;AAC7D,IAAM,yBAAyB,uBAAQ,wBAAyB;AAChE,IAAM,0BAA0B,uBAAQ,sBAAuB;AAC/D,IAAM,iCAAiC;AAAA,EAC7C;AACD;AACO,IAAM,yBAAyB,uBAAQ,wBAAyB;AAChE,IAAM,eAAe,uBAAQ,cAAe;AAC5C,IAAM,oBAAoB,uBAAQ,gBAAiB;AACnD,IAAM,sBAAsB,uBAAQ,kBAAmB;AACvD,IAAM,gBAAgB,uBAAQ,eAAgB;AAC9C,IAAM,gCAAgC;AAAA,EAC5C;AACD;AACO,IAAM,4BAA4B,uBAAQ,wBAAyB;AACnE,IAAM,0BAA0B,uBAAQ,sBAAuB;AAC/D,IAAM,0BAA0B,uBAAQ,sBAAuB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -511,12 +511,26 @@ var DEFAULT_BLOCK_STYLE_STATE = {
|
|
|
511
511
|
viewport: "default",
|
|
512
512
|
pseudo: "default"
|
|
513
513
|
};
|
|
514
|
-
function
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
return state.
|
|
519
|
-
}
|
|
514
|
+
function getStyleStateViewport(state) {
|
|
515
|
+
return state.styleStateViewport ?? DEFAULT_BLOCK_STYLE_STATE.viewport;
|
|
516
|
+
}
|
|
517
|
+
function isResponsiveEditing(state) {
|
|
518
|
+
return state.isResponsiveEditing;
|
|
519
|
+
}
|
|
520
|
+
var getSelectedBlockStyleState = createSelector(
|
|
521
|
+
(state, clientId) => {
|
|
522
|
+
const perBlockState = state.selectedBlockStyleState?.clientId === clientId ? state.selectedBlockStyleState.value ?? DEFAULT_BLOCK_STYLE_STATE : DEFAULT_BLOCK_STYLE_STATE;
|
|
523
|
+
return {
|
|
524
|
+
...perBlockState,
|
|
525
|
+
// The viewport is tracked globally, so inject it here. This way
|
|
526
|
+
// consumers receive a single combined state object instead of
|
|
527
|
+
// merging the global viewport themselves, and selectors derived
|
|
528
|
+
// from this stay consistent.
|
|
529
|
+
viewport: getStyleStateViewport(state)
|
|
530
|
+
};
|
|
531
|
+
},
|
|
532
|
+
(state) => [state.styleStateViewport, state.selectedBlockStyleState]
|
|
533
|
+
);
|
|
520
534
|
function hasSelectedStyleState(state, clientId) {
|
|
521
535
|
const selectedState = getSelectedBlockStyleState(state, clientId);
|
|
522
536
|
return selectedState.viewport !== DEFAULT_BLOCK_STYLE_STATE.viewport || selectedState.pseudo !== DEFAULT_BLOCK_STYLE_STATE.pseudo;
|
|
@@ -556,6 +570,7 @@ export {
|
|
|
556
570
|
getSectionRootClientId,
|
|
557
571
|
getSelectedBlockStyleState,
|
|
558
572
|
getStyleOverrides,
|
|
573
|
+
getStyleStateViewport,
|
|
559
574
|
getViewportModalClientIds,
|
|
560
575
|
getZoomLevel,
|
|
561
576
|
hasAllowedPatterns,
|
|
@@ -576,6 +591,7 @@ export {
|
|
|
576
591
|
isLockedBlock,
|
|
577
592
|
isMoveLockedBlock,
|
|
578
593
|
isRemoveLockedBlock,
|
|
594
|
+
isResponsiveEditing,
|
|
579
595
|
isSectionBlock,
|
|
580
596
|
isSelectedBlockStyleStateShownOnCanvas,
|
|
581
597
|
isWithinEditedContentOnlySection,
|