@wordpress/block-editor 11.8.0 → 12.1.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 +10 -0
- package/README.md +16 -4
- package/build/components/block-controls/slot.js +12 -4
- package/build/components/block-controls/slot.js.map +1 -1
- package/build/components/block-controls/slot.native.js +10 -1
- package/build/components/block-controls/slot.native.js.map +1 -1
- package/build/components/block-draggable/index.js +11 -7
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.js +2 -2
- package/build/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
- package/build/components/block-info-slot-fill/index.js +47 -0
- package/build/components/block-info-slot-fill/index.js.map +1 -0
- package/build/components/block-inspector/index.js +4 -2
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.native.js +15 -7
- package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build/components/block-list/block-list-item-cell.native.js +15 -2
- package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js +158 -195
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-outline.native.js +57 -0
- package/build/components/block-list/block-outline.native.js.map +1 -0
- package/build/components/block-list/block.native.js +343 -300
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +202 -298
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/insertion-point.native.js +4 -2
- package/build/components/block-list/insertion-point.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +8 -10
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +15 -4
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +2 -1
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +40 -11
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +8 -30
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build/components/editor-styles/index.js +4 -3
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +21 -14
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/global-styles/advanced-panel.js +86 -0
- package/build/components/global-styles/advanced-panel.js.map +1 -0
- package/build/components/global-styles/border-panel.js +2 -32
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +16 -13
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.native.js +174 -0
- package/build/components/global-styles/color-panel.native.js.map +1 -0
- package/build/components/global-styles/dimensions-panel.js +12 -12
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/effects-panel.js +1 -1
- package/build/components/global-styles/effects-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +78 -14
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +1 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +24 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +10 -10
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +114 -81
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +30 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +24 -8
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/index.js +7 -0
- package/build/components/index.js.map +1 -1
- package/build/components/inserter/block-types-tab.js +12 -7
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/index.js +2 -1
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +5 -0
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls/fill.js +1 -1
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +1 -1
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/groups.js +2 -0
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls/slot.js +3 -6
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls/slot.native.js +1 -1
- package/build/components/inspector-controls/slot.native.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +2 -0
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/line-height-control/index.js +7 -2
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/use-internal-input-value.js +9 -8
- package/build/components/link-control/use-internal-input-value.js.map +1 -1
- package/build/components/list-view/block-contents.js +7 -2
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block-select-button.js +9 -3
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +16 -25
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/drop-indicator.js +37 -10
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js +38 -18
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/leaf.js +2 -1
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +1 -1
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +163 -11
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/media-placeholder/index.js +68 -7
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +5 -5
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +2 -2
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +12 -4
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +2 -7
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js +3 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
- package/build/components/preview-options/index.js +6 -1
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +1 -2
- package/build/components/url-input/index.js.map +1 -1
- package/build/hooks/align.js +1 -1
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/border.js +1 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +1 -1
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +8 -12
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/duotone.js +29 -4
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.native.js +8 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout.js +2 -2
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +1 -1
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +1 -1
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/use-editor-wrapper-styles.native.js +255 -0
- package/build/hooks/use-editor-wrapper-styles.native.js.map +1 -0
- package/build/hooks/use-typography-props.js +14 -10
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/hooks/utils.js +15 -3
- package/build/hooks/utils.js.map +1 -1
- package/build/index.native.js +31 -0
- package/build/index.native.js.map +1 -0
- package/build/private-apis.js +10 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +7 -0
- package/build/store/actions.js.map +1 -1
- package/build/utils/object.js +5 -5
- package/build/utils/object.js.map +1 -1
- package/build/utils/transform-styles/index.js +2 -2
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build/utils/use-should-contextual-toolbar-show.js +72 -0
- package/build/utils/use-should-contextual-toolbar-show.js.map +1 -0
- package/build-module/components/block-controls/slot.js +11 -4
- package/build-module/components/block-controls/slot.js.map +1 -1
- package/build-module/components/block-controls/slot.native.js +9 -1
- package/build-module/components/block-controls/slot.native.js.map +1 -1
- package/build-module/components/block-draggable/index.js +10 -6
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.js +2 -2
- package/build-module/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
- package/build-module/components/block-info-slot-fill/index.js +34 -0
- package/build-module/components/block-info-slot-fill/index.js.map +1 -0
- package/build-module/components/block-inspector/index.js +3 -2
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.native.js +16 -8
- package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build-module/components/block-list/block-list-item-cell.native.js +13 -2
- package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +160 -190
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-outline.native.js +44 -0
- package/build-module/components/block-list/block-outline.native.js.map +1 -0
- package/build-module/components/block-list/block.native.js +341 -299
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +203 -293
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/insertion-point.native.js +4 -2
- package/build-module/components/block-list/insertion-point.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +8 -9
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +13 -5
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +2 -1
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +37 -11
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +8 -29
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build-module/components/editor-styles/index.js +4 -3
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +21 -14
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +74 -0
- package/build-module/components/global-styles/advanced-panel.js.map +1 -0
- package/build-module/components/global-styles/border-panel.js +2 -32
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +18 -15
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.native.js +150 -0
- package/build-module/components/global-styles/color-panel.native.js.map +1 -0
- package/build-module/components/global-styles/dimensions-panel.js +13 -13
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/effects-panel.js +2 -2
- package/build-module/components/global-styles/effects-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +78 -16
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +1 -2
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +3 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +11 -11
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +112 -81
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +25 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +24 -8
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/index.js +1 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +12 -6
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/index.js +2 -1
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +4 -0
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +1 -1
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +1 -1
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +2 -0
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +4 -7
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls/slot.native.js +1 -1
- package/build-module/components/inspector-controls/slot.native.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +2 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/line-height-control/index.js +7 -2
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/use-internal-input-value.js +9 -8
- package/build-module/components/link-control/use-internal-input-value.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +7 -3
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +9 -3
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +18 -26
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +36 -10
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js +39 -19
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/leaf.js +2 -1
- package/build-module/components/list-view/leaf.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +1 -1
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +160 -11
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +66 -7
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +5 -5
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +2 -2
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +12 -4
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +1 -5
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js +3 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
- package/build-module/components/preview-options/index.js +7 -2
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/index.js +1 -2
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/hooks/align.js +1 -1
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/border.js +1 -1
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +1 -1
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +8 -11
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/duotone.js +28 -5
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.native.js +1 -0
- package/build-module/hooks/index.native.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 +1 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +1 -1
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/use-editor-wrapper-styles.native.js +242 -0
- package/build-module/hooks/use-editor-wrapper-styles.native.js.map +1 -0
- package/build-module/hooks/use-typography-props.js +14 -10
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/hooks/utils.js +16 -4
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/index.native.js +6 -0
- package/build-module/index.native.js.map +1 -0
- package/build-module/private-apis.js +7 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +7 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/utils/object.js +4 -4
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +2 -2
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-module/utils/use-should-contextual-toolbar-show.js +60 -0
- package/build-module/utils/use-should-contextual-toolbar-show.js.map +1 -0
- package/build-style/content-rtl.css +9 -7
- package/build-style/content.css +9 -7
- package/build-style/style-rtl.css +257 -56
- package/build-style/style.css +257 -56
- package/package.json +32 -32
- package/src/components/block-breadcrumb/style.scss +2 -1
- package/src/components/block-controls/slot.js +8 -4
- package/src/components/block-controls/slot.native.js +6 -1
- package/src/components/block-draggable/index.js +10 -6
- package/src/components/block-draggable/use-scroll-when-dragging.js +8 -2
- package/src/components/block-info-slot-fill/index.js +24 -0
- package/src/components/block-inspector/index.js +3 -0
- package/src/components/block-list/block-invalid-warning.native.js +17 -9
- package/src/components/block-list/block-list-item-cell.native.js +10 -1
- package/src/components/block-list/block-list-item.native.js +180 -208
- package/src/components/block-list/block-outline.native.js +58 -0
- package/src/components/block-list/block.native.js +564 -524
- package/src/components/block-list/content.scss +16 -16
- package/src/components/block-list/index.native.js +229 -298
- package/src/components/block-list/insertion-point.native.js +2 -2
- package/src/components/block-list/test/block-invalid-warning.native.js +48 -0
- package/src/components/block-list/test/index.native.js +205 -0
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +3 -1
- package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +9 -9
- package/src/components/block-mover/style.scss +10 -4
- package/src/components/block-mover/test/index.native.js +4 -4
- package/src/components/block-pattern-setup/style.scss +1 -4
- package/src/components/block-patterns-list/style.scss +1 -4
- package/src/components/block-settings-menu/block-settings-dropdown.js +10 -17
- package/src/components/block-settings-menu-controls/index.js +24 -4
- package/src/components/block-styles/style.scss +4 -4
- package/src/components/block-toolbar/index.js +4 -3
- package/src/components/block-toolbar/style.scss +56 -33
- package/src/components/block-tools/block-contextual-toolbar.js +64 -15
- package/src/components/block-tools/selected-block-popover.js +11 -46
- package/src/components/block-tools/style.scss +165 -3
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +16 -2
- package/src/components/editor-styles/index.js +9 -5
- package/src/components/font-sizes/fluid-utils.js +31 -14
- package/src/components/font-sizes/test/fluid-utils.js +5 -16
- package/src/components/global-styles/advanced-panel.js +82 -0
- package/src/components/global-styles/border-panel.js +1 -30
- package/src/components/global-styles/color-panel.js +19 -14
- package/src/components/global-styles/color-panel.native.js +207 -0
- package/src/components/global-styles/dimensions-panel.js +23 -13
- package/src/components/global-styles/effects-panel.js +2 -2
- package/src/components/global-styles/filters-panel.js +90 -17
- package/src/components/global-styles/hooks.js +1 -5
- package/src/components/global-styles/index.js +6 -1
- package/src/components/global-styles/style.scss +16 -1
- package/src/components/global-styles/test/typography-utils.js +63 -22
- package/src/components/global-styles/test/use-global-styles-output.js +126 -4
- package/src/components/global-styles/test/utils.js +57 -1
- package/src/components/global-styles/typography-panel.js +38 -12
- package/src/components/global-styles/use-global-styles-output.js +85 -67
- package/src/components/global-styles/utils.js +27 -0
- package/src/components/image-editor/use-save-image.js +20 -9
- package/src/components/index.js +1 -0
- package/src/components/inserter/block-types-tab.js +9 -6
- package/src/components/inserter/index.js +1 -1
- package/src/components/inserter-draggable-blocks/index.js +4 -0
- package/src/components/inspector-controls/fill.js +1 -1
- package/src/components/inspector-controls/fill.native.js +1 -1
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls/slot.js +4 -9
- package/src/components/inspector-controls/slot.native.js +1 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +1 -0
- package/src/components/line-height-control/index.js +7 -2
- package/src/components/line-height-control/stories/index.js +1 -1
- package/src/components/link-control/test/index.js +42 -0
- package/src/components/link-control/use-internal-input-value.js +8 -7
- package/src/components/list-view/block-contents.js +26 -20
- package/src/components/list-view/block-select-button.js +11 -2
- package/src/components/list-view/block.js +28 -33
- package/src/components/list-view/drop-indicator.js +67 -22
- package/src/components/list-view/index.js +33 -14
- package/src/components/list-view/leaf.js +1 -0
- package/src/components/list-view/style.scss +18 -3
- package/src/components/list-view/test/use-list-view-drop-zone.js +88 -12
- package/src/components/list-view/use-block-selection.js +1 -1
- package/src/components/list-view/use-list-view-drop-zone.js +194 -11
- package/src/components/media-placeholder/index.js +74 -1
- package/src/components/media-replace-flow/README.md +3 -2
- package/src/components/media-replace-flow/index.js +4 -5
- package/src/components/multi-selection-inspector/index.js +2 -2
- package/src/components/navigable-toolbar/index.js +12 -3
- package/src/components/off-canvas-editor/appender.js +1 -4
- package/src/components/off-canvas-editor/leaf-more-menu.js +2 -1
- package/src/components/preview-options/index.js +9 -2
- package/src/components/spacing-sizes-control/spacing-input-control.js +1 -0
- package/src/components/url-input/index.js +1 -2
- package/src/components/url-popover/test/__snapshots__/index.js.snap +3 -3
- package/src/hooks/align.js +2 -1
- package/src/hooks/border.js +2 -1
- package/src/hooks/color.js +2 -1
- package/src/hooks/content-lock-ui.js +3 -15
- package/src/hooks/duotone.js +47 -25
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/layout.js +4 -2
- package/src/hooks/position.js +2 -1
- package/src/hooks/style.js +2 -1
- package/src/hooks/test/anchor.js +113 -0
- package/src/hooks/test/color.js +0 -9
- package/src/hooks/test/use-editor-wrapper-styles.native.js +282 -0
- package/src/hooks/test/use-typography-props.js +49 -4
- package/src/hooks/test/utils.js +20 -101
- package/src/hooks/use-editor-wrapper-styles.native.js +250 -0
- package/src/hooks/use-editor-wrapper-styles.native.scss +11 -0
- package/src/hooks/use-typography-props.js +10 -11
- package/src/hooks/utils.js +20 -3
- package/src/index.native.js +6 -0
- package/src/private-apis.js +6 -0
- package/src/store/actions.js +7 -0
- package/src/utils/object.js +4 -4
- package/src/utils/test/object.js +21 -21
- package/src/utils/transform-styles/index.js +2 -2
- package/src/utils/use-should-contextual-toolbar-show.js +85 -0
- package/tsconfig.json +2 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/hooks/color-panel.native.js +0 -77
- package/build/hooks/color-panel.native.js.map +0 -1
- package/build-module/hooks/color-panel.native.js +0 -62
- package/build-module/hooks/color-panel.native.js.map +0 -1
- package/src/hooks/color-panel.native.js +0 -63
|
@@ -20,7 +20,7 @@ import LetterSpacingControl from '../letter-spacing-control';
|
|
|
20
20
|
import TextTransformControl from '../text-transform-control';
|
|
21
21
|
import TextDecorationControl from '../text-decoration-control';
|
|
22
22
|
import { getValueFromVariable } from './utils';
|
|
23
|
-
import {
|
|
23
|
+
import { setImmutably } from '../../utils/object';
|
|
24
24
|
|
|
25
25
|
const MIN_TEXT_COLUMNS = 1;
|
|
26
26
|
const MAX_TEXT_COLUMNS = 6;
|
|
@@ -163,10 +163,12 @@ export default function TypographyPanel( {
|
|
|
163
163
|
( { fontFamily: f } ) => f === newValue
|
|
164
164
|
)?.slug;
|
|
165
165
|
onChange(
|
|
166
|
-
|
|
166
|
+
setImmutably(
|
|
167
167
|
value,
|
|
168
168
|
[ 'typography', 'fontFamily' ],
|
|
169
|
-
slug
|
|
169
|
+
slug
|
|
170
|
+
? `var:preset|font-family|${ slug }`
|
|
171
|
+
: newValue || undefined
|
|
170
172
|
)
|
|
171
173
|
);
|
|
172
174
|
};
|
|
@@ -188,7 +190,11 @@ export default function TypographyPanel( {
|
|
|
188
190
|
: newValue;
|
|
189
191
|
|
|
190
192
|
onChange(
|
|
191
|
-
|
|
193
|
+
setImmutably(
|
|
194
|
+
value,
|
|
195
|
+
[ 'typography', 'fontSize' ],
|
|
196
|
+
actualValue || undefined
|
|
197
|
+
)
|
|
192
198
|
);
|
|
193
199
|
};
|
|
194
200
|
const hasFontSize = () => !! value?.typography?.fontSize;
|
|
@@ -209,8 +215,8 @@ export default function TypographyPanel( {
|
|
|
209
215
|
...value,
|
|
210
216
|
typography: {
|
|
211
217
|
...value?.typography,
|
|
212
|
-
fontStyle: newFontStyle,
|
|
213
|
-
fontWeight: newFontWeight,
|
|
218
|
+
fontStyle: newFontStyle || undefined,
|
|
219
|
+
fontWeight: newFontWeight || undefined,
|
|
214
220
|
},
|
|
215
221
|
} );
|
|
216
222
|
};
|
|
@@ -225,10 +231,14 @@ export default function TypographyPanel( {
|
|
|
225
231
|
const lineHeight = decodeValue( inheritedValue?.typography?.lineHeight );
|
|
226
232
|
const setLineHeight = ( newValue ) => {
|
|
227
233
|
onChange(
|
|
228
|
-
|
|
234
|
+
setImmutably(
|
|
235
|
+
value,
|
|
236
|
+
[ 'typography', 'lineHeight' ],
|
|
237
|
+
newValue || undefined
|
|
238
|
+
)
|
|
229
239
|
);
|
|
230
240
|
};
|
|
231
|
-
const hasLineHeight = () =>
|
|
241
|
+
const hasLineHeight = () => value?.typography?.lineHeight !== undefined;
|
|
232
242
|
const resetLineHeight = () => setLineHeight( undefined );
|
|
233
243
|
|
|
234
244
|
// Letter Spacing
|
|
@@ -238,7 +248,11 @@ export default function TypographyPanel( {
|
|
|
238
248
|
);
|
|
239
249
|
const setLetterSpacing = ( newValue ) => {
|
|
240
250
|
onChange(
|
|
241
|
-
|
|
251
|
+
setImmutably(
|
|
252
|
+
value,
|
|
253
|
+
[ 'typography', 'letterSpacing' ],
|
|
254
|
+
newValue || undefined
|
|
255
|
+
)
|
|
242
256
|
);
|
|
243
257
|
};
|
|
244
258
|
const hasLetterSpacing = () => !! value?.typography?.letterSpacing;
|
|
@@ -249,7 +263,11 @@ export default function TypographyPanel( {
|
|
|
249
263
|
const textColumns = decodeValue( inheritedValue?.typography?.textColumns );
|
|
250
264
|
const setTextColumns = ( newValue ) => {
|
|
251
265
|
onChange(
|
|
252
|
-
|
|
266
|
+
setImmutably(
|
|
267
|
+
value,
|
|
268
|
+
[ 'typography', 'textColumns' ],
|
|
269
|
+
newValue || undefined
|
|
270
|
+
)
|
|
253
271
|
);
|
|
254
272
|
};
|
|
255
273
|
const hasTextColumns = () => !! value?.typography?.textColumns;
|
|
@@ -262,7 +280,11 @@ export default function TypographyPanel( {
|
|
|
262
280
|
);
|
|
263
281
|
const setTextTransform = ( newValue ) => {
|
|
264
282
|
onChange(
|
|
265
|
-
|
|
283
|
+
setImmutably(
|
|
284
|
+
value,
|
|
285
|
+
[ 'typography', 'textTransform' ],
|
|
286
|
+
newValue || undefined
|
|
287
|
+
)
|
|
266
288
|
);
|
|
267
289
|
};
|
|
268
290
|
const hasTextTransform = () => !! value?.typography?.textTransform;
|
|
@@ -275,7 +297,11 @@ export default function TypographyPanel( {
|
|
|
275
297
|
);
|
|
276
298
|
const setTextDecoration = ( newValue ) => {
|
|
277
299
|
onChange(
|
|
278
|
-
|
|
300
|
+
setImmutably(
|
|
301
|
+
value,
|
|
302
|
+
[ 'typography', 'textDecoration' ],
|
|
303
|
+
newValue || undefined
|
|
304
|
+
)
|
|
279
305
|
);
|
|
280
306
|
};
|
|
281
307
|
const hasTextDecoration = () => !! value?.typography?.textDecoration;
|
|
@@ -325,7 +325,7 @@ export function getStylesDeclarations(
|
|
|
325
325
|
return declarations;
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
-
if (
|
|
328
|
+
if ( properties && typeof styleValue !== 'string' ) {
|
|
329
329
|
Object.entries( properties ).forEach( ( entry ) => {
|
|
330
330
|
const [ name, prop ] = entry;
|
|
331
331
|
|
|
@@ -382,7 +382,7 @@ export function getStylesDeclarations(
|
|
|
382
382
|
ruleValue = get( tree, refPath );
|
|
383
383
|
// Presence of another ref indicates a reference to another dynamic value.
|
|
384
384
|
// Pointing to another dynamic value is not supported.
|
|
385
|
-
if ( ! ruleValue ||
|
|
385
|
+
if ( ! ruleValue || ruleValue?.ref ) {
|
|
386
386
|
return;
|
|
387
387
|
}
|
|
388
388
|
}
|
|
@@ -551,6 +551,33 @@ export function getLayoutStyles( {
|
|
|
551
551
|
return ruleset;
|
|
552
552
|
}
|
|
553
553
|
|
|
554
|
+
const STYLE_KEYS = [
|
|
555
|
+
'border',
|
|
556
|
+
'color',
|
|
557
|
+
'dimensions',
|
|
558
|
+
'spacing',
|
|
559
|
+
'typography',
|
|
560
|
+
'filter',
|
|
561
|
+
'outline',
|
|
562
|
+
'shadow',
|
|
563
|
+
];
|
|
564
|
+
|
|
565
|
+
function pickStyleKeys( treeToPickFrom ) {
|
|
566
|
+
if ( ! treeToPickFrom ) {
|
|
567
|
+
return {};
|
|
568
|
+
}
|
|
569
|
+
const entries = Object.entries( treeToPickFrom );
|
|
570
|
+
const pickedEntries = entries.filter( ( [ key ] ) =>
|
|
571
|
+
STYLE_KEYS.includes( key )
|
|
572
|
+
);
|
|
573
|
+
// clone the style objects so that `getFeatureDeclarations` can remove consumed keys from it
|
|
574
|
+
const clonedEntries = pickedEntries.map( ( [ key, style ] ) => [
|
|
575
|
+
key,
|
|
576
|
+
JSON.parse( JSON.stringify( style ) ),
|
|
577
|
+
] );
|
|
578
|
+
return Object.fromEntries( clonedEntries );
|
|
579
|
+
}
|
|
580
|
+
|
|
554
581
|
export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
555
582
|
const nodes = [];
|
|
556
583
|
|
|
@@ -558,25 +585,9 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
558
585
|
return nodes;
|
|
559
586
|
}
|
|
560
587
|
|
|
561
|
-
const pickStyleKeys = ( treeToPickFrom ) =>
|
|
562
|
-
Object.fromEntries(
|
|
563
|
-
Object.entries( treeToPickFrom ?? {} ).filter( ( [ key ] ) =>
|
|
564
|
-
[
|
|
565
|
-
'border',
|
|
566
|
-
'color',
|
|
567
|
-
'dimensions',
|
|
568
|
-
'spacing',
|
|
569
|
-
'typography',
|
|
570
|
-
'filter',
|
|
571
|
-
'outline',
|
|
572
|
-
'shadow',
|
|
573
|
-
].includes( key )
|
|
574
|
-
)
|
|
575
|
-
);
|
|
576
|
-
|
|
577
588
|
// Top-level.
|
|
578
589
|
const styles = pickStyleKeys( tree.styles );
|
|
579
|
-
if (
|
|
590
|
+
if ( styles ) {
|
|
580
591
|
nodes.push( {
|
|
581
592
|
styles,
|
|
582
593
|
selector: ROOT_BLOCK_SELECTOR,
|
|
@@ -584,7 +595,7 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
584
595
|
}
|
|
585
596
|
|
|
586
597
|
Object.entries( ELEMENTS ).forEach( ( [ name, selector ] ) => {
|
|
587
|
-
if (
|
|
598
|
+
if ( tree.styles?.elements?.[ name ] ) {
|
|
588
599
|
nodes.push( {
|
|
589
600
|
styles: tree.styles?.elements?.[ name ],
|
|
590
601
|
selector,
|
|
@@ -606,10 +617,7 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
606
617
|
} );
|
|
607
618
|
blockStyles.variations = variations;
|
|
608
619
|
}
|
|
609
|
-
if (
|
|
610
|
-
!! blockStyles &&
|
|
611
|
-
!! blockSelectors?.[ blockName ]?.selector
|
|
612
|
-
) {
|
|
620
|
+
if ( blockStyles && blockSelectors?.[ blockName ]?.selector ) {
|
|
613
621
|
nodes.push( {
|
|
614
622
|
duotoneSelector:
|
|
615
623
|
blockSelectors[ blockName ].duotoneSelector,
|
|
@@ -617,7 +625,7 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
617
625
|
blockSelectors[ blockName ].fallbackGapValue,
|
|
618
626
|
hasLayoutSupport:
|
|
619
627
|
blockSelectors[ blockName ].hasLayoutSupport,
|
|
620
|
-
selector: blockSelectors[ blockName ]
|
|
628
|
+
selector: blockSelectors[ blockName ].selector,
|
|
621
629
|
styles: blockStyles,
|
|
622
630
|
featureSelectors:
|
|
623
631
|
blockSelectors[ blockName ].featureSelectors,
|
|
@@ -629,9 +637,9 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
629
637
|
Object.entries( node?.elements ?? {} ).forEach(
|
|
630
638
|
( [ elementName, value ] ) => {
|
|
631
639
|
if (
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
640
|
+
value &&
|
|
641
|
+
blockSelectors?.[ blockName ] &&
|
|
642
|
+
ELEMENTS[ elementName ]
|
|
635
643
|
) {
|
|
636
644
|
nodes.push( {
|
|
637
645
|
styles: value,
|
|
@@ -677,7 +685,7 @@ export const getNodesWithSettings = ( tree, blockSelectors ) => {
|
|
|
677
685
|
// Top-level.
|
|
678
686
|
const presets = pickPresets( tree.settings );
|
|
679
687
|
const custom = tree.settings?.custom;
|
|
680
|
-
if ( ! isEmpty( presets ) ||
|
|
688
|
+
if ( ! isEmpty( presets ) || custom ) {
|
|
681
689
|
nodes.push( {
|
|
682
690
|
presets,
|
|
683
691
|
custom,
|
|
@@ -690,7 +698,7 @@ export const getNodesWithSettings = ( tree, blockSelectors ) => {
|
|
|
690
698
|
( [ blockName, node ] ) => {
|
|
691
699
|
const blockPresets = pickPresets( node );
|
|
692
700
|
const blockCustom = node.custom;
|
|
693
|
-
if ( ! isEmpty( blockPresets ) ||
|
|
701
|
+
if ( ! isEmpty( blockPresets ) || blockCustom ) {
|
|
694
702
|
nodes.push( {
|
|
695
703
|
presets: blockPresets,
|
|
696
704
|
custom: blockCustom,
|
|
@@ -714,7 +722,7 @@ export const toCustomProperties = ( tree, blockSelectors ) => {
|
|
|
714
722
|
}
|
|
715
723
|
|
|
716
724
|
if ( declarations.length > 0 ) {
|
|
717
|
-
ruleset
|
|
725
|
+
ruleset += `${ selector }{${ declarations.join( ';' ) };}`;
|
|
718
726
|
}
|
|
719
727
|
} );
|
|
720
728
|
|
|
@@ -787,9 +795,9 @@ export const toStyles = (
|
|
|
787
795
|
|
|
788
796
|
Object.entries( featureDeclarations ).forEach(
|
|
789
797
|
( [ cssSelector, declarations ] ) => {
|
|
790
|
-
if (
|
|
798
|
+
if ( declarations.length ) {
|
|
791
799
|
const rules = declarations.join( ';' );
|
|
792
|
-
ruleset
|
|
800
|
+
ruleset += `${ cssSelector }{${ rules };}`;
|
|
793
801
|
}
|
|
794
802
|
}
|
|
795
803
|
);
|
|
@@ -798,20 +806,20 @@ export const toStyles = (
|
|
|
798
806
|
if ( styleVariationSelectors ) {
|
|
799
807
|
Object.entries( styleVariationSelectors ).forEach(
|
|
800
808
|
( [ styleVariationName, styleVariationSelector ] ) => {
|
|
801
|
-
|
|
809
|
+
const styleVariations =
|
|
810
|
+
styles?.variations?.[ styleVariationName ];
|
|
811
|
+
if ( styleVariations ) {
|
|
802
812
|
// If the block uses any custom selectors for block support, add those first.
|
|
803
813
|
if ( featureSelectors ) {
|
|
804
814
|
const featureDeclarations =
|
|
805
815
|
getFeatureDeclarations(
|
|
806
816
|
featureSelectors,
|
|
807
|
-
|
|
808
|
-
styleVariationName
|
|
809
|
-
]
|
|
817
|
+
styleVariations
|
|
810
818
|
);
|
|
811
819
|
|
|
812
820
|
Object.entries( featureDeclarations ).forEach(
|
|
813
821
|
( [ baseSelector, declarations ] ) => {
|
|
814
|
-
if (
|
|
822
|
+
if ( declarations.length ) {
|
|
815
823
|
const cssSelector =
|
|
816
824
|
concatFeatureVariationSelectorString(
|
|
817
825
|
baseSelector,
|
|
@@ -819,9 +827,7 @@ export const toStyles = (
|
|
|
819
827
|
);
|
|
820
828
|
const rules =
|
|
821
829
|
declarations.join( ';' );
|
|
822
|
-
ruleset
|
|
823
|
-
ruleset +
|
|
824
|
-
`${ cssSelector }{${ rules }}`;
|
|
830
|
+
ruleset += `${ cssSelector }{${ rules };}`;
|
|
825
831
|
}
|
|
826
832
|
}
|
|
827
833
|
);
|
|
@@ -830,39 +836,34 @@ export const toStyles = (
|
|
|
830
836
|
// Otherwise add regular selectors.
|
|
831
837
|
const styleVariationDeclarations =
|
|
832
838
|
getStylesDeclarations(
|
|
833
|
-
|
|
839
|
+
styleVariations,
|
|
834
840
|
styleVariationSelector,
|
|
835
841
|
useRootPaddingAlign,
|
|
836
842
|
tree
|
|
837
843
|
);
|
|
838
|
-
if (
|
|
839
|
-
ruleset
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
';'
|
|
843
|
-
) }}`;
|
|
844
|
+
if ( styleVariationDeclarations.length ) {
|
|
845
|
+
ruleset += `${ styleVariationSelector }{${ styleVariationDeclarations.join(
|
|
846
|
+
';'
|
|
847
|
+
) };}`;
|
|
844
848
|
}
|
|
845
849
|
}
|
|
846
850
|
}
|
|
847
851
|
);
|
|
848
852
|
}
|
|
849
853
|
|
|
850
|
-
const duotoneStyles = {};
|
|
851
|
-
if ( styles?.filter ) {
|
|
852
|
-
duotoneStyles.filter = styles.filter;
|
|
853
|
-
delete styles.filter;
|
|
854
|
-
}
|
|
855
|
-
|
|
856
854
|
// Process duotone styles.
|
|
857
855
|
if ( duotoneSelector ) {
|
|
856
|
+
const duotoneStyles = {};
|
|
857
|
+
if ( styles?.filter ) {
|
|
858
|
+
duotoneStyles.filter = styles.filter;
|
|
859
|
+
delete styles.filter;
|
|
860
|
+
}
|
|
858
861
|
const duotoneDeclarations =
|
|
859
862
|
getStylesDeclarations( duotoneStyles );
|
|
860
|
-
if ( duotoneDeclarations.length
|
|
861
|
-
ruleset
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
';'
|
|
865
|
-
) };}`;
|
|
863
|
+
if ( duotoneDeclarations.length ) {
|
|
864
|
+
ruleset += `${ duotoneSelector }{${ duotoneDeclarations.join(
|
|
865
|
+
';'
|
|
866
|
+
) };}`;
|
|
866
867
|
}
|
|
867
868
|
}
|
|
868
869
|
|
|
@@ -889,8 +890,7 @@ export const toStyles = (
|
|
|
889
890
|
tree
|
|
890
891
|
);
|
|
891
892
|
if ( declarations?.length ) {
|
|
892
|
-
ruleset
|
|
893
|
-
ruleset + `${ selector }{${ declarations.join( ';' ) };}`;
|
|
893
|
+
ruleset += `${ selector }{${ declarations.join( ';' ) };}`;
|
|
894
894
|
}
|
|
895
895
|
|
|
896
896
|
// Check for pseudo selector in `styles` and handle separately.
|
|
@@ -924,7 +924,7 @@ export const toStyles = (
|
|
|
924
924
|
';'
|
|
925
925
|
) };}`;
|
|
926
926
|
|
|
927
|
-
ruleset
|
|
927
|
+
ruleset += pseudoRule;
|
|
928
928
|
}
|
|
929
929
|
);
|
|
930
930
|
}
|
|
@@ -965,7 +965,7 @@ export const toStyles = (
|
|
|
965
965
|
|
|
966
966
|
const classes = getPresetsClasses( selector, presets );
|
|
967
967
|
if ( ! isEmpty( classes ) ) {
|
|
968
|
-
ruleset
|
|
968
|
+
ruleset += classes;
|
|
969
969
|
}
|
|
970
970
|
} );
|
|
971
971
|
|
|
@@ -1106,9 +1106,17 @@ const processCSSNesting = ( css, blockSelector ) => {
|
|
|
1106
1106
|
return processedCSS;
|
|
1107
1107
|
};
|
|
1108
1108
|
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1109
|
+
/**
|
|
1110
|
+
* Returns the global styles output using a global styles configuration.
|
|
1111
|
+
* If wishing to generate global styles and settings based on the
|
|
1112
|
+
* global styles config loaded in the editor context, use `useGlobalStylesOutput()`.
|
|
1113
|
+
* The use case for a custom config is to generate bespoke styles
|
|
1114
|
+
* and settings for previews, or other out-of-editor experiences.
|
|
1115
|
+
*
|
|
1116
|
+
* @param {Object} mergedConfig Global styles configuration.
|
|
1117
|
+
* @return {Array} Array of stylesheets and settings.
|
|
1118
|
+
*/
|
|
1119
|
+
export function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {
|
|
1112
1120
|
const [ blockGap ] = useGlobalSetting( 'spacing.blockGap' );
|
|
1113
1121
|
const hasBlockGapSupport = blockGap !== null;
|
|
1114
1122
|
const hasFallbackGapSupport = ! hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support.
|
|
@@ -1190,3 +1198,13 @@ export function useGlobalStylesOutput() {
|
|
|
1190
1198
|
disableLayoutStyles,
|
|
1191
1199
|
] );
|
|
1192
1200
|
}
|
|
1201
|
+
|
|
1202
|
+
/**
|
|
1203
|
+
* Returns the global styles output based on the current state of global styles config loaded in the editor context.
|
|
1204
|
+
*
|
|
1205
|
+
* @return {Array} Array of stylesheets and settings.
|
|
1206
|
+
*/
|
|
1207
|
+
export function useGlobalStylesOutput() {
|
|
1208
|
+
const { merged: mergedConfig } = useContext( GlobalStylesContext );
|
|
1209
|
+
return useGlobalStylesOutputWithConfig( mergedConfig );
|
|
1210
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { get } from 'lodash';
|
|
5
|
+
import fastDeepEqual from 'fast-deep-equal/es6';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Internal dependencies
|
|
@@ -376,3 +377,29 @@ export function scopeSelector( scope, selector ) {
|
|
|
376
377
|
|
|
377
378
|
return selectorsScoped.join( ', ' );
|
|
378
379
|
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Compares global style variations according to their styles and settings properties.
|
|
383
|
+
*
|
|
384
|
+
* @example
|
|
385
|
+
* ```js
|
|
386
|
+
* const globalStyles = { styles: { typography: { fontSize: '10px' } }, settings: {} };
|
|
387
|
+
* const variation = { styles: { typography: { fontSize: '10000px' } }, settings: {} };
|
|
388
|
+
* const isEqual = areGlobalStyleConfigsEqual( globalStyles, variation );
|
|
389
|
+
* // false
|
|
390
|
+
* ```
|
|
391
|
+
*
|
|
392
|
+
* @param {Object} original A global styles object.
|
|
393
|
+
* @param {Object} variation A global styles object.
|
|
394
|
+
*
|
|
395
|
+
* @return {boolean} Whether `original` and `variation` match.
|
|
396
|
+
*/
|
|
397
|
+
export function areGlobalStyleConfigsEqual( original, variation ) {
|
|
398
|
+
if ( typeof original !== 'object' || typeof variation !== 'object' ) {
|
|
399
|
+
return original === variation;
|
|
400
|
+
}
|
|
401
|
+
return (
|
|
402
|
+
fastDeepEqual( original?.styles, variation?.styles ) &&
|
|
403
|
+
fastDeepEqual( original?.settings, variation?.settings )
|
|
404
|
+
);
|
|
405
|
+
}
|
|
@@ -32,24 +32,35 @@ export default function useSaveImage( {
|
|
|
32
32
|
const apply = useCallback( () => {
|
|
33
33
|
setIsInProgress( true );
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
const modifiers = [];
|
|
36
|
+
|
|
37
|
+
if ( rotation > 0 ) {
|
|
38
|
+
modifiers.push( {
|
|
39
|
+
type: 'rotate',
|
|
40
|
+
args: {
|
|
41
|
+
angle: rotation,
|
|
42
|
+
},
|
|
43
|
+
} );
|
|
44
|
+
}
|
|
36
45
|
|
|
37
46
|
// The crop script may return some very small, sub-pixel values when the image was not cropped.
|
|
38
47
|
// Crop only when the new size has changed by more than 0.1%.
|
|
39
48
|
if ( crop.width < 99.9 || crop.height < 99.9 ) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
modifiers.push( {
|
|
50
|
+
type: 'crop',
|
|
51
|
+
args: {
|
|
52
|
+
left: crop.x,
|
|
53
|
+
top: crop.y,
|
|
54
|
+
width: crop.width,
|
|
55
|
+
height: crop.height,
|
|
56
|
+
},
|
|
57
|
+
} );
|
|
45
58
|
}
|
|
46
59
|
|
|
47
|
-
attrs.src = url;
|
|
48
|
-
|
|
49
60
|
apiFetch( {
|
|
50
61
|
path: `/wp/v2/media/${ id }/edit`,
|
|
51
62
|
method: 'POST',
|
|
52
|
-
data:
|
|
63
|
+
data: { src: url, modifiers },
|
|
53
64
|
} )
|
|
54
65
|
.then( ( response ) => {
|
|
55
66
|
onSaveImage( {
|
package/src/components/index.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { groupBy } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -59,7 +54,15 @@ export function BlockTypesTab( {
|
|
|
59
54
|
itemList.filter(
|
|
60
55
|
( item ) => item.category && item.category !== 'reusable'
|
|
61
56
|
),
|
|
62
|
-
( itemList ) =>
|
|
57
|
+
( itemList ) =>
|
|
58
|
+
itemList.reduce( ( acc, item ) => {
|
|
59
|
+
const { category } = item;
|
|
60
|
+
if ( ! acc[ category ] ) {
|
|
61
|
+
acc[ category ] = [];
|
|
62
|
+
}
|
|
63
|
+
acc[ category ].push( item );
|
|
64
|
+
return acc;
|
|
65
|
+
}, {} )
|
|
63
66
|
)( items );
|
|
64
67
|
}, [ items ] );
|
|
65
68
|
|
|
@@ -214,7 +214,7 @@ class PrivateInserter extends Component {
|
|
|
214
214
|
'block-editor-inserter__popover',
|
|
215
215
|
{ 'is-quick': isQuick }
|
|
216
216
|
) }
|
|
217
|
-
popoverProps={ { position } }
|
|
217
|
+
popoverProps={ { position, shift: true } }
|
|
218
218
|
onToggle={ this.onToggle }
|
|
219
219
|
expandOnMobile
|
|
220
220
|
headerTitle={ __( 'Add a block' ) }
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { Draggable } from '@wordpress/components';
|
|
5
|
+
import { serialize } from '@wordpress/blocks';
|
|
5
6
|
/**
|
|
6
7
|
* Internal dependencies
|
|
7
8
|
*/
|
|
@@ -23,6 +24,9 @@ const InserterDraggableBlocks = ( {
|
|
|
23
24
|
<Draggable
|
|
24
25
|
__experimentalTransferDataType="wp-blocks"
|
|
25
26
|
transferData={ transferData }
|
|
27
|
+
onDragStart={ ( event ) => {
|
|
28
|
+
event.dataTransfer.setData( 'text/html', serialize( blocks ) );
|
|
29
|
+
} }
|
|
26
30
|
__experimentalDragComponent={
|
|
27
31
|
<BlockDraggableChip
|
|
28
32
|
count={ blocks.length }
|
|
@@ -41,7 +41,7 @@ export default function InspectorControlsFill( {
|
|
|
41
41
|
const isDisplayed = useDisplayBlockControls();
|
|
42
42
|
const Fill = groups[ group ]?.Fill;
|
|
43
43
|
if ( ! Fill ) {
|
|
44
|
-
warning( `Unknown
|
|
44
|
+
warning( `Unknown InspectorControls group "${ group }" provided.` );
|
|
45
45
|
return null;
|
|
46
46
|
}
|
|
47
47
|
if ( ! isDisplayed ) {
|
|
@@ -39,7 +39,7 @@ export default function InspectorControlsFill( {
|
|
|
39
39
|
|
|
40
40
|
const Fill = groups[ group ]?.Fill;
|
|
41
41
|
if ( ! Fill ) {
|
|
42
|
-
warning( `Unknown
|
|
42
|
+
warning( `Unknown InspectorControls group "${ group }" provided.` );
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
45
45
|
if ( ! isDisplayed ) {
|
|
@@ -7,6 +7,7 @@ const InspectorControlsDefault = createSlotFill( 'InspectorControls' );
|
|
|
7
7
|
const InspectorControlsAdvanced = createSlotFill( 'InspectorAdvancedControls' );
|
|
8
8
|
const InspectorControlsBorder = createSlotFill( 'InspectorControlsBorder' );
|
|
9
9
|
const InspectorControlsColor = createSlotFill( 'InspectorControlsColor' );
|
|
10
|
+
const InspectorControlsFilter = createSlotFill( 'InspectorControlsFilter' );
|
|
10
11
|
const InspectorControlsDimensions = createSlotFill(
|
|
11
12
|
'InspectorControlsDimensions'
|
|
12
13
|
);
|
|
@@ -22,6 +23,7 @@ const groups = {
|
|
|
22
23
|
advanced: InspectorControlsAdvanced,
|
|
23
24
|
border: InspectorControlsBorder,
|
|
24
25
|
color: InspectorControlsColor,
|
|
26
|
+
filter: InspectorControlsFilter,
|
|
25
27
|
dimensions: InspectorControlsDimensions,
|
|
26
28
|
list: InspectorControlsListView,
|
|
27
29
|
settings: InspectorControlsDefault, // Alias for default.
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
__experimentalUseSlot as useSlot,
|
|
6
|
-
__experimentalUseSlotFills as useSlotFills,
|
|
7
|
-
} from '@wordpress/components';
|
|
4
|
+
import { __experimentalUseSlotFills as useSlotFills } from '@wordpress/components';
|
|
8
5
|
import warning from '@wordpress/warning';
|
|
9
6
|
import deprecated from '@wordpress/deprecated';
|
|
10
7
|
|
|
@@ -33,15 +30,13 @@ export default function InspectorControlsSlot( {
|
|
|
33
30
|
group = __experimentalGroup;
|
|
34
31
|
}
|
|
35
32
|
const Slot = groups[ group ]?.Slot;
|
|
36
|
-
const slot = useSlot( Slot?.__unstableName );
|
|
37
33
|
const fills = useSlotFills( Slot?.__unstableName );
|
|
38
|
-
if ( ! Slot
|
|
39
|
-
warning( `Unknown
|
|
34
|
+
if ( ! Slot ) {
|
|
35
|
+
warning( `Unknown InspectorControls group "${ group }" provided.` );
|
|
40
36
|
return null;
|
|
41
37
|
}
|
|
42
38
|
|
|
43
|
-
|
|
44
|
-
if ( ! hasFills ) {
|
|
39
|
+
if ( ! fills?.length ) {
|
|
45
40
|
return null;
|
|
46
41
|
}
|
|
47
42
|
|
|
@@ -27,7 +27,7 @@ export default function InspectorControlsSlot( {
|
|
|
27
27
|
}
|
|
28
28
|
const Slot = groups[ group ]?.Slot;
|
|
29
29
|
if ( ! Slot ) {
|
|
30
|
-
warning( `Unknown
|
|
30
|
+
warning( `Unknown InspectorControls group "${ group }" provided.` );
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -32,6 +32,7 @@ const StylesTab = ( { blockName, clientId, hasBlockStyles } ) => {
|
|
|
32
32
|
label={ __( 'Color' ) }
|
|
33
33
|
className="color-block-support-panel__inner-wrapper"
|
|
34
34
|
/>
|
|
35
|
+
<InspectorControls.Slot group="filter" />
|
|
35
36
|
<InspectorControls.Slot
|
|
36
37
|
group="typography"
|
|
37
38
|
label={ __( 'Typography' ) }
|
|
@@ -85,12 +85,17 @@ const LineHeightControl = ( {
|
|
|
85
85
|
: { marginBottom: 24 };
|
|
86
86
|
|
|
87
87
|
const handleOnChange = ( nextValue, { event } ) => {
|
|
88
|
+
if ( nextValue === '' ) {
|
|
89
|
+
onChange();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
88
93
|
if ( event.type === 'click' ) {
|
|
89
|
-
onChange( adjustNextValue( nextValue
|
|
94
|
+
onChange( adjustNextValue( `${ nextValue }`, false ) );
|
|
90
95
|
return;
|
|
91
96
|
}
|
|
92
97
|
|
|
93
|
-
onChange( nextValue );
|
|
98
|
+
onChange( `${ nextValue }` );
|
|
94
99
|
};
|
|
95
100
|
|
|
96
101
|
return (
|
|
@@ -23,7 +23,7 @@ const Template = ( props ) => {
|
|
|
23
23
|
export const Default = Template.bind( {} );
|
|
24
24
|
Default.args = {
|
|
25
25
|
__nextHasNoMarginBottom: true,
|
|
26
|
-
__unstableInputWidth: '
|
|
26
|
+
__unstableInputWidth: '100px',
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export const UnconstrainedWidth = Template.bind( {} );
|