@wordpress/block-editor 15.21.1 → 15.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +2 -2
- package/build/components/block-card/index.cjs +4 -5
- package/build/components/block-card/index.cjs.map +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 +35 -20
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-mover/mover-description.cjs +6 -6
- package/build/components/block-mover/mover-description.cjs.map +1 -1
- package/build/components/block-patterns-list/index.cjs.map +2 -2
- package/build/components/block-patterns-paging/index.cjs +4 -4
- package/build/components/block-patterns-paging/index.cjs.map +2 -2
- package/build/components/block-popover/use-popover-scroll.cjs.map +1 -1
- package/build/components/block-quick-navigation/index.cjs +7 -5
- package/build/components/block-quick-navigation/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/block-toolbar/edit-section-button.cjs.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.cjs +10 -4
- package/build/components/block-tools/use-block-toolbar-popover-props.cjs.map +2 -2
- package/build/components/child-layout-control/index.cjs +51 -19
- package/build/components/child-layout-control/index.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/dimensions-tool/index.cjs +4 -5
- package/build/components/dimensions-tool/index.cjs.map +2 -2
- package/build/components/dimensions-tool/scale-tool.cjs +1 -1
- package/build/components/dimensions-tool/scale-tool.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 +1 -4
- 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/shadow-panel-components.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/grid/grid-item-resizer.cjs.map +1 -1
- package/build/components/grid/grid-visualizer.cjs.map +1 -1
- package/build/components/iframe/index.cjs +6 -3
- package/build/components/iframe/index.cjs.map +3 -3
- package/build/components/image-editor/use-transform-image.cjs.map +1 -1
- package/build/components/inserter/get-appender-label.cjs.map +1 -1
- package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
- package/build/components/inserter/search-items.cjs.map +1 -1
- package/build/components/inspector-controls/fill.cjs +1 -3
- package/build/components/inspector-controls/fill.cjs.map +2 -2
- package/build/components/inspector-controls/groups.cjs +2 -0
- package/build/components/inspector-controls/groups.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/index.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/styles-tab.cjs +76 -32
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/keyboard-shortcuts/index.cjs.map +1 -1
- package/build/components/line-height-control/index.cjs.map +1 -1
- package/build/components/link-control/index.cjs +2 -3
- package/build/components/link-control/index.cjs.map +2 -2
- package/build/components/link-control/normalize-url.cjs.map +1 -1
- 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/list-view/utils.cjs.map +1 -1
- package/build/components/preset-input-control/custom-value-controls.cjs.map +2 -2
- package/build/components/provider/index.cjs.map +1 -1
- package/build/components/provider/use-block-sync.cjs +3 -1
- package/build/components/provider/use-block-sync.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/before-input-rules.cjs +1 -1
- package/build/components/rich-text/event-listeners/before-input-rules.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/paste-handler.cjs.map +1 -1
- package/build/components/rich-text/prevent-event-discovery.cjs +1 -1
- package/build/components/rich-text/prevent-event-discovery.cjs.map +1 -1
- 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/writing-flow/use-tab-nav.cjs.map +1 -1
- package/build/hooks/anchor.cjs +1 -2
- 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/block-fields/index.cjs +13 -2
- package/build/hooks/block-fields/index.cjs.map +2 -2
- 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/dimensions.cjs +13 -2
- package/build/hooks/dimensions.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 +65 -10
- 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/list-view.cjs +10 -7
- package/build/hooks/list-view.cjs.map +2 -2
- package/build/hooks/spacing-visualizer.cjs.map +1 -1
- package/build/hooks/state-utils.cjs.map +1 -1
- package/build/hooks/states.cjs +2 -2
- package/build/hooks/states.cjs.map +2 -2
- package/build/hooks/style.cjs +50 -6
- 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 +4 -0
- package/build/private-apis.cjs.map +2 -2
- package/build/store/actions.cjs.map +1 -1
- package/build/store/private-selectors.cjs +19 -2
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs.map +1 -1
- package/build/store/selectors.cjs.map +1 -1
- 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 +3 -2
- 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-card/index.mjs +5 -6
- package/build-module/components/block-card/index.mjs.map +2 -2
- 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 +35 -21
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-mover/mover-description.mjs +6 -6
- package/build-module/components/block-mover/mover-description.mjs.map +1 -1
- package/build-module/components/block-patterns-list/index.mjs.map +2 -2
- package/build-module/components/block-patterns-paging/index.mjs +4 -4
- package/build-module/components/block-patterns-paging/index.mjs.map +2 -2
- package/build-module/components/block-popover/use-popover-scroll.mjs.map +1 -1
- package/build-module/components/block-quick-navigation/index.mjs +8 -6
- package/build-module/components/block-quick-navigation/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/block-toolbar/edit-section-button.mjs.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs +10 -4
- package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs.map +2 -2
- package/build-module/components/child-layout-control/index.mjs +51 -19
- package/build-module/components/child-layout-control/index.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/dimensions-tool/index.mjs +4 -5
- package/build-module/components/dimensions-tool/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/scale-tool.mjs +1 -1
- package/build-module/components/dimensions-tool/scale-tool.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 +1 -5
- 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/shadow-panel-components.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/grid/grid-item-resizer.mjs.map +1 -1
- package/build-module/components/grid/grid-visualizer.mjs.map +1 -1
- package/build-module/components/iframe/index.mjs +6 -3
- package/build-module/components/iframe/index.mjs.map +2 -2
- package/build-module/components/image-editor/use-transform-image.mjs.map +1 -1
- package/build-module/components/inserter/get-appender-label.mjs.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
- package/build-module/components/inserter/search-items.mjs.map +1 -1
- package/build-module/components/inspector-controls/fill.mjs +1 -3
- package/build-module/components/inspector-controls/fill.mjs.map +2 -2
- package/build-module/components/inspector-controls/groups.mjs +2 -0
- package/build-module/components/inspector-controls/groups.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +76 -32
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/keyboard-shortcuts/index.mjs.map +1 -1
- package/build-module/components/line-height-control/index.mjs.map +1 -1
- package/build-module/components/link-control/index.mjs +2 -3
- package/build-module/components/link-control/index.mjs.map +2 -2
- package/build-module/components/link-control/normalize-url.mjs.map +1 -1
- 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/list-view/utils.mjs.map +1 -1
- package/build-module/components/preset-input-control/custom-value-controls.mjs.map +2 -2
- package/build-module/components/provider/index.mjs.map +1 -1
- 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/rich-text/event-listeners/before-input-rules.mjs +1 -1
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +1 -1
- package/build-module/components/rich-text/prevent-event-discovery.mjs +1 -1
- package/build-module/components/rich-text/prevent-event-discovery.mjs.map +1 -1
- 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/writing-flow/use-tab-nav.mjs.map +1 -1
- package/build-module/hooks/anchor.mjs +1 -2
- 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/block-fields/index.mjs +13 -2
- package/build-module/hooks/block-fields/index.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/dimensions.mjs +12 -2
- package/build-module/hooks/dimensions.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 +68 -10
- 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/list-view.mjs +10 -7
- package/build-module/hooks/list-view.mjs.map +2 -2
- package/build-module/hooks/spacing-visualizer.mjs.map +1 -1
- package/build-module/hooks/state-utils.mjs.map +1 -1
- package/build-module/hooks/states.mjs +2 -2
- package/build-module/hooks/states.mjs.map +2 -2
- package/build-module/hooks/style.mjs +53 -8
- 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 +8 -0
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs.map +1 -1
- package/build-module/store/private-selectors.mjs +18 -1
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs.map +1 -1
- package/build-module/store/selectors.mjs.map +1 -1
- 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 +3 -2
- 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 +46 -40
- 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-card/index.js +7 -13
- 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 +22 -20
- package/src/components/block-patterns-list/index.js +0 -1
- package/src/components/block-quick-navigation/index.js +7 -7
- 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-tools/use-block-toolbar-popover-props.js +10 -4
- package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +4 -0
- package/src/components/child-layout-control/index.js +65 -20
- package/src/components/child-layout-control/test/index.js +64 -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/dimensions-tool/index.js +4 -9
- package/src/components/dimensions-tool/scale-tool.js +1 -2
- package/src/components/dimensions-tool/test/index.js +89 -11
- 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 +1 -5
- package/src/components/global-styles/hooks.js +45 -0
- package/src/components/global-styles/shadow-panel-components.js +0 -1
- 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/iframe/index.js +8 -3
- package/src/components/inserter/media-tab/media-preview.js +0 -1
- package/src/components/inspector-controls/README.md +0 -2
- package/src/components/inspector-controls/fill.js +6 -8
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/index.js +0 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +78 -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 -18
- package/src/components/preset-input-control/custom-value-controls.js +0 -1
- 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/hooks/anchor.js +0 -1
- package/src/hooks/background.js +210 -133
- package/src/hooks/background.scss +0 -35
- package/src/hooks/block-fields/index.js +27 -2
- 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/dimensions.js +14 -3
- 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 +92 -14
- package/src/hooks/layout.js +6 -3
- package/src/hooks/list-view.js +10 -11
- package/src/hooks/states.js +2 -2
- package/src/hooks/style.js +91 -9
- package/src/hooks/test/background.js +59 -0
- package/src/hooks/test/block-style-state.js +14 -14
- package/src/hooks/test/dimensions.js +71 -0
- package/src/hooks/test/layout-child.js +165 -0
- package/src/hooks/test/layout.js +6 -6
- package/src/hooks/test/style.js +133 -11
- package/src/hooks/typography.js +70 -6
- package/src/layouts/flex.js +118 -15
- package/src/private-apis.js +8 -0
- package/src/store/private-selectors.js +47 -0
- package/src/store/test/private-selectors.js +166 -7
- package/src/store/test/reducer.js +61 -10
- 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/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
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// packages/block-editor/src/hooks/elements.js
|
|
2
|
+
import { getBlockSupport } from "@wordpress/blocks";
|
|
3
|
+
import { useMemo, useCallback } from "@wordpress/element";
|
|
4
|
+
import { useSelect } from "@wordpress/data";
|
|
5
|
+
import { __ } from "@wordpress/i18n";
|
|
6
|
+
import InspectorControls from "../components/inspector-controls/index.mjs";
|
|
7
|
+
import {
|
|
8
|
+
useHasColorPanel,
|
|
9
|
+
default as StylesColorPanel
|
|
10
|
+
} from "../components/global-styles/color-panel.mjs";
|
|
11
|
+
import { cleanEmptyObject } from "./utils.mjs";
|
|
12
|
+
import { store as blockEditorStore } from "../store/index.mjs";
|
|
13
|
+
import { COLOR_SUPPORT_KEY } from "./color.mjs";
|
|
14
|
+
import useBlockColorContrastWarning from "./contrast-checker.mjs";
|
|
15
|
+
import {
|
|
16
|
+
getStyleForState,
|
|
17
|
+
isDefaultBlockStyleState,
|
|
18
|
+
setStyleForState,
|
|
19
|
+
useBlockStyleState
|
|
20
|
+
} from "./block-style-state.mjs";
|
|
21
|
+
import { jsx } from "react/jsx-runtime";
|
|
22
|
+
function ElementsInspectorControl({ children, resetAllFilter }) {
|
|
23
|
+
const attributesResetAllFilter = useCallback(
|
|
24
|
+
(attributes) => {
|
|
25
|
+
const updatedStyle = resetAllFilter(attributes.style);
|
|
26
|
+
return {
|
|
27
|
+
...attributes,
|
|
28
|
+
style: cleanEmptyObject(updatedStyle)
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
[resetAllFilter]
|
|
32
|
+
);
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
InspectorControls,
|
|
35
|
+
{
|
|
36
|
+
group: "elements",
|
|
37
|
+
resetAllFilter: attributesResetAllFilter,
|
|
38
|
+
children
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
function ElementsEdit({
|
|
43
|
+
clientId,
|
|
44
|
+
name,
|
|
45
|
+
setAttributes,
|
|
46
|
+
settings,
|
|
47
|
+
asWrapper,
|
|
48
|
+
label,
|
|
49
|
+
defaultControls
|
|
50
|
+
}) {
|
|
51
|
+
const selectedState = useBlockStyleState();
|
|
52
|
+
const isEnabled = useHasColorPanel(settings);
|
|
53
|
+
const style = useSelect(
|
|
54
|
+
(select) => {
|
|
55
|
+
if (!isEnabled) {
|
|
56
|
+
return void 0;
|
|
57
|
+
}
|
|
58
|
+
const attributes = select(blockEditorStore).getBlockAttributes(clientId);
|
|
59
|
+
return attributes?.style;
|
|
60
|
+
},
|
|
61
|
+
[clientId, isEnabled]
|
|
62
|
+
);
|
|
63
|
+
const isStateSelected = !isDefaultBlockStyleState(selectedState);
|
|
64
|
+
const value = useMemo(() => {
|
|
65
|
+
if (isStateSelected) {
|
|
66
|
+
return getStyleForState(style, selectedState);
|
|
67
|
+
}
|
|
68
|
+
return style;
|
|
69
|
+
}, [isStateSelected, selectedState, style]);
|
|
70
|
+
const onChange = isStateSelected ? (newStyle) => {
|
|
71
|
+
setAttributes({
|
|
72
|
+
style: setStyleForState(style, selectedState, newStyle)
|
|
73
|
+
});
|
|
74
|
+
} : (newStyle) => {
|
|
75
|
+
setAttributes({ style: cleanEmptyObject(newStyle) });
|
|
76
|
+
};
|
|
77
|
+
const enableContrastChecking = !isStateSelected && !!value?.elements?.link?.color?.text && settings?.color?.link && false !== getBlockSupport(name, [
|
|
78
|
+
COLOR_SUPPORT_KEY,
|
|
79
|
+
"enableContrastChecker"
|
|
80
|
+
]);
|
|
81
|
+
const contrastWarning = useBlockColorContrastWarning({
|
|
82
|
+
clientId,
|
|
83
|
+
name,
|
|
84
|
+
enabled: !!enableContrastChecking,
|
|
85
|
+
checkTextColor: false,
|
|
86
|
+
messageOverride: __(
|
|
87
|
+
"This link color has poor contrast against the background. Consider increasing contrast."
|
|
88
|
+
)
|
|
89
|
+
});
|
|
90
|
+
if (!isEnabled) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
defaultControls = defaultControls ? defaultControls : getBlockSupport(name, [
|
|
94
|
+
COLOR_SUPPORT_KEY,
|
|
95
|
+
"__experimentalDefaultControls"
|
|
96
|
+
]);
|
|
97
|
+
const Wrapper = asWrapper || ElementsInspectorControl;
|
|
98
|
+
return /* @__PURE__ */ jsx(
|
|
99
|
+
StylesColorPanel,
|
|
100
|
+
{
|
|
101
|
+
as: Wrapper,
|
|
102
|
+
panelId: clientId,
|
|
103
|
+
settings,
|
|
104
|
+
value,
|
|
105
|
+
onChange,
|
|
106
|
+
defaultControls,
|
|
107
|
+
label,
|
|
108
|
+
contrastWarning
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
export {
|
|
113
|
+
ElementsEdit
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=elements.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/hooks/elements.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport {\n\tuseHasColorPanel,\n\tdefault as StylesColorPanel,\n} from '../components/global-styles/color-panel';\nimport { cleanEmptyObject } from './utils';\nimport { store as blockEditorStore } from '../store';\nimport { COLOR_SUPPORT_KEY } from './color';\nimport useBlockColorContrastWarning from './contrast-checker';\nimport {\n\tgetStyleForState,\n\tisDefaultBlockStyleState,\n\tsetStyleForState,\n\tuseBlockStyleState,\n} from './block-style-state';\n\nfunction ElementsInspectorControl( { children, resetAllFilter } ) {\n\tconst attributesResetAllFilter = useCallback(\n\t\t( attributes ) => {\n\t\t\tconst updatedStyle = resetAllFilter( attributes.style );\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\tstyle: cleanEmptyObject( updatedStyle ),\n\t\t\t};\n\t\t},\n\t\t[ resetAllFilter ]\n\t);\n\n\treturn (\n\t\t<InspectorControls\n\t\t\tgroup=\"elements\"\n\t\t\tresetAllFilter={ attributesResetAllFilter }\n\t\t>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function ElementsEdit( {\n\tclientId,\n\tname,\n\tsetAttributes,\n\tsettings,\n\tasWrapper,\n\tlabel,\n\tdefaultControls,\n} ) {\n\tconst selectedState = useBlockStyleState();\n\tconst isEnabled = useHasColorPanel( settings );\n\n\tconst style = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isEnabled ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst attributes =\n\t\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId );\n\t\t\treturn attributes?.style;\n\t\t},\n\t\t[ clientId, isEnabled ]\n\t);\n\n\tconst isStateSelected = ! isDefaultBlockStyleState( selectedState );\n\n\tconst value = useMemo( () => {\n\t\tif ( isStateSelected ) {\n\t\t\treturn getStyleForState( style, selectedState );\n\t\t}\n\t\treturn style;\n\t}, [ isStateSelected, selectedState, style ] );\n\n\tconst onChange = isStateSelected\n\t\t? ( newStyle ) => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tstyle: setStyleForState( style, selectedState, newStyle ),\n\t\t\t\t} );\n\t\t }\n\t\t: ( newStyle ) => {\n\t\t\t\tsetAttributes( { style: cleanEmptyObject( newStyle ) } );\n\t\t };\n\n\t// Text and background color failures are reported by the Typography and\n\t// Background panels, which own those selections.\n\tconst enableContrastChecking =\n\t\t! isStateSelected &&\n\t\t!! value?.elements?.link?.color?.text &&\n\t\tsettings?.color?.link &&\n\t\tfalse !==\n\t\t\tgetBlockSupport( name, [\n\t\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\t\t'enableContrastChecker',\n\t\t\t] );\n\n\tconst contrastWarning = useBlockColorContrastWarning( {\n\t\tclientId,\n\t\tname,\n\t\tenabled: !! enableContrastChecking,\n\t\tcheckTextColor: false,\n\t\tmessageOverride: __(\n\t\t\t'This link color has poor contrast against the background. Consider increasing contrast.'\n\t\t),\n\t} );\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tdefaultControls = defaultControls\n\t\t? defaultControls\n\t\t: getBlockSupport( name, [\n\t\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\t\t'__experimentalDefaultControls',\n\t\t ] );\n\n\tconst Wrapper = asWrapper || ElementsInspectorControl;\n\n\treturn (\n\t\t<StylesColorPanel\n\t\t\tas={ Wrapper }\n\t\t\tpanelId={ clientId }\n\t\t\tsettings={ settings }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tdefaultControls={ defaultControls }\n\t\t\tlabel={ label }\n\t\t\tcontrastWarning={ contrastWarning }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,uBAAuB;AAChC,SAAS,SAAS,mBAAmB;AACrC,SAAS,iBAAiB;AAC1B,SAAS,UAAU;AAKnB,OAAO,uBAAuB;AAC9B;AAAA,EACC;AAAA,EACA,WAAW;AAAA,OACL;AACP,SAAS,wBAAwB;AACjC,SAAS,SAAS,wBAAwB;AAC1C,SAAS,yBAAyB;AAClC,OAAO,kCAAkC;AACzC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAeL;AAbF,SAAS,yBAA0B,EAAE,UAAU,eAAe,GAAI;AACjE,QAAM,2BAA2B;AAAA,IAChC,CAAE,eAAgB;AACjB,YAAM,eAAe,eAAgB,WAAW,KAAM;AACtD,aAAO;AAAA,QACN,GAAG;AAAA,QACH,OAAO,iBAAkB,YAAa;AAAA,MACvC;AAAA,IACD;AAAA,IACA,CAAE,cAAe;AAAA,EAClB;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAM;AAAA,MACN,gBAAiB;AAAA,MAEf;AAAA;AAAA,EACH;AAEF;AAEO,SAAS,aAAc;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,gBAAgB,mBAAmB;AACzC,QAAM,YAAY,iBAAkB,QAAS;AAE7C,QAAM,QAAQ;AAAA,IACb,CAAE,WAAY;AACb,UAAK,CAAE,WAAY;AAClB,eAAO;AAAA,MACR;AACA,YAAM,aACL,OAAQ,gBAAiB,EAAE,mBAAoB,QAAS;AACzD,aAAO,YAAY;AAAA,IACpB;AAAA,IACA,CAAE,UAAU,SAAU;AAAA,EACvB;AAEA,QAAM,kBAAkB,CAAE,yBAA0B,aAAc;AAElE,QAAM,QAAQ,QAAS,MAAM;AAC5B,QAAK,iBAAkB;AACtB,aAAO,iBAAkB,OAAO,aAAc;AAAA,IAC/C;AACA,WAAO;AAAA,EACR,GAAG,CAAE,iBAAiB,eAAe,KAAM,CAAE;AAE7C,QAAM,WAAW,kBACd,CAAE,aAAc;AAChB,kBAAe;AAAA,MACd,OAAO,iBAAkB,OAAO,eAAe,QAAS;AAAA,IACzD,CAAE;AAAA,EACF,IACA,CAAE,aAAc;AAChB,kBAAe,EAAE,OAAO,iBAAkB,QAAS,EAAE,CAAE;AAAA,EACvD;AAIH,QAAM,yBACL,CAAE,mBACF,CAAC,CAAE,OAAO,UAAU,MAAM,OAAO,QACjC,UAAU,OAAO,QACjB,UACC,gBAAiB,MAAM;AAAA,IACtB;AAAA,IACA;AAAA,EACD,CAAE;AAEJ,QAAM,kBAAkB,6BAA8B;AAAA,IACrD;AAAA,IACA;AAAA,IACA,SAAS,CAAC,CAAE;AAAA,IACZ,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,MAChB;AAAA,IACD;AAAA,EACD,CAAE;AAEF,MAAK,CAAE,WAAY;AAClB,WAAO;AAAA,EACR;AAEA,oBAAkB,kBACf,kBACA,gBAAiB,MAAM;AAAA,IACvB;AAAA,IACA;AAAA,EACA,CAAE;AAEL,QAAM,UAAU,aAAa;AAE7B,SACC;AAAA,IAAC;AAAA;AAAA,MACA,IAAK;AAAA,MACL,SAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACD;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -5,6 +5,7 @@ import { useSelect } from "@wordpress/data";
|
|
|
5
5
|
import { GridVisualizer, useGridLayoutSync } from "../components/grid/index.mjs";
|
|
6
6
|
import { store as blockEditorStore } from "../store/index.mjs";
|
|
7
7
|
import { unlock } from "../lock-unlock.mjs";
|
|
8
|
+
import { useBlockElement } from "../components/block-list/use-block-props/use-block-refs.mjs";
|
|
8
9
|
import useBlockVisibility from "../components/block-visibility/use-block-visibility.mjs";
|
|
9
10
|
import { deviceTypeKey } from "../store/private-keys.mjs";
|
|
10
11
|
import { BLOCK_VISIBILITY_VIEWPORTS } from "../components/block-visibility/constants.mjs";
|
|
@@ -13,7 +14,7 @@ function GridLayoutSync(props) {
|
|
|
13
14
|
useGridLayoutSync(props);
|
|
14
15
|
}
|
|
15
16
|
function GridTools({ clientId, layout }) {
|
|
16
|
-
const { isVisible, blockVisibility, deviceType
|
|
17
|
+
const { isVisible, blockVisibility, deviceType } = useSelect(
|
|
17
18
|
(select) => {
|
|
18
19
|
const {
|
|
19
20
|
isBlockSelected,
|
|
@@ -27,28 +28,37 @@ function GridTools({ clientId, layout }) {
|
|
|
27
28
|
if (!isDraggingBlocks() && !isBlockSelected(clientId) || getTemplateLock(clientId) || getBlockEditingMode(clientId) !== "default" || hasSelectedInnerBlock(clientId)) {
|
|
28
29
|
return { isVisible: false };
|
|
29
30
|
}
|
|
30
|
-
const { isBlockParentHiddenAtViewport } = unlock(
|
|
31
|
-
select(blockEditorStore)
|
|
32
|
-
);
|
|
33
31
|
const attributes = getBlockAttributes(clientId);
|
|
34
32
|
const settings = getSettings();
|
|
35
33
|
const currentDeviceType = settings?.[deviceTypeKey]?.toLowerCase() || BLOCK_VISIBILITY_VIEWPORTS.desktop.key;
|
|
36
34
|
return {
|
|
37
35
|
isVisible: true,
|
|
38
36
|
blockVisibility: attributes?.metadata?.blockVisibility,
|
|
39
|
-
deviceType: currentDeviceType
|
|
40
|
-
isAnyAncestorHidden: isBlockParentHiddenAtViewport(
|
|
41
|
-
clientId,
|
|
42
|
-
currentDeviceType
|
|
43
|
-
)
|
|
37
|
+
deviceType: currentDeviceType
|
|
44
38
|
};
|
|
45
39
|
},
|
|
46
40
|
[clientId]
|
|
47
41
|
);
|
|
48
|
-
const
|
|
42
|
+
const blockElement = useBlockElement(clientId);
|
|
43
|
+
const rawCanvasView = blockElement?.ownerDocument?.defaultView;
|
|
44
|
+
const canvasView = rawCanvasView === null ? void 0 : rawCanvasView;
|
|
45
|
+
const { isBlockCurrentlyHidden, currentViewport } = useBlockVisibility({
|
|
49
46
|
blockVisibility,
|
|
50
|
-
deviceType
|
|
47
|
+
deviceType,
|
|
48
|
+
view: canvasView
|
|
51
49
|
});
|
|
50
|
+
const isAnyAncestorHidden = useSelect(
|
|
51
|
+
(select) => {
|
|
52
|
+
if (!isVisible) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
const { isBlockParentHiddenAtViewport } = unlock(
|
|
56
|
+
select(blockEditorStore)
|
|
57
|
+
);
|
|
58
|
+
return isBlockParentHiddenAtViewport(clientId, currentViewport);
|
|
59
|
+
},
|
|
60
|
+
[clientId, currentViewport, isVisible]
|
|
61
|
+
);
|
|
52
62
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53
63
|
/* @__PURE__ */ jsx(GridLayoutSync, { clientId }),
|
|
54
64
|
isVisible && !isBlockCurrentlyHidden && !isAnyAncestorHidden && /* @__PURE__ */ jsx(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/hooks/grid-visualizer.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { GridVisualizer, useGridLayoutSync } from '../components/grid';\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\nimport useBlockVisibility from '../components/block-visibility/use-block-visibility';\nimport { deviceTypeKey } from '../store/private-keys';\nimport { BLOCK_VISIBILITY_VIEWPORTS } from '../components/block-visibility/constants';\n\nfunction GridLayoutSync( props ) {\n\tuseGridLayoutSync( props );\n}\n\nfunction GridTools( { clientId, layout } ) {\n\tconst { isVisible, blockVisibility, deviceType
|
|
5
|
-
"mappings": ";AAGA,SAAS,kCAAkC;AAC3C,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAK1B,SAAS,gBAAgB,yBAAyB;AAClD,SAAS,SAAS,wBAAwB;AAC1C,SAAS,cAAc;AACvB,OAAO,wBAAwB;AAC/B,SAAS,qBAAqB;AAC9B,SAAS,kCAAkC;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { GridVisualizer, useGridLayoutSync } from '../components/grid';\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\nimport useBlockVisibility from '../components/block-visibility/use-block-visibility';\nimport { deviceTypeKey } from '../store/private-keys';\nimport { BLOCK_VISIBILITY_VIEWPORTS } from '../components/block-visibility/constants';\n\nfunction GridLayoutSync( props ) {\n\tuseGridLayoutSync( props );\n}\n\nfunction GridTools( { clientId, layout } ) {\n\tconst { isVisible, blockVisibility, deviceType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisBlockSelected,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tisDraggingBlocks,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetSettings,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\t// These calls are purposely ordered from least expensive to most expensive.\n\t\t\t// Hides the visualizer in cases where the user is not or cannot interact with it.\n\t\t\t// Also hide if a child block is selected, because layout-child.js will render\n\t\t\t// the visualizer in that case (with proper childGridClientId handling).\n\t\t\tif (\n\t\t\t\t( ! isDraggingBlocks() && ! isBlockSelected( clientId ) ) ||\n\t\t\t\tgetTemplateLock( clientId ) ||\n\t\t\t\tgetBlockEditingMode( clientId ) !== 'default' ||\n\t\t\t\thasSelectedInnerBlock( clientId )\n\t\t\t) {\n\t\t\t\treturn { isVisible: false };\n\t\t\t}\n\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\tconst settings = getSettings();\n\t\t\tconst currentDeviceType =\n\t\t\t\tsettings?.[ deviceTypeKey ]?.toLowerCase() ||\n\t\t\t\tBLOCK_VISIBILITY_VIEWPORTS.desktop.key;\n\n\t\t\treturn {\n\t\t\t\tisVisible: true,\n\t\t\t\tblockVisibility: attributes?.metadata?.blockVisibility,\n\t\t\t\tdeviceType: currentDeviceType,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Get the block's DOM element to derive the canvas iframe window,\n\t// so viewport detection matches the actual block rendering context\n\tconst blockElement = useBlockElement( clientId );\n\tconst rawCanvasView = blockElement?.ownerDocument?.defaultView;\n\tconst canvasView = rawCanvasView === null ? undefined : rawCanvasView;\n\n\tconst { isBlockCurrentlyHidden, currentViewport } = useBlockVisibility( {\n\t\tblockVisibility,\n\t\tdeviceType,\n\t\tview: canvasView,\n\t} );\n\n\t// Check whether any ancestor is hidden at the viewport actually detected\n\t// from the canvas, so it stays consistent with how blocks are hidden.\n\tconst isAnyAncestorHidden = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isVisible ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tconst { isBlockParentHiddenAtViewport } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\treturn isBlockParentHiddenAtViewport( clientId, currentViewport );\n\t\t},\n\t\t[ clientId, currentViewport, isVisible ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<GridLayoutSync clientId={ clientId } />\n\t\t\t{ isVisible &&\n\t\t\t\t! isBlockCurrentlyHidden &&\n\t\t\t\t! isAnyAncestorHidden && (\n\t\t\t\t\t<GridVisualizer\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tparentLayout={ layout }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t</>\n\t);\n}\n\nconst addGridVisualizerToBlockEdit = createHigherOrderComponent(\n\t( BlockEdit ) =>\n\t\tfunction AddGridVisualizerToBlockEdit( props ) {\n\t\t\tif ( props.attributes.layout?.type !== 'grid' ) {\n\t\t\t\treturn <BlockEdit key=\"edit\" { ...props } />;\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<GridTools\n\t\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\t\tlayout={ props.attributes.layout }\n\t\t\t\t\t/>\n\t\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t\t</>\n\t\t\t);\n\t\t},\n\t'addGridVisualizerToBlockEdit'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/grid-visualizer',\n\taddGridVisualizerToBlockEdit\n);\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,kCAAkC;AAC3C,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAK1B,SAAS,gBAAgB,yBAAyB;AAClD,SAAS,SAAS,wBAAwB;AAC1C,SAAS,cAAc;AACvB,SAAS,uBAAuB;AAChC,OAAO,wBAAwB;AAC/B,SAAS,qBAAqB;AAC9B,SAAS,kCAAkC;AA2EzC,mBACC,KADD;AAzEF,SAAS,eAAgB,OAAQ;AAChC,oBAAmB,KAAM;AAC1B;AAEA,SAAS,UAAW,EAAE,UAAU,OAAO,GAAI;AAC1C,QAAM,EAAE,WAAW,iBAAiB,WAAW,IAAI;AAAA,IAClD,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,gBAAiB;AAM7B,UACG,CAAE,iBAAiB,KAAK,CAAE,gBAAiB,QAAS,KACtD,gBAAiB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AAAA,UACjB,QAAS,MAAM,WAAW;AAAA;AAAA,MAC3B;AAAA,MACA,oBAAC,aAAuB,GAAG,SAAZ,MAAoB;AAAA,OACpC;AAAA,EAEF;AAAA,EACD;AACD;AAEA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,6 +3,7 @@ import { useInstanceId } from "@wordpress/compose";
|
|
|
3
3
|
import { useSelect } from "@wordpress/data";
|
|
4
4
|
import { useState } from "@wordpress/element";
|
|
5
5
|
import { store as blockEditorStore } from "../store/index.mjs";
|
|
6
|
+
import { unlock } from "../lock-unlock.mjs";
|
|
6
7
|
import { useStyleOverride } from "./utils.mjs";
|
|
7
8
|
import { useLayout } from "../components/block-list/layout.mjs";
|
|
8
9
|
import {
|
|
@@ -10,15 +11,33 @@ import {
|
|
|
10
11
|
GridItemResizer,
|
|
11
12
|
GridItemMovers
|
|
12
13
|
} from "../components/grid/index.mjs";
|
|
14
|
+
import { useBlockElement } from "../components/block-list/use-block-props/use-block-refs.mjs";
|
|
13
15
|
import useBlockVisibility from "../components/block-visibility/use-block-visibility.mjs";
|
|
14
16
|
import { deviceTypeKey } from "../store/private-keys.mjs";
|
|
15
17
|
import { BLOCK_VISIBILITY_VIEWPORTS } from "../components/block-visibility/constants.mjs";
|
|
18
|
+
import {
|
|
19
|
+
DEFAULT_BLOCK_STYLE_STATE,
|
|
20
|
+
getStyleForState
|
|
21
|
+
} from "./block-style-state.mjs";
|
|
16
22
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
17
23
|
var LAYOUT_CHILD_BLOCK_PROPS_REFERENCE = {};
|
|
18
24
|
var RESPONSIVE_BREAKPOINTS = {
|
|
19
|
-
mobile: "@media (width <= 480px)",
|
|
20
|
-
tablet: "@media (480px < width <= 782px)"
|
|
25
|
+
"@mobile": "@media (width <= 480px)",
|
|
26
|
+
"@tablet": "@media (480px < width <= 782px)"
|
|
27
|
+
};
|
|
28
|
+
var FLEX_CHILD_LAYOUT_VALUES = {
|
|
29
|
+
fit: "fit",
|
|
30
|
+
grow: "fill",
|
|
31
|
+
max: "fixed",
|
|
32
|
+
fixed: "fixedNoShrink"
|
|
21
33
|
};
|
|
34
|
+
var FLEX_SIZE_VALUES = [
|
|
35
|
+
FLEX_CHILD_LAYOUT_VALUES.max,
|
|
36
|
+
FLEX_CHILD_LAYOUT_VALUES.fixed
|
|
37
|
+
];
|
|
38
|
+
function isFlexSizeValue(value) {
|
|
39
|
+
return FLEX_SIZE_VALUES.includes(value);
|
|
40
|
+
}
|
|
22
41
|
function serializeRule({ selector, declarations }) {
|
|
23
42
|
return `${selector} {
|
|
24
43
|
${Object.entries(declarations).map(([property, value]) => `${property}: ${value}`).join("; ")};
|
|
@@ -45,14 +64,26 @@ function getChildLayoutStyleRules({
|
|
|
45
64
|
columnSpan,
|
|
46
65
|
rowSpan
|
|
47
66
|
} = effectiveLayout;
|
|
67
|
+
const baseSelfStretch = layout.selfStretch;
|
|
48
68
|
const { columnCount, minimumColumnWidth } = parentLayout;
|
|
49
69
|
const rules = [];
|
|
50
70
|
const declarations = {};
|
|
51
71
|
if (!hasViewportOverrides || hasViewportOverride("selfStretch") || hasViewportOverride("flexSize")) {
|
|
52
|
-
if (selfStretch ===
|
|
72
|
+
if (hasViewportOverrides && (selfStretch === FLEX_CHILD_LAYOUT_VALUES.fit || selfStretch === FLEX_CHILD_LAYOUT_VALUES.grow) && isFlexSizeValue(baseSelfStretch) && layout.flexSize) {
|
|
73
|
+
declarations["flex-basis"] = "unset";
|
|
74
|
+
if (baseSelfStretch === FLEX_CHILD_LAYOUT_VALUES.fixed) {
|
|
75
|
+
declarations["flex-shrink"] = "unset";
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (isFlexSizeValue(selfStretch) && flexSize) {
|
|
53
79
|
declarations["flex-basis"] = flexSize;
|
|
80
|
+
if (selfStretch === FLEX_CHILD_LAYOUT_VALUES.fixed) {
|
|
81
|
+
declarations["flex-shrink"] = "0";
|
|
82
|
+
} else if (hasViewportOverrides && baseSelfStretch === FLEX_CHILD_LAYOUT_VALUES.fixed) {
|
|
83
|
+
declarations["flex-shrink"] = "unset";
|
|
84
|
+
}
|
|
54
85
|
declarations["box-sizing"] = "border-box";
|
|
55
|
-
} else if (selfStretch ===
|
|
86
|
+
} else if (selfStretch === FLEX_CHILD_LAYOUT_VALUES.grow) {
|
|
56
87
|
declarations["flex-grow"] = "1";
|
|
57
88
|
}
|
|
58
89
|
}
|
|
@@ -142,7 +173,10 @@ function getResponsiveChildLayoutStyles({
|
|
|
142
173
|
}) {
|
|
143
174
|
const baseLayout = style?.layout ?? {};
|
|
144
175
|
return Object.entries(RESPONSIVE_BREAKPOINTS).map(([viewport, mediaQuery]) => {
|
|
145
|
-
const viewportLayout = style
|
|
176
|
+
const viewportLayout = getStyleForState(style, {
|
|
177
|
+
viewport,
|
|
178
|
+
pseudo: DEFAULT_BLOCK_STYLE_STATE.pseudo
|
|
179
|
+
})?.layout;
|
|
146
180
|
if (!viewportLayout || !Object.keys(viewportLayout).length) {
|
|
147
181
|
return "";
|
|
148
182
|
}
|
|
@@ -257,29 +291,53 @@ function GridTools({
|
|
|
257
291
|
const parentAttributes = getBlockAttributes(_rootClientId);
|
|
258
292
|
const blockAttributes = getBlockAttributes(clientId);
|
|
259
293
|
const settings = getSettings();
|
|
294
|
+
const currentDeviceType = settings?.[deviceTypeKey]?.toLowerCase() || BLOCK_VISIBILITY_VIEWPORTS.desktop.key;
|
|
260
295
|
return {
|
|
261
296
|
rootClientId: _rootClientId,
|
|
262
297
|
isVisible: true,
|
|
263
298
|
parentBlockVisibility: parentAttributes?.metadata?.blockVisibility,
|
|
264
299
|
blockBlockVisibility: blockAttributes?.metadata?.blockVisibility,
|
|
265
|
-
deviceType:
|
|
300
|
+
deviceType: currentDeviceType,
|
|
266
301
|
// Check if the selected child block is itself a grid.
|
|
267
302
|
isChildBlockAGrid: blockAttributes?.layout?.type === "grid"
|
|
268
303
|
};
|
|
269
304
|
},
|
|
270
305
|
[clientId]
|
|
271
306
|
);
|
|
272
|
-
const
|
|
307
|
+
const blockElement = useBlockElement(clientId);
|
|
308
|
+
const rawCanvasView = blockElement?.ownerDocument?.defaultView;
|
|
309
|
+
const canvasView = rawCanvasView === null ? void 0 : rawCanvasView;
|
|
310
|
+
const {
|
|
311
|
+
isBlockCurrentlyHidden: isParentBlockCurrentlyHidden,
|
|
312
|
+
currentViewport
|
|
313
|
+
} = useBlockVisibility({
|
|
273
314
|
blockVisibility: parentBlockVisibility,
|
|
274
|
-
deviceType
|
|
315
|
+
deviceType,
|
|
316
|
+
view: canvasView
|
|
275
317
|
});
|
|
318
|
+
const isAnyAncestorHidden = useSelect(
|
|
319
|
+
(select) => {
|
|
320
|
+
if (!rootClientId) {
|
|
321
|
+
return false;
|
|
322
|
+
}
|
|
323
|
+
const { isBlockParentHiddenAtViewport } = unlock(
|
|
324
|
+
select(blockEditorStore)
|
|
325
|
+
);
|
|
326
|
+
return isBlockParentHiddenAtViewport(
|
|
327
|
+
rootClientId,
|
|
328
|
+
currentViewport
|
|
329
|
+
);
|
|
330
|
+
},
|
|
331
|
+
[rootClientId, currentViewport]
|
|
332
|
+
);
|
|
276
333
|
const { isBlockCurrentlyHidden: isBlockItselfCurrentlyHidden } = useBlockVisibility({
|
|
277
334
|
blockVisibility: blockBlockVisibility,
|
|
278
|
-
deviceType
|
|
335
|
+
deviceType,
|
|
336
|
+
view: canvasView
|
|
279
337
|
});
|
|
280
338
|
const [resizerBounds, setResizerBounds] = useState();
|
|
281
339
|
const childGridClientId = isChildBlockAGrid ? clientId : void 0;
|
|
282
|
-
if (!isVisible || isParentBlockCurrentlyHidden) {
|
|
340
|
+
if (!isVisible || isParentBlockCurrentlyHidden || isAnyAncestorHidden) {
|
|
283
341
|
return null;
|
|
284
342
|
}
|
|
285
343
|
const showResizer = allowSizingOnChildren && !isBlockItselfCurrentlyHidden;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/hooks/layout-child.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { useStyleOverride } from './utils';\nimport { useLayout } from '../components/block-list/layout';\nimport {\n\tGridVisualizer,\n\tGridItemResizer,\n\tGridItemMovers,\n} from '../components/grid';\nimport useBlockVisibility from '../components/block-visibility/use-block-visibility';\nimport { deviceTypeKey } from '../store/private-keys';\nimport { BLOCK_VISIBILITY_VIEWPORTS } from '../components/block-visibility/constants';\n\n// Used for generating the instance ID\nconst LAYOUT_CHILD_BLOCK_PROPS_REFERENCE = {};\n// Keep in sync with WP_Theme_JSON_Gutenberg::RESPONSIVE_BREAKPOINTS.\nconst RESPONSIVE_BREAKPOINTS = {\n\tmobile: '@media (width <= 480px)',\n\ttablet: '@media (480px < width <= 782px)',\n};\n\nfunction serializeRule( { selector, declarations } ) {\n\treturn `${ selector } {\n\t\t${ Object.entries( declarations )\n\t\t\t.map( ( [ property, value ] ) => `${ property }: ${ value }` )\n\t\t\t.join( '; ' ) };\n\t}`;\n}\n\nexport function getChildLayoutStyleRules( {\n\tselector,\n\tlayout = {},\n\tviewportOverrides,\n\tparentLayout = {},\n\tincludeContainerQuery = true,\n} ) {\n\tconst hasViewportOverrides = viewportOverrides !== undefined;\n\tconst effectiveLayout = hasViewportOverrides\n\t\t? {\n\t\t\t\t...layout,\n\t\t\t\t...viewportOverrides,\n\t\t }\n\t\t: layout;\n\tconst hasViewportOverride = ( key ) =>\n\t\tObject.hasOwn( viewportOverrides || {}, key );\n\tconst {\n\t\tselfStretch,\n\t\tflexSize,\n\t\tcolumnStart,\n\t\trowStart,\n\t\tcolumnSpan,\n\t\trowSpan,\n\t} = effectiveLayout;\n\tconst { columnCount, minimumColumnWidth } = parentLayout;\n\tconst rules = [];\n\n\tconst declarations = {};\n\tif (\n\t\t! hasViewportOverrides ||\n\t\thasViewportOverride( 'selfStretch' ) ||\n\t\thasViewportOverride( 'flexSize' )\n\t) {\n\t\tif ( selfStretch === 'fixed' && flexSize ) {\n\t\t\tdeclarations[ 'flex-basis' ] = flexSize;\n\t\t\tdeclarations[ 'box-sizing' ] = 'border-box';\n\t\t} else if ( selfStretch === 'fill' ) {\n\t\t\tdeclarations[ 'flex-grow' ] = '1';\n\t\t}\n\t}\n\n\tif (\n\t\t! hasViewportOverrides ||\n\t\thasViewportOverride( 'columnStart' ) ||\n\t\thasViewportOverride( 'columnSpan' )\n\t) {\n\t\tif ( columnStart && columnSpan ) {\n\t\t\tdeclarations[\n\t\t\t\t'grid-column'\n\t\t\t] = `${ columnStart } / span ${ columnSpan }`;\n\t\t} else if ( columnStart ) {\n\t\t\tdeclarations[ 'grid-column' ] = `${ columnStart }`;\n\t\t} else if ( columnSpan ) {\n\t\t\tdeclarations[ 'grid-column' ] = `span ${ columnSpan }`;\n\t\t}\n\t}\n\n\tif (\n\t\t! hasViewportOverrides ||\n\t\thasViewportOverride( 'rowStart' ) ||\n\t\thasViewportOverride( 'rowSpan' )\n\t) {\n\t\tif ( rowStart && rowSpan ) {\n\t\t\tdeclarations[ 'grid-row' ] = `${ rowStart } / span ${ rowSpan }`;\n\t\t} else if ( rowStart ) {\n\t\t\tdeclarations[ 'grid-row' ] = `${ rowStart }`;\n\t\t} else if ( rowSpan ) {\n\t\t\tdeclarations[ 'grid-row' ] = `span ${ rowSpan }`;\n\t\t}\n\t}\n\n\tif ( Object.keys( declarations ).length ) {\n\t\trules.push( { selector, declarations } );\n\t}\n\n\tif ( includeContainerQuery && ! hasViewportOverrides ) {\n\t\t/**\n\t\t * If minimumColumnWidth is set on the parent, or if no\n\t\t * columnCount is set, the grid is responsive so a\n\t\t * container query is needed for the span to resize.\n\t\t */\n\t\tif (\n\t\t\t( columnSpan || columnStart ) &&\n\t\t\t( minimumColumnWidth || ! columnCount )\n\t\t) {\n\t\t\tlet parentColumnValue = parseFloat( minimumColumnWidth );\n\t\t\t/**\n\t\t\t * 12rem is the default minimumColumnWidth value.\n\t\t\t * If parentColumnValue is not a number, default to 12.\n\t\t\t */\n\t\t\tif ( isNaN( parentColumnValue ) ) {\n\t\t\t\tparentColumnValue = 12;\n\t\t\t}\n\n\t\t\tlet parentColumnUnit = minimumColumnWidth?.replace(\n\t\t\t\tparentColumnValue,\n\t\t\t\t''\n\t\t\t);\n\t\t\t/**\n\t\t\t * Check that parent column unit is either 'px', 'rem' or 'em'.\n\t\t\t * If not, default to 'rem'.\n\t\t\t */\n\t\t\tif ( ! [ 'px', 'rem', 'em' ].includes( parentColumnUnit ) ) {\n\t\t\t\tparentColumnUnit = 'rem';\n\t\t\t}\n\n\t\t\tlet numColsToBreakAt = 2;\n\n\t\t\tif ( columnSpan && columnStart ) {\n\t\t\t\tnumColsToBreakAt = columnSpan + columnStart - 1;\n\t\t\t} else if ( columnSpan ) {\n\t\t\t\tnumColsToBreakAt = columnSpan;\n\t\t\t} else {\n\t\t\t\tnumColsToBreakAt = columnStart;\n\t\t\t}\n\n\t\t\tconst defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5;\n\t\t\tconst containerQueryValue =\n\t\t\t\tnumColsToBreakAt * parentColumnValue +\n\t\t\t\t( numColsToBreakAt - 1 ) * defaultGapValue;\n\t\t\t// For blocks that only span one column, we want to remove any rowStart values as\n\t\t\t// the container reduces in size, so that blocks are still arranged in markup order.\n\t\t\tconst minimumContainerQueryValue =\n\t\t\t\tparentColumnValue * 2 + defaultGapValue - 1;\n\t\t\t// If a span is set we want to preserve it as long as possible, otherwise we just reset the value.\n\t\t\tconst gridColumnValue =\n\t\t\t\tcolumnSpan && columnSpan > 1 ? '1/-1' : 'auto';\n\n\t\t\trules.push( {\n\t\t\t\trulesGroup: `@container (max-width: ${ Math.max(\n\t\t\t\t\tcontainerQueryValue,\n\t\t\t\t\tminimumContainerQueryValue\n\t\t\t\t) }${ parentColumnUnit })`,\n\t\t\t\tselector,\n\t\t\t\tdeclarations: {\n\t\t\t\t\t'grid-column': gridColumnValue,\n\t\t\t\t\t'grid-row': 'auto',\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t}\n\n\treturn rules;\n}\n\nexport function getChildLayoutStyles( {\n\tselector,\n\tlayout = {},\n\tparentLayout = {},\n\tincludeContainerQuery = true,\n} ) {\n\treturn getChildLayoutStyleRules( {\n\t\tselector,\n\t\tlayout,\n\t\tparentLayout,\n\t\tincludeContainerQuery,\n\t} )\n\t\t.map( ( rule ) => {\n\t\t\tconst serializedRule = serializeRule( rule );\n\t\t\treturn rule.rulesGroup\n\t\t\t\t? `${ rule.rulesGroup } {\n\t\t\t\t${ serializedRule }\n\t\t\t}`\n\t\t\t\t: serializedRule;\n\t\t} )\n\t\t.join( '' );\n}\n\nexport function getResponsiveChildLayoutStyles( {\n\tstyle = {},\n\tselector,\n\tparentLayout = {},\n} ) {\n\tconst baseLayout = style?.layout ?? {};\n\n\treturn Object.entries( RESPONSIVE_BREAKPOINTS )\n\t\t.map( ( [ viewport, mediaQuery ] ) => {\n\t\t\tconst viewportLayout = style?.[ viewport ]?.layout;\n\t\t\tif ( ! viewportLayout || ! Object.keys( viewportLayout ).length ) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\tconst viewportRules = getChildLayoutStyleRules( {\n\t\t\t\tselector,\n\t\t\t\tlayout: baseLayout,\n\t\t\t\tviewportOverrides: viewportLayout,\n\t\t\t\tparentLayout,\n\t\t\t\tincludeContainerQuery: false,\n\t\t\t} );\n\t\t\tconst css = viewportRules.map( serializeRule ).join( '' );\n\n\t\t\treturn css ? `${ mediaQuery }{${ css }}` : '';\n\t\t} )\n\t\t.filter( Boolean )\n\t\t.join( '' );\n}\n\nfunction useBlockPropsChildLayoutStyles( { style } ) {\n\tconst shouldRenderChildLayoutStyles = useSelect( ( select ) => {\n\t\treturn ! select( blockEditorStore ).getSettings().disableLayoutStyles;\n\t} );\n\tconst layout = style?.layout ?? {};\n\tconst { columnStart, rowStart, columnSpan, rowSpan } = layout;\n\tconst parentLayout = useLayout() || {};\n\tconst id = useInstanceId( LAYOUT_CHILD_BLOCK_PROPS_REFERENCE );\n\tconst selector = `.wp-container-content-${ id }`;\n\n\t// Check that the grid layout attributes are of the correct type, so that we don't accidentally\n\t// write code that stores a string attribute instead of a number.\n\tif ( process.env.NODE_ENV === 'development' ) {\n\t\tif ( columnStart && typeof columnStart !== 'number' ) {\n\t\t\tthrow new Error( 'columnStart must be a number' );\n\t\t}\n\t\tif ( rowStart && typeof rowStart !== 'number' ) {\n\t\t\tthrow new Error( 'rowStart must be a number' );\n\t\t}\n\t\tif ( columnSpan && typeof columnSpan !== 'number' ) {\n\t\t\tthrow new Error( 'columnSpan must be a number' );\n\t\t}\n\t\tif ( rowSpan && typeof rowSpan !== 'number' ) {\n\t\t\tthrow new Error( 'rowSpan must be a number' );\n\t\t}\n\t}\n\n\tlet css = '';\n\tif ( shouldRenderChildLayoutStyles ) {\n\t\tcss = [\n\t\t\tgetChildLayoutStyles( {\n\t\t\t\tselector,\n\t\t\t\tlayout,\n\t\t\t\tparentLayout,\n\t\t\t} ),\n\t\t\tgetResponsiveChildLayoutStyles( {\n\t\t\t\tstyle,\n\t\t\t\tselector,\n\t\t\t\tparentLayout,\n\t\t\t} ),\n\t\t].join( '' );\n\t}\n\n\tuseStyleOverride( { css } );\n\n\t// Only attach a container class if there is generated CSS to be attached.\n\tif ( ! css ) {\n\t\treturn;\n\t}\n\n\t// Attach a `wp-container-content` id-based classname.\n\treturn { className: `wp-container-content-${ id }` };\n}\n\nfunction ChildLayoutControlsPure( { clientId, style, setAttributes } ) {\n\tconst parentLayout = useLayout() || {};\n\tconst {\n\t\ttype: parentLayoutType = 'default',\n\t\tallowSizingOnChildren = false,\n\t\tisManualPlacement,\n\t} = parentLayout;\n\n\tif ( parentLayoutType !== 'grid' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<GridTools\n\t\t\tclientId={ clientId }\n\t\t\tstyle={ style }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tallowSizingOnChildren={ allowSizingOnChildren }\n\t\t\tisManualPlacement={ isManualPlacement }\n\t\t\tparentLayout={ parentLayout }\n\t\t/>\n\t);\n}\n\nfunction GridTools( {\n\tclientId,\n\tstyle,\n\tsetAttributes,\n\tallowSizingOnChildren,\n\tisManualPlacement,\n\tparentLayout,\n} ) {\n\tconst {\n\t\trootClientId,\n\t\tisVisible,\n\t\tparentBlockVisibility,\n\t\tblockBlockVisibility,\n\t\tdeviceType,\n\t\tisChildBlockAGrid,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetSettings,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst _rootClientId = getBlockRootClientId( clientId );\n\n\t\t\tif (\n\t\t\t\tgetTemplateLock( _rootClientId ) ||\n\t\t\t\tgetBlockEditingMode( _rootClientId ) !== 'default'\n\t\t\t) {\n\t\t\t\treturn {\n\t\t\t\t\trootClientId: _rootClientId,\n\t\t\t\t\tisVisible: false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst parentAttributes = getBlockAttributes( _rootClientId );\n\t\t\tconst blockAttributes = getBlockAttributes( clientId );\n\t\t\tconst settings = getSettings();\n\n\t\t\treturn {\n\t\t\t\trootClientId: _rootClientId,\n\t\t\t\tisVisible: true,\n\t\t\t\tparentBlockVisibility:\n\t\t\t\t\tparentAttributes?.metadata?.blockVisibility,\n\t\t\t\tblockBlockVisibility:\n\t\t\t\t\tblockAttributes?.metadata?.blockVisibility,\n\t\t\t\tdeviceType:\n\t\t\t\t\tsettings?.[ deviceTypeKey ]?.toLowerCase() ||\n\t\t\t\t\tBLOCK_VISIBILITY_VIEWPORTS.desktop.key,\n\t\t\t\t// Check if the selected child block is itself a grid.\n\t\t\t\tisChildBlockAGrid: blockAttributes?.layout?.type === 'grid',\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { isBlockCurrentlyHidden: isParentBlockCurrentlyHidden } =\n\t\tuseBlockVisibility( {\n\t\t\tblockVisibility: parentBlockVisibility,\n\t\t\tdeviceType,\n\t\t} );\n\n\tconst { isBlockCurrentlyHidden: isBlockItselfCurrentlyHidden } =\n\t\tuseBlockVisibility( {\n\t\t\tblockVisibility: blockBlockVisibility,\n\t\t\tdeviceType,\n\t\t} );\n\n\t// Use useState() instead of useRef() so that GridItemResizer updates when ref is set.\n\tconst [ resizerBounds, setResizerBounds ] = useState();\n\n\tconst childGridClientId = isChildBlockAGrid ? clientId : undefined;\n\n\tif ( ! isVisible || isParentBlockCurrentlyHidden ) {\n\t\treturn null;\n\t}\n\n\tconst showResizer = allowSizingOnChildren && ! isBlockItselfCurrentlyHidden;\n\n\tfunction updateLayout( layout ) {\n\t\tsetAttributes( {\n\t\t\tstyle: {\n\t\t\t\t...style,\n\t\t\t\tlayout: {\n\t\t\t\t\t...style?.layout,\n\t\t\t\t\t...layout,\n\t\t\t\t},\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<GridVisualizer\n\t\t\t\tclientId={ rootClientId }\n\t\t\t\tcontentRef={ setResizerBounds }\n\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\tchildGridClientId={ childGridClientId }\n\t\t\t/>\n\t\t\t{ showResizer && (\n\t\t\t\t<GridItemResizer\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t// Don't allow resizing beyond the grid visualizer.\n\t\t\t\t\tbounds={ resizerBounds }\n\t\t\t\t\tonChange={ updateLayout }\n\t\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isManualPlacement &&\n\t\t\t\twindow.__experimentalEnableGridInteractivity && (\n\t\t\t\t\t<GridItemMovers\n\t\t\t\t\t\tlayout={ style?.layout }\n\t\t\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\t\t\tonChange={ updateLayout }\n\t\t\t\t\t\tgridClientId={ rootClientId }\n\t\t\t\t\t\tblockClientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tuseBlockProps: useBlockPropsChildLayoutStyles,\n\tedit: ChildLayoutControlsPure,\n\tattributeKeys: [ 'style' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AAKzB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,wBAAwB;AACjC,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,OAAO,wBAAwB;AAC/B,SAAS,qBAAqB;AAC9B,SAAS,kCAAkC;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\nimport { useStyleOverride } from './utils';\nimport { useLayout } from '../components/block-list/layout';\nimport {\n\tGridVisualizer,\n\tGridItemResizer,\n\tGridItemMovers,\n} from '../components/grid';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\nimport useBlockVisibility from '../components/block-visibility/use-block-visibility';\nimport { deviceTypeKey } from '../store/private-keys';\nimport { BLOCK_VISIBILITY_VIEWPORTS } from '../components/block-visibility/constants';\nimport {\n\tDEFAULT_BLOCK_STYLE_STATE,\n\tgetStyleForState,\n} from './block-style-state';\n\n// Used for generating the instance ID\nconst LAYOUT_CHILD_BLOCK_PROPS_REFERENCE = {};\n// Keep in sync with WP_Theme_JSON_Gutenberg::RESPONSIVE_BREAKPOINTS.\nconst RESPONSIVE_BREAKPOINTS = {\n\t'@mobile': '@media (width <= 480px)',\n\t'@tablet': '@media (480px < width <= 782px)',\n};\n\n// These are the serialized `selfStretch` values. `max` used to be called\n// \"Fixed\" in the UI, but was renamed and replaced by `fixedNoShrink`.\nconst FLEX_CHILD_LAYOUT_VALUES = {\n\tfit: 'fit',\n\tgrow: 'fill',\n\tmax: 'fixed',\n\tfixed: 'fixedNoShrink',\n};\n\nconst FLEX_SIZE_VALUES = [\n\tFLEX_CHILD_LAYOUT_VALUES.max,\n\tFLEX_CHILD_LAYOUT_VALUES.fixed,\n];\n\nfunction isFlexSizeValue( value ) {\n\treturn FLEX_SIZE_VALUES.includes( value );\n}\n\nfunction serializeRule( { selector, declarations } ) {\n\treturn `${ selector } {\n\t\t${ Object.entries( declarations )\n\t\t\t.map( ( [ property, value ] ) => `${ property }: ${ value }` )\n\t\t\t.join( '; ' ) };\n\t}`;\n}\n\nexport function getChildLayoutStyleRules( {\n\tselector,\n\tlayout = {},\n\tviewportOverrides,\n\tparentLayout = {},\n\tincludeContainerQuery = true,\n} ) {\n\tconst hasViewportOverrides = viewportOverrides !== undefined;\n\tconst effectiveLayout = hasViewportOverrides\n\t\t? {\n\t\t\t\t...layout,\n\t\t\t\t...viewportOverrides,\n\t\t }\n\t\t: layout;\n\tconst hasViewportOverride = ( key ) =>\n\t\tObject.hasOwn( viewportOverrides || {}, key );\n\tconst {\n\t\tselfStretch,\n\t\tflexSize,\n\t\tcolumnStart,\n\t\trowStart,\n\t\tcolumnSpan,\n\t\trowSpan,\n\t} = effectiveLayout;\n\tconst baseSelfStretch = layout.selfStretch;\n\tconst { columnCount, minimumColumnWidth } = parentLayout;\n\tconst rules = [];\n\n\tconst declarations = {};\n\tif (\n\t\t! hasViewportOverrides ||\n\t\thasViewportOverride( 'selfStretch' ) ||\n\t\thasViewportOverride( 'flexSize' )\n\t) {\n\t\tif (\n\t\t\thasViewportOverrides &&\n\t\t\t( selfStretch === FLEX_CHILD_LAYOUT_VALUES.fit ||\n\t\t\t\tselfStretch === FLEX_CHILD_LAYOUT_VALUES.grow ) &&\n\t\t\tisFlexSizeValue( baseSelfStretch ) &&\n\t\t\tlayout.flexSize\n\t\t) {\n\t\t\tdeclarations[ 'flex-basis' ] = 'unset';\n\t\t\tif ( baseSelfStretch === FLEX_CHILD_LAYOUT_VALUES.fixed ) {\n\t\t\t\tdeclarations[ 'flex-shrink' ] = 'unset';\n\t\t\t}\n\t\t}\n\t\tif ( isFlexSizeValue( selfStretch ) && flexSize ) {\n\t\t\tdeclarations[ 'flex-basis' ] = flexSize;\n\t\t\tif ( selfStretch === FLEX_CHILD_LAYOUT_VALUES.fixed ) {\n\t\t\t\tdeclarations[ 'flex-shrink' ] = '0';\n\t\t\t} else if (\n\t\t\t\thasViewportOverrides &&\n\t\t\t\tbaseSelfStretch === FLEX_CHILD_LAYOUT_VALUES.fixed\n\t\t\t) {\n\t\t\t\tdeclarations[ 'flex-shrink' ] = 'unset';\n\t\t\t}\n\t\t\tdeclarations[ 'box-sizing' ] = 'border-box';\n\t\t} else if ( selfStretch === FLEX_CHILD_LAYOUT_VALUES.grow ) {\n\t\t\tdeclarations[ 'flex-grow' ] = '1';\n\t\t}\n\t}\n\n\tif (\n\t\t! hasViewportOverrides ||\n\t\thasViewportOverride( 'columnStart' ) ||\n\t\thasViewportOverride( 'columnSpan' )\n\t) {\n\t\tif ( columnStart && columnSpan ) {\n\t\t\tdeclarations[\n\t\t\t\t'grid-column'\n\t\t\t] = `${ columnStart } / span ${ columnSpan }`;\n\t\t} else if ( columnStart ) {\n\t\t\tdeclarations[ 'grid-column' ] = `${ columnStart }`;\n\t\t} else if ( columnSpan ) {\n\t\t\tdeclarations[ 'grid-column' ] = `span ${ columnSpan }`;\n\t\t}\n\t}\n\n\tif (\n\t\t! hasViewportOverrides ||\n\t\thasViewportOverride( 'rowStart' ) ||\n\t\thasViewportOverride( 'rowSpan' )\n\t) {\n\t\tif ( rowStart && rowSpan ) {\n\t\t\tdeclarations[ 'grid-row' ] = `${ rowStart } / span ${ rowSpan }`;\n\t\t} else if ( rowStart ) {\n\t\t\tdeclarations[ 'grid-row' ] = `${ rowStart }`;\n\t\t} else if ( rowSpan ) {\n\t\t\tdeclarations[ 'grid-row' ] = `span ${ rowSpan }`;\n\t\t}\n\t}\n\n\tif ( Object.keys( declarations ).length ) {\n\t\trules.push( { selector, declarations } );\n\t}\n\n\tif ( includeContainerQuery && ! hasViewportOverrides ) {\n\t\t/**\n\t\t * If minimumColumnWidth is set on the parent, or if no\n\t\t * columnCount is set, the grid is responsive so a\n\t\t * container query is needed for the span to resize.\n\t\t */\n\t\tif (\n\t\t\t( columnSpan || columnStart ) &&\n\t\t\t( minimumColumnWidth || ! columnCount )\n\t\t) {\n\t\t\tlet parentColumnValue = parseFloat( minimumColumnWidth );\n\t\t\t/**\n\t\t\t * 12rem is the default minimumColumnWidth value.\n\t\t\t * If parentColumnValue is not a number, default to 12.\n\t\t\t */\n\t\t\tif ( isNaN( parentColumnValue ) ) {\n\t\t\t\tparentColumnValue = 12;\n\t\t\t}\n\n\t\t\tlet parentColumnUnit = minimumColumnWidth?.replace(\n\t\t\t\tparentColumnValue,\n\t\t\t\t''\n\t\t\t);\n\t\t\t/**\n\t\t\t * Check that parent column unit is either 'px', 'rem' or 'em'.\n\t\t\t * If not, default to 'rem'.\n\t\t\t */\n\t\t\tif ( ! [ 'px', 'rem', 'em' ].includes( parentColumnUnit ) ) {\n\t\t\t\tparentColumnUnit = 'rem';\n\t\t\t}\n\n\t\t\tlet numColsToBreakAt = 2;\n\n\t\t\tif ( columnSpan && columnStart ) {\n\t\t\t\tnumColsToBreakAt = columnSpan + columnStart - 1;\n\t\t\t} else if ( columnSpan ) {\n\t\t\t\tnumColsToBreakAt = columnSpan;\n\t\t\t} else {\n\t\t\t\tnumColsToBreakAt = columnStart;\n\t\t\t}\n\n\t\t\tconst defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5;\n\t\t\tconst containerQueryValue =\n\t\t\t\tnumColsToBreakAt * parentColumnValue +\n\t\t\t\t( numColsToBreakAt - 1 ) * defaultGapValue;\n\t\t\t// For blocks that only span one column, we want to remove any rowStart values as\n\t\t\t// the container reduces in size, so that blocks are still arranged in markup order.\n\t\t\tconst minimumContainerQueryValue =\n\t\t\t\tparentColumnValue * 2 + defaultGapValue - 1;\n\t\t\t// If a span is set we want to preserve it as long as possible, otherwise we just reset the value.\n\t\t\tconst gridColumnValue =\n\t\t\t\tcolumnSpan && columnSpan > 1 ? '1/-1' : 'auto';\n\n\t\t\trules.push( {\n\t\t\t\trulesGroup: `@container (max-width: ${ Math.max(\n\t\t\t\t\tcontainerQueryValue,\n\t\t\t\t\tminimumContainerQueryValue\n\t\t\t\t) }${ parentColumnUnit })`,\n\t\t\t\tselector,\n\t\t\t\tdeclarations: {\n\t\t\t\t\t'grid-column': gridColumnValue,\n\t\t\t\t\t'grid-row': 'auto',\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t}\n\n\treturn rules;\n}\n\nexport function getChildLayoutStyles( {\n\tselector,\n\tlayout = {},\n\tparentLayout = {},\n\tincludeContainerQuery = true,\n} ) {\n\treturn getChildLayoutStyleRules( {\n\t\tselector,\n\t\tlayout,\n\t\tparentLayout,\n\t\tincludeContainerQuery,\n\t} )\n\t\t.map( ( rule ) => {\n\t\t\tconst serializedRule = serializeRule( rule );\n\t\t\treturn rule.rulesGroup\n\t\t\t\t? `${ rule.rulesGroup } {\n\t\t\t\t${ serializedRule }\n\t\t\t}`\n\t\t\t\t: serializedRule;\n\t\t} )\n\t\t.join( '' );\n}\n\nexport function getResponsiveChildLayoutStyles( {\n\tstyle = {},\n\tselector,\n\tparentLayout = {},\n} ) {\n\tconst baseLayout = style?.layout ?? {};\n\n\treturn Object.entries( RESPONSIVE_BREAKPOINTS )\n\t\t.map( ( [ viewport, mediaQuery ] ) => {\n\t\t\tconst viewportLayout = getStyleForState( style, {\n\t\t\t\tviewport,\n\t\t\t\tpseudo: DEFAULT_BLOCK_STYLE_STATE.pseudo,\n\t\t\t} )?.layout;\n\t\t\tif ( ! viewportLayout || ! Object.keys( viewportLayout ).length ) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\tconst viewportRules = getChildLayoutStyleRules( {\n\t\t\t\tselector,\n\t\t\t\tlayout: baseLayout,\n\t\t\t\tviewportOverrides: viewportLayout,\n\t\t\t\tparentLayout,\n\t\t\t\tincludeContainerQuery: false,\n\t\t\t} );\n\t\t\tconst css = viewportRules.map( serializeRule ).join( '' );\n\n\t\t\treturn css ? `${ mediaQuery }{${ css }}` : '';\n\t\t} )\n\t\t.filter( Boolean )\n\t\t.join( '' );\n}\n\nfunction useBlockPropsChildLayoutStyles( { style } ) {\n\tconst shouldRenderChildLayoutStyles = useSelect( ( select ) => {\n\t\treturn ! select( blockEditorStore ).getSettings().disableLayoutStyles;\n\t} );\n\tconst layout = style?.layout ?? {};\n\tconst { columnStart, rowStart, columnSpan, rowSpan } = layout;\n\tconst parentLayout = useLayout() || {};\n\tconst id = useInstanceId( LAYOUT_CHILD_BLOCK_PROPS_REFERENCE );\n\tconst selector = `.wp-container-content-${ id }`;\n\n\t// Check that the grid layout attributes are of the correct type, so that we don't accidentally\n\t// write code that stores a string attribute instead of a number.\n\tif ( process.env.NODE_ENV === 'development' ) {\n\t\tif ( columnStart && typeof columnStart !== 'number' ) {\n\t\t\tthrow new Error( 'columnStart must be a number' );\n\t\t}\n\t\tif ( rowStart && typeof rowStart !== 'number' ) {\n\t\t\tthrow new Error( 'rowStart must be a number' );\n\t\t}\n\t\tif ( columnSpan && typeof columnSpan !== 'number' ) {\n\t\t\tthrow new Error( 'columnSpan must be a number' );\n\t\t}\n\t\tif ( rowSpan && typeof rowSpan !== 'number' ) {\n\t\t\tthrow new Error( 'rowSpan must be a number' );\n\t\t}\n\t}\n\n\tlet css = '';\n\tif ( shouldRenderChildLayoutStyles ) {\n\t\tcss = [\n\t\t\tgetChildLayoutStyles( {\n\t\t\t\tselector,\n\t\t\t\tlayout,\n\t\t\t\tparentLayout,\n\t\t\t} ),\n\t\t\tgetResponsiveChildLayoutStyles( {\n\t\t\t\tstyle,\n\t\t\t\tselector,\n\t\t\t\tparentLayout,\n\t\t\t} ),\n\t\t].join( '' );\n\t}\n\n\tuseStyleOverride( { css } );\n\n\t// Only attach a container class if there is generated CSS to be attached.\n\tif ( ! css ) {\n\t\treturn;\n\t}\n\n\t// Attach a `wp-container-content` id-based classname.\n\treturn { className: `wp-container-content-${ id }` };\n}\n\nfunction ChildLayoutControlsPure( { clientId, style, setAttributes } ) {\n\tconst parentLayout = useLayout() || {};\n\tconst {\n\t\ttype: parentLayoutType = 'default',\n\t\tallowSizingOnChildren = false,\n\t\tisManualPlacement,\n\t} = parentLayout;\n\n\tif ( parentLayoutType !== 'grid' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<GridTools\n\t\t\tclientId={ clientId }\n\t\t\tstyle={ style }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tallowSizingOnChildren={ allowSizingOnChildren }\n\t\t\tisManualPlacement={ isManualPlacement }\n\t\t\tparentLayout={ parentLayout }\n\t\t/>\n\t);\n}\n\nfunction GridTools( {\n\tclientId,\n\tstyle,\n\tsetAttributes,\n\tallowSizingOnChildren,\n\tisManualPlacement,\n\tparentLayout,\n} ) {\n\tconst {\n\t\trootClientId,\n\t\tisVisible,\n\t\tparentBlockVisibility,\n\t\tblockBlockVisibility,\n\t\tdeviceType,\n\t\tisChildBlockAGrid,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetSettings,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst _rootClientId = getBlockRootClientId( clientId );\n\n\t\t\tif (\n\t\t\t\tgetTemplateLock( _rootClientId ) ||\n\t\t\t\tgetBlockEditingMode( _rootClientId ) !== 'default'\n\t\t\t) {\n\t\t\t\treturn {\n\t\t\t\t\trootClientId: _rootClientId,\n\t\t\t\t\tisVisible: false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst parentAttributes = getBlockAttributes( _rootClientId );\n\t\t\tconst blockAttributes = getBlockAttributes( clientId );\n\t\t\tconst settings = getSettings();\n\t\t\tconst currentDeviceType =\n\t\t\t\tsettings?.[ deviceTypeKey ]?.toLowerCase() ||\n\t\t\t\tBLOCK_VISIBILITY_VIEWPORTS.desktop.key;\n\n\t\t\treturn {\n\t\t\t\trootClientId: _rootClientId,\n\t\t\t\tisVisible: true,\n\t\t\t\tparentBlockVisibility:\n\t\t\t\t\tparentAttributes?.metadata?.blockVisibility,\n\t\t\t\tblockBlockVisibility:\n\t\t\t\t\tblockAttributes?.metadata?.blockVisibility,\n\t\t\t\tdeviceType: currentDeviceType,\n\t\t\t\t// Check if the selected child block is itself a grid.\n\t\t\t\tisChildBlockAGrid: blockAttributes?.layout?.type === 'grid',\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Get the block's DOM element to derive the canvas iframe window,\n\t// so viewport detection matches the actual block rendering context\n\tconst blockElement = useBlockElement( clientId );\n\tconst rawCanvasView = blockElement?.ownerDocument?.defaultView;\n\tconst canvasView = rawCanvasView === null ? undefined : rawCanvasView;\n\n\tconst {\n\t\tisBlockCurrentlyHidden: isParentBlockCurrentlyHidden,\n\t\tcurrentViewport,\n\t} = useBlockVisibility( {\n\t\tblockVisibility: parentBlockVisibility,\n\t\tdeviceType,\n\t\tview: canvasView,\n\t} );\n\n\t// Check whether any ancestor of the parent grid is hidden at the viewport\n\t// actually detected from the canvas, so it stays consistent with how\n\t// blocks are hidden.\n\tconst isAnyAncestorHidden = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! rootClientId ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tconst { isBlockParentHiddenAtViewport } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\treturn isBlockParentHiddenAtViewport(\n\t\t\t\trootClientId,\n\t\t\t\tcurrentViewport\n\t\t\t);\n\t\t},\n\t\t[ rootClientId, currentViewport ]\n\t);\n\n\tconst { isBlockCurrentlyHidden: isBlockItselfCurrentlyHidden } =\n\t\tuseBlockVisibility( {\n\t\t\tblockVisibility: blockBlockVisibility,\n\t\t\tdeviceType,\n\t\t\tview: canvasView,\n\t\t} );\n\n\t// Use useState() instead of useRef() so that GridItemResizer updates when ref is set.\n\tconst [ resizerBounds, setResizerBounds ] = useState();\n\n\tconst childGridClientId = isChildBlockAGrid ? clientId : undefined;\n\n\tif ( ! isVisible || isParentBlockCurrentlyHidden || isAnyAncestorHidden ) {\n\t\treturn null;\n\t}\n\n\tconst showResizer = allowSizingOnChildren && ! isBlockItselfCurrentlyHidden;\n\n\tfunction updateLayout( layout ) {\n\t\tsetAttributes( {\n\t\t\tstyle: {\n\t\t\t\t...style,\n\t\t\t\tlayout: {\n\t\t\t\t\t...style?.layout,\n\t\t\t\t\t...layout,\n\t\t\t\t},\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<GridVisualizer\n\t\t\t\tclientId={ rootClientId }\n\t\t\t\tcontentRef={ setResizerBounds }\n\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\tchildGridClientId={ childGridClientId }\n\t\t\t/>\n\t\t\t{ showResizer && (\n\t\t\t\t<GridItemResizer\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t// Don't allow resizing beyond the grid visualizer.\n\t\t\t\t\tbounds={ resizerBounds }\n\t\t\t\t\tonChange={ updateLayout }\n\t\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isManualPlacement &&\n\t\t\t\twindow.__experimentalEnableGridInteractivity && (\n\t\t\t\t\t<GridItemMovers\n\t\t\t\t\t\tlayout={ style?.layout }\n\t\t\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\t\t\tonChange={ updateLayout }\n\t\t\t\t\t\tgridClientId={ rootClientId }\n\t\t\t\t\t\tblockClientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tuseBlockProps: useBlockPropsChildLayoutStyles,\n\tedit: ChildLayoutControlsPure,\n\tattributeKeys: [ 'style' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AAKzB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,cAAc;AACvB,SAAS,wBAAwB;AACjC,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,uBAAuB;AAChC,OAAO,wBAAwB;AAC/B,SAAS,qBAAqB;AAC9B,SAAS,kCAAkC;AAC3C;AAAA,EACC;AAAA,EACA;AAAA,OACM;AAoUL,SAuIA,UAvIA,KAuIA,YAvIA;AAjUF,IAAM,qCAAqC,CAAC;AAE5C,IAAM,yBAAyB;AAAA,EAC9B,WAAW;AAAA,EACX,WAAW;AACZ;AAIA,IAAM,2BAA2B;AAAA,EAChC,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AACR;AAEA,IAAM,mBAAmB;AAAA,EACxB,yBAAyB;AAAA,EACzB,yBAAyB;AAC1B;AAEA,SAAS,gBAAiB,OAAQ;AACjC,SAAO,iBAAiB,SAAU,KAAM;AACzC;AAEA,SAAS,cAAe,EAAE,UAAU,aAAa,GAAI;AACpD,SAAO,GAAI,QAAS;AAAA,IAChB,OAAO,QAAS,YAAa,EAC9B,IAAK,CAAE,CAAE,UAAU,KAAM,MAAO,GAAI,QAAS,KAAM,KAAM,EAAG,EAC5D,KAAM,IAAK,CAAE;AAAA;AAEjB;AAEO,SAAS,yBAA0B;AAAA,EACzC;AAAA,EACA,SAAS,CAAC;AAAA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;AACZ,WAAO;AAAA,EACR;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -39,8 +39,8 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
39
39
|
var VARIATION_PREFIX = "is-style-";
|
|
40
40
|
var layoutBlockSupportKey = "layout";
|
|
41
41
|
var RESPONSIVE_BREAKPOINTS = {
|
|
42
|
-
mobile: "@media (width <= 480px)",
|
|
43
|
-
tablet: "@media (480px < width <= 782px)"
|
|
42
|
+
"@mobile": "@media (width <= 480px)",
|
|
43
|
+
"@tablet": "@media (480px < width <= 782px)"
|
|
44
44
|
};
|
|
45
45
|
var CHILD_LAYOUT_KEYS = [
|
|
46
46
|
"selfStretch",
|
|
@@ -149,7 +149,10 @@ function getResponsiveLayoutStyles({
|
|
|
149
149
|
globalBlockGapValue
|
|
150
150
|
}) {
|
|
151
151
|
return Object.entries(RESPONSIVE_BREAKPOINTS).map(([viewport, mediaQuery]) => {
|
|
152
|
-
const viewportStyle = attributes?.style
|
|
152
|
+
const viewportStyle = getStyleForState(attributes?.style, {
|
|
153
|
+
viewport,
|
|
154
|
+
pseudo: DEFAULT_BLOCK_STYLE_STATE.pseudo
|
|
155
|
+
});
|
|
153
156
|
const viewportLayout = getLayoutContainerValues(
|
|
154
157
|
viewportStyle?.layout
|
|
155
158
|
);
|