@wordpress/block-editor 12.19.5 → 12.21.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 +4 -0
- package/build/components/block-canvas/index.js +2 -0
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.js +14 -17
- package/build/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build/components/block-inspector/index.js +0 -3
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js +1 -1
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-outline.native.js +23 -7
- package/build/components/block-list/block-outline.native.js.map +1 -1
- package/build/components/block-list/block-selection-button.native.js.map +1 -1
- package/build/components/block-list/block.native.js +0 -3
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +9 -9
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-popover/cover.js +68 -0
- package/build/components/block-popover/cover.js.map +1 -0
- package/build/components/block-popover/drop-zone.js +2 -3
- package/build/components/block-popover/drop-zone.js.map +1 -1
- package/build/components/block-popover/index.js +1 -19
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/index.js +2 -1
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +2 -4
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js +54 -0
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js +9 -37
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build/components/block-toolbar/index.js +7 -5
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +89 -0
- package/build/components/block-toolbar/shuffle.js.map +1 -0
- package/build/components/block-toolbar/use-has-block-toolbar.js +43 -0
- package/build/components/block-toolbar/use-has-block-toolbar.js.map +1 -0
- package/build/components/block-tools/block-selection-button.js +5 -1
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/empty-block-inserter.js +2 -5
- package/build/components/block-tools/empty-block-inserter.js.map +1 -1
- package/build/components/block-tools/index.js +9 -26
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +60 -0
- package/build/components/block-tools/use-show-block-tools.js.map +1 -0
- package/build/components/caption/index.native.js.map +1 -1
- package/build/components/child-layout-control/index.js +37 -5
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/color-palette/control.js.map +1 -1
- package/build/components/colors-gradients/control.js +1 -1
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/date-format-picker/index.js +0 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +1 -2
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +1 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +30 -19
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +7 -5
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +15 -15
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/grid-visualizer/grid-item-resizer.js +77 -0
- package/build/components/grid-visualizer/grid-item-resizer.js.map +1 -0
- package/build/components/grid-visualizer/grid-visualizer.js +81 -0
- package/build/components/grid-visualizer/grid-visualizer.js.map +1 -0
- package/build/components/grid-visualizer/index.js +20 -0
- package/build/components/grid-visualizer/index.js.map +1 -0
- package/build/components/grid-visualizer/utils.js +10 -0
- package/build/components/grid-visualizer/utils.js.map +1 -0
- package/build/components/iframe/index.js +61 -16
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.native.js +7 -0
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +8 -2
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/menu.js +9 -3
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/menu.native.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +1 -1
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build/components/inserter/search-results.js +3 -2
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +2 -1
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +1 -1
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +0 -4
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/observe-typing/index.js +5 -10
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/panel-color-settings/index.js.map +1 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/resizable-box-popover/index.js +3 -5
- package/build/components/resizable-box-popover/index.js.map +1 -1
- package/build/components/responsive-block-control/index.js +1 -1
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +1 -31
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +1 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +7 -14
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +5 -8
- package/build/components/url-input/index.js.map +1 -1
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/dimensions.js +3 -4
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-size.js +6 -7
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +1 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +89 -1
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/layout.js +11 -4
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/position.js +0 -1
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/spacing-visualizer.js +115 -0
- package/build/hooks/spacing-visualizer.js.map +1 -0
- package/build/hooks/use-typography-props.js +1 -2
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/layouts/grid.js +111 -14
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +2 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +4 -36
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +29 -45
- package/build/store/private-actions.js.map +1 -1
- package/build/store/reducer.js +2 -4
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +27 -15
- package/build/store/selectors.js.map +1 -1
- package/build/utils/calculate-scale.js +17 -0
- package/build/utils/calculate-scale.js.map +1 -0
- package/build-module/components/block-canvas/index.js +2 -0
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js +14 -17
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -4
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +1 -1
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-outline.native.js +23 -7
- package/build-module/components/block-list/block-outline.native.js.map +1 -1
- package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
- package/build-module/components/block-list/block.native.js +0 -3
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +9 -9
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-popover/cover.js +60 -0
- package/build-module/components/block-popover/cover.js.map +1 -0
- package/build-module/components/block-popover/drop-zone.js +2 -3
- package/build-module/components/block-popover/drop-zone.js.map +1 -1
- package/build-module/components/block-popover/index.js +1 -19
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/index.js +2 -1
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +3 -5
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js +46 -0
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -40
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +7 -6
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +82 -0
- package/build-module/components/block-toolbar/shuffle.js.map +1 -0
- package/build-module/components/block-toolbar/use-has-block-toolbar.js +36 -0
- package/build-module/components/block-toolbar/use-has-block-toolbar.js.map +1 -0
- package/build-module/components/block-tools/block-selection-button.js +5 -1
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/empty-block-inserter.js +2 -5
- package/build-module/components/block-tools/empty-block-inserter.js.map +1 -1
- package/build-module/components/block-tools/index.js +9 -26
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +54 -0
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -0
- package/build-module/components/caption/index.native.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +38 -6
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/color-palette/control.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +1 -1
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +0 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +1 -2
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +1 -1
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +30 -19
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +7 -5
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +16 -16
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +2 -2
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/grid-visualizer/grid-item-resizer.js +69 -0
- package/build-module/components/grid-visualizer/grid-item-resizer.js.map +1 -0
- package/build-module/components/grid-visualizer/grid-visualizer.js +73 -0
- package/build-module/components/grid-visualizer/grid-visualizer.js.map +1 -0
- package/build-module/components/grid-visualizer/index.js +3 -0
- package/build-module/components/grid-visualizer/index.js.map +1 -0
- package/build-module/components/grid-visualizer/utils.js +4 -0
- package/build-module/components/grid-visualizer/utils.js.map +1 -0
- package/build-module/components/iframe/index.js +61 -16
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +8 -2
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/menu.js +9 -3
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build-module/components/inserter/search-results.js +3 -2
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +2 -1
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +1 -1
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +0 -4
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/observe-typing/index.js +5 -10
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/panel-color-settings/index.js.map +1 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/resizable-box-popover/index.js +3 -5
- package/build-module/components/resizable-box-popover/index.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +1 -1
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +1 -31
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -2
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js +8 -14
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/index.js +5 -8
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/dimensions.js +1 -2
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-size.js +7 -8
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +89 -1
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/layout.js +11 -4
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/position.js +0 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/spacing-visualizer.js +106 -0
- package/build-module/hooks/spacing-visualizer.js.map +1 -0
- package/build-module/hooks/use-typography-props.js +2 -3
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/layouts/grid.js +113 -16
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +2 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +4 -36
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +29 -45
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/reducer.js +2 -4
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +23 -13
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/calculate-scale.js +11 -0
- package/build-module/utils/calculate-scale.js.map +1 -0
- package/build-style/content-rtl.css +7 -2
- package/build-style/content.css +7 -2
- package/build-style/style-rtl.css +55 -25
- package/build-style/style.css +55 -25
- package/package.json +31 -32
- package/src/components/block-canvas/index.js +2 -0
- package/src/components/block-draggable/test/index.native.js +2 -2
- package/src/components/block-heading-level-dropdown/index.js +17 -25
- package/src/components/block-inspector/index.js +0 -11
- package/src/components/block-list/block-invalid-warning.native.js +1 -1
- package/src/components/block-list/block-list-item.native.js +1 -1
- package/src/components/block-list/block-outline.native.js +36 -21
- package/src/components/block-list/block-selection-button.native.js +1 -3
- package/src/components/block-list/block.native.js +0 -3
- package/src/components/block-list/content.scss +5 -1
- package/src/components/block-list/index.js +55 -55
- package/src/components/block-list/test/block-outline.native.js +255 -0
- package/src/components/block-mover/index.native.js +1 -1
- package/src/components/block-popover/cover.js +63 -0
- package/src/components/block-popover/drop-zone.js +3 -4
- package/src/components/block-popover/index.js +1 -28
- package/src/components/block-preview/index.js +3 -1
- package/src/components/block-removal-warning-modal/index.js +5 -19
- package/src/components/block-rename/modal.js +1 -1
- package/src/components/block-settings-menu/block-parent-selector-menu-item.js +50 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +9 -50
- package/src/components/block-styles/style.scss +0 -4
- package/src/components/block-switcher/block-transformations-menu.native.js +1 -1
- package/src/components/block-toolbar/block-toolbar-menu.native.js +2 -2
- package/src/components/block-toolbar/index.js +5 -11
- package/src/components/block-toolbar/shuffle.js +93 -0
- package/src/components/block-toolbar/use-has-block-toolbar.js +49 -0
- package/src/components/block-tools/block-selection-button.js +4 -0
- package/src/components/block-tools/empty-block-inserter.js +3 -6
- package/src/components/block-tools/index.js +13 -36
- package/src/components/block-tools/use-show-block-tools.js +73 -0
- package/src/components/caption/index.native.js +1 -1
- package/src/components/child-layout-control/index.js +85 -44
- package/src/components/color-palette/control.js +1 -1
- package/src/components/colors-gradients/control.js +1 -1
- package/src/components/colors-gradients/test/control.js +2 -2
- package/src/components/contrast-checker/test/index.js +10 -10
- package/src/components/date-format-picker/index.js +0 -1
- package/src/components/default-block-appender/content.scss +5 -2
- package/src/components/font-appearance-control/index.js +0 -1
- package/src/components/global-styles/border-panel.js +2 -2
- package/src/components/global-styles/color-panel.js +1 -1
- package/src/components/global-styles/dimensions-panel.js +36 -24
- package/src/components/global-styles/image-settings-panel.js +1 -1
- package/src/components/global-styles/test/typography-utils.js +231 -81
- package/src/components/global-styles/test/use-global-styles-output.js +3 -2
- package/src/components/global-styles/typography-utils.js +10 -7
- package/src/components/global-styles/use-global-styles-output.js +14 -16
- package/src/components/global-styles/utils.js +2 -8
- package/src/components/grid-visualizer/grid-item-resizer.js +100 -0
- package/src/components/grid-visualizer/grid-visualizer.js +81 -0
- package/src/components/grid-visualizer/index.js +2 -0
- package/src/components/grid-visualizer/style.scss +33 -0
- package/src/components/grid-visualizer/utils.js +5 -0
- package/src/components/iframe/index.js +78 -31
- package/src/components/index.native.js +1 -0
- package/src/components/inner-blocks/use-nested-settings-update.js +12 -2
- package/src/components/inserter/media-tab/media-preview.js +1 -1
- package/src/components/inserter/menu.js +10 -4
- package/src/components/inserter/menu.native.js +3 -3
- package/src/components/inserter/mobile-tab-navigation.js +1 -1
- package/src/components/inserter/search-results.js +2 -1
- package/src/components/inserter/style.scss +10 -0
- package/src/components/inserter/tabs.js +2 -1
- package/src/components/inspector-controls/block-support-tools-panel.js +2 -2
- package/src/components/inspector-controls-tabs/index.js +1 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +0 -7
- package/src/components/line-height-control/test/index.js +1 -1
- package/src/components/link-control/search-input.js +1 -1
- package/src/components/list-view/branch.js +1 -1
- package/src/components/list-view/drop-indicator.js +1 -1
- package/src/components/list-view/index.js +1 -1
- package/src/components/observe-typing/index.js +7 -10
- package/src/components/panel-color-settings/index.js +1 -1
- package/src/components/panel-color-settings/test/index.js +3 -3
- package/src/components/provider/index.js +1 -4
- package/src/components/resizable-box-popover/index.js +4 -6
- package/src/components/responsive-block-control/README.md +4 -4
- package/src/components/responsive-block-control/index.js +1 -1
- package/src/components/responsive-block-control/test/index.js +5 -5
- package/src/components/rich-text/format-toolbar-container.js +1 -48
- package/src/components/rich-text/index.js +1 -2
- package/src/components/skip-to-selected-block/index.js +10 -13
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -5
- package/src/components/url-input/index.js +6 -15
- package/src/hooks/anchor.scss +1 -1
- package/src/hooks/background.js +1 -1
- package/src/hooks/block-hooks.js +1 -1
- package/src/hooks/dimensions.js +1 -2
- package/src/hooks/font-size.js +7 -12
- package/src/hooks/index.js +1 -0
- package/src/hooks/layout-child.js +91 -1
- package/src/hooks/layout.js +12 -1
- package/src/hooks/line-height.js +1 -1
- package/src/hooks/position.js +0 -1
- package/src/hooks/spacing-visualizer.js +126 -0
- package/src/hooks/{padding.scss → spacing.scss} +1 -1
- package/src/hooks/use-typography-props.js +2 -8
- package/src/layouts/grid.js +137 -53
- package/src/layouts/test/grid.js +16 -2
- package/src/private-apis.js +2 -2
- package/src/store/actions.js +4 -42
- package/src/store/private-actions.js +34 -69
- package/src/store/reducer.js +2 -8
- package/src/store/selectors.js +41 -46
- package/src/store/test/actions.js +0 -105
- package/src/style.scss +2 -2
- package/src/utils/calculate-scale.js +20 -0
- package/build/components/default-style-picker/index.js +0 -70
- package/build/components/default-style-picker/index.js.map +0 -1
- package/build/hooks/margin.js +0 -86
- package/build/hooks/margin.js.map +0 -1
- package/build/hooks/padding.js +0 -78
- package/build/hooks/padding.js.map +0 -1
- package/build/utils/use-can-block-toolbar-be-focused.js +0 -46
- package/build/utils/use-can-block-toolbar-be-focused.js.map +0 -1
- package/build-module/components/default-style-picker/index.js +0 -63
- package/build-module/components/default-style-picker/index.js.map +0 -1
- package/build-module/hooks/margin.js +0 -78
- package/build-module/hooks/margin.js.map +0 -1
- package/build-module/hooks/padding.js +0 -70
- package/build-module/hooks/padding.js.map +0 -1
- package/build-module/utils/use-can-block-toolbar-be-focused.js +0 -40
- package/build-module/utils/use-can-block-toolbar-be-focused.js.map +0 -1
- package/src/components/block-settings-menu/style.scss +0 -3
- package/src/components/default-style-picker/index.js +0 -70
- package/src/hooks/margin.js +0 -91
- package/src/hooks/padding.js +0 -82
- package/src/utils/use-can-block-toolbar-be-focused.js +0 -48
package/src/store/actions.js
CHANGED
|
@@ -331,36 +331,6 @@ export function toggleSelection( isSelectionEnabled = true ) {
|
|
|
331
331
|
};
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
-
function getBlocksWithDefaultStylesApplied( blocks, blockEditorSettings ) {
|
|
335
|
-
const preferredStyleVariations =
|
|
336
|
-
blockEditorSettings?.__experimentalPreferredStyleVariations?.value ??
|
|
337
|
-
{};
|
|
338
|
-
return blocks.map( ( block ) => {
|
|
339
|
-
const blockName = block.name;
|
|
340
|
-
if ( ! hasBlockSupport( blockName, 'defaultStylePicker', true ) ) {
|
|
341
|
-
return block;
|
|
342
|
-
}
|
|
343
|
-
if ( ! preferredStyleVariations[ blockName ] ) {
|
|
344
|
-
return block;
|
|
345
|
-
}
|
|
346
|
-
const className = block.attributes?.className;
|
|
347
|
-
if ( className?.includes( 'is-style-' ) ) {
|
|
348
|
-
return block;
|
|
349
|
-
}
|
|
350
|
-
const { attributes = {} } = block;
|
|
351
|
-
const blockStyle = preferredStyleVariations[ blockName ];
|
|
352
|
-
return {
|
|
353
|
-
...block,
|
|
354
|
-
attributes: {
|
|
355
|
-
...attributes,
|
|
356
|
-
className: `${
|
|
357
|
-
className || ''
|
|
358
|
-
} is-style-${ blockStyle }`.trim(),
|
|
359
|
-
},
|
|
360
|
-
};
|
|
361
|
-
} );
|
|
362
|
-
}
|
|
363
|
-
|
|
364
334
|
/* eslint-disable jsdoc/valid-types */
|
|
365
335
|
/**
|
|
366
336
|
* Action that replaces given blocks with one or more replacement blocks.
|
|
@@ -378,10 +348,7 @@ export const replaceBlocks =
|
|
|
378
348
|
( { select, dispatch, registry } ) => {
|
|
379
349
|
/* eslint-enable jsdoc/valid-types */
|
|
380
350
|
clientIds = castArray( clientIds );
|
|
381
|
-
blocks =
|
|
382
|
-
castArray( blocks ),
|
|
383
|
-
select.getSettings()
|
|
384
|
-
);
|
|
351
|
+
blocks = castArray( blocks );
|
|
385
352
|
const rootClientId = select.getBlockRootClientId( clientIds[ 0 ] );
|
|
386
353
|
// Replace is valid if the new blocks can be inserted in the root block.
|
|
387
354
|
for ( let index = 0; index < blocks.length; index++ ) {
|
|
@@ -594,10 +561,7 @@ export const insertBlocks =
|
|
|
594
561
|
);
|
|
595
562
|
}
|
|
596
563
|
|
|
597
|
-
blocks =
|
|
598
|
-
castArray( blocks ),
|
|
599
|
-
select.getSettings()
|
|
600
|
-
);
|
|
564
|
+
blocks = castArray( blocks );
|
|
601
565
|
const allowedBlocks = [];
|
|
602
566
|
for ( const block of blocks ) {
|
|
603
567
|
const isValid = select.canInsertBlockType(
|
|
@@ -960,10 +924,8 @@ export const __unstableExpandSelection =
|
|
|
960
924
|
export const mergeBlocks =
|
|
961
925
|
( firstBlockClientId, secondBlockClientId ) =>
|
|
962
926
|
( { registry, select, dispatch } ) => {
|
|
963
|
-
const
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
const [ clientIdA, clientIdB ] = blocks;
|
|
927
|
+
const clientIdA = firstBlockClientId;
|
|
928
|
+
const clientIdB = secondBlockClientId;
|
|
967
929
|
const blockA = select.getBlock( clientIdA );
|
|
968
930
|
const blockAType = getBlockType( blockA.name );
|
|
969
931
|
|
|
@@ -123,61 +123,36 @@ export const privateRemoveBlocks =
|
|
|
123
123
|
//
|
|
124
124
|
// @see https://github.com/WordPress/gutenberg/pull/51145
|
|
125
125
|
const rules = ! forceRemove && select.getBlockRemovalRules();
|
|
126
|
-
if ( rules ) {
|
|
127
|
-
const blockNamesForPrompt = new Set();
|
|
128
|
-
|
|
129
|
-
// Given a list of client IDs of blocks that the user intended to
|
|
130
|
-
// remove, perform a tree search (BFS) to find all block names
|
|
131
|
-
// corresponding to "important" blocks, i.e. blocks that require a
|
|
132
|
-
// removal prompt.
|
|
133
|
-
const queue = [ ...clientIds ];
|
|
134
|
-
let messageType = 'templates';
|
|
135
|
-
while ( queue.length ) {
|
|
136
|
-
const clientId = queue.shift();
|
|
137
|
-
const blockName = select.getBlockName( clientId );
|
|
138
|
-
if ( rules[ blockName ] ) {
|
|
139
|
-
blockNamesForPrompt.add( blockName );
|
|
140
|
-
}
|
|
141
126
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
continue;
|
|
151
|
-
}
|
|
152
|
-
const blockAttributes =
|
|
153
|
-
select.getBlockAttributes( clientId );
|
|
154
|
-
if (
|
|
155
|
-
blockAttributes?.metadata?.bindings &&
|
|
156
|
-
JSON.stringify(
|
|
157
|
-
blockAttributes.metadata.bindings
|
|
158
|
-
).includes( 'core/pattern-overrides' )
|
|
159
|
-
) {
|
|
160
|
-
blockNamesForPrompt.add( blockName );
|
|
161
|
-
messageType = 'patternOverrides';
|
|
162
|
-
}
|
|
127
|
+
if ( rules ) {
|
|
128
|
+
function flattenBlocks( blocks ) {
|
|
129
|
+
const result = [];
|
|
130
|
+
const stack = [ ...blocks ];
|
|
131
|
+
while ( stack.length ) {
|
|
132
|
+
const { innerBlocks, ...block } = stack.shift();
|
|
133
|
+
stack.push( ...innerBlocks );
|
|
134
|
+
result.push( block );
|
|
163
135
|
}
|
|
164
|
-
|
|
165
|
-
const innerBlocks = select.getBlockOrder( clientId );
|
|
166
|
-
queue.push( ...innerBlocks );
|
|
136
|
+
return result;
|
|
167
137
|
}
|
|
168
138
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
139
|
+
const blockList = clientIds.map( select.getBlock );
|
|
140
|
+
const flattenedBlocks = flattenBlocks( blockList );
|
|
141
|
+
|
|
142
|
+
// Find the first message and use it.
|
|
143
|
+
let message;
|
|
144
|
+
for ( const rule of rules ) {
|
|
145
|
+
message = rule.callback( flattenedBlocks );
|
|
146
|
+
if ( message ) {
|
|
147
|
+
dispatch(
|
|
148
|
+
displayBlockRemovalPrompt(
|
|
149
|
+
clientIds,
|
|
150
|
+
selectPrevious,
|
|
151
|
+
message
|
|
152
|
+
)
|
|
153
|
+
);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
181
156
|
}
|
|
182
157
|
}
|
|
183
158
|
|
|
@@ -228,31 +203,21 @@ export const ensureDefaultBlock =
|
|
|
228
203
|
*
|
|
229
204
|
* Contrast with `setBlockRemovalRules`.
|
|
230
205
|
*
|
|
231
|
-
* @param {string|string[]} clientIds
|
|
232
|
-
* @param {boolean} selectPrevious
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
* @param {string[]} blockNamesForPrompt Names of the blocks that
|
|
238
|
-
* triggered the need for
|
|
239
|
-
* confirmation before removal.
|
|
240
|
-
* @param {string} messageType The type of message to display.
|
|
206
|
+
* @param {string|string[]} clientIds Client IDs of blocks to remove.
|
|
207
|
+
* @param {boolean} selectPrevious True if the previous block or the
|
|
208
|
+
* immediate parent (if no previous
|
|
209
|
+
* block exists) should be selected
|
|
210
|
+
* when a block is removed.
|
|
211
|
+
* @param {string} message Message to display in the prompt.
|
|
241
212
|
*
|
|
242
213
|
* @return {Object} Action object.
|
|
243
214
|
*/
|
|
244
|
-
function displayBlockRemovalPrompt(
|
|
245
|
-
clientIds,
|
|
246
|
-
selectPrevious,
|
|
247
|
-
blockNamesForPrompt,
|
|
248
|
-
messageType
|
|
249
|
-
) {
|
|
215
|
+
function displayBlockRemovalPrompt( clientIds, selectPrevious, message ) {
|
|
250
216
|
return {
|
|
251
217
|
type: 'DISPLAY_BLOCK_REMOVAL_PROMPT',
|
|
252
218
|
clientIds,
|
|
253
219
|
selectPrevious,
|
|
254
|
-
|
|
255
|
-
messageType,
|
|
220
|
+
message,
|
|
256
221
|
};
|
|
257
222
|
}
|
|
258
223
|
|
package/src/store/reducer.js
CHANGED
|
@@ -1521,17 +1521,11 @@ export function isSelectionEnabled( state = true, action ) {
|
|
|
1521
1521
|
function removalPromptData( state = false, action ) {
|
|
1522
1522
|
switch ( action.type ) {
|
|
1523
1523
|
case 'DISPLAY_BLOCK_REMOVAL_PROMPT':
|
|
1524
|
-
const {
|
|
1525
|
-
clientIds,
|
|
1526
|
-
selectPrevious,
|
|
1527
|
-
blockNamesForPrompt,
|
|
1528
|
-
messageType,
|
|
1529
|
-
} = action;
|
|
1524
|
+
const { clientIds, selectPrevious, message } = action;
|
|
1530
1525
|
return {
|
|
1531
1526
|
clientIds,
|
|
1532
1527
|
selectPrevious,
|
|
1533
|
-
|
|
1534
|
-
messageType,
|
|
1528
|
+
message,
|
|
1535
1529
|
};
|
|
1536
1530
|
case 'CLEAR_BLOCK_REMOVAL_PROMPT':
|
|
1537
1531
|
return false;
|
package/src/store/selectors.js
CHANGED
|
@@ -2231,56 +2231,41 @@ export const __experimentalGetAllowedBlocks = createSelector(
|
|
|
2231
2231
|
* @param {Object} state Editor state.
|
|
2232
2232
|
* @param {?string} rootClientId Optional root client ID of block list.
|
|
2233
2233
|
*
|
|
2234
|
-
* @return {
|
|
2234
|
+
* @return {WPDirectInsertBlock|undefined} The block type to be directly inserted.
|
|
2235
2235
|
*
|
|
2236
2236
|
* @typedef {Object} WPDirectInsertBlock
|
|
2237
2237
|
* @property {string} name The type of block.
|
|
2238
2238
|
* @property {?Object} attributes Attributes to pass to the newly created block.
|
|
2239
2239
|
* @property {?Array<string>} attributesToCopy Attributes to be copied from adjecent blocks when inserted.
|
|
2240
2240
|
*/
|
|
2241
|
-
export
|
|
2242
|
-
(
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
if ( ! defaultBlock || ! directInsert ) {
|
|
2251
|
-
return;
|
|
2252
|
-
}
|
|
2253
|
-
if ( typeof directInsert === 'function' ) {
|
|
2254
|
-
return directInsert( getBlock( state, rootClientId ) )
|
|
2255
|
-
? defaultBlock
|
|
2256
|
-
: null;
|
|
2257
|
-
}
|
|
2258
|
-
return defaultBlock;
|
|
2259
|
-
},
|
|
2260
|
-
( state, rootClientId ) => [
|
|
2261
|
-
state.blockListSettings[ rootClientId ],
|
|
2262
|
-
state.blocks.tree.get( rootClientId ),
|
|
2263
|
-
]
|
|
2264
|
-
);
|
|
2241
|
+
export function getDirectInsertBlock( state, rootClientId = null ) {
|
|
2242
|
+
if ( ! rootClientId ) {
|
|
2243
|
+
return;
|
|
2244
|
+
}
|
|
2245
|
+
const { defaultBlock, directInsert } =
|
|
2246
|
+
state.blockListSettings[ rootClientId ] ?? {};
|
|
2247
|
+
if ( ! defaultBlock || ! directInsert ) {
|
|
2248
|
+
return;
|
|
2249
|
+
}
|
|
2265
2250
|
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2251
|
+
return defaultBlock;
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
export function __experimentalGetDirectInsertBlock(
|
|
2255
|
+
state,
|
|
2256
|
+
rootClientId = null
|
|
2257
|
+
) {
|
|
2258
|
+
deprecated(
|
|
2259
|
+
'wp.data.select( "core/block-editor" ).__experimentalGetDirectInsertBlock',
|
|
2260
|
+
{
|
|
2261
|
+
alternative:
|
|
2262
|
+
'wp.data.select( "core/block-editor" ).getDirectInsertBlock',
|
|
2263
|
+
since: '6.3',
|
|
2264
|
+
version: '6.4',
|
|
2265
|
+
}
|
|
2266
|
+
);
|
|
2267
|
+
return getDirectInsertBlock( state, rootClientId );
|
|
2268
|
+
}
|
|
2284
2269
|
|
|
2285
2270
|
export const __experimentalGetParsedPattern = createRegistrySelector(
|
|
2286
2271
|
( select ) =>
|
|
@@ -2293,11 +2278,21 @@ export const __experimentalGetParsedPattern = createRegistrySelector(
|
|
|
2293
2278
|
if ( ! pattern ) {
|
|
2294
2279
|
return null;
|
|
2295
2280
|
}
|
|
2281
|
+
const blocks = parse( pattern.content, {
|
|
2282
|
+
__unstableSkipMigrationLogs: true,
|
|
2283
|
+
} );
|
|
2284
|
+
if ( blocks.length === 1 ) {
|
|
2285
|
+
blocks[ 0 ].attributes = {
|
|
2286
|
+
...blocks[ 0 ].attributes,
|
|
2287
|
+
metadata: {
|
|
2288
|
+
...( blocks[ 0 ].attributes.metadata || {} ),
|
|
2289
|
+
categories: pattern.categories,
|
|
2290
|
+
},
|
|
2291
|
+
};
|
|
2292
|
+
}
|
|
2296
2293
|
return {
|
|
2297
2294
|
...pattern,
|
|
2298
|
-
blocks
|
|
2299
|
-
__unstableSkipMigrationLogs: true,
|
|
2300
|
-
} ),
|
|
2295
|
+
blocks,
|
|
2301
2296
|
};
|
|
2302
2297
|
}, getAllPatternsDependants( select ) )
|
|
2303
2298
|
);
|
|
@@ -380,107 +380,6 @@ describe( 'actions', () => {
|
|
|
380
380
|
} );
|
|
381
381
|
|
|
382
382
|
describe( 'insertBlocks', () => {
|
|
383
|
-
it( 'should apply default styles to blocks if blocks do not contain a style', () => {
|
|
384
|
-
const ribsBlock = {
|
|
385
|
-
clientId: 'ribs',
|
|
386
|
-
name: 'core/test-ribs',
|
|
387
|
-
};
|
|
388
|
-
const chickenBlock = {
|
|
389
|
-
clientId: 'chicken',
|
|
390
|
-
name: 'core/test-chicken',
|
|
391
|
-
};
|
|
392
|
-
const chickenRibsBlock = {
|
|
393
|
-
clientId: 'chicken-ribs',
|
|
394
|
-
name: 'core/test-chicken-ribs',
|
|
395
|
-
};
|
|
396
|
-
const blocks = [ ribsBlock, chickenBlock, chickenRibsBlock ];
|
|
397
|
-
|
|
398
|
-
const select = {
|
|
399
|
-
getSettings: () => ( {
|
|
400
|
-
__experimentalPreferredStyleVariations: {
|
|
401
|
-
value: {
|
|
402
|
-
'core/test-ribs': 'squared',
|
|
403
|
-
'core/test-chicken-ribs': 'colorful',
|
|
404
|
-
},
|
|
405
|
-
},
|
|
406
|
-
} ),
|
|
407
|
-
canInsertBlockType: () => true,
|
|
408
|
-
};
|
|
409
|
-
const dispatch = jest.fn();
|
|
410
|
-
|
|
411
|
-
insertBlocks(
|
|
412
|
-
blocks,
|
|
413
|
-
5,
|
|
414
|
-
'testrootid',
|
|
415
|
-
false
|
|
416
|
-
)( { select, dispatch } );
|
|
417
|
-
|
|
418
|
-
expect( dispatch ).toHaveBeenCalledWith( {
|
|
419
|
-
type: 'INSERT_BLOCKS',
|
|
420
|
-
blocks: [
|
|
421
|
-
{
|
|
422
|
-
...ribsBlock,
|
|
423
|
-
attributes: { className: 'is-style-squared' },
|
|
424
|
-
},
|
|
425
|
-
chickenBlock,
|
|
426
|
-
{
|
|
427
|
-
...chickenRibsBlock,
|
|
428
|
-
attributes: { className: 'is-style-colorful' },
|
|
429
|
-
},
|
|
430
|
-
],
|
|
431
|
-
index: 5,
|
|
432
|
-
rootClientId: 'testrootid',
|
|
433
|
-
time: expect.any( Number ),
|
|
434
|
-
updateSelection: false,
|
|
435
|
-
initialPosition: null,
|
|
436
|
-
} );
|
|
437
|
-
} );
|
|
438
|
-
|
|
439
|
-
it( 'should keep styles explicitly set even if different from the default', () => {
|
|
440
|
-
const ribsWithStyleBlock = {
|
|
441
|
-
clientId: 'ribs',
|
|
442
|
-
name: 'core/test-ribs',
|
|
443
|
-
attributes: {
|
|
444
|
-
className: 'is-style-colorful',
|
|
445
|
-
},
|
|
446
|
-
};
|
|
447
|
-
const blocks = [ ribsWithStyleBlock ];
|
|
448
|
-
|
|
449
|
-
const select = {
|
|
450
|
-
getSettings: () => ( {
|
|
451
|
-
__experimentalPreferredStyleVariations: {
|
|
452
|
-
value: {
|
|
453
|
-
'core/test-ribs': 'squared',
|
|
454
|
-
},
|
|
455
|
-
},
|
|
456
|
-
} ),
|
|
457
|
-
canInsertBlockType: () => true,
|
|
458
|
-
};
|
|
459
|
-
const dispatch = jest.fn();
|
|
460
|
-
|
|
461
|
-
insertBlocks(
|
|
462
|
-
blocks,
|
|
463
|
-
5,
|
|
464
|
-
'testrootid',
|
|
465
|
-
false
|
|
466
|
-
)( { select, dispatch } );
|
|
467
|
-
|
|
468
|
-
expect( dispatch ).toHaveBeenCalledWith( {
|
|
469
|
-
type: 'INSERT_BLOCKS',
|
|
470
|
-
blocks: [
|
|
471
|
-
{
|
|
472
|
-
...ribsWithStyleBlock,
|
|
473
|
-
attributes: { className: 'is-style-colorful' },
|
|
474
|
-
},
|
|
475
|
-
],
|
|
476
|
-
index: 5,
|
|
477
|
-
rootClientId: 'testrootid',
|
|
478
|
-
time: expect.any( Number ),
|
|
479
|
-
updateSelection: false,
|
|
480
|
-
initialPosition: null,
|
|
481
|
-
} );
|
|
482
|
-
} );
|
|
483
|
-
|
|
484
383
|
it( 'should filter the allowed blocks in INSERT_BLOCKS action', () => {
|
|
485
384
|
const ribsBlock = {
|
|
486
385
|
clientId: 'ribs',
|
|
@@ -933,10 +832,6 @@ describe( 'actions', () => {
|
|
|
933
832
|
blockB.clientId
|
|
934
833
|
)( { select, dispatch } );
|
|
935
834
|
|
|
936
|
-
expect( dispatch ).toHaveBeenCalledWith( {
|
|
937
|
-
type: 'MERGE_BLOCKS',
|
|
938
|
-
blocks: [ blockA.clientId, blockB.clientId ],
|
|
939
|
-
} );
|
|
940
835
|
expect( dispatch.selectBlock ).toHaveBeenCalledWith( 'chicken' );
|
|
941
836
|
} );
|
|
942
837
|
|
package/src/style.scss
CHANGED
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
@import "./components/block-popover/style.scss";
|
|
18
18
|
@import "./components/block-preview/style.scss";
|
|
19
19
|
@import "./components/block-rename/style.scss";
|
|
20
|
-
@import "./components/block-settings-menu/style.scss";
|
|
21
20
|
@import "./components/block-styles/style.scss";
|
|
22
21
|
@import "./components/block-switcher/style.scss";
|
|
23
22
|
@import "./components/block-types-list/style.scss";
|
|
@@ -29,6 +28,7 @@
|
|
|
29
28
|
@import "./components/duotone-control/style.scss";
|
|
30
29
|
@import "./components/font-appearance-control/style.scss";
|
|
31
30
|
@import "./components/global-styles/style.scss";
|
|
31
|
+
@import "./components/grid-visualizer/style.scss";
|
|
32
32
|
@import "./components/height-control/style.scss";
|
|
33
33
|
@import "./components/image-size-control/style.scss";
|
|
34
34
|
@import "./components/inserter-list-item/style.scss";
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
@import "./hooks/color.scss";
|
|
55
55
|
@import "./hooks/dimensions.scss";
|
|
56
56
|
@import "./hooks/layout.scss";
|
|
57
|
-
@import "./hooks/padding.scss";
|
|
58
57
|
@import "./hooks/position.scss";
|
|
58
|
+
@import "./hooks/spacing.scss";
|
|
59
59
|
@import "./hooks/typography.scss";
|
|
60
60
|
|
|
61
61
|
@import "./components/block-toolbar/style.scss";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const clamp = ( lowerlimit, width, upperlimit ) => {
|
|
2
|
+
if ( width < lowerlimit ) return lowerlimit;
|
|
3
|
+
if ( width > upperlimit ) return upperlimit;
|
|
4
|
+
return width;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export default function calculateScale( scaleConfig, width ) {
|
|
8
|
+
const scaleSlope =
|
|
9
|
+
( scaleConfig.maxScale - scaleConfig.minScale ) /
|
|
10
|
+
( scaleConfig.maxWidth - scaleConfig.minWidth );
|
|
11
|
+
|
|
12
|
+
const scaleIntercept =
|
|
13
|
+
scaleConfig.minScale - scaleSlope * scaleConfig.minWidth;
|
|
14
|
+
|
|
15
|
+
return clamp(
|
|
16
|
+
scaleConfig.maxScale,
|
|
17
|
+
scaleSlope * width + scaleIntercept,
|
|
18
|
+
scaleConfig.minScale
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = DefaultStylePicker;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _blocks = require("@wordpress/blocks");
|
|
9
|
-
var _element = require("@wordpress/element");
|
|
10
|
-
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
var _components = require("@wordpress/components");
|
|
12
|
-
var _data = require("@wordpress/data");
|
|
13
|
-
var _store = require("../../store");
|
|
14
|
-
var _utils = require("../block-styles/utils");
|
|
15
|
-
/**
|
|
16
|
-
* WordPress dependencies
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Internal dependencies
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
function DefaultStylePicker({
|
|
24
|
-
blockName
|
|
25
|
-
}) {
|
|
26
|
-
const {
|
|
27
|
-
preferredStyle,
|
|
28
|
-
onUpdatePreferredStyleVariations,
|
|
29
|
-
styles
|
|
30
|
-
} = (0, _data.useSelect)(select => {
|
|
31
|
-
var _preferredStyleVariat;
|
|
32
|
-
const settings = select(_store.store).getSettings();
|
|
33
|
-
const preferredStyleVariations = settings.__experimentalPreferredStyleVariations;
|
|
34
|
-
return {
|
|
35
|
-
preferredStyle: preferredStyleVariations?.value?.[blockName],
|
|
36
|
-
onUpdatePreferredStyleVariations: (_preferredStyleVariat = preferredStyleVariations?.onChange) !== null && _preferredStyleVariat !== void 0 ? _preferredStyleVariat : null,
|
|
37
|
-
styles: select(_blocks.store).getBlockStyles(blockName)
|
|
38
|
-
};
|
|
39
|
-
}, [blockName]);
|
|
40
|
-
const selectOptions = (0, _element.useMemo)(() => [{
|
|
41
|
-
label: (0, _i18n.__)('Not set'),
|
|
42
|
-
value: ''
|
|
43
|
-
}, ...styles.map(({
|
|
44
|
-
label,
|
|
45
|
-
name
|
|
46
|
-
}) => ({
|
|
47
|
-
label,
|
|
48
|
-
value: name
|
|
49
|
-
}))], [styles]);
|
|
50
|
-
const defaultStyleName = (0, _element.useMemo)(() => (0, _utils.getDefaultStyle)(styles)?.name, [styles]);
|
|
51
|
-
const selectOnChange = (0, _element.useCallback)(blockStyle => {
|
|
52
|
-
onUpdatePreferredStyleVariations(blockName, blockStyle);
|
|
53
|
-
}, [blockName, onUpdatePreferredStyleVariations]);
|
|
54
|
-
|
|
55
|
-
// Until the functionality is migrated to global styles,
|
|
56
|
-
// only show the default style picker if a non-default style has already been selected.
|
|
57
|
-
if (!preferredStyle || preferredStyle === defaultStyleName) {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
return onUpdatePreferredStyleVariations && (0, _react.createElement)("div", {
|
|
61
|
-
className: "default-style-picker__default-switcher"
|
|
62
|
-
}, (0, _react.createElement)(_components.SelectControl, {
|
|
63
|
-
__nextHasNoMarginBottom: true,
|
|
64
|
-
options: selectOptions,
|
|
65
|
-
value: preferredStyle || '',
|
|
66
|
-
label: (0, _i18n.__)('Default Style'),
|
|
67
|
-
onChange: selectOnChange
|
|
68
|
-
}));
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_element","_i18n","_components","_data","_store","_utils","DefaultStylePicker","blockName","preferredStyle","onUpdatePreferredStyleVariations","styles","useSelect","select","_preferredStyleVariat","settings","blockEditorStore","getSettings","preferredStyleVariations","__experimentalPreferredStyleVariations","value","onChange","blocksStore","getBlockStyles","selectOptions","useMemo","label","__","map","name","defaultStyleName","getDefaultStyle","selectOnChange","useCallback","blockStyle","_react","createElement","className","SelectControl","__nextHasNoMarginBottom","options"],"sources":["@wordpress/block-editor/src/components/default-style-picker/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { getDefaultStyle } from '../block-styles/utils';\n\nexport default function DefaultStylePicker( { blockName } ) {\n\tconst { preferredStyle, onUpdatePreferredStyleVariations, styles } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\t\t\tconst preferredStyleVariations =\n\t\t\t\t\tsettings.__experimentalPreferredStyleVariations;\n\t\t\t\treturn {\n\t\t\t\t\tpreferredStyle:\n\t\t\t\t\t\tpreferredStyleVariations?.value?.[ blockName ],\n\t\t\t\t\tonUpdatePreferredStyleVariations:\n\t\t\t\t\t\tpreferredStyleVariations?.onChange ?? null,\n\t\t\t\t\tstyles: select( blocksStore ).getBlockStyles( blockName ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ blockName ]\n\t\t);\n\tconst selectOptions = useMemo(\n\t\t() => [\n\t\t\t{ label: __( 'Not set' ), value: '' },\n\t\t\t...styles.map( ( { label, name } ) => ( { label, value: name } ) ),\n\t\t],\n\t\t[ styles ]\n\t);\n\tconst defaultStyleName = useMemo(\n\t\t() => getDefaultStyle( styles )?.name,\n\t\t[ styles ]\n\t);\n\tconst selectOnChange = useCallback(\n\t\t( blockStyle ) => {\n\t\t\tonUpdatePreferredStyleVariations( blockName, blockStyle );\n\t\t},\n\t\t[ blockName, onUpdatePreferredStyleVariations ]\n\t);\n\n\t// Until the functionality is migrated to global styles,\n\t// only show the default style picker if a non-default style has already been selected.\n\tif ( ! preferredStyle || preferredStyle === defaultStyleName ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\tonUpdatePreferredStyleVariations && (\n\t\t\t<div className=\"default-style-picker__default-switcher\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\toptions={ selectOptions }\n\t\t\t\t\tvalue={ preferredStyle || '' }\n\t\t\t\t\tlabel={ __( 'Default Style' ) }\n\t\t\t\t\tonChange={ selectOnChange }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t)\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAbA;AACA;AACA;;AAOA;AACA;AACA;;AAIe,SAASO,kBAAkBA,CAAE;EAAEC;AAAU,CAAC,EAAG;EAC3D,MAAM;IAAEC,cAAc;IAAEC,gCAAgC;IAAEC;EAAO,CAAC,GACjE,IAAAC,eAAS,EACNC,MAAM,IAAM;IAAA,IAAAC,qBAAA;IACb,MAAMC,QAAQ,GAAGF,MAAM,CAAEG,YAAiB,CAAC,CAACC,WAAW,CAAC,CAAC;IACzD,MAAMC,wBAAwB,GAC7BH,QAAQ,CAACI,sCAAsC;IAChD,OAAO;MACNV,cAAc,EACbS,wBAAwB,EAAEE,KAAK,GAAIZ,SAAS,CAAE;MAC/CE,gCAAgC,GAAAI,qBAAA,GAC/BI,wBAAwB,EAAEG,QAAQ,cAAAP,qBAAA,cAAAA,qBAAA,GAAI,IAAI;MAC3CH,MAAM,EAAEE,MAAM,CAAES,aAAY,CAAC,CAACC,cAAc,CAAEf,SAAU;IACzD,CAAC;EACF,CAAC,EACD,CAAEA,SAAS,CACZ,CAAC;EACF,MAAMgB,aAAa,GAAG,IAAAC,gBAAO,EAC5B,MAAM,CACL;IAAEC,KAAK,EAAE,IAAAC,QAAE,EAAE,SAAU,CAAC;IAAEP,KAAK,EAAE;EAAG,CAAC,EACrC,GAAGT,MAAM,CAACiB,GAAG,CAAE,CAAE;IAAEF,KAAK;IAAEG;EAAK,CAAC,MAAQ;IAAEH,KAAK;IAAEN,KAAK,EAAES;EAAK,CAAC,CAAG,CAAC,CAClE,EACD,CAAElB,MAAM,CACT,CAAC;EACD,MAAMmB,gBAAgB,GAAG,IAAAL,gBAAO,EAC/B,MAAM,IAAAM,sBAAe,EAAEpB,MAAO,CAAC,EAAEkB,IAAI,EACrC,CAAElB,MAAM,CACT,CAAC;EACD,MAAMqB,cAAc,GAAG,IAAAC,oBAAW,EAC/BC,UAAU,IAAM;IACjBxB,gCAAgC,CAAEF,SAAS,EAAE0B,UAAW,CAAC;EAC1D,CAAC,EACD,CAAE1B,SAAS,EAAEE,gCAAgC,CAC9C,CAAC;;EAED;EACA;EACA,IAAK,CAAED,cAAc,IAAIA,cAAc,KAAKqB,gBAAgB,EAAG;IAC9D,OAAO,IAAI;EACZ;EAEA,OACCpB,gCAAgC,IAC/B,IAAAyB,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAAwC,GACtD,IAAAF,MAAA,CAAAC,aAAA,EAACjC,WAAA,CAAAmC,aAAa;IACbC,uBAAuB;IACvBC,OAAO,EAAGhB,aAAe;IACzBJ,KAAK,EAAGX,cAAc,IAAI,EAAI;IAC9BiB,KAAK,EAAG,IAAAC,QAAE,EAAE,eAAgB,CAAG;IAC/BN,QAAQ,EAAGW;EAAgB,CAC3B,CACG,CACL;AAEH"}
|
package/build/hooks/margin.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.MarginVisualizer = MarginVisualizer;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _element = require("@wordpress/element");
|
|
10
|
-
var _isShallowEqual = _interopRequireDefault(require("@wordpress/is-shallow-equal"));
|
|
11
|
-
var _blockPopover = _interopRequireDefault(require("../components/block-popover"));
|
|
12
|
-
var _useBlockRefs = require("../components/block-list/use-block-props/use-block-refs");
|
|
13
|
-
/**
|
|
14
|
-
* WordPress dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Internal dependencies
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
function getComputedCSS(element, property) {
|
|
22
|
-
return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property);
|
|
23
|
-
}
|
|
24
|
-
function MarginVisualizer({
|
|
25
|
-
clientId,
|
|
26
|
-
attributes,
|
|
27
|
-
forceShow
|
|
28
|
-
}) {
|
|
29
|
-
const blockElement = (0, _useBlockRefs.__unstableUseBlockElement)(clientId);
|
|
30
|
-
const [style, setStyle] = (0, _element.useState)();
|
|
31
|
-
const margin = attributes?.style?.spacing?.margin;
|
|
32
|
-
(0, _element.useEffect)(() => {
|
|
33
|
-
if (!blockElement || null === blockElement.ownerDocument.defaultView) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const top = getComputedCSS(blockElement, 'margin-top');
|
|
37
|
-
const right = getComputedCSS(blockElement, 'margin-right');
|
|
38
|
-
const bottom = getComputedCSS(blockElement, 'margin-bottom');
|
|
39
|
-
const left = getComputedCSS(blockElement, 'margin-left');
|
|
40
|
-
setStyle({
|
|
41
|
-
borderTopWidth: top,
|
|
42
|
-
borderRightWidth: right,
|
|
43
|
-
borderBottomWidth: bottom,
|
|
44
|
-
borderLeftWidth: left,
|
|
45
|
-
top: top ? `-${top}` : 0,
|
|
46
|
-
right: right ? `-${right}` : 0,
|
|
47
|
-
bottom: bottom ? `-${bottom}` : 0,
|
|
48
|
-
left: left ? `-${left}` : 0
|
|
49
|
-
});
|
|
50
|
-
}, [blockElement, margin]);
|
|
51
|
-
const [isActive, setIsActive] = (0, _element.useState)(false);
|
|
52
|
-
const valueRef = (0, _element.useRef)(margin);
|
|
53
|
-
const timeoutRef = (0, _element.useRef)();
|
|
54
|
-
const clearTimer = () => {
|
|
55
|
-
if (timeoutRef.current) {
|
|
56
|
-
window.clearTimeout(timeoutRef.current);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
(0, _element.useEffect)(() => {
|
|
60
|
-
if (!(0, _isShallowEqual.default)(margin, valueRef.current) && !forceShow) {
|
|
61
|
-
setIsActive(true);
|
|
62
|
-
valueRef.current = margin;
|
|
63
|
-
timeoutRef.current = setTimeout(() => {
|
|
64
|
-
setIsActive(false);
|
|
65
|
-
}, 400);
|
|
66
|
-
}
|
|
67
|
-
return () => {
|
|
68
|
-
setIsActive(false);
|
|
69
|
-
clearTimer();
|
|
70
|
-
};
|
|
71
|
-
}, [margin, forceShow]);
|
|
72
|
-
if (!isActive && !forceShow) {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
return (0, _react.createElement)(_blockPopover.default, {
|
|
76
|
-
clientId: clientId,
|
|
77
|
-
__unstableCoverTarget: true,
|
|
78
|
-
__unstableRefreshSize: margin,
|
|
79
|
-
__unstablePopoverSlot: "block-toolbar",
|
|
80
|
-
shift: false
|
|
81
|
-
}, (0, _react.createElement)("div", {
|
|
82
|
-
className: "block-editor__padding-visualizer",
|
|
83
|
-
style: style
|
|
84
|
-
}));
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=margin.js.map
|