@wordpress/block-editor 12.25.0 → 12.26.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 +9 -3
- package/README.md +6 -0
- package/build/components/block-actions/index.js +4 -2
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/ui.js +2 -2
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-card/index.js +2 -2
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-compare/index.js +2 -2
- package/build/components/block-compare/index.js.map +1 -1
- package/build/components/block-edit/edit.js +2 -2
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-icon/index.js +2 -2
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-inspector/index.js +1 -1
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block.js +4 -4
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +2 -2
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +2 -2
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +5 -2
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-scroll-into-view.js +44 -0
- package/build/components/block-list/use-block-props/use-scroll-into-view.js.map +1 -0
- package/build/components/block-list-appender/index.js +2 -2
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-mover/button.js +2 -2
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +2 -2
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +26 -5
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-popover/cover.js +9 -6
- package/build/components/block-popover/cover.js.map +1 -1
- package/build/components/block-popover/inbetween.js +2 -2
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +22 -4
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/index.js +2 -2
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +8 -5
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +10 -7
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/index.js +2 -2
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +3 -3
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +2 -2
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/block-toolbar-breadcrumb.js +4 -4
- package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -1
- package/build/components/block-tools/block-toolbar-popover.js +2 -2
- package/build/components/block-tools/block-toolbar-popover.js.map +1 -1
- package/build/components/block-tools/empty-block-inserter.js +2 -2
- package/build/components/block-tools/empty-block-inserter.js.map +1 -1
- package/build/components/block-tools/index.js +20 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +4 -4
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +66 -22
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-variation-picker/index.js +2 -2
- package/build/components/block-variation-picker/index.js.map +1 -1
- package/build/components/button-block-appender/index.js +2 -2
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/child-layout-control/index.js +2 -2
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/colors-gradients/control.js +3 -3
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +2 -2
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +2 -2
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/convert-to-group-buttons/index.js +6 -0
- package/build/components/convert-to-group-buttons/index.js.map +1 -1
- package/build/components/default-block-appender/index.js +2 -2
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/dimensions-tool/aspect-ratio-tool.js +30 -36
- package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -1
- package/build/components/global-styles/background-panel.js +3 -3
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +3 -3
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +4 -4
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +2 -2
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/shadow-panel-components.js +4 -4
- package/build/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +1 -1
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/grid-visualizer/grid-item-resizer.js +141 -24
- package/build/components/grid-visualizer/grid-item-resizer.js.map +1 -1
- package/build/components/grid-visualizer/grid-visualizer.js +11 -5
- package/build/components/grid-visualizer/grid-visualizer.js.map +1 -1
- package/build/components/iframe/index.js +69 -30
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js +53 -36
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build/components/image-editor/cropper.js +2 -2
- package/build/components/image-editor/cropper.js.map +1 -1
- package/build/components/image-editor/index.js +1 -1
- package/build/components/image-editor/index.js.map +1 -1
- package/build/components/index.js +8 -0
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/button-block-appender.js +2 -2
- package/build/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build/components/inner-blocks/index.js +22 -21
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/index.js +9 -0
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/block-types-tab.js +5 -3
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js +11 -2
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +12 -5
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/index.js +2 -2
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/library.js +8 -2
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +2 -2
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/menu.js +72 -56
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -2
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/tabs.js +17 -5
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inserter-list-item/index.js +3 -3
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +9 -0
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/link-control/index.js +2 -2
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/link-preview.js +3 -3
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-results.js +2 -2
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/list-view/block-contents.js +2 -2
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block-select-button.js +11 -3
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +35 -12
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/drop-indicator.js +3 -3
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js +2 -2
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/leaf.js +2 -2
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/media-placeholder/index.js +4 -4
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +2 -2
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/plain-text/index.js +2 -2
- package/build/components/plain-text/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +18 -0
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/responsive-block-control/index.js +2 -2
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/rich-text/event-listeners/enter.js +33 -42
- package/build/components/rich-text/event-listeners/enter.js.map +1 -1
- package/build/components/rich-text/event-listeners/paste-handler.js +22 -42
- package/build/components/rich-text/event-listeners/paste-handler.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js +2 -2
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +9 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +2 -2
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/multiline.js +30 -2
- package/build/components/rich-text/multiline.js.map +1 -1
- package/build/components/segmented-text-control/index.js +2 -2
- package/build/components/segmented-text-control/index.js.map +1 -1
- package/build/components/text-alignment-control/index.js +2 -2
- package/build/components/text-alignment-control/index.js.map +1 -1
- package/build/components/text-decoration-control/index.js +2 -2
- package/build/components/text-decoration-control/index.js.map +1 -1
- package/build/components/text-transform-control/index.js +2 -2
- package/build/components/text-transform-control/index.js.map +1 -1
- package/build/components/url-input/index.js +4 -4
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/link-editor.js +2 -2
- package/build/components/url-popover/link-editor.js.map +1 -1
- package/build/components/url-popover/link-viewer-url.js +2 -2
- package/build/components/url-popover/link-viewer-url.js.map +1 -1
- package/build/components/url-popover/link-viewer.js +2 -2
- package/build/components/url-popover/link-viewer.js.map +1 -1
- package/build/components/warning/index.js +2 -2
- package/build/components/warning/index.js.map +1 -1
- package/build/components/writing-flow/index.js +2 -2
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-clipboard-handler.js +77 -30
- package/build/components/writing-flow/use-clipboard-handler.js.map +1 -1
- package/build/components/writing-flow/use-input.js +44 -2
- package/build/components/writing-flow/use-input.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +6 -1
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/components/writing-mode-control/index.js +2 -2
- package/build/components/writing-mode-control/index.js.map +1 -1
- package/build/hooks/align.js +2 -2
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/background.js +1 -1
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/border.js +3 -3
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +3 -3
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +5 -28
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/custom-class-name.js +2 -2
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/custom-class-name.native.js +2 -2
- package/build/hooks/custom-class-name.native.js.map +1 -1
- package/build/hooks/dimensions.js +2 -2
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/layout-child.js +16 -8
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/layout.js +2 -2
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +2 -2
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/text-align.js +3 -3
- package/build/hooks/text-align.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +39 -13
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/use-color-props.js +2 -2
- package/build/hooks/use-color-props.js.map +1 -1
- package/build/hooks/use-typography-props.js +2 -2
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/hooks/utils.js +2 -2
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/grid.js +7 -6
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +4 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +134 -40
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +26 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-keys.js +2 -1
- package/build/store/private-keys.js.map +1 -1
- package/build/store/private-selectors.js +6 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/selectors.js +4 -1
- package/build/store/selectors.js.map +1 -1
- package/build/utils/selection.js +8 -0
- package/build/utils/selection.js.map +1 -1
- package/build/utils/transform-styles/index.js +12 -7
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +4 -2
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +2 -2
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-card/index.js +2 -2
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-compare/index.js +2 -2
- package/build-module/components/block-compare/index.js.map +1 -1
- package/build-module/components/block-edit/edit.js +2 -2
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-icon/index.js +2 -2
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -1
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block.js +4 -4
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +2 -2
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +2 -2
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +5 -2
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-scroll-into-view.js +37 -0
- package/build-module/components/block-list/use-block-props/use-scroll-into-view.js.map +1 -0
- package/build-module/components/block-list-appender/index.js +2 -2
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-mover/button.js +2 -2
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +2 -2
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +27 -6
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-popover/cover.js +9 -5
- package/build-module/components/block-popover/cover.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +2 -2
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +21 -3
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/index.js +2 -2
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +8 -5
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +10 -7
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +2 -2
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +3 -3
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +2 -2
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js +4 -4
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-popover.js +2 -2
- package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -1
- package/build-module/components/block-tools/empty-block-inserter.js +2 -2
- package/build-module/components/block-tools/empty-block-inserter.js.map +1 -1
- package/build-module/components/block-tools/index.js +20 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +4 -4
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +67 -23
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +2 -2
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/button-block-appender/index.js +2 -2
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +2 -2
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +3 -3
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +2 -2
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +2 -2
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.js +7 -1
- package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +2 -2
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/dimensions-tool/aspect-ratio-tool.js +30 -36
- package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +3 -3
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +3 -3
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +4 -4
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +2 -2
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +4 -4
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/grid-visualizer/grid-item-resizer.js +141 -24
- package/build-module/components/grid-visualizer/grid-item-resizer.js.map +1 -1
- package/build-module/components/grid-visualizer/grid-visualizer.js +12 -6
- package/build-module/components/grid-visualizer/grid-visualizer.js.map +1 -1
- package/build-module/components/iframe/index.js +70 -31
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +52 -36
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/image-editor/cropper.js +2 -2
- package/build-module/components/image-editor/cropper.js.map +1 -1
- package/build-module/components/image-editor/index.js +1 -1
- package/build-module/components/image-editor/index.js.map +1 -1
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/button-block-appender.js +2 -2
- package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +22 -21
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js +10 -1
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +6 -4
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js +11 -2
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +12 -5
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/index.js +2 -2
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/library.js +8 -2
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +2 -2
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/menu.js +72 -56
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -2
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/tabs.js +18 -6
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +3 -3
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +9 -0
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/link-control/index.js +2 -2
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +3 -3
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-results.js +2 -2
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +2 -2
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +11 -3
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +36 -13
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +3 -3
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js +2 -2
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/leaf.js +2 -2
- package/build-module/components/list-view/leaf.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +4 -4
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +2 -2
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/plain-text/index.js +2 -2
- package/build-module/components/plain-text/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +19 -1
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +2 -2
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/enter.js +33 -43
- package/build-module/components/rich-text/event-listeners/enter.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/paste-handler.js +23 -43
- package/build-module/components/rich-text/event-listeners/paste-handler.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +2 -2
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +9 -2
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +2 -2
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/multiline.js +31 -3
- package/build-module/components/rich-text/multiline.js.map +1 -1
- package/build-module/components/segmented-text-control/index.js +2 -2
- package/build-module/components/segmented-text-control/index.js.map +1 -1
- package/build-module/components/text-alignment-control/index.js +2 -2
- package/build-module/components/text-alignment-control/index.js.map +1 -1
- package/build-module/components/text-decoration-control/index.js +2 -2
- package/build-module/components/text-decoration-control/index.js.map +1 -1
- package/build-module/components/text-transform-control/index.js +2 -2
- package/build-module/components/text-transform-control/index.js.map +1 -1
- package/build-module/components/url-input/index.js +4 -4
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/link-editor.js +2 -2
- package/build-module/components/url-popover/link-editor.js.map +1 -1
- package/build-module/components/url-popover/link-viewer-url.js +2 -2
- package/build-module/components/url-popover/link-viewer-url.js.map +1 -1
- package/build-module/components/url-popover/link-viewer.js +2 -2
- package/build-module/components/url-popover/link-viewer.js.map +1 -1
- package/build-module/components/warning/index.js +2 -2
- package/build-module/components/warning/index.js.map +1 -1
- package/build-module/components/writing-flow/index.js +2 -2
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-clipboard-handler.js +78 -31
- package/build-module/components/writing-flow/use-clipboard-handler.js.map +1 -1
- package/build-module/components/writing-flow/use-input.js +45 -3
- package/build-module/components/writing-flow/use-input.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +6 -1
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/components/writing-mode-control/index.js +2 -2
- package/build-module/components/writing-mode-control/index.js.map +1 -1
- package/build-module/hooks/align.js +2 -2
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/background.js +1 -1
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/border.js +3 -3
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +3 -3
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +5 -28
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +2 -2
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/custom-class-name.native.js +2 -2
- package/build-module/hooks/custom-class-name.native.js.map +1 -1
- package/build-module/hooks/dimensions.js +2 -2
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/layout-child.js +16 -8
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/layout.js +2 -2
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +2 -2
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/text-align.js +3 -3
- package/build-module/hooks/text-align.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +39 -13
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/use-color-props.js +2 -2
- package/build-module/hooks/use-color-props.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +2 -2
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/hooks/utils.js +2 -2
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/grid.js +7 -6
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +5 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +136 -42
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +24 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-keys.js +1 -0
- package/build-module/store/private-keys.js.map +1 -1
- package/build-module/store/private-selectors.js +5 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/selectors.js +4 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/selection.js +7 -0
- package/build-module/utils/selection.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +12 -7
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +89 -96
- package/build-style/content.css +89 -96
- package/build-style/style-rtl.css +14 -4
- package/build-style/style.css +14 -4
- package/build-types/components/block-context/index.d.ts +1 -1
- package/build-types/components/block-context/index.d.ts.map +1 -1
- package/package.json +32 -32
- package/src/components/block-actions/index.js +5 -1
- package/src/components/block-alignment-control/ui.js +2 -2
- package/src/components/block-card/index.js +2 -2
- package/src/components/block-compare/index.js +2 -2
- package/src/components/block-content-overlay/content.scss +4 -37
- package/src/components/block-draggable/test/helpers.native.js +8 -8
- package/src/components/block-edit/edit.js +2 -2
- package/src/components/block-icon/index.js +2 -2
- package/src/components/block-inspector/index.js +2 -1
- package/src/components/block-list/block.js +4 -4
- package/src/components/block-list/block.native.js +2 -2
- package/src/components/block-list/content.scss +46 -73
- package/src/components/block-list/index.js +2 -2
- package/src/components/block-list/use-block-props/index.js +4 -2
- package/src/components/block-list/use-block-props/use-scroll-into-view.js +38 -0
- package/src/components/block-list-appender/index.js +2 -2
- package/src/components/block-mover/button.js +2 -2
- package/src/components/block-mover/index.js +2 -2
- package/src/components/block-patterns-list/index.js +29 -4
- package/src/components/block-popover/README.md +1 -1
- package/src/components/block-popover/cover.js +22 -7
- package/src/components/block-popover/inbetween.js +2 -2
- package/src/components/block-popover/index.js +24 -6
- package/src/components/block-preview/index.js +2 -2
- package/src/components/block-settings-menu/block-settings-dropdown.js +14 -6
- package/src/components/block-settings-menu-controls/index.js +25 -16
- package/src/components/block-styles/index.js +2 -2
- package/src/components/block-toolbar/index.js +3 -3
- package/src/components/block-tools/block-selection-button.js +2 -2
- package/src/components/block-tools/block-toolbar-breadcrumb.js +5 -5
- package/src/components/block-tools/block-toolbar-popover.js +4 -7
- package/src/components/block-tools/empty-block-inserter.js +2 -2
- package/src/components/block-tools/index.js +24 -3
- package/src/components/block-tools/insertion-point.js +4 -4
- package/src/components/block-tools/style.scss +8 -0
- package/src/components/block-tools/zoom-out-mode-inserters.js +73 -21
- package/src/components/block-variation-picker/index.js +2 -2
- package/src/components/button-block-appender/index.js +2 -2
- package/src/components/child-layout-control/index.js +14 -2
- package/src/components/colors-gradients/control.js +3 -3
- package/src/components/colors-gradients/dropdown.js +2 -2
- package/src/components/colors-gradients/panel-color-gradient-settings.js +2 -2
- package/src/components/colors-gradients/test/control.js +3 -3
- package/src/components/convert-to-group-buttons/index.js +10 -1
- package/src/components/default-block-appender/index.js +2 -2
- package/src/components/dimensions-tool/aspect-ratio-tool.js +40 -67
- package/src/components/dimensions-tool/test/index.js +10 -0
- package/src/components/editable-text/README.md +0 -4
- package/src/components/global-styles/background-panel.js +3 -3
- package/src/components/global-styles/color-panel.js +3 -3
- package/src/components/global-styles/dimensions-panel.js +4 -4
- package/src/components/global-styles/filters-panel.js +2 -2
- package/src/components/global-styles/shadow-panel-components.js +6 -9
- package/src/components/global-styles/test/get-global-styles-changes.js +0 -2
- package/src/components/global-styles/test/use-global-styles-output.js +5 -5
- package/src/components/global-styles/use-global-styles-output.js +1 -1
- package/src/components/grid-visualizer/grid-item-resizer.js +169 -40
- package/src/components/grid-visualizer/grid-visualizer.js +19 -6
- package/src/components/iframe/content.scss +63 -0
- package/src/components/iframe/index.js +119 -39
- package/src/components/image-editor/aspect-ratio-dropdown.js +91 -59
- package/src/components/image-editor/cropper.js +2 -2
- package/src/components/image-editor/index.js +1 -1
- package/src/components/image-editor/test/index.js +22 -0
- package/src/components/index.js +1 -0
- package/src/components/inner-blocks/button-block-appender.js +2 -2
- package/src/components/inner-blocks/index.js +19 -17
- package/src/components/inserter/block-patterns-explorer/pattern-list.js +2 -1
- package/src/components/inserter/block-patterns-tab/index.js +17 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +2 -1
- package/src/components/inserter/block-types-tab.js +7 -9
- package/src/components/inserter/hooks/use-insertion-point.js +15 -1
- package/src/components/inserter/hooks/use-patterns-state.js +18 -5
- package/src/components/inserter/index.js +4 -5
- package/src/components/inserter/library.js +6 -0
- package/src/components/inserter/media-tab/media-preview.js +2 -2
- package/src/components/inserter/menu.js +113 -107
- package/src/components/inserter/quick-inserter.js +2 -2
- package/src/components/inserter/style.scss +6 -8
- package/src/components/inserter/tabs.js +29 -15
- package/src/components/inserter-list-item/index.js +3 -3
- package/src/components/keyboard-shortcuts/index.js +12 -0
- package/src/components/line-height-control/test/index.js +16 -14
- package/src/components/link-control/index.js +2 -2
- package/src/components/link-control/link-preview.js +3 -3
- package/src/components/link-control/search-results.js +2 -2
- package/src/components/list-view/block-contents.js +2 -2
- package/src/components/list-view/block-select-button.js +14 -3
- package/src/components/list-view/block.js +54 -30
- package/src/components/list-view/drop-indicator.js +3 -3
- package/src/components/list-view/index.js +2 -2
- package/src/components/list-view/leaf.js +2 -5
- package/src/components/media-placeholder/index.js +4 -4
- package/src/components/media-replace-flow/index.js +2 -2
- package/src/components/plain-text/index.js +2 -2
- package/src/components/provider/use-block-sync.js +27 -1
- package/src/components/responsive-block-control/index.js +2 -2
- package/src/components/rich-text/README.md +0 -8
- package/src/components/rich-text/event-listeners/enter.js +28 -48
- package/src/components/rich-text/event-listeners/paste-handler.js +21 -58
- package/src/components/rich-text/format-toolbar/index.js +2 -2
- package/src/components/rich-text/index.js +10 -3
- package/src/components/rich-text/index.native.js +2 -2
- package/src/components/rich-text/multiline.js +31 -3
- package/src/components/segmented-text-control/index.js +2 -2
- package/src/components/text-alignment-control/index.js +2 -2
- package/src/components/text-decoration-control/index.js +2 -2
- package/src/components/text-transform-control/index.js +2 -2
- package/src/components/url-input/index.js +4 -4
- package/src/components/url-popover/link-editor.js +2 -2
- package/src/components/url-popover/link-viewer-url.js +2 -2
- package/src/components/url-popover/link-viewer.js +2 -2
- package/src/components/warning/index.js +2 -2
- package/src/components/writing-flow/index.js +2 -2
- package/src/components/writing-flow/use-clipboard-handler.js +107 -47
- package/src/components/writing-flow/use-input.js +75 -1
- package/src/components/writing-flow/use-tab-nav.js +10 -1
- package/src/components/writing-mode-control/index.js +2 -5
- package/src/content.scss +1 -0
- package/src/hooks/align.js +2 -2
- package/src/hooks/background.js +1 -1
- package/src/hooks/border.js +3 -3
- package/src/hooks/color.js +12 -19
- package/src/hooks/color.scss +1 -0
- package/src/hooks/content-lock-ui.js +16 -33
- package/src/hooks/custom-class-name.js +2 -2
- package/src/hooks/custom-class-name.native.js +2 -2
- package/src/hooks/dimensions.js +2 -2
- package/src/hooks/layout-child.js +34 -20
- package/src/hooks/layout.js +2 -2
- package/src/hooks/position.js +2 -2
- package/src/hooks/text-align.js +3 -3
- package/src/hooks/use-bindings-attributes.js +48 -16
- package/src/hooks/use-color-props.js +2 -2
- package/src/hooks/use-typography-props.js +2 -2
- package/src/hooks/utils.js +2 -2
- package/src/layouts/grid.js +3 -7
- package/src/private-apis.js +4 -0
- package/src/store/actions.js +225 -70
- package/src/store/private-actions.js +24 -0
- package/src/store/private-keys.js +1 -0
- package/src/store/private-selectors.js +15 -0
- package/src/store/selectors.js +4 -2
- package/src/utils/selection.js +8 -0
- package/src/utils/test/__snapshots__/transform-styles.js.snap +6 -0
- package/src/utils/test/transform-styles.js +14 -0
- package/src/utils/transform-styles/index.js +12 -9
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/rich-text/split-value.js +0 -81
- package/build/components/rich-text/split-value.js.map +0 -1
- package/build-module/components/rich-text/split-value.js +0 -75
- package/build-module/components/rich-text/split-value.js.map +0 -1
- package/src/components/rich-text/split-value.js +0 -64
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","addFilter","getBlockSupport","useMemo","Platform","useCallback","useSelect","getColorClassName","getColorObjectByAttributeValues","__experimentalGetGradientClass","cleanEmptyObject","transformStyles","shouldSkipSerialization","getBackgroundImageClasses","useSettings","InspectorControls","useHasColorPanel","default","StylesColorPanel","BlockColorContrastChecker","store","blockEditorStore","COLOR_SUPPORT_KEY","hasColorSupport","blockNameOrType","colorSupport","link","gradient","background","text","hasLinkColorSupport","blockType","OS","hasGradientSupport","gradients","hasBackgroundColorSupport","hasTextColorSupport","addAttributes","settings","attributes","backgroundColor","Object","assign","type","textColor","addSaveProps","props","hasGradient","style","shouldSerialize","feature","textClass","undefined","gradientClass","backgroundClass","serializeHasBackground","hasBackground","color","newClassName","className","elements","styleToAttributes","textColorValue","textColorSlug","startsWith","substring","length","backgroundColorValue","backgroundColorSlug","gradientValue","gradientSlug","updatedStyle","attributesToStyle","ColorInspectorControl","children","resetAllFilter","attributesResetAllFilter","existingStyle","createElement","group","ColorEdit","clientId","name","setAttributes","isEnabled","selector","select","getBlockAttributes","value","onChange","newStyle","defaultControls","enableContrastChecking","as","panelId","enableContrastChecker","useBlockProps","userPalette","themePalette","defaultPalette","colors","extraStyles","saveProps","hasBackgroundValue","attributeKeys","hasSupport","MIGRATION_PATHS","linkColor","addTransforms","result","source","index","results","destinationBlockType","activeSupports"],"sources":["@wordpress/block-editor/src/hooks/color.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useMemo, Platform, useCallback } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetColorClassName,\n\tgetColorObjectByAttributeValues,\n} from '../components/colors';\nimport { __experimentalGetGradientClass } from '../components/gradients';\nimport {\n\tcleanEmptyObject,\n\ttransformStyles,\n\tshouldSkipSerialization,\n} from './utils';\nimport { getBackgroundImageClasses } from './background';\nimport { useSettings } from '../components/use-settings';\nimport InspectorControls from '../components/inspector-controls';\nimport {\n\tuseHasColorPanel,\n\tdefault as StylesColorPanel,\n} from '../components/global-styles/color-panel';\nimport BlockColorContrastChecker from './contrast-checker';\nimport { store as blockEditorStore } from '../store';\n\nexport const COLOR_SUPPORT_KEY = 'color';\n\nconst hasColorSupport = ( blockNameOrType ) => {\n\tconst colorSupport = getBlockSupport( blockNameOrType, COLOR_SUPPORT_KEY );\n\treturn (\n\t\tcolorSupport &&\n\t\t( colorSupport.link === true ||\n\t\t\tcolorSupport.gradient === true ||\n\t\t\tcolorSupport.background !== false ||\n\t\t\tcolorSupport.text !== false )\n\t);\n};\n\nconst hasLinkColorSupport = ( blockType ) => {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn (\n\t\tcolorSupport !== null &&\n\t\ttypeof colorSupport === 'object' &&\n\t\t!! colorSupport.link\n\t);\n};\n\nconst hasGradientSupport = ( blockNameOrType ) => {\n\tconst colorSupport = getBlockSupport( blockNameOrType, COLOR_SUPPORT_KEY );\n\n\treturn (\n\t\tcolorSupport !== null &&\n\t\ttypeof colorSupport === 'object' &&\n\t\t!! colorSupport.gradients\n\t);\n};\n\nconst hasBackgroundColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.background !== false;\n};\n\nconst hasTextColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.text !== false;\n};\n\n/**\n * Filters registered block settings, extending attributes to include\n * `backgroundColor` and `textColor` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasColorSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( ! settings.attributes.backgroundColor ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tbackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\tif ( ! settings.attributes.textColor ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\ttextColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( hasGradientSupport( settings ) && ! settings.attributes.gradient ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tgradient: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject colors classnames.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object|string} blockNameOrType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( props, blockNameOrType, attributes ) {\n\tif (\n\t\t! hasColorSupport( blockNameOrType ) ||\n\t\tshouldSkipSerialization( blockNameOrType, COLOR_SUPPORT_KEY )\n\t) {\n\t\treturn props;\n\t}\n\n\tconst hasGradient = hasGradientSupport( blockNameOrType );\n\n\t// I'd have preferred to avoid the \"style\" attribute usage here\n\tconst { backgroundColor, textColor, gradient, style } = attributes;\n\n\tconst shouldSerialize = ( feature ) =>\n\t\t! shouldSkipSerialization(\n\t\t\tblockNameOrType,\n\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\tfeature\n\t\t);\n\n\t// Primary color classes must come before the `has-text-color`,\n\t// `has-background` and `has-link-color` classes to maintain backwards\n\t// compatibility and avoid block invalidations.\n\tconst textClass = shouldSerialize( 'text' )\n\t\t? getColorClassName( 'color', textColor )\n\t\t: undefined;\n\n\tconst gradientClass = shouldSerialize( 'gradients' )\n\t\t? __experimentalGetGradientClass( gradient )\n\t\t: undefined;\n\n\tconst backgroundClass = shouldSerialize( 'background' )\n\t\t? getColorClassName( 'background-color', backgroundColor )\n\t\t: undefined;\n\n\tconst serializeHasBackground =\n\t\tshouldSerialize( 'background' ) || shouldSerialize( 'gradients' );\n\tconst hasBackground =\n\t\tbackgroundColor ||\n\t\tstyle?.color?.background ||\n\t\t( hasGradient && ( gradient || style?.color?.gradient ) );\n\n\tconst newClassName = classnames(\n\t\tprops.className,\n\t\ttextClass,\n\t\tgradientClass,\n\t\t{\n\t\t\t// Don't apply the background class if there's a custom gradient.\n\t\t\t[ backgroundClass ]:\n\t\t\t\t( ! hasGradient || ! style?.color?.gradient ) &&\n\t\t\t\t!! backgroundClass,\n\t\t\t'has-text-color':\n\t\t\t\tshouldSerialize( 'text' ) &&\n\t\t\t\t( textColor || style?.color?.text ),\n\t\t\t'has-background': serializeHasBackground && hasBackground,\n\t\t\t'has-link-color':\n\t\t\t\tshouldSerialize( 'link' ) && style?.elements?.link?.color,\n\t\t}\n\t);\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\nfunction styleToAttributes( style ) {\n\tconst textColorValue = style?.color?.text;\n\tconst textColorSlug = textColorValue?.startsWith( 'var:preset|color|' )\n\t\t? textColorValue.substring( 'var:preset|color|'.length )\n\t\t: undefined;\n\tconst backgroundColorValue = style?.color?.background;\n\tconst backgroundColorSlug = backgroundColorValue?.startsWith(\n\t\t'var:preset|color|'\n\t)\n\t\t? backgroundColorValue.substring( 'var:preset|color|'.length )\n\t\t: undefined;\n\tconst gradientValue = style?.color?.gradient;\n\tconst gradientSlug = gradientValue?.startsWith( 'var:preset|gradient|' )\n\t\t? gradientValue.substring( 'var:preset|gradient|'.length )\n\t\t: undefined;\n\tconst updatedStyle = { ...style };\n\tupdatedStyle.color = {\n\t\t...updatedStyle.color,\n\t\ttext: textColorSlug ? undefined : textColorValue,\n\t\tbackground: backgroundColorSlug ? undefined : backgroundColorValue,\n\t\tgradient: gradientSlug ? undefined : gradientValue,\n\t};\n\treturn {\n\t\tstyle: cleanEmptyObject( updatedStyle ),\n\t\ttextColor: textColorSlug,\n\t\tbackgroundColor: backgroundColorSlug,\n\t\tgradient: gradientSlug,\n\t};\n}\n\nfunction attributesToStyle( attributes ) {\n\treturn {\n\t\t...attributes.style,\n\t\tcolor: {\n\t\t\t...attributes.style?.color,\n\t\t\ttext: attributes.textColor\n\t\t\t\t? 'var:preset|color|' + attributes.textColor\n\t\t\t\t: attributes.style?.color?.text,\n\t\t\tbackground: attributes.backgroundColor\n\t\t\t\t? 'var:preset|color|' + attributes.backgroundColor\n\t\t\t\t: attributes.style?.color?.background,\n\t\t\tgradient: attributes.gradient\n\t\t\t\t? 'var:preset|gradient|' + attributes.gradient\n\t\t\t\t: attributes.style?.color?.gradient,\n\t\t},\n\t};\n}\n\nfunction ColorInspectorControl( { children, resetAllFilter } ) {\n\tconst attributesResetAllFilter = useCallback(\n\t\t( attributes ) => {\n\t\t\tconst existingStyle = attributesToStyle( attributes );\n\t\t\tconst updatedStyle = resetAllFilter( existingStyle );\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\t...styleToAttributes( 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=\"color\"\n\t\t\tresetAllFilter={ attributesResetAllFilter }\n\t\t>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function ColorEdit( { clientId, name, setAttributes, settings } ) {\n\tconst isEnabled = useHasColorPanel( settings );\n\tfunction selector( select ) {\n\t\tconst { style, textColor, backgroundColor, gradient } =\n\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId ) || {};\n\t\treturn { style, textColor, backgroundColor, gradient };\n\t}\n\tconst { style, textColor, backgroundColor, gradient } = useSelect(\n\t\tselector,\n\t\t[ clientId ]\n\t);\n\tconst value = useMemo( () => {\n\t\treturn attributesToStyle( {\n\t\t\tstyle,\n\t\t\ttextColor,\n\t\t\tbackgroundColor,\n\t\t\tgradient,\n\t\t} );\n\t}, [ style, textColor, backgroundColor, gradient ] );\n\n\tconst onChange = ( newStyle ) => {\n\t\tsetAttributes( styleToAttributes( newStyle ) );\n\t};\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultControls = getBlockSupport( name, [\n\t\tCOLOR_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\tconst enableContrastChecking =\n\t\tPlatform.OS === 'web' &&\n\t\t! value?.color?.gradient &&\n\t\t( settings?.color?.text || settings?.color?.link ) &&\n\t\t// Contrast checking is enabled by default.\n\t\t// Deactivating it requires `enableContrastChecker` to have\n\t\t// an explicit value of `false`.\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\treturn (\n\t\t<StylesColorPanel\n\t\t\tas={ ColorInspectorControl }\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\tenableContrastChecker={\n\t\t\t\tfalse !==\n\t\t\t\tgetBlockSupport( name, [\n\t\t\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\t\t\t'enableContrastChecker',\n\t\t\t\t] )\n\t\t\t}\n\t\t>\n\t\t\t{ enableContrastChecking && (\n\t\t\t\t<BlockColorContrastChecker clientId={ clientId } />\n\t\t\t) }\n\t\t</StylesColorPanel>\n\t);\n}\n\nfunction useBlockProps( {\n\tname,\n\tbackgroundColor,\n\ttextColor,\n\tgradient,\n\tstyle,\n} ) {\n\tconst [ userPalette, themePalette, defaultPalette ] = useSettings(\n\t\t'color.palette.custom',\n\t\t'color.palette.theme',\n\t\t'color.palette.default'\n\t);\n\n\tconst colors = useMemo(\n\t\t() => [\n\t\t\t...( userPalette || [] ),\n\t\t\t...( themePalette || [] ),\n\t\t\t...( defaultPalette || [] ),\n\t\t],\n\t\t[ userPalette, themePalette, defaultPalette ]\n\t);\n\tif (\n\t\t! hasColorSupport( name ) ||\n\t\tshouldSkipSerialization( name, COLOR_SUPPORT_KEY )\n\t) {\n\t\treturn {};\n\t}\n\tconst extraStyles = {};\n\n\tif (\n\t\ttextColor &&\n\t\t! shouldSkipSerialization( name, COLOR_SUPPORT_KEY, 'text' )\n\t) {\n\t\textraStyles.color = getColorObjectByAttributeValues(\n\t\t\tcolors,\n\t\t\ttextColor\n\t\t)?.color;\n\t}\n\tif (\n\t\tbackgroundColor &&\n\t\t! shouldSkipSerialization( name, COLOR_SUPPORT_KEY, 'background' )\n\t) {\n\t\textraStyles.backgroundColor = getColorObjectByAttributeValues(\n\t\t\tcolors,\n\t\t\tbackgroundColor\n\t\t)?.color;\n\t}\n\n\tconst saveProps = addSaveProps( { style: extraStyles }, name, {\n\t\ttextColor,\n\t\tbackgroundColor,\n\t\tgradient,\n\t\tstyle,\n\t} );\n\n\tconst hasBackgroundValue =\n\t\tbackgroundColor ||\n\t\tstyle?.color?.background ||\n\t\tgradient ||\n\t\tstyle?.color?.gradient;\n\n\treturn {\n\t\t...saveProps,\n\t\tclassName: classnames(\n\t\t\tsaveProps.className,\n\t\t\t// Add background image classes in the editor, if not already handled by background color values.\n\t\t\t! hasBackgroundValue && getBackgroundImageClasses( style )\n\t\t),\n\t};\n}\n\nexport default {\n\tuseBlockProps,\n\taddSaveProps,\n\tattributeKeys: [ 'backgroundColor', 'textColor', 'gradient', 'style' ],\n\thasSupport: hasColorSupport,\n};\n\nconst MIGRATION_PATHS = {\n\tlinkColor: [ [ 'style', 'elements', 'link', 'color', 'text' ] ],\n\ttextColor: [ [ 'textColor' ], [ 'style', 'color', 'text' ] ],\n\tbackgroundColor: [\n\t\t[ 'backgroundColor' ],\n\t\t[ 'style', 'color', 'background' ],\n\t],\n\tgradient: [ [ 'gradient' ], [ 'style', 'color', 'gradient' ] ],\n};\n\nexport function addTransforms( result, source, index, results ) {\n\tconst destinationBlockType = result.name;\n\tconst activeSupports = {\n\t\tlinkColor: hasLinkColorSupport( destinationBlockType ),\n\t\ttextColor: hasTextColorSupport( destinationBlockType ),\n\t\tbackgroundColor: hasBackgroundColorSupport( destinationBlockType ),\n\t\tgradient: hasGradientSupport( destinationBlockType ),\n\t};\n\treturn transformStyles(\n\t\tactiveSupports,\n\t\tMIGRATION_PATHS,\n\t\tresult,\n\t\tsource,\n\t\tindex,\n\t\tresults\n\t);\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/color/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/color/addTransfor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ElF;AACb,CAAC;AAED,MAAMmF,eAAe,GAAG;EACvBC,SAAS,EAAE,CAAE,CAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAE,CAAE;EAC/D/D,SAAS,EAAE,CAAE,CAAE,WAAW,CAAE,EAAE,CAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAE,CAAE;EAC5DJ,eAAe,EAAE,CAChB,CAAE,iBAAiB,CAAE,EACrB,CAAE,OAAO,EAAE,OAAO,EAAE,YAAY,CAAE,CAClC;EACDb,QAAQ,EAAE,CAAE,CAAE,UAAU,CAAE,EAAE,CAAE,OAAO,EAAE,OAAO,EAAE,UAAU,CAAE;AAC7D,CAAC;AAED,OAAO,SAASiF,aAAaA,CAAEC,MAAM,EAAEC,MAAM,EAAEC,KAAK,EAAEC,OAAO,EAAG;EAC/D,MAAMC,oBAAoB,GAAGJ,MAAM,CAAC3B,IAAI;EACxC,MAAMgC,cAAc,GAAG;IACtBP,SAAS,EAAE7E,mBAAmB,CAAEmF,oBAAqB,CAAC;IACtDrE,SAAS,EAAER,mBAAmB,CAAE6E,oBAAqB,CAAC;IACtDzE,eAAe,EAAEL,yBAAyB,CAAE8E,oBAAqB,CAAC;IAClEtF,QAAQ,EAAEM,kBAAkB,CAAEgF,oBAAqB;EACpD,CAAC;EACD,OAAOtG,eAAe,CACrBuG,cAAc,EACdR,eAAe,EACfG,MAAM,EACNC,MAAM,EACNC,KAAK,EACLC,OACD,CAAC;AACF;AAEA/G,SAAS,CACR,0BAA0B,EAC1B,yBAAyB,EACzBoC,aACD,CAAC;AAEDpC,SAAS,CACR,2CAA2C,EAC3C,0BAA0B,EAC1B2G,aACD,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","addFilter","getBlockSupport","useMemo","Platform","useCallback","useSelect","getColorClassName","getColorObjectByAttributeValues","__experimentalGetGradientClass","cleanEmptyObject","transformStyles","shouldSkipSerialization","getBackgroundImageClasses","useSettings","InspectorControls","useHasColorPanel","default","StylesColorPanel","BlockColorContrastChecker","store","blockEditorStore","COLOR_SUPPORT_KEY","hasColorSupport","blockNameOrType","colorSupport","link","gradient","background","text","hasLinkColorSupport","blockType","OS","hasGradientSupport","gradients","hasBackgroundColorSupport","hasTextColorSupport","addAttributes","settings","attributes","backgroundColor","Object","assign","type","textColor","addSaveProps","props","hasGradient","style","shouldSerialize","feature","textClass","undefined","gradientClass","backgroundClass","serializeHasBackground","hasBackground","color","newClassName","className","elements","styleToAttributes","textColorValue","textColorSlug","startsWith","substring","length","backgroundColorValue","backgroundColorSlug","gradientValue","gradientSlug","updatedStyle","attributesToStyle","ColorInspectorControl","children","resetAllFilter","attributesResetAllFilter","existingStyle","createElement","group","ColorEdit","clientId","name","setAttributes","isEnabled","selector","select","getBlockAttributes","value","onChange","newStyle","defaultControls","enableContrastChecking","as","panelId","enableContrastChecker","useBlockProps","userPalette","themePalette","defaultPalette","colors","extraStyles","saveProps","hasBackgroundValue","attributeKeys","hasSupport","MIGRATION_PATHS","linkColor","addTransforms","result","source","index","results","destinationBlockType","activeSupports"],"sources":["@wordpress/block-editor/src/hooks/color.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useMemo, Platform, useCallback } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetColorClassName,\n\tgetColorObjectByAttributeValues,\n} from '../components/colors';\nimport { __experimentalGetGradientClass } from '../components/gradients';\nimport {\n\tcleanEmptyObject,\n\ttransformStyles,\n\tshouldSkipSerialization,\n} from './utils';\nimport { getBackgroundImageClasses } from './background';\nimport { useSettings } from '../components/use-settings';\nimport InspectorControls from '../components/inspector-controls';\nimport {\n\tuseHasColorPanel,\n\tdefault as StylesColorPanel,\n} from '../components/global-styles/color-panel';\nimport BlockColorContrastChecker from './contrast-checker';\nimport { store as blockEditorStore } from '../store';\n\nexport const COLOR_SUPPORT_KEY = 'color';\n\nconst hasColorSupport = ( blockNameOrType ) => {\n\tconst colorSupport = getBlockSupport( blockNameOrType, COLOR_SUPPORT_KEY );\n\treturn (\n\t\tcolorSupport &&\n\t\t( colorSupport.link === true ||\n\t\t\tcolorSupport.gradient === true ||\n\t\t\tcolorSupport.background !== false ||\n\t\t\tcolorSupport.text !== false )\n\t);\n};\n\nconst hasLinkColorSupport = ( blockType ) => {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn (\n\t\tcolorSupport !== null &&\n\t\ttypeof colorSupport === 'object' &&\n\t\t!! colorSupport.link\n\t);\n};\n\nconst hasGradientSupport = ( blockNameOrType ) => {\n\tconst colorSupport = getBlockSupport( blockNameOrType, COLOR_SUPPORT_KEY );\n\n\treturn (\n\t\tcolorSupport !== null &&\n\t\ttypeof colorSupport === 'object' &&\n\t\t!! colorSupport.gradients\n\t);\n};\n\nconst hasBackgroundColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.background !== false;\n};\n\nconst hasTextColorSupport = ( blockType ) => {\n\tconst colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.text !== false;\n};\n\n/**\n * Filters registered block settings, extending attributes to include\n * `backgroundColor` and `textColor` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasColorSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( ! settings.attributes.backgroundColor ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tbackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\tif ( ! settings.attributes.textColor ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\ttextColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( hasGradientSupport( settings ) && ! settings.attributes.gradient ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tgradient: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject colors classnames.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object|string} blockNameOrType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( props, blockNameOrType, attributes ) {\n\tif (\n\t\t! hasColorSupport( blockNameOrType ) ||\n\t\tshouldSkipSerialization( blockNameOrType, COLOR_SUPPORT_KEY )\n\t) {\n\t\treturn props;\n\t}\n\n\tconst hasGradient = hasGradientSupport( blockNameOrType );\n\n\t// I'd have preferred to avoid the \"style\" attribute usage here\n\tconst { backgroundColor, textColor, gradient, style } = attributes;\n\n\tconst shouldSerialize = ( feature ) =>\n\t\t! shouldSkipSerialization(\n\t\t\tblockNameOrType,\n\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\tfeature\n\t\t);\n\n\t// Primary color classes must come before the `has-text-color`,\n\t// `has-background` and `has-link-color` classes to maintain backwards\n\t// compatibility and avoid block invalidations.\n\tconst textClass = shouldSerialize( 'text' )\n\t\t? getColorClassName( 'color', textColor )\n\t\t: undefined;\n\n\tconst gradientClass = shouldSerialize( 'gradients' )\n\t\t? __experimentalGetGradientClass( gradient )\n\t\t: undefined;\n\n\tconst backgroundClass = shouldSerialize( 'background' )\n\t\t? getColorClassName( 'background-color', backgroundColor )\n\t\t: undefined;\n\n\tconst serializeHasBackground =\n\t\tshouldSerialize( 'background' ) || shouldSerialize( 'gradients' );\n\tconst hasBackground =\n\t\tbackgroundColor ||\n\t\tstyle?.color?.background ||\n\t\t( hasGradient && ( gradient || style?.color?.gradient ) );\n\n\tconst newClassName = clsx( props.className, textClass, gradientClass, {\n\t\t// Don't apply the background class if there's a custom gradient.\n\t\t[ backgroundClass ]:\n\t\t\t( ! hasGradient || ! style?.color?.gradient ) && !! backgroundClass,\n\t\t'has-text-color':\n\t\t\tshouldSerialize( 'text' ) && ( textColor || style?.color?.text ),\n\t\t'has-background': serializeHasBackground && hasBackground,\n\t\t'has-link-color':\n\t\t\tshouldSerialize( 'link' ) && style?.elements?.link?.color,\n\t} );\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\nfunction styleToAttributes( style ) {\n\tconst textColorValue = style?.color?.text;\n\tconst textColorSlug = textColorValue?.startsWith( 'var:preset|color|' )\n\t\t? textColorValue.substring( 'var:preset|color|'.length )\n\t\t: undefined;\n\tconst backgroundColorValue = style?.color?.background;\n\tconst backgroundColorSlug = backgroundColorValue?.startsWith(\n\t\t'var:preset|color|'\n\t)\n\t\t? backgroundColorValue.substring( 'var:preset|color|'.length )\n\t\t: undefined;\n\tconst gradientValue = style?.color?.gradient;\n\tconst gradientSlug = gradientValue?.startsWith( 'var:preset|gradient|' )\n\t\t? gradientValue.substring( 'var:preset|gradient|'.length )\n\t\t: undefined;\n\tconst updatedStyle = { ...style };\n\tupdatedStyle.color = {\n\t\t...updatedStyle.color,\n\t\ttext: textColorSlug ? undefined : textColorValue,\n\t\tbackground: backgroundColorSlug ? undefined : backgroundColorValue,\n\t\tgradient: gradientSlug ? undefined : gradientValue,\n\t};\n\treturn {\n\t\tstyle: cleanEmptyObject( updatedStyle ),\n\t\ttextColor: textColorSlug,\n\t\tbackgroundColor: backgroundColorSlug,\n\t\tgradient: gradientSlug,\n\t};\n}\n\nfunction attributesToStyle( attributes ) {\n\treturn {\n\t\t...attributes.style,\n\t\tcolor: {\n\t\t\t...attributes.style?.color,\n\t\t\ttext: attributes.textColor\n\t\t\t\t? 'var:preset|color|' + attributes.textColor\n\t\t\t\t: attributes.style?.color?.text,\n\t\t\tbackground: attributes.backgroundColor\n\t\t\t\t? 'var:preset|color|' + attributes.backgroundColor\n\t\t\t\t: attributes.style?.color?.background,\n\t\t\tgradient: attributes.gradient\n\t\t\t\t? 'var:preset|gradient|' + attributes.gradient\n\t\t\t\t: attributes.style?.color?.gradient,\n\t\t},\n\t};\n}\n\nfunction ColorInspectorControl( { children, resetAllFilter } ) {\n\tconst attributesResetAllFilter = useCallback(\n\t\t( attributes ) => {\n\t\t\tconst existingStyle = attributesToStyle( attributes );\n\t\t\tconst updatedStyle = resetAllFilter( existingStyle );\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\t...styleToAttributes( 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=\"color\"\n\t\t\tresetAllFilter={ attributesResetAllFilter }\n\t\t>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function ColorEdit( { clientId, name, setAttributes, settings } ) {\n\tconst isEnabled = useHasColorPanel( settings );\n\tfunction selector( select ) {\n\t\tconst { style, textColor, backgroundColor, gradient } =\n\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId ) || {};\n\t\treturn { style, textColor, backgroundColor, gradient };\n\t}\n\tconst { style, textColor, backgroundColor, gradient } = useSelect(\n\t\tselector,\n\t\t[ clientId ]\n\t);\n\tconst value = useMemo( () => {\n\t\treturn attributesToStyle( {\n\t\t\tstyle,\n\t\t\ttextColor,\n\t\t\tbackgroundColor,\n\t\t\tgradient,\n\t\t} );\n\t}, [ style, textColor, backgroundColor, gradient ] );\n\n\tconst onChange = ( newStyle ) => {\n\t\tsetAttributes( styleToAttributes( newStyle ) );\n\t};\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultControls = getBlockSupport( name, [\n\t\tCOLOR_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\tconst enableContrastChecking =\n\t\tPlatform.OS === 'web' &&\n\t\t! value?.color?.gradient &&\n\t\t( settings?.color?.text || settings?.color?.link ) &&\n\t\t// Contrast checking is enabled by default.\n\t\t// Deactivating it requires `enableContrastChecker` to have\n\t\t// an explicit value of `false`.\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\treturn (\n\t\t<StylesColorPanel\n\t\t\tas={ ColorInspectorControl }\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\tenableContrastChecker={\n\t\t\t\tfalse !==\n\t\t\t\tgetBlockSupport( name, [\n\t\t\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\t\t\t'enableContrastChecker',\n\t\t\t\t] )\n\t\t\t}\n\t\t>\n\t\t\t{ enableContrastChecking && (\n\t\t\t\t<BlockColorContrastChecker clientId={ clientId } />\n\t\t\t) }\n\t\t</StylesColorPanel>\n\t);\n}\n\nfunction useBlockProps( {\n\tname,\n\tbackgroundColor,\n\ttextColor,\n\tgradient,\n\tstyle,\n} ) {\n\tconst [ userPalette, themePalette, defaultPalette ] = useSettings(\n\t\t'color.palette.custom',\n\t\t'color.palette.theme',\n\t\t'color.palette.default'\n\t);\n\n\tconst colors = useMemo(\n\t\t() => [\n\t\t\t...( userPalette || [] ),\n\t\t\t...( themePalette || [] ),\n\t\t\t...( defaultPalette || [] ),\n\t\t],\n\t\t[ userPalette, themePalette, defaultPalette ]\n\t);\n\tif (\n\t\t! hasColorSupport( name ) ||\n\t\tshouldSkipSerialization( name, COLOR_SUPPORT_KEY )\n\t) {\n\t\treturn {};\n\t}\n\tconst extraStyles = {};\n\n\tif (\n\t\ttextColor &&\n\t\t! shouldSkipSerialization( name, COLOR_SUPPORT_KEY, 'text' )\n\t) {\n\t\textraStyles.color = getColorObjectByAttributeValues(\n\t\t\tcolors,\n\t\t\ttextColor\n\t\t)?.color;\n\t}\n\tif (\n\t\tbackgroundColor &&\n\t\t! shouldSkipSerialization( name, COLOR_SUPPORT_KEY, 'background' )\n\t) {\n\t\textraStyles.backgroundColor = getColorObjectByAttributeValues(\n\t\t\tcolors,\n\t\t\tbackgroundColor\n\t\t)?.color;\n\t}\n\n\tconst saveProps = addSaveProps( { style: extraStyles }, name, {\n\t\ttextColor,\n\t\tbackgroundColor,\n\t\tgradient,\n\t\tstyle,\n\t} );\n\n\tconst hasBackgroundValue =\n\t\tbackgroundColor ||\n\t\tstyle?.color?.background ||\n\t\tgradient ||\n\t\tstyle?.color?.gradient;\n\n\treturn {\n\t\t...saveProps,\n\t\tclassName: clsx(\n\t\t\tsaveProps.className,\n\t\t\t// Add background image classes in the editor, if not already handled by background color values.\n\t\t\t! hasBackgroundValue && getBackgroundImageClasses( style )\n\t\t),\n\t};\n}\n\nexport default {\n\tuseBlockProps,\n\taddSaveProps,\n\tattributeKeys: [ 'backgroundColor', 'textColor', 'gradient', 'style' ],\n\thasSupport: hasColorSupport,\n};\n\nconst MIGRATION_PATHS = {\n\tlinkColor: [ [ 'style', 'elements', 'link', 'color', 'text' ] ],\n\ttextColor: [ [ 'textColor' ], [ 'style', 'color', 'text' ] ],\n\tbackgroundColor: [\n\t\t[ 'backgroundColor' ],\n\t\t[ 'style', 'color', 'background' ],\n\t],\n\tgradient: [ [ 'gradient' ], [ 'style', 'color', 'gradient' ] ],\n};\n\nexport function addTransforms( result, source, index, results ) {\n\tconst destinationBlockType = result.name;\n\tconst activeSupports = {\n\t\tlinkColor: hasLinkColorSupport( destinationBlockType ),\n\t\ttextColor: hasTextColorSupport( destinationBlockType ),\n\t\tbackgroundColor: hasBackgroundColorSupport( destinationBlockType ),\n\t\tgradient: hasGradientSupport( destinationBlockType ),\n\t};\n\treturn transformStyles(\n\t\tactiveSupports,\n\t\tMIGRATION_PATHS,\n\t\tresult,\n\t\tsource,\n\t\tindex,\n\t\tresults\n\t);\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/color/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/color/addTransforms',\n\taddTransforms\n);\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,OAAO,EAAEC,QAAQ,EAAEC,WAAW,QAAQ,oBAAoB;AACnE,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SACCC,iBAAiB,EACjBC,+BAA+B,QACzB,sBAAsB;AAC7B,SAASC,8BAA8B,QAAQ,yBAAyB;AACxE,SACCC,gBAAgB,EAChBC,eAAe,EACfC,uBAAuB,QACjB,SAAS;AAChB,SAASC,yBAAyB,QAAQ,cAAc;AACxD,SAASC,WAAW,QAAQ,4BAA4B;AACxD,OAAOC,iBAAiB,MAAM,kCAAkC;AAChE,SACCC,gBAAgB,EAChBC,OAAO,IAAIC,gBAAgB,QACrB,yCAAyC;AAChD,OAAOC,yBAAyB,MAAM,oBAAoB;AAC1D,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AAEpD,OAAO,MAAMC,iBAAiB,GAAG,OAAO;AAExC,MAAMC,eAAe,GAAKC,eAAe,IAAM;EAC9C,MAAMC,YAAY,GAAGvB,eAAe,CAAEsB,eAAe,EAAEF,iBAAkB,CAAC;EAC1E,OACCG,YAAY,KACVA,YAAY,CAACC,IAAI,KAAK,IAAI,IAC3BD,YAAY,CAACE,QAAQ,KAAK,IAAI,IAC9BF,YAAY,CAACG,UAAU,KAAK,KAAK,IACjCH,YAAY,CAACI,IAAI,KAAK,KAAK,CAAE;AAEhC,CAAC;AAED,MAAMC,mBAAmB,GAAKC,SAAS,IAAM;EAC5C,IAAK3B,QAAQ,CAAC4B,EAAE,KAAK,KAAK,EAAG;IAC5B,OAAO,KAAK;EACb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
25
25
|
isSelected
|
|
26
26
|
}) {
|
|
27
|
-
const {
|
|
28
|
-
getBlockListSettings,
|
|
29
|
-
getSettings
|
|
30
|
-
} = useSelect(blockEditorStore);
|
|
31
27
|
const {
|
|
32
28
|
templateLock,
|
|
33
29
|
isLockedByParent,
|
|
@@ -45,18 +41,10 @@ function ContentLockControlsPure({
|
|
|
45
41
|
};
|
|
46
42
|
}, [clientId]);
|
|
47
43
|
const {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
__unstableSetTemporarilyEditingAsBlocks
|
|
51
|
-
} = useDispatch(blockEditorStore);
|
|
52
|
-
const {
|
|
53
|
-
stopEditingAsBlocks
|
|
44
|
+
stopEditingAsBlocks,
|
|
45
|
+
modifyContentLockBlock
|
|
54
46
|
} = unlock(useDispatch(blockEditorStore));
|
|
55
47
|
const isContentLocked = !isLockedByParent && templateLock === 'contentOnly';
|
|
56
|
-
const {
|
|
57
|
-
__unstableMarkNextChangeAsNotPersistent,
|
|
58
|
-
updateBlockAttributes
|
|
59
|
-
} = useDispatch(blockEditorStore);
|
|
60
48
|
const stopEditingAsBlockCallback = useCallback(() => {
|
|
61
49
|
stopEditingAsBlocks(clientId);
|
|
62
50
|
}, [clientId, stopEditingAsBlocks]);
|
|
@@ -70,22 +58,11 @@ function ContentLockControlsPure({
|
|
|
70
58
|
}, createElement(ToolbarButton, {
|
|
71
59
|
onClick: stopEditingAsBlockCallback
|
|
72
60
|
}, __('Done')))), showStartEditingAsBlocks && createElement(BlockSettingsMenuControls, null, ({
|
|
61
|
+
selectedClientIds,
|
|
73
62
|
onClose
|
|
74
|
-
}) => createElement(MenuItem, {
|
|
63
|
+
}) => selectedClientIds.length === 1 && selectedClientIds[0] === clientId && createElement(MenuItem, {
|
|
75
64
|
onClick: () => {
|
|
76
|
-
|
|
77
|
-
updateBlockAttributes(clientId, {
|
|
78
|
-
templateLock: undefined
|
|
79
|
-
});
|
|
80
|
-
updateBlockListSettings(clientId, {
|
|
81
|
-
...getBlockListSettings(clientId),
|
|
82
|
-
templateLock: false
|
|
83
|
-
});
|
|
84
|
-
const focusModeToRevert = getSettings().focusMode;
|
|
85
|
-
updateSettings({
|
|
86
|
-
focusMode: true
|
|
87
|
-
});
|
|
88
|
-
__unstableSetTemporarilyEditingAsBlocks(clientId, focusModeToRevert);
|
|
65
|
+
modifyContentLockBlock(clientId);
|
|
89
66
|
onClose();
|
|
90
67
|
}
|
|
91
68
|
}, __('Modify'))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ToolbarButton","MenuItem","useDispatch","useSelect","__","useCallback","store","blockEditorStore","BlockControls","BlockSettingsMenuControls","unlock","ContentLockControlsPure","clientId","isSelected","
|
|
1
|
+
{"version":3,"names":["ToolbarButton","MenuItem","useDispatch","useSelect","__","useCallback","store","blockEditorStore","BlockControls","BlockSettingsMenuControls","unlock","ContentLockControlsPure","clientId","isSelected","templateLock","isLockedByParent","isEditingAsBlocks","select","getContentLockingParent","getTemplateLock","getTemporarilyEditingAsBlocks","stopEditingAsBlocks","modifyContentLockBlock","isContentLocked","stopEditingAsBlockCallback","showStopEditingAsBlocks","showStartEditingAsBlocks","createElement","Fragment","group","onClick","selectedClientIds","onClose","length","edit","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/content-lock-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToolbarButton, MenuItem } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { BlockControls, BlockSettingsMenuControls } from '../components';\nimport { unlock } from '../lock-unlock';\n\n// The implementation of content locking is mainly in this file, although the mechanism\n// to stop temporarily editing as blocks when an outside block is selected is on component StopEditingAsBlocksOnOutsideSelect\n// at block-editor/src/components/block-list/index.js.\n// Besides the components on this file and the file referenced above the implementation\n// also includes artifacts on the store (actions, reducers, and selector).\n\nfunction ContentLockControlsPure( { clientId, isSelected } ) {\n\tconst { templateLock, isLockedByParent, isEditingAsBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetContentLockingParent,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetTemporarilyEditingAsBlocks,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\treturn {\n\t\t\t\ttemplateLock: getTemplateLock( clientId ),\n\t\t\t\tisLockedByParent: !! getContentLockingParent( clientId ),\n\t\t\t\tisEditingAsBlocks: getTemporarilyEditingAsBlocks() === clientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { stopEditingAsBlocks, modifyContentLockBlock } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tconst isContentLocked =\n\t\t! isLockedByParent && templateLock === 'contentOnly';\n\n\tconst stopEditingAsBlockCallback = useCallback( () => {\n\t\tstopEditingAsBlocks( clientId );\n\t}, [ clientId, stopEditingAsBlocks ] );\n\n\tif ( ! isContentLocked && ! isEditingAsBlocks ) {\n\t\treturn null;\n\t}\n\n\tconst showStopEditingAsBlocks = isEditingAsBlocks && ! isContentLocked;\n\tconst showStartEditingAsBlocks =\n\t\t! isEditingAsBlocks && isContentLocked && isSelected;\n\n\treturn (\n\t\t<>\n\t\t\t{ showStopEditingAsBlocks && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t<ToolbarButton onClick={ stopEditingAsBlockCallback }>\n\t\t\t\t\t\t\t{ __( 'Done' ) }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ showStartEditingAsBlocks && (\n\t\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t\t{ ( { selectedClientIds, onClose } ) =>\n\t\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\t\tselectedClientIds[ 0 ] === clientId && (\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tmodifyContentLockBlock( clientId );\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Modify' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t</BlockSettingsMenuControls>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tedit: ContentLockControlsPure,\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,uBAAuB;AAC/D,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AACpD,SAASC,aAAa,EAAEC,yBAAyB,QAAQ,eAAe;AACxE,SAASC,MAAM,QAAQ,gBAAgB;;AAEvC;AACA;AACA;AACA;AACA;;AAEA,SAASC,uBAAuBA,CAAE;EAAEC,QAAQ;EAAEC;AAAW,CAAC,EAAG;EAC5D,MAAM;IAAEC,YAAY;IAAEC,gBAAgB;IAAEC;EAAkB,CAAC,GAAGb,SAAS,CACpEc,MAAM,IAAM;IACb,MAAM;MACLC,uBAAuB;MACvBC,eAAe;MACfC;IACD,CAAC,GAAGV,MAAM,CAAEO,MAAM,CAAEV,gBAAiB,CAAE,CAAC;IACxC,OAAO;MACNO,YAAY,EAAEK,eAAe,CAAEP,QAAS,CAAC;MACzCG,gBAAgB,EAAE,CAAC,CAAEG,uBAAuB,CAAEN,QAAS,CAAC;MACxDI,iBAAiB,EAAEI,6BAA6B,CAAC,CAAC,KAAKR;IACxD,CAAC;EACF,CAAC,EACD,CAAEA,QAAQ,CACX,CAAC;EA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|
@@ -2,7 +2,7 @@ import { createElement } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* External dependencies
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import clsx from 'clsx';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
@@ -83,7 +83,7 @@ export default {
|
|
|
83
83
|
*/
|
|
84
84
|
export function addSaveProps(extraProps, blockType, attributes) {
|
|
85
85
|
if (hasBlockSupport(blockType, 'customClassName', true) && attributes.className) {
|
|
86
|
-
extraProps.className =
|
|
86
|
+
extraProps.className = clsx(extraProps.className, attributes.className);
|
|
87
87
|
}
|
|
88
88
|
return extraProps;
|
|
89
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["clsx","addFilter","TextControl","__","hasBlockSupport","InspectorControls","useBlockEditingMode","addAttribute","settings","attributes","className","type","CustomClassNameControlsPure","setAttributes","blockEditingMode","createElement","group","__nextHasNoMarginBottom","__next40pxDefaultSize","autoComplete","label","value","onChange","nextValue","undefined","help","edit","addSaveProps","attributeKeys","hasSupport","name","extraProps","blockType","addTransforms","result","source","index","results","length","innerBlocks","originClassName"],"sources":["@wordpress/block-editor/src/hooks/custom-class-name.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { TextControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { InspectorControls } from '../components';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * Filters registered block settings, extending attributes to include `className`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( hasBlockSupport( settings, 'customClassName', true ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tclassName: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction CustomClassNameControlsPure( { className, setAttributes } ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tautoComplete=\"off\"\n\t\t\t\tlabel={ __( 'Additional CSS class(es)' ) }\n\t\t\t\tvalue={ className || '' }\n\t\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tclassName: nextValue !== '' ? nextValue : undefined,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\thelp={ __( 'Separate multiple classes with spaces.' ) }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nexport default {\n\tedit: CustomClassNameControlsPure,\n\taddSaveProps,\n\tattributeKeys: [ 'className' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'customClassName', true );\n\t},\n};\n\n/**\n * Override props assigned to save component to inject the className, if block\n * supports customClassName. This is only applied if the block's save result is an\n * element and not a markup string.\n *\n * @param {Object} extraProps Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Current block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( extraProps, blockType, attributes ) {\n\tif (\n\t\thasBlockSupport( blockType, 'customClassName', true ) &&\n\t\tattributes.className\n\t) {\n\t\textraProps.className = clsx(\n\t\t\textraProps.className,\n\t\t\tattributes.className\n\t\t);\n\t}\n\n\treturn extraProps;\n}\n\nexport function addTransforms( result, source, index, results ) {\n\tif ( ! hasBlockSupport( result.name, 'customClassName', true ) ) {\n\t\treturn result;\n\t}\n\n\t// If the condition verifies we are probably in the presence of a wrapping transform\n\t// e.g: nesting paragraphs in a group or columns and in that case the class should not be kept.\n\tif ( results.length === 1 && result.innerBlocks.length === source.length ) {\n\t\treturn result;\n\t}\n\n\t// If we are transforming one block to multiple blocks or multiple blocks to one block,\n\t// we ignore the class during the transform.\n\tif (\n\t\t( results.length === 1 && source.length > 1 ) ||\n\t\t( results.length > 1 && source.length === 1 )\n\t) {\n\t\treturn result;\n\t}\n\n\t// If we are in presence of transform between one or more block in the source\n\t// that have one or more blocks in the result\n\t// we apply the class on source N to the result N,\n\t// if source N does not exists we do nothing.\n\tif ( source[ index ] ) {\n\t\tconst originClassName = source[ index ]?.attributes.className;\n\t\tif ( originClassName ) {\n\t\t\treturn {\n\t\t\t\t...result,\n\t\t\t\tattributes: {\n\t\t\t\t\t...result.attributes,\n\t\t\t\t\tclassName: originClassName,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t}\n\treturn result;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-class-name/attribute',\n\taddAttribute\n);\n\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/color/addTransforms',\n\taddTransforms\n);\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,QAAQ,mBAAmB;;AAEnD;AACA;AACA;AACA,SAASC,iBAAiB,QAAQ,eAAe;AACjD,SAASC,mBAAmB,QAAQ,kCAAkC;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAEC,QAAQ,EAAG;EACxC,IAAKJ,eAAe,CAAEI,QAAQ,EAAE,iBAAiB,EAAE,IAAK,CAAC,EAAG;IAC3D;IACAA,QAAQ,CAACC,UAAU,GAAG;MACrB,GAAGD,QAAQ,CAACC,UAAU;MACtBC,SA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;EAEA,OAAOqB,UAAU;AAClB;AAEA,OAAO,SAASE,aAAaA,CAAEC,MAAM,EAAEC,MAAM,EAAEC,KAAK,EAAEC,OAAO,EAAG;EAC/D,IAAK,CAAEjC,eAAe,CAAE8B,MAAM,CAACJ,IAAI,EAAE,iBAAiB,EAAE,IAAK,CAAC,EAAG;IAChE,OAAOI,MAAM;EACd;;EAEA;EACA;EACA,IAAKG,OAAO,CAACC,MAAM,KAAK,CAAC,IAAIJ,MAAM,CAACK,WAAW,CAACD,MAAM,KAAKH,MAAM,CAACG,MAAM,EAAG;IAC1E,OAAOJ,MAAM;EACd;;EAEA;EACA;EACA,IACGG,OAAO,CAACC,MAAM,KAAK,CAAC,IAAIH,MAAM,CAACG,MAAM,GAAG,CAAC,IACzCD,OAAO,CAACC,MAAM,GAAG,CAAC,IAAIH,MAAM,CAACG,MAAM,KAAK,CAAG,EAC5C;IACD,OAAOJ,MAAM;EACd;;EAEA;EACA;EACA;EACA;EACA,IAAKC,MAAM,CAAEC,KAAK,CAAE,EAAG;IACtB,MAAMI,eAAe,GAAGL,MAAM,CAAEC,KAAK,CAAE,EAAE3B,UAAU,CAACC,SAAS;IAC7D,IAAK8B,eAAe,EAAG;MACtB,OAAO;QACN,GAAGN,MAAM;QACTzB,UAAU,EAAE;UACX,GAAGyB,MAAM,CAACzB,UAAU;UACpBC,SAAS,EAAE8B;QACZ;MACD,CAAC;IACF;EACD;EACA,OAAON,MAAM;AACd;AAEAjC,SAAS,CACR,0BAA0B,EAC1B,yCAAyC,EACzCM,YACD,CAAC;AAEDN,SAAS,CACR,2CAA2C,EAC3C,0BAA0B,EAC1BgC,aACD,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import clsx from 'clsx';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -42,7 +42,7 @@ export function addAttribute(settings) {
|
|
|
42
42
|
*/
|
|
43
43
|
export function addSaveProps(extraProps, blockType, attributes) {
|
|
44
44
|
if (hasBlockSupport(blockType, 'customClassName', true) && attributes.className) {
|
|
45
|
-
extraProps.className =
|
|
45
|
+
extraProps.className = clsx(extraProps.className, attributes.className);
|
|
46
46
|
}
|
|
47
47
|
return extraProps;
|
|
48
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["clsx","addFilter","hasBlockSupport","addAttribute","settings","attributes","className","type","addSaveProps","extraProps","blockType","attributeKeys","hasSupport","name"],"sources":["@wordpress/block-editor/src/hooks/custom-class-name.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Filters registered block settings, extending attributes to include `className`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( hasBlockSupport( settings, 'customClassName', true ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tclassName: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject the className, if block\n * supports customClassName. This is only applied if the block's save result is an\n * element and not a markup string.\n *\n * @param {Object} extraProps Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Current block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( extraProps, blockType, attributes ) {\n\tif (\n\t\thasBlockSupport( blockType, 'customClassName', true ) &&\n\t\tattributes.className\n\t) {\n\t\textraProps.className = clsx(\n\t\t\textraProps.className,\n\t\t\tattributes.className\n\t\t);\n\t}\n\n\treturn extraProps;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/custom-class-name/attribute',\n\taddAttribute\n);\n\nexport default {\n\taddSaveProps,\n\tattributeKeys: [ 'className' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'customClassName', true );\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,eAAe,QAAQ,mBAAmB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAEC,QAAQ,EAAG;EACxC,IAAKF,eAAe,CAAEE,QAAQ,EAAE,iBAAiB,EAAE,IAAK,CAAC,EAAG;IAC3D;IACAA,QAAQ,CAACC,UAAU,GAAG;MACrB,GAAGD,QAAQ,CAACC,UAAU;MACtBC,SAAS,EAAE;QACVC,IAAI,EAAE;MACP;IACD,CAAC;EACF;EAEA,OAAOH,QAAQ;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,YAAYA,CAAEC,UAAU,EAAEC,SAAS,EAAEL,UAAU,EAAG;EACjE,IACCH,eAAe,CAAEQ,SAAS,EAAE,iBAAiB,EAAE,IAAK,CAAC,IACrDL,UAAU,CAACC,SAAS,EACnB;IACDG,UAAU,CAACH,SAAS,GAAGN,IAAI,CAC1BS,UAAU,CAACH,SAAS,EACpBD,UAAU,CAACC,SACZ,CAAC;EACF;EAEA,OAAOG,UAAU;AAClB;AAEAR,SAAS,CACR,0BAA0B,EAC1B,kCAAkC,EAClCE,YACD,CAAC;AAED,eAAe;EACdK,YAAY;EACZG,aAAa,EAAE,CAAE,WAAW,CAAE;EAC9BC,UAAUA,CAAEC,IAAI,EAAG;IAClB,OAAOX,eAAe,CAAEW,IAAI,EAAE,iBAAiB,EAAE,IAAK,CAAC;EACxD;AACD,CAAC","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@ import { createElement, Fragment } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* External dependencies
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import clsx from 'clsx';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
@@ -135,7 +135,7 @@ function useBlockProps({
|
|
|
135
135
|
if (!hasDimensionsSupport(name, 'aspectRatio') || shouldSkipSerialization(name, DIMENSIONS_SUPPORT_KEY, 'aspectRatio')) {
|
|
136
136
|
return {};
|
|
137
137
|
}
|
|
138
|
-
const className =
|
|
138
|
+
const className = clsx({
|
|
139
139
|
'has-aspect-ratio': !!style?.dimensions?.aspectRatio
|
|
140
140
|
});
|
|
141
141
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","Platform","useState","useEffect","useCallback","useDispatch","useSelect","getBlockSupport","deprecated","InspectorControls","DimensionsPanel","StylesDimensionsPanel","useHasDimensionsPanel","MarginVisualizer","PaddingVisualizer","store","blockEditorStore","unlock","cleanEmptyObject","shouldSkipSerialization","DIMENSIONS_SUPPORT_KEY","SPACING_SUPPORT_KEY","ALL_SIDES","AXIAL_SIDES","useVisualizer","property","setProperty","hideBlockInterface","showBlockInterface","DimensionsInspectorControl","children","resetAllFilter","attributesResetAllFilter","attributes","existingStyle","style","updatedStyle","createElement","group","clientId","name","setAttributes","settings","isEnabled","value","select","getBlockAttributes","visualizedProperty","setVisualizedProperty","onChange","newStyle","defaultDimensionsControls","defaultSpacingControls","defaultControls","Fragment","as","panelId","onVisualize","spacing","padding","forceShow","margin","hasDimensionsSupport","blockName","feature","OS","support","aspectRatio","minHeight","useBlockProps","attributeKeys","hasSupport","className","dimensions","inlineStyleOverrides","useCustomSides","since","version"],"sources":["@wordpress/block-editor/src/hooks/dimensions.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Platform, useState, useEffect, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport {\n\tDimensionsPanel as StylesDimensionsPanel,\n\tuseHasDimensionsPanel,\n} from '../components/global-styles';\nimport { MarginVisualizer, PaddingVisualizer } from './spacing-visualizer';\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\nimport { cleanEmptyObject, shouldSkipSerialization } from './utils';\n\nexport const DIMENSIONS_SUPPORT_KEY = 'dimensions';\nexport const SPACING_SUPPORT_KEY = 'spacing';\nexport const ALL_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nexport const AXIAL_SIDES = [ 'vertical', 'horizontal' ];\n\nfunction useVisualizer() {\n\tconst [ property, setProperty ] = useState( false );\n\tconst { hideBlockInterface, showBlockInterface } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tuseEffect( () => {\n\t\tif ( ! property ) {\n\t\t\tshowBlockInterface();\n\t\t} else {\n\t\t\thideBlockInterface();\n\t\t}\n\t}, [ property, showBlockInterface, hideBlockInterface ] );\n\n\treturn [ property, setProperty ];\n}\n\nfunction DimensionsInspectorControl( { children, resetAllFilter } ) {\n\tconst attributesResetAllFilter = useCallback(\n\t\t( attributes ) => {\n\t\t\tconst existingStyle = attributes.style;\n\t\t\tconst updatedStyle = resetAllFilter( existingStyle );\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\tstyle: 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=\"dimensions\"\n\t\t\tresetAllFilter={ attributesResetAllFilter }\n\t\t>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function DimensionsPanel( { clientId, name, setAttributes, settings } ) {\n\tconst isEnabled = useHasDimensionsPanel( settings );\n\tconst value = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId )?.style,\n\t\t[ clientId ]\n\t);\n\tconst [ visualizedProperty, setVisualizedProperty ] = useVisualizer();\n\tconst onChange = ( newStyle ) => {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultDimensionsControls = getBlockSupport( name, [\n\t\tDIMENSIONS_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\tconst defaultSpacingControls = getBlockSupport( name, [\n\t\tSPACING_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\tconst defaultControls = {\n\t\t...defaultDimensionsControls,\n\t\t...defaultSpacingControls,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<StylesDimensionsPanel\n\t\t\t\tas={ DimensionsInspectorControl }\n\t\t\t\tpanelId={ clientId }\n\t\t\t\tsettings={ settings }\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tdefaultControls={ defaultControls }\n\t\t\t\tonVisualize={ setVisualizedProperty }\n\t\t\t/>\n\t\t\t{ !! settings?.spacing?.padding && (\n\t\t\t\t<PaddingVisualizer\n\t\t\t\t\tforceShow={ visualizedProperty === 'padding' }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ !! settings?.spacing?.margin && (\n\t\t\t\t<MarginVisualizer\n\t\t\t\t\tforceShow={ visualizedProperty === 'margin' }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n/**\n * Determine whether there is block support for dimensions.\n *\n * @param {string} blockName Block name.\n * @param {string} feature Background image feature to check for.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasDimensionsSupport( blockName, feature = 'any' ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst support = getBlockSupport( blockName, DIMENSIONS_SUPPORT_KEY );\n\n\tif ( support === true ) {\n\t\treturn true;\n\t}\n\n\tif ( feature === 'any' ) {\n\t\treturn !! ( support?.aspectRatio || !! support?.minHeight );\n\t}\n\n\treturn !! support?.[ feature ];\n}\n\nexport default {\n\tuseBlockProps,\n\tattributeKeys: [ 'minHeight', 'style' ],\n\thasSupport( name ) {\n\t\treturn hasDimensionsSupport( name, 'aspectRatio' );\n\t},\n};\n\nfunction useBlockProps( { name, minHeight, style } ) {\n\tif (\n\t\t! hasDimensionsSupport( name, 'aspectRatio' ) ||\n\t\tshouldSkipSerialization( name, DIMENSIONS_SUPPORT_KEY, 'aspectRatio' )\n\t) {\n\t\treturn {};\n\t}\n\n\tconst className = classnames( {\n\t\t'has-aspect-ratio': !! style?.dimensions?.aspectRatio,\n\t} );\n\n\t// Allow dimensions-based inline style overrides to override any global styles rules that\n\t// might be set for the block, and therefore affect the display of the aspect ratio.\n\tconst inlineStyleOverrides = {};\n\n\t// Apply rules to unset incompatible styles.\n\t// Note that a set `aspectRatio` will win out if both an aspect ratio and a minHeight are set.\n\t// This is because the aspect ratio is a newer block support, so (in theory) any aspect ratio\n\t// that is set should be intentional and should override any existing minHeight. The Cover block\n\t// and dimensions controls have logic that will manually clear the aspect ratio if a minHeight\n\t// is set.\n\tif ( style?.dimensions?.aspectRatio ) {\n\t\t// To ensure the aspect ratio does not get overridden by `minHeight` unset any existing rule.\n\t\tinlineStyleOverrides.minHeight = 'unset';\n\t} else if ( minHeight || style?.dimensions?.minHeight ) {\n\t\t// To ensure the minHeight does not get overridden by `aspectRatio` unset any existing rule.\n\t\tinlineStyleOverrides.aspectRatio = 'unset';\n\t}\n\n\treturn { className, style: inlineStyleOverrides };\n}\n\n/**\n * @deprecated\n */\nexport function useCustomSides() {\n\tdeprecated( 'wp.blockEditor.__experimentalUseCustomSides', {\n\t\tsince: '6.3',\n\t\tversion: '6.4',\n\t} );\n}\n"],"mappings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,CAAC,CAAEF,OAAO,GAAIF,OAAO,CAAE;AAC/B;AAEA,eAAe;EACdK,aAAa;EACbC,aAAa,EAAE,CAAE,WAAW,EAAE,OAAO,CAAE;EACvCC,UAAUA,CAAE/B,IAAI,EAAG;IAClB,OAAOsB,oBAAoB,CAAEtB,IAAI,EAAE,aAAc,CAAC;EACnD;AACD,CAAC;AAED,SAAS6B,aAAaA,CAAE;EAAE7B,IAAI;EAAE4B,SAAS;EAAEjC;AAAM,CAAC,EAAG;EACpD,IACC,CAAE2B,oBAAoB,CAAEtB,IAAI,EAAE,aAAc,CAAC,IAC7CrB,uBAAuB,CAAEqB,IAAI,EAAEpB,sBAAsB,EAAE,aAAc,CAAC,EACrE;IACD,OAAO,CAAC,CAAC;EACV;EAEA,MAAMoD,SAAS,GAAGxE,UAAU,CAAE;IAC7B,kBAAkB,EAAE,CAAC,CAAEmC,KAAK,EAAEsC,UAAU,EAAEN;EAC3C,CAAE,CAAC;;EAEH;EACA;EACA,MAAMO,oBAAoB,GAAG,CAAC,CAAC;;EAE/B;EACA;EACA;EACA;EACA;EACA;EACA,IAAKvC,KAAK,EAAEsC,UAAU,EAAEN,WAAW,EAAG;IACrC;IACAO,oBAAoB,CAACN,SAAS,GAAG,OAAO;EACzC,CAAC,MAAM,IAAKA,SAAS,IAAIjC,KAAK,EAAEsC,UAAU,EAAEL,SAAS,EAAG;IACvD;IACAM,oBAAoB,CAACP,WAAW,GAAG,OAAO;EAC3C;EAEA,OAAO;IAAEK,SAAS;IAAErC,KAAK,EAAEuC;EAAqB,CAAC;AAClD;;AAEA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAA,EAAG;EAChCnE,UAAU,CAAE,6CAA6C,EAAE;IAC1DoE,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","Platform","useState","useEffect","useCallback","useDispatch","useSelect","getBlockSupport","deprecated","InspectorControls","DimensionsPanel","StylesDimensionsPanel","useHasDimensionsPanel","MarginVisualizer","PaddingVisualizer","store","blockEditorStore","unlock","cleanEmptyObject","shouldSkipSerialization","DIMENSIONS_SUPPORT_KEY","SPACING_SUPPORT_KEY","ALL_SIDES","AXIAL_SIDES","useVisualizer","property","setProperty","hideBlockInterface","showBlockInterface","DimensionsInspectorControl","children","resetAllFilter","attributesResetAllFilter","attributes","existingStyle","style","updatedStyle","createElement","group","clientId","name","setAttributes","settings","isEnabled","value","select","getBlockAttributes","visualizedProperty","setVisualizedProperty","onChange","newStyle","defaultDimensionsControls","defaultSpacingControls","defaultControls","Fragment","as","panelId","onVisualize","spacing","padding","forceShow","margin","hasDimensionsSupport","blockName","feature","OS","support","aspectRatio","minHeight","useBlockProps","attributeKeys","hasSupport","className","dimensions","inlineStyleOverrides","useCustomSides","since","version"],"sources":["@wordpress/block-editor/src/hooks/dimensions.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Platform, useState, useEffect, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport {\n\tDimensionsPanel as StylesDimensionsPanel,\n\tuseHasDimensionsPanel,\n} from '../components/global-styles';\nimport { MarginVisualizer, PaddingVisualizer } from './spacing-visualizer';\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\nimport { cleanEmptyObject, shouldSkipSerialization } from './utils';\n\nexport const DIMENSIONS_SUPPORT_KEY = 'dimensions';\nexport const SPACING_SUPPORT_KEY = 'spacing';\nexport const ALL_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nexport const AXIAL_SIDES = [ 'vertical', 'horizontal' ];\n\nfunction useVisualizer() {\n\tconst [ property, setProperty ] = useState( false );\n\tconst { hideBlockInterface, showBlockInterface } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tuseEffect( () => {\n\t\tif ( ! property ) {\n\t\t\tshowBlockInterface();\n\t\t} else {\n\t\t\thideBlockInterface();\n\t\t}\n\t}, [ property, showBlockInterface, hideBlockInterface ] );\n\n\treturn [ property, setProperty ];\n}\n\nfunction DimensionsInspectorControl( { children, resetAllFilter } ) {\n\tconst attributesResetAllFilter = useCallback(\n\t\t( attributes ) => {\n\t\t\tconst existingStyle = attributes.style;\n\t\t\tconst updatedStyle = resetAllFilter( existingStyle );\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\tstyle: 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=\"dimensions\"\n\t\t\tresetAllFilter={ attributesResetAllFilter }\n\t\t>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function DimensionsPanel( { clientId, name, setAttributes, settings } ) {\n\tconst isEnabled = useHasDimensionsPanel( settings );\n\tconst value = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId )?.style,\n\t\t[ clientId ]\n\t);\n\tconst [ visualizedProperty, setVisualizedProperty ] = useVisualizer();\n\tconst onChange = ( newStyle ) => {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultDimensionsControls = getBlockSupport( name, [\n\t\tDIMENSIONS_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\tconst defaultSpacingControls = getBlockSupport( name, [\n\t\tSPACING_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\tconst defaultControls = {\n\t\t...defaultDimensionsControls,\n\t\t...defaultSpacingControls,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<StylesDimensionsPanel\n\t\t\t\tas={ DimensionsInspectorControl }\n\t\t\t\tpanelId={ clientId }\n\t\t\t\tsettings={ settings }\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tdefaultControls={ defaultControls }\n\t\t\t\tonVisualize={ setVisualizedProperty }\n\t\t\t/>\n\t\t\t{ !! settings?.spacing?.padding && (\n\t\t\t\t<PaddingVisualizer\n\t\t\t\t\tforceShow={ visualizedProperty === 'padding' }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ !! settings?.spacing?.margin && (\n\t\t\t\t<MarginVisualizer\n\t\t\t\t\tforceShow={ visualizedProperty === 'margin' }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n/**\n * Determine whether there is block support for dimensions.\n *\n * @param {string} blockName Block name.\n * @param {string} feature Background image feature to check for.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasDimensionsSupport( blockName, feature = 'any' ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst support = getBlockSupport( blockName, DIMENSIONS_SUPPORT_KEY );\n\n\tif ( support === true ) {\n\t\treturn true;\n\t}\n\n\tif ( feature === 'any' ) {\n\t\treturn !! ( support?.aspectRatio || !! support?.minHeight );\n\t}\n\n\treturn !! support?.[ feature ];\n}\n\nexport default {\n\tuseBlockProps,\n\tattributeKeys: [ 'minHeight', 'style' ],\n\thasSupport( name ) {\n\t\treturn hasDimensionsSupport( name, 'aspectRatio' );\n\t},\n};\n\nfunction useBlockProps( { name, minHeight, style } ) {\n\tif (\n\t\t! hasDimensionsSupport( name, 'aspectRatio' ) ||\n\t\tshouldSkipSerialization( name, DIMENSIONS_SUPPORT_KEY, 'aspectRatio' )\n\t) {\n\t\treturn {};\n\t}\n\n\tconst className = clsx( {\n\t\t'has-aspect-ratio': !! style?.dimensions?.aspectRatio,\n\t} );\n\n\t// Allow dimensions-based inline style overrides to override any global styles rules that\n\t// might be set for the block, and therefore affect the display of the aspect ratio.\n\tconst inlineStyleOverrides = {};\n\n\t// Apply rules to unset incompatible styles.\n\t// Note that a set `aspectRatio` will win out if both an aspect ratio and a minHeight are set.\n\t// This is because the aspect ratio is a newer block support, so (in theory) any aspect ratio\n\t// that is set should be intentional and should override any existing minHeight. The Cover block\n\t// and dimensions controls have logic that will manually clear the aspect ratio if a minHeight\n\t// is set.\n\tif ( style?.dimensions?.aspectRatio ) {\n\t\t// To ensure the aspect ratio does not get overridden by `minHeight` unset any existing rule.\n\t\tinlineStyleOverrides.minHeight = 'unset';\n\t} else if ( minHeight || style?.dimensions?.minHeight ) {\n\t\t// To ensure the minHeight does not get overridden by `aspectRatio` unset any existing rule.\n\t\tinlineStyleOverrides.aspectRatio = 'unset';\n\t}\n\n\treturn { className, style: inlineStyleOverrides };\n}\n\n/**\n * @deprecated\n */\nexport function useCustomSides() {\n\tdeprecated( 'wp.blockEditor.__experimentalUseCustomSides', {\n\t\tsince: '6.3',\n\t\tversion: '6.4',\n\t} );\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,WAAW,QAAQ,oBAAoB;AAC/E,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,eAAe,QAAQ,mBAAmB;AACnD,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,OAAOC,iBAAiB,MAAM,kCAAkC;AAChE,SACCC,eAAe,IAAIC,qBAAqB,EACxCC,qBAAqB,QACf,6BAA6B;AACpC,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,sBAAsB;AAC1E,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AACpD,SAASC,MAAM,QAAQ,gBAAgB;AACvC,SAASC,gBAAgB,EAAEC,uBAAuB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EmC,KAAK,EAAEsC,UAAU,EAAEN;EAC3C,CAAE,CAAC;;EAEH;EACA;EACA,MAAMO,oBAAoB,GAAG,CAAC,CAAC;;EAE/B;EACA;EACA;EACA;EACA;EACA;EACA,IAAKvC,KAAK,EAAEsC,UAAU,EAAEN,WAAW,EAAG;IACrC;IACAO,oBAAoB,CAACN,SAAS,GAAG,OAAO;EACzC,CAAC,MAAM,IAAKA,SAAS,IAAIjC,KAAK,EAAEsC,UAAU,EAAEL,SAAS,EAAG;IACvD;IACAM,oBAAoB,CAACP,WAAW,GAAG,OAAO;EAC3C;EAEA,OAAO;IAAEK,SAAS;IAAErC,KAAK,EAAEuC;EAAqB,CAAC;AAClD;;AAEA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAA,EAAG;EAChCnE,UAAU,CAAE,6CAA6C,EAAE;IAC1DoE,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ import { createElement, Fragment } from "react";
|
|
|
4
4
|
*/
|
|
5
5
|
import { useInstanceId } from '@wordpress/compose';
|
|
6
6
|
import { useSelect } from '@wordpress/data';
|
|
7
|
+
import { useState } from '@wordpress/element';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Internal dependencies
|
|
@@ -128,20 +129,27 @@ function ChildLayoutControlsPure({
|
|
|
128
129
|
style,
|
|
129
130
|
setAttributes
|
|
130
131
|
}) {
|
|
131
|
-
const
|
|
132
|
+
const {
|
|
133
|
+
type: parentLayoutType = 'default',
|
|
134
|
+
allowSizingOnChildren = false
|
|
135
|
+
} = useLayout() || {};
|
|
132
136
|
const rootClientId = useSelect(select => {
|
|
133
137
|
return select(blockEditorStore).getBlockRootClientId(clientId);
|
|
134
138
|
}, [clientId]);
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (
|
|
139
|
+
|
|
140
|
+
// Use useState() instead of useRef() so that GridItemResizer updates when ref is set.
|
|
141
|
+
const [resizerBounds, setResizerBounds] = useState();
|
|
142
|
+
if (parentLayoutType !== 'grid') {
|
|
139
143
|
return null;
|
|
140
144
|
}
|
|
141
145
|
return createElement(Fragment, null, createElement(GridVisualizer, {
|
|
142
|
-
clientId: rootClientId
|
|
143
|
-
|
|
144
|
-
|
|
146
|
+
clientId: rootClientId,
|
|
147
|
+
contentRef: setResizerBounds
|
|
148
|
+
}), allowSizingOnChildren && createElement(GridItemResizer, {
|
|
149
|
+
clientId: clientId
|
|
150
|
+
// Don't allow resizing beyond the grid visualizer.
|
|
151
|
+
,
|
|
152
|
+
bounds: resizerBounds,
|
|
145
153
|
onChange: ({
|
|
146
154
|
columnSpan,
|
|
147
155
|
rowSpan
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useInstanceId","useSelect","store","blockEditorStore","useStyleOverride","useLayout","GridVisualizer","GridItemResizer","useBlockPropsChildLayoutStyles","style","_style$layout","shouldRenderChildLayoutStyles","select","getSettings","disableLayoutStyles","layout","selfStretch","flexSize","columnStart","rowStart","columnSpan","rowSpan","parentLayout","columnCount","minimumColumnWidth","id","selector","css","columnSpanNumber","parseInt","columnStartNumber","highestNumber","Math","max","parentColumnValue","parseFloat","isNaN","parentColumnUnit","replace","includes","defaultGapValue","containerQueryValue","gridColumnValue","className","ChildLayoutControlsPure","clientId","setAttributes","rootClientId","getBlockRootClientId","type","window","__experimentalEnableGridInteractivity","createElement","Fragment","onChange","useBlockProps","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/layout-child.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { useStyleOverride } from './utils';\nimport { useLayout } from '../components/block-list/layout';\nimport { GridVisualizer, GridItemResizer } from '../components/grid-visualizer';\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 {\n\t\tselfStretch,\n\t\tflexSize,\n\t\tcolumnStart,\n\t\trowStart,\n\t\tcolumnSpan,\n\t\trowSpan,\n\t} = layout;\n\tconst parentLayout = useLayout() || {};\n\tconst { columnCount, minimumColumnWidth } = parentLayout;\n\tconst id = useInstanceId( useBlockPropsChildLayoutStyles );\n\tconst selector = `.wp-container-content-${ id }`;\n\n\tlet css = '';\n\tif ( shouldRenderChildLayoutStyles ) {\n\t\tif ( selfStretch === 'fixed' && flexSize ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tflex-basis: ${ flexSize };\n\t\t\t\tbox-sizing: border-box;\n\t\t\t}`;\n\t\t} else if ( selfStretch === 'fill' ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tflex-grow: 1;\n\t\t\t}`;\n\t\t} else if ( columnStart && columnSpan ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: ${ columnStart } / span ${ columnSpan };\n\t\t\t}`;\n\t\t} else if ( columnStart ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: ${ columnStart };\n\t\t\t}`;\n\t\t} else if ( columnSpan ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: span ${ columnSpan };\n\t\t\t}`;\n\t\t}\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\t// Check if columnSpan and columnStart are numbers so Math.max doesn't break.\n\t\t\tconst columnSpanNumber = columnSpan ? parseInt( columnSpan ) : null;\n\t\t\tconst columnStartNumber = columnStart\n\t\t\t\t? parseInt( columnStart )\n\t\t\t\t: null;\n\t\t\tconst highestNumber = Math.max(\n\t\t\t\tcolumnSpanNumber,\n\t\t\t\tcolumnStartNumber\n\t\t\t);\n\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\tconst defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5;\n\t\t\tconst containerQueryValue =\n\t\t\t\thighestNumber * parentColumnValue +\n\t\t\t\t( highestNumber - 1 ) * defaultGapValue;\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 = columnSpan ? '1/-1' : 'auto';\n\n\t\t\tcss += `@container (max-width: ${ containerQueryValue }${ parentColumnUnit }) {\n\t\t\t\t${ selector } {\n\t\t\t\t\tgrid-column: ${ gridColumnValue };\n\t\t\t\t}\n\t\t\t}`;\n\t\t}\n\t\tif ( rowStart && rowSpan ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: ${ rowStart } / span ${ rowSpan };\n\t\t\t}`;\n\t\t} else if ( rowStart ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: ${ rowStart };\n\t\t\t}`;\n\t\t} else if ( rowSpan ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: span ${ rowSpan };\n\t\t\t}`;\n\t\t}\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 rootClientId = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( blockEditorStore ).getBlockRootClientId( clientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\tif ( parentLayout.type !== 'grid' ) {\n\t\treturn null;\n\t}\n\tif ( ! window.__experimentalEnableGridInteractivity ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t<GridVisualizer clientId={ rootClientId } />\n\t\t\t<GridItemResizer\n\t\t\t\tclientId={ clientId }\n\t\t\t\tonChange={ ( { columnSpan, rowSpan } ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t...style?.layout,\n\t\t\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\t\t\trowSpan,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t\t} }\n\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"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AACpD,SAASC,gBAAgB,QAAQ,SAAS;AAC1C,SAASC,SAAS,QAAQ,iCAAiC;AAC3D,SAASC,cAAc,EAAEC,eAAe,QAAQ,+BAA+B;AAE/E,S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VC;UACD;QACD;MACD,CAAE,CAAC;IACJ;EAAG,CACH,CACA,CAAC;AAEL;AAEA,eAAe;EACdkC,aAAa,EAAE/C,8BAA8B;EAC7CgD,IAAI,EAAEZ,uBAAuB;EAC7Ba,aAAa,EAAE,CAAE,OAAO,CAAE;EAC1BC,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useInstanceId","useSelect","useState","store","blockEditorStore","useStyleOverride","useLayout","GridVisualizer","GridItemResizer","useBlockPropsChildLayoutStyles","style","_style$layout","shouldRenderChildLayoutStyles","select","getSettings","disableLayoutStyles","layout","selfStretch","flexSize","columnStart","rowStart","columnSpan","rowSpan","parentLayout","columnCount","minimumColumnWidth","id","selector","css","columnSpanNumber","parseInt","columnStartNumber","highestNumber","Math","max","parentColumnValue","parseFloat","isNaN","parentColumnUnit","replace","includes","defaultGapValue","containerQueryValue","gridColumnValue","className","ChildLayoutControlsPure","clientId","setAttributes","type","parentLayoutType","allowSizingOnChildren","rootClientId","getBlockRootClientId","resizerBounds","setResizerBounds","createElement","Fragment","contentRef","bounds","onChange","useBlockProps","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/layout-child.js"],"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 { GridVisualizer, GridItemResizer } from '../components/grid-visualizer';\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 {\n\t\tselfStretch,\n\t\tflexSize,\n\t\tcolumnStart,\n\t\trowStart,\n\t\tcolumnSpan,\n\t\trowSpan,\n\t} = layout;\n\tconst parentLayout = useLayout() || {};\n\tconst { columnCount, minimumColumnWidth } = parentLayout;\n\tconst id = useInstanceId( useBlockPropsChildLayoutStyles );\n\tconst selector = `.wp-container-content-${ id }`;\n\n\tlet css = '';\n\tif ( shouldRenderChildLayoutStyles ) {\n\t\tif ( selfStretch === 'fixed' && flexSize ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tflex-basis: ${ flexSize };\n\t\t\t\tbox-sizing: border-box;\n\t\t\t}`;\n\t\t} else if ( selfStretch === 'fill' ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tflex-grow: 1;\n\t\t\t}`;\n\t\t} else if ( columnStart && columnSpan ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: ${ columnStart } / span ${ columnSpan };\n\t\t\t}`;\n\t\t} else if ( columnStart ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: ${ columnStart };\n\t\t\t}`;\n\t\t} else if ( columnSpan ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: span ${ columnSpan };\n\t\t\t}`;\n\t\t}\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\t// Check if columnSpan and columnStart are numbers so Math.max doesn't break.\n\t\t\tconst columnSpanNumber = columnSpan ? parseInt( columnSpan ) : null;\n\t\t\tconst columnStartNumber = columnStart\n\t\t\t\t? parseInt( columnStart )\n\t\t\t\t: null;\n\t\t\tconst highestNumber = Math.max(\n\t\t\t\tcolumnSpanNumber,\n\t\t\t\tcolumnStartNumber\n\t\t\t);\n\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\tconst defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5;\n\t\t\tconst containerQueryValue =\n\t\t\t\thighestNumber * parentColumnValue +\n\t\t\t\t( highestNumber - 1 ) * defaultGapValue;\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 = columnSpan ? '1/-1' : 'auto';\n\n\t\t\tcss += `@container (max-width: ${ containerQueryValue }${ parentColumnUnit }) {\n\t\t\t\t${ selector } {\n\t\t\t\t\tgrid-column: ${ gridColumnValue };\n\t\t\t\t}\n\t\t\t}`;\n\t\t}\n\t\tif ( rowStart && rowSpan ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: ${ rowStart } / span ${ rowSpan };\n\t\t\t}`;\n\t\t} else if ( rowStart ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: ${ rowStart };\n\t\t\t}`;\n\t\t} else if ( rowSpan ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: span ${ rowSpan };\n\t\t\t}`;\n\t\t}\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 {\n\t\ttype: parentLayoutType = 'default',\n\t\tallowSizingOnChildren = false,\n\t} = useLayout() || {};\n\n\tconst rootClientId = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( blockEditorStore ).getBlockRootClientId( clientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Use useState() instead of useRef() so that GridItemResizer updates when ref is set.\n\tconst [ resizerBounds, setResizerBounds ] = useState();\n\n\tif ( parentLayoutType !== 'grid' ) {\n\t\treturn null;\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/>\n\t\t\t{ allowSizingOnChildren && (\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={ ( { columnSpan, rowSpan } ) => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t...style?.layout,\n\t\t\t\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\t\t\t\trowSpan,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\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"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,g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AqB,IACtBK,aAAA,CAAC/C,eAAe;IACfsC,QAAQ,EAAGA;IACX;IAAA;IACAY,MAAM,EAAGL,aAAe;IACxBM,QAAQ,EAAGA,CAAE;MAAEtC,UAAU;MAAEC;IAAQ,CAAC,KAAM;MACzCyB,aAAa,CAAE;QACdrC,KAAK,EAAE;UACN,GAAGA,KAAK;UACRM,MAAM,EAAE;YACP,GAAGN,KAAK,EAAEM,MAAM;YAChBK,UAAU;YACVC;UACD;QACD;MACD,CAAE,CAAC;IACJ;EAAG,CACH,CAED,CAAC;AAEL;AAEA,eAAe;EACdsC,aAAa,EAAEnD,8BAA8B;EAC7CoD,IAAI,EAAEhB,uBAAuB;EAC7BiB,aAAa,EAAE,CAAE,OAAO,CAAE;EAC1BC,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@ import { createElement, Fragment } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* External dependencies
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import clsx from 'clsx';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
@@ -317,7 +317,7 @@ function BlockWithLayoutStyles({
|
|
|
317
317
|
});
|
|
318
318
|
|
|
319
319
|
// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.
|
|
320
|
-
const layoutClassNames =
|
|
320
|
+
const layoutClassNames = clsx({
|
|
321
321
|
[`${selectorPrefix}${id}`]: !!css // Only attach a container class if there is generated CSS to be attached.
|
|
322
322
|
}, layoutClasses);
|
|
323
323
|
useStyleOverride({
|