@wordpress/block-editor 12.16.0 → 12.17.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 +2 -0
- package/LICENSE.md +1 -1
- package/README.md +3 -6
- package/build/components/block-canvas/index.js +0 -2
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-card/index.js +1 -1
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.js +6 -1
- package/build/components/block-draggable/draggable-chip.js.map +1 -1
- package/build/components/block-draggable/index.js +76 -6
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/index.native.js +0 -6
- package/build/components/block-draggable/index.native.js.map +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
- package/build/components/block-editing-mode/index.js +2 -3
- package/build/components/block-editing-mode/index.js.map +1 -1
- package/build/components/block-inspector/index.js +1 -1
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-list-item-cell.native.js +1 -0
- package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build/components/block-list/block.js +245 -102
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +46 -20
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +3 -5
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/private-block-context.js +14 -0
- package/build/components/block-list/private-block-context.js.map +1 -0
- package/build/components/block-list/use-block-props/index.js +33 -96
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +3 -2
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list/use-scroll-upon-insertion.native.js +41 -0
- package/build/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
- package/build/components/block-lock/toolbar.js +15 -27
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mover/index.js +2 -1
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +4 -4
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-switcher/index.js +4 -4
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +1 -2
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-toolbar-popover.js +0 -2
- package/build/components/block-tools/block-toolbar-popover.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +29 -2
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/border-radius-control/linked-button.js +1 -1
- package/build/components/border-radius-control/linked-button.js.map +1 -1
- package/build/components/colors/utils.js +10 -2
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors/with-colors.js +6 -2
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/font-sizes/utils.js +10 -2
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/global-styles/border-panel.js +2 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +2 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +4 -3
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/effects-panel.js +2 -1
- package/build/components/global-styles/effects-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +1 -4
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +192 -0
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -0
- package/build/components/global-styles/hooks.js +1 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +7 -1
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/index.js +7 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +2 -1
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +22 -8
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +8 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/height-control/index.js +6 -2
- package/build/components/height-control/index.js.map +1 -1
- package/build/components/image-size-control/index.js +2 -2
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.native.js +6 -5
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/index.js +61 -22
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +18 -4
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +5 -6
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +5 -9
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +10 -9
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +10 -10
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +9 -9
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/utils.js +10 -14
- package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +4 -14
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/index.js +1 -2
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/library.js +3 -7
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js +14 -28
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/tabs.js +21 -21
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +1 -1
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inserter-list-item/index.js +2 -4
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +3 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +34 -23
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +4 -0
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +57 -3
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/media-upload-progress/constants.js +19 -0
- package/build/components/media-upload-progress/constants.js.map +1 -0
- package/build/components/media-upload-progress/index.native.js +42 -17
- package/build/components/media-upload-progress/index.native.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +9 -14
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +8 -3
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/provider/index.js +3 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +7 -1
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/index.js +17 -7
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +16 -24
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +2 -2
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/rich-text/use-mark-persistent.js +1 -1
- package/build/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +9 -6
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-commands/index.js +14 -18
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +51 -22
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +100 -92
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +8 -11
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/writing-flow/index.js +0 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-drag-selection.js +15 -4
- package/build/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +73 -27
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +7 -4
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js +1 -1
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/anchor.js +1 -1
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/aria-label.js +9 -1
- package/build/hooks/aria-label.js.map +1 -1
- package/build/hooks/background.js +185 -20
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/border.js +5 -10
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +13 -11
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/custom-class-name.js +1 -1
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/custom-class-name.native.js +9 -1
- package/build/hooks/custom-class-name.native.js.map +1 -1
- package/build/hooks/dimensions.js +4 -9
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-family.js +7 -3
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +1 -1
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +4 -3
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +5 -3
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout.js +10 -4
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/style.js +1 -1
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +4 -9
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/typography.native.js +43 -18
- package/build/hooks/typography.native.js.map +1 -1
- package/build/hooks/use-typography-props.js +10 -2
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/hooks/utils.js +44 -4
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +2 -4
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +0 -2
- package/build/private-apis.native.js.map +1 -1
- package/build/store/actions.js +0 -16
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +51 -5
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +12 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +14 -6
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +1 -13
- package/build/store/selectors.js.map +1 -1
- package/build/store/undo-ignore.js +12 -0
- package/build/store/undo-ignore.js.map +1 -0
- package/build/store/utils.js +1 -1
- package/build/store/utils.js.map +1 -1
- package/build/utils/get-px-from-css-unit.js +16 -0
- package/build/utils/get-px-from-css-unit.js.map +1 -0
- package/build/utils/index.js +2 -2
- package/build/utils/index.js.map +1 -1
- package/build/utils/object.js +0 -38
- package/build/utils/object.js.map +1 -1
- package/build/utils/use-can-block-toolbar-be-focused.js +46 -0
- package/build/utils/use-can-block-toolbar-be-focused.js.map +1 -0
- package/build-module/components/block-canvas/index.js +0 -2
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-card/index.js +1 -1
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.js +6 -1
- package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
- package/build-module/components/block-draggable/index.js +76 -6
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +1 -7
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
- package/build-module/components/block-editing-mode/index.js +3 -4
- package/build-module/components/block-editing-mode/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -1
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-list-item-cell.native.js +1 -0
- package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build-module/components/block-list/block.js +249 -106
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +48 -22
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +3 -5
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/private-block-context.js +6 -0
- package/build-module/components/block-list/private-block-context.js.map +1 -0
- package/build-module/components/block-list/use-block-props/index.js +34 -97
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +3 -2
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list/use-scroll-upon-insertion.native.js +33 -0
- package/build-module/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
- package/build-module/components/block-lock/toolbar.js +16 -28
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-mover/index.js +2 -1
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +5 -5
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +4 -4
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +1 -2
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-popover.js +0 -2
- package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +30 -3
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/border-radius-control/linked-button.js +1 -1
- package/build-module/components/border-radius-control/linked-button.js.map +1 -1
- package/build-module/components/colors/utils.js +9 -1
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors/with-colors.js +5 -1
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/font-sizes/utils.js +9 -1
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +3 -2
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +3 -2
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +5 -4
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/effects-panel.js +3 -2
- package/build-module/components/global-styles/effects-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +2 -5
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +184 -0
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +1 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +7 -1
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/index.js +1 -0
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +3 -2
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +15 -1
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +7 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/height-control/index.js +6 -2
- package/build-module/components/height-control/index.js.map +1 -1
- package/build-module/components/image-size-control/index.js +2 -2
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.native.js +2 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +62 -23
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +18 -4
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +5 -6
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +6 -10
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +11 -10
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +11 -11
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +11 -11
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/utils.js +7 -11
- package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +4 -14
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +2 -2
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/index.js +1 -2
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/library.js +3 -7
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js +14 -28
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/tabs.js +22 -22
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +2 -2
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +2 -4
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +35 -24
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +4 -0
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +58 -4
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/media-upload-progress/constants.js +7 -0
- package/build-module/components/media-upload-progress/constants.js.map +1 -0
- package/build-module/components/media-upload-progress/index.native.js +37 -8
- package/build-module/components/media-upload-progress/index.native.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +9 -14
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +6 -1
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/provider/index.js +3 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +7 -1
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/index.js +17 -7
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +16 -23
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +2 -2
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/rich-text/use-mark-persistent.js +1 -1
- package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -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 +9 -6
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +14 -18
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +51 -23
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +102 -94
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +8 -11
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/writing-flow/index.js +0 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js +15 -4
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +73 -27
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +7 -4
- package/build-module/components/writing-flow/use-tab-nav.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/anchor.js +1 -1
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/aria-label.js +7 -1
- package/build-module/hooks/aria-label.js.map +1 -1
- package/build-module/hooks/background.js +181 -19
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/border.js +2 -8
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +11 -9
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +1 -1
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/custom-class-name.native.js +7 -1
- package/build-module/hooks/custom-class-name.native.js.map +1 -1
- package/build-module/hooks/dimensions.js +1 -7
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-family.js +6 -2
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +1 -1
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +5 -4
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +6 -4
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout.js +9 -3
- package/build-module/hooks/layout.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/typography.js +1 -7
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/typography.native.js +43 -17
- package/build-module/hooks/typography.native.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +9 -1
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/hooks/utils.js +43 -4
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +2 -4
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +0 -2
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/actions.js +0 -15
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +49 -4
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +11 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +14 -6
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +1 -12
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/undo-ignore.js +5 -0
- package/build-module/store/undo-ignore.js.map +1 -0
- package/build-module/store/utils.js +2 -2
- package/build-module/store/utils.js.map +1 -1
- package/build-module/utils/get-px-from-css-unit.js +9 -0
- package/build-module/utils/get-px-from-css-unit.js.map +1 -0
- package/build-module/utils/index.js +1 -1
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/object.js +0 -37
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/use-can-block-toolbar-be-focused.js +40 -0
- package/build-module/utils/use-can-block-toolbar-be-focused.js.map +1 -0
- package/build-style/content-rtl.css +7 -6
- package/build-style/content.css +7 -6
- package/build-style/style-rtl.css +51 -8
- package/build-style/style.css +51 -8
- package/package.json +31 -31
- package/src/components/alignment-control/README.md +0 -5
- package/src/components/block-alignment-control/README.md +0 -5
- package/src/components/block-alignment-matrix-control/README.md +0 -10
- package/src/components/block-breadcrumb/README.md +0 -5
- package/src/components/block-canvas/index.js +0 -2
- package/src/components/block-canvas/style.scss +6 -0
- package/src/components/block-caption/README.md +0 -5
- package/src/components/block-card/README.md +0 -5
- package/src/components/block-card/index.js +1 -1
- package/src/components/block-draggable/draggable-chip.js +11 -1
- package/src/components/block-draggable/index.js +116 -4
- package/src/components/block-draggable/index.native.js +0 -5
- package/src/components/block-draggable/style.scss +35 -0
- package/src/components/block-draggable/test/helpers.native.js +8 -7
- package/src/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
- package/src/components/block-editing-mode/index.js +3 -3
- package/src/components/block-icon/README.md +0 -5
- package/src/components/block-inspector/README.md +0 -5
- package/src/components/block-inspector/index.js +3 -1
- package/src/components/block-list/block-list-item-cell.native.js +5 -1
- package/src/components/block-list/block.js +290 -119
- package/src/components/block-list/block.native.js +55 -21
- package/src/components/block-list/content.scss +14 -10
- package/src/components/block-list/index.native.js +3 -5
- package/src/components/block-list/{block-list-block-context.js → private-block-context.js} +1 -1
- package/src/components/block-list/use-block-props/index.js +32 -128
- package/src/components/block-list/use-in-between-inserter.js +4 -1
- package/src/components/block-list/use-scroll-upon-insertion.native.js +52 -0
- package/src/components/block-lock/toolbar.js +15 -34
- package/src/components/block-mover/README.md +0 -5
- package/src/components/block-mover/index.js +1 -1
- package/src/components/block-parent-selector/README.md +0 -5
- package/src/components/block-patterns-list/README.md +0 -5
- package/src/components/block-patterns-list/index.js +8 -5
- package/src/components/block-switcher/index.js +49 -59
- package/src/components/block-toolbar/README.md +0 -5
- package/src/components/block-toolbar/index.js +1 -2
- package/src/components/block-tools/block-toolbar-popover.js +4 -10
- package/src/components/block-types-list/README.md +0 -5
- package/src/components/block-variation-picker/README.md +0 -5
- package/src/components/block-variation-transforms/README.md +0 -5
- package/src/components/block-variation-transforms/index.js +49 -3
- package/src/components/border-radius-control/linked-button.js +1 -1
- package/src/components/caption/README.md +0 -5
- package/src/components/color-palette/test/__snapshots__/control.js.snap +0 -1
- package/src/components/colors/utils.js +8 -1
- package/src/components/colors/with-colors.js +3 -1
- package/src/components/contrast-checker/README.md +0 -4
- package/src/components/copy-handler/README.md +0 -10
- package/src/components/font-sizes/utils.js +7 -1
- package/src/components/global-styles/border-panel.js +2 -1
- package/src/components/global-styles/color-panel.js +2 -1
- package/src/components/global-styles/dimensions-panel.js +4 -3
- package/src/components/global-styles/effects-panel.js +2 -1
- package/src/components/global-styles/filters-panel.js +2 -5
- package/src/components/global-styles/get-global-styles-changes.js +210 -0
- package/src/components/global-styles/hooks.js +3 -0
- package/src/components/global-styles/image-settings-panel.js +6 -0
- package/src/components/global-styles/index.js +1 -0
- package/src/components/global-styles/test/get-global-styles-changes.js +234 -0
- package/src/components/global-styles/typography-panel.js +2 -1
- package/src/components/global-styles/use-global-styles-output.js +9 -5
- package/src/components/global-styles/utils.js +7 -0
- package/src/components/height-control/README.md +2 -7
- package/src/components/height-control/index.js +4 -0
- package/src/components/image-size-control/index.js +5 -2
- package/src/components/index.native.js +2 -2
- package/src/components/inner-blocks/index.js +68 -29
- package/src/components/inner-blocks/index.native.js +19 -7
- package/src/components/inner-blocks/use-inner-block-template-sync.js +5 -7
- package/src/components/inner-blocks/use-nested-settings-update.js +6 -13
- package/src/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +15 -15
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +15 -13
- package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +15 -18
- package/src/components/inserter/block-patterns-tab/utils.js +11 -12
- package/src/components/inserter/hooks/use-block-types-state.js +9 -11
- package/src/components/inserter/hooks/use-patterns-state.js +2 -2
- package/src/components/inserter/index.js +0 -1
- package/src/components/inserter/library.js +2 -8
- package/src/components/inserter/menu.js +13 -31
- package/src/components/inserter/style.scss +6 -4
- package/src/components/inserter/tabs.js +34 -25
- package/src/components/inserter-draggable-blocks/index.js +2 -2
- package/src/components/inserter-list-item/index.js +6 -6
- package/src/components/inspector-controls/block-support-tools-panel.js +2 -0
- package/src/components/inspector-controls-tabs/index.js +39 -28
- package/src/components/inspector-controls-tabs/style.scss +3 -2
- package/src/components/letter-spacing-control/README.md +0 -5
- package/src/components/line-height-control/README.md +0 -5
- package/src/components/list-view/README.md +0 -5
- package/src/components/list-view/block-select-button.js +4 -0
- package/src/components/list-view/block.js +73 -2
- package/src/components/list-view/style.scss +6 -0
- package/src/components/media-upload-progress/constants.js +6 -0
- package/src/components/media-upload-progress/index.native.js +66 -14
- package/src/components/media-upload-progress/test/index.native.js +2 -2
- package/src/components/multi-selection-inspector/README.md +0 -5
- package/src/components/navigable-toolbar/index.js +13 -11
- package/src/components/plain-text/index.native.js +6 -1
- package/src/components/provider/index.js +1 -1
- package/src/components/provider/test/use-block-sync.js +20 -17
- package/src/components/provider/use-block-sync.js +6 -0
- package/src/components/rich-text/index.js +18 -6
- package/src/components/rich-text/native/index.native.js +16 -24
- package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +3 -3
- package/src/components/rich-text/native/test/index.native.js +72 -5
- package/src/components/rich-text/use-input-rules.js +2 -2
- package/src/components/rich-text/use-mark-persistent.js +1 -2
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/src/components/text-decoration-control/README.md +40 -0
- package/src/components/text-transform-control/README.md +0 -4
- package/src/components/ungroup-button/README.md +0 -5
- package/src/components/unit-control/README.md +0 -4
- package/src/components/url-input/index.js +11 -11
- package/src/components/use-block-commands/index.js +18 -21
- package/src/components/use-block-drop-zone/index.js +85 -34
- package/src/components/use-moving-animation/index.js +107 -103
- package/src/components/use-on-block-drop/index.js +7 -23
- package/src/components/use-on-block-drop/test/index.js +12 -26
- package/src/components/use-resize-canvas/README.md +0 -4
- package/src/components/use-settings/README.md +0 -4
- package/src/components/writing-flow/index.js +0 -1
- package/src/components/writing-flow/use-drag-selection.js +18 -4
- package/src/components/writing-flow/use-selection-observer.js +99 -37
- package/src/components/writing-flow/use-tab-nav.js +7 -7
- package/src/hooks/align.js +1 -5
- package/src/hooks/anchor.js +1 -5
- package/src/hooks/aria-label.js +8 -5
- package/src/hooks/background.js +253 -21
- package/src/hooks/border.js +2 -13
- package/src/hooks/color.js +19 -14
- package/src/hooks/custom-class-name.js +1 -5
- package/src/hooks/custom-class-name.native.js +8 -5
- package/src/hooks/dimensions.js +1 -7
- package/src/hooks/font-family.js +4 -7
- package/src/hooks/font-size.js +1 -6
- package/src/hooks/index.js +19 -3
- package/src/hooks/index.native.js +17 -4
- package/src/hooks/layout.js +5 -2
- package/src/hooks/style.js +1 -6
- package/src/hooks/test/anchor.js +4 -9
- package/src/hooks/test/custom-class-name.js +3 -8
- package/src/hooks/test/style.js +4 -14
- package/src/hooks/typography.js +1 -7
- package/src/hooks/typography.native.js +31 -33
- package/src/hooks/use-typography-props.js +7 -1
- package/src/hooks/utils.js +60 -2
- package/src/private-apis.js +2 -4
- package/src/private-apis.native.js +0 -2
- package/src/store/actions.js +0 -15
- package/src/store/private-actions.js +44 -4
- package/src/store/private-selectors.js +11 -0
- package/src/store/reducer.js +16 -5
- package/src/store/selectors.js +5 -13
- package/src/store/undo-ignore.js +4 -0
- package/src/store/utils.js +2 -2
- package/src/style.scss +1 -0
- package/src/utils/get-px-from-css-unit.js +8 -0
- package/src/utils/index.js +1 -1
- package/src/utils/object.js +0 -35
- package/src/utils/test/object.js +1 -96
- package/src/utils/use-can-block-toolbar-be-focused.js +48 -0
- package/build/components/block-list/block-list-block-context.js +0 -14
- package/build/components/block-list/block-list-block-context.js.map +0 -1
- package/build/utils/parse-css-unit-to-px.js +0 -302
- package/build/utils/parse-css-unit-to-px.js.map +0 -1
- package/build/utils/use-should-contextual-toolbar-show.js +0 -63
- package/build/utils/use-should-contextual-toolbar-show.js.map +0 -1
- package/build-module/components/block-list/block-list-block-context.js +0 -6
- package/build-module/components/block-list/block-list-block-context.js.map +0 -1
- package/build-module/utils/parse-css-unit-to-px.js +0 -294
- package/build-module/utils/parse-css-unit-to-px.js.map +0 -1
- package/build-module/utils/use-should-contextual-toolbar-show.js +0 -57
- package/build-module/utils/use-should-contextual-toolbar-show.js.map +0 -1
- package/src/utils/parse-css-unit-to-px.js +0 -329
- package/src/utils/test/parse-css-unit-to-px.js +0 -172
- package/src/utils/use-should-contextual-toolbar-show.js +0 -85
|
@@ -4,11 +4,6 @@ This component allows to display the selected block's variations which have the
|
|
|
4
4
|
|
|
5
5
|
By selecting such a variation an update to the selected block's attributes happen, based on the variation's attributes.
|
|
6
6
|
|
|
7
|
-
## Table of contents
|
|
8
|
-
|
|
9
|
-
1. [Development guidelines](#development-guidelines)
|
|
10
|
-
2. [Related components](#related-components)
|
|
11
|
-
|
|
12
7
|
## Development guidelines
|
|
13
8
|
|
|
14
9
|
### Usage
|
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
DropdownMenu,
|
|
9
9
|
MenuGroup,
|
|
10
10
|
MenuItemsChoice,
|
|
11
|
+
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
12
|
+
__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,
|
|
11
13
|
VisuallyHidden,
|
|
12
14
|
} from '@wordpress/components';
|
|
13
15
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
@@ -95,6 +97,43 @@ function VariationsDropdown( {
|
|
|
95
97
|
);
|
|
96
98
|
}
|
|
97
99
|
|
|
100
|
+
function VariationsToggleGroupControl( {
|
|
101
|
+
className,
|
|
102
|
+
onSelectVariation,
|
|
103
|
+
selectedValue,
|
|
104
|
+
variations,
|
|
105
|
+
} ) {
|
|
106
|
+
return (
|
|
107
|
+
<div className={ className }>
|
|
108
|
+
<ToggleGroupControl
|
|
109
|
+
label={ __( 'Transform to variation' ) }
|
|
110
|
+
value={ selectedValue }
|
|
111
|
+
hideLabelFromVision
|
|
112
|
+
onChange={ onSelectVariation }
|
|
113
|
+
__next40pxDefaultSize
|
|
114
|
+
__nextHasNoMarginBottom
|
|
115
|
+
>
|
|
116
|
+
{ variations.map( ( variation ) => (
|
|
117
|
+
<ToggleGroupControlOptionIcon
|
|
118
|
+
key={ variation.name }
|
|
119
|
+
icon={ variation.icon }
|
|
120
|
+
value={ variation.name }
|
|
121
|
+
label={
|
|
122
|
+
selectedValue === variation.name
|
|
123
|
+
? variation.title
|
|
124
|
+
: sprintf(
|
|
125
|
+
/* translators: %s: Name of the block variation */
|
|
126
|
+
__( 'Transform to %s' ),
|
|
127
|
+
variation.title
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
/>
|
|
131
|
+
) ) }
|
|
132
|
+
</ToggleGroupControl>
|
|
133
|
+
</div>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
98
137
|
function __experimentalBlockVariationTransforms( { blockClientId } ) {
|
|
99
138
|
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
100
139
|
const { activeBlockVariation, variations } = useSelect(
|
|
@@ -138,12 +177,19 @@ function __experimentalBlockVariationTransforms( { blockClientId } ) {
|
|
|
138
177
|
} );
|
|
139
178
|
};
|
|
140
179
|
|
|
141
|
-
const baseClass = 'block-editor-block-variation-transforms';
|
|
142
|
-
|
|
143
180
|
// Skip rendering if there are no variations
|
|
144
181
|
if ( ! variations?.length ) return null;
|
|
145
182
|
|
|
146
|
-
const
|
|
183
|
+
const baseClass = 'block-editor-block-variation-transforms';
|
|
184
|
+
|
|
185
|
+
// Show buttons if there are more than 5 variations because the ToggleGroupControl does not wrap
|
|
186
|
+
const showButtons = variations.length > 5;
|
|
187
|
+
|
|
188
|
+
const ButtonComponent = showButtons
|
|
189
|
+
? VariationsButtons
|
|
190
|
+
: VariationsToggleGroupControl;
|
|
191
|
+
|
|
192
|
+
const Component = hasUniqueIcons ? ButtonComponent : VariationsDropdown;
|
|
147
193
|
|
|
148
194
|
return (
|
|
149
195
|
<Component
|
|
@@ -13,7 +13,7 @@ export default function LinkedButton( { isLinked, ...props } ) {
|
|
|
13
13
|
<Button
|
|
14
14
|
{ ...props }
|
|
15
15
|
className="component-border-radius-control__linked-button"
|
|
16
|
-
|
|
16
|
+
size="small"
|
|
17
17
|
icon={ isLinked ? link : linkOff }
|
|
18
18
|
iconSize={ 24 }
|
|
19
19
|
aria-label={ label }
|
|
@@ -4,11 +4,6 @@ The `Caption` component renders the [caption part](https://wordpress.org/documen
|
|
|
4
4
|
|
|
5
5
|
This component encapsulates the "caption" behaviour and styles over a `<RichText>` so it can be used in other components such as the `BlockCaption` component.
|
|
6
6
|
|
|
7
|
-
## Table of contents
|
|
8
|
-
|
|
9
|
-
1. [Development guidelines](#development-guidelines)
|
|
10
|
-
2. [Related components](#related-components)
|
|
11
|
-
|
|
12
7
|
## Development guidelines
|
|
13
8
|
|
|
14
9
|
### Usage
|
|
@@ -221,7 +221,6 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
|
221
221
|
aria-selected="true"
|
|
222
222
|
class="components-button components-circular-option-picker__option"
|
|
223
223
|
data-active-item=""
|
|
224
|
-
data-command=""
|
|
225
224
|
id="components-circular-option-picker-0-0"
|
|
226
225
|
role="option"
|
|
227
226
|
style="background-color: rgb(255, 0, 0); color: rgb(255, 0, 0);"
|
|
@@ -5,10 +5,15 @@ import { colord, extend } from 'colord';
|
|
|
5
5
|
import namesPlugin from 'colord/plugins/names';
|
|
6
6
|
import a11yPlugin from 'colord/plugins/a11y';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
12
|
+
|
|
8
13
|
/**
|
|
9
14
|
* Internal dependencies
|
|
10
15
|
*/
|
|
11
|
-
import {
|
|
16
|
+
import { unlock } from '../../lock-unlock';
|
|
12
17
|
|
|
13
18
|
extend( [ namesPlugin, a11yPlugin ] );
|
|
14
19
|
|
|
@@ -70,6 +75,8 @@ export function getColorClassName( colorContextName, colorSlug ) {
|
|
|
70
75
|
return undefined;
|
|
71
76
|
}
|
|
72
77
|
|
|
78
|
+
const { kebabCase } = unlock( componentsPrivateApis );
|
|
79
|
+
|
|
73
80
|
return `has-${ kebabCase( colorSlug ) }-${ colorContextName }`;
|
|
74
81
|
}
|
|
75
82
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useMemo, Component } from '@wordpress/element';
|
|
5
5
|
import { compose, createHigherOrderComponent } from '@wordpress/compose';
|
|
6
|
+
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
@@ -14,7 +15,7 @@ import {
|
|
|
14
15
|
getMostReadableColor,
|
|
15
16
|
} from './utils';
|
|
16
17
|
import { useSettings } from '../use-settings';
|
|
17
|
-
import {
|
|
18
|
+
import { unlock } from '../../lock-unlock';
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Capitalizes the first letter in a string.
|
|
@@ -79,6 +80,7 @@ const withEditorColorPalette = () =>
|
|
|
79
80
|
* @return {Component} The component that can be used as a HOC.
|
|
80
81
|
*/
|
|
81
82
|
function createColorHOC( colorTypes, withColorPalette ) {
|
|
83
|
+
const { kebabCase } = unlock( componentsPrivateApis );
|
|
82
84
|
const colorMap = colorTypes.reduce( ( colorObject, colorType ) => {
|
|
83
85
|
return {
|
|
84
86
|
...colorObject,
|
|
@@ -6,10 +6,6 @@ ContrastChecker also accounts for font sizes.
|
|
|
6
6
|
|
|
7
7
|
A notice will be rendered if the color combination of text and background colors are low.
|
|
8
8
|
|
|
9
|
-
## Table of contents
|
|
10
|
-
|
|
11
|
-
1. [Development guidelines](#development-guidelines)
|
|
12
|
-
|
|
13
9
|
## Developer guidelines
|
|
14
10
|
|
|
15
11
|
### Usage
|
|
@@ -8,16 +8,6 @@ Concretely, it handles the display of success messages and takes care of copying
|
|
|
8
8
|
|
|
9
9
|

|
|
10
10
|
|
|
11
|
-
## Table of contents
|
|
12
|
-
|
|
13
|
-
- [Copy Handler](#copy-handler)
|
|
14
|
-
- [Table of contents](#table-of-contents)
|
|
15
|
-
- [Development guidelines](#development-guidelines)
|
|
16
|
-
- [Usage](#usage)
|
|
17
|
-
- [Props](#props)
|
|
18
|
-
- [`children`](#children)
|
|
19
|
-
- [Related components](#related-components)
|
|
20
|
-
|
|
21
11
|
## Development guidelines
|
|
22
12
|
|
|
23
13
|
### Usage
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* Internal dependencies
|
|
3
8
|
*/
|
|
4
|
-
import {
|
|
9
|
+
import { unlock } from '../../lock-unlock';
|
|
5
10
|
|
|
6
11
|
/**
|
|
7
12
|
* Returns the font size object based on an array of named font sizes and the namedFontSize and customFontSize values.
|
|
@@ -64,5 +69,6 @@ export function getFontSizeClass( fontSizeSlug ) {
|
|
|
64
69
|
return;
|
|
65
70
|
}
|
|
66
71
|
|
|
72
|
+
const { kebabCase } = unlock( componentsPrivateApis );
|
|
67
73
|
return `has-${ kebabCase( fontSizeSlug ) }-font-size`;
|
|
68
74
|
}
|
|
@@ -16,7 +16,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
16
16
|
*/
|
|
17
17
|
import BorderRadiusControl from '../border-radius-control';
|
|
18
18
|
import { useColorsPerOrigin } from './hooks';
|
|
19
|
-
import { getValueFromVariable } from './utils';
|
|
19
|
+
import { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';
|
|
20
20
|
|
|
21
21
|
export function useHasBorderPanel( settings ) {
|
|
22
22
|
const controls = [
|
|
@@ -62,6 +62,7 @@ function BorderToolsPanel( {
|
|
|
62
62
|
label={ __( 'Border' ) }
|
|
63
63
|
resetAll={ resetAll }
|
|
64
64
|
panelId={ panelId }
|
|
65
|
+
dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }
|
|
65
66
|
>
|
|
66
67
|
{ children }
|
|
67
68
|
</ToolsPanel>
|
|
@@ -27,7 +27,7 @@ import { __, sprintf } from '@wordpress/i18n';
|
|
|
27
27
|
*/
|
|
28
28
|
import ColorGradientControl from '../colors-gradients/control';
|
|
29
29
|
import { useColorsPerOrigin, useGradientsPerOrigin } from './hooks';
|
|
30
|
-
import { getValueFromVariable } from './utils';
|
|
30
|
+
import { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';
|
|
31
31
|
import { setImmutably } from '../../utils/object';
|
|
32
32
|
import { unlock } from '../../lock-unlock';
|
|
33
33
|
|
|
@@ -130,6 +130,7 @@ function ColorToolsPanel( {
|
|
|
130
130
|
className="color-block-support-panel"
|
|
131
131
|
__experimentalFirstVisibleItemClass="first"
|
|
132
132
|
__experimentalLastVisibleItemClass="last"
|
|
133
|
+
dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }
|
|
133
134
|
>
|
|
134
135
|
<div className="color-block-support-panel__inner-wrapper">
|
|
135
136
|
{ children }
|
|
@@ -23,7 +23,7 @@ import { useCallback, Platform } from '@wordpress/element';
|
|
|
23
23
|
/**
|
|
24
24
|
* Internal dependencies
|
|
25
25
|
*/
|
|
26
|
-
import { getValueFromVariable } from './utils';
|
|
26
|
+
import { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';
|
|
27
27
|
import SpacingSizesControl from '../spacing-sizes-control';
|
|
28
28
|
import HeightControl from '../height-control';
|
|
29
29
|
import ChildLayoutControl from '../child-layout-control';
|
|
@@ -178,6 +178,7 @@ function DimensionsToolsPanel( {
|
|
|
178
178
|
label={ __( 'Dimensions' ) }
|
|
179
179
|
resetAll={ resetAll }
|
|
180
180
|
panelId={ panelId }
|
|
181
|
+
dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }
|
|
181
182
|
>
|
|
182
183
|
{ children }
|
|
183
184
|
</ToolsPanel>
|
|
@@ -602,7 +603,7 @@ export default function DimensionsPanel( {
|
|
|
602
603
|
{ showMinHeightControl && (
|
|
603
604
|
<ToolsPanelItem
|
|
604
605
|
hasValue={ hasMinHeightValue }
|
|
605
|
-
label={ __( '
|
|
606
|
+
label={ __( 'Minimum height' ) }
|
|
606
607
|
onDeselect={ resetMinHeightValue }
|
|
607
608
|
isShownByDefault={
|
|
608
609
|
defaultControls.minHeight ?? DEFAULT_CONTROLS.minHeight
|
|
@@ -610,7 +611,7 @@ export default function DimensionsPanel( {
|
|
|
610
611
|
panelId={ panelId }
|
|
611
612
|
>
|
|
612
613
|
<HeightControl
|
|
613
|
-
label={ __( '
|
|
614
|
+
label={ __( 'Minimum height' ) }
|
|
614
615
|
value={ minHeightValue }
|
|
615
616
|
onChange={ setMinHeightValue }
|
|
616
617
|
/>
|
|
@@ -26,7 +26,7 @@ import { shadow as shadowIcon, Icon, check } from '@wordpress/icons';
|
|
|
26
26
|
/**
|
|
27
27
|
* Internal dependencies
|
|
28
28
|
*/
|
|
29
|
-
import { getValueFromVariable } from './utils';
|
|
29
|
+
import { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';
|
|
30
30
|
import { setImmutably } from '../../utils/object';
|
|
31
31
|
|
|
32
32
|
export function useHasEffectsPanel( settings ) {
|
|
@@ -55,6 +55,7 @@ function EffectsToolsPanel( {
|
|
|
55
55
|
label={ __( 'Effects' ) }
|
|
56
56
|
resetAll={ resetAll }
|
|
57
57
|
panelId={ panelId }
|
|
58
|
+
dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }
|
|
58
59
|
>
|
|
59
60
|
{ children }
|
|
60
61
|
</ToolsPanel>
|
|
@@ -28,7 +28,7 @@ import { useCallback, useMemo } from '@wordpress/element';
|
|
|
28
28
|
/**
|
|
29
29
|
* Internal dependencies
|
|
30
30
|
*/
|
|
31
|
-
import { getValueFromVariable } from './utils';
|
|
31
|
+
import { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';
|
|
32
32
|
import { setImmutably } from '../../utils/object';
|
|
33
33
|
|
|
34
34
|
const EMPTY_ARRAY = [];
|
|
@@ -82,10 +82,7 @@ function FiltersToolsPanel( {
|
|
|
82
82
|
label={ _x( 'Filters', 'Name for applying graphical effects' ) }
|
|
83
83
|
resetAll={ resetAll }
|
|
84
84
|
panelId={ panelId }
|
|
85
|
-
dropdownMenuProps={
|
|
86
|
-
placement: 'left-start',
|
|
87
|
-
offset: 258, // sidebar width (280px) - button width (24px) + border (2px)
|
|
88
|
-
} }
|
|
85
|
+
dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }
|
|
89
86
|
>
|
|
90
87
|
{ children }
|
|
91
88
|
</ToolsPanel>
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import memoize from 'memize';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
10
|
+
import { getBlockTypes } from '@wordpress/blocks';
|
|
11
|
+
|
|
12
|
+
const globalStylesChangesCache = new Map();
|
|
13
|
+
const EMPTY_ARRAY = [];
|
|
14
|
+
const translationMap = {
|
|
15
|
+
caption: __( 'Caption' ),
|
|
16
|
+
link: __( 'Link' ),
|
|
17
|
+
button: __( 'Button' ),
|
|
18
|
+
heading: __( 'Heading' ),
|
|
19
|
+
h1: __( 'H1' ),
|
|
20
|
+
h2: __( 'H2' ),
|
|
21
|
+
h3: __( 'H3' ),
|
|
22
|
+
h4: __( 'H4' ),
|
|
23
|
+
h5: __( 'H5' ),
|
|
24
|
+
h6: __( 'H6' ),
|
|
25
|
+
'settings.color': __( 'Color settings' ),
|
|
26
|
+
'settings.typography': __( 'Typography settings' ),
|
|
27
|
+
'styles.color': __( 'Colors' ),
|
|
28
|
+
'styles.spacing': __( 'Spacing' ),
|
|
29
|
+
'styles.typography': __( 'Typography' ),
|
|
30
|
+
};
|
|
31
|
+
const getBlockNames = memoize( () =>
|
|
32
|
+
getBlockTypes().reduce( ( accumulator, { name, title } ) => {
|
|
33
|
+
accumulator[ name ] = title;
|
|
34
|
+
return accumulator;
|
|
35
|
+
}, {} )
|
|
36
|
+
);
|
|
37
|
+
const isObject = ( obj ) => obj !== null && typeof obj === 'object';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Get the translation for a given global styles key.
|
|
41
|
+
* @param {string} key A key representing a path to a global style property or setting.
|
|
42
|
+
* @return {string|undefined} A translated key or undefined if no translation exists.
|
|
43
|
+
*/
|
|
44
|
+
function getTranslation( key ) {
|
|
45
|
+
if ( translationMap[ key ] ) {
|
|
46
|
+
return translationMap[ key ];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const keyArray = key.split( '.' );
|
|
50
|
+
|
|
51
|
+
if ( keyArray?.[ 0 ] === 'blocks' ) {
|
|
52
|
+
const blockName = getBlockNames()?.[ keyArray[ 1 ] ];
|
|
53
|
+
return blockName
|
|
54
|
+
? sprintf(
|
|
55
|
+
// translators: %s: block name.
|
|
56
|
+
__( '%s block' ),
|
|
57
|
+
blockName
|
|
58
|
+
)
|
|
59
|
+
: keyArray[ 1 ];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if ( keyArray?.[ 0 ] === 'elements' ) {
|
|
63
|
+
const elementName = translationMap[ keyArray[ 1 ] ] || keyArray[ 1 ];
|
|
64
|
+
return sprintf(
|
|
65
|
+
// translators: %s: element name, e.g., heading button, link, caption.
|
|
66
|
+
__( '%s element' ),
|
|
67
|
+
elementName
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* A deep comparison of two objects, optimized for comparing global styles.
|
|
76
|
+
* @param {Object} changedObject The changed object to compare.
|
|
77
|
+
* @param {Object} originalObject The original object to compare against.
|
|
78
|
+
* @param {string} parentPath A key/value pair object of block names and their rendered titles.
|
|
79
|
+
* @return {string[]} An array of paths whose values have changed.
|
|
80
|
+
*/
|
|
81
|
+
function deepCompare( changedObject, originalObject, parentPath = '' ) {
|
|
82
|
+
// We have two non-object values to compare.
|
|
83
|
+
if ( ! isObject( changedObject ) && ! isObject( originalObject ) ) {
|
|
84
|
+
/*
|
|
85
|
+
* Only return a path if the value has changed.
|
|
86
|
+
* And then only the path name up to 2 levels deep.
|
|
87
|
+
*/
|
|
88
|
+
return changedObject !== originalObject
|
|
89
|
+
? parentPath.split( '.' ).slice( 0, 2 ).join( '.' )
|
|
90
|
+
: undefined;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Enable comparison when an object doesn't have a corresponding property to compare.
|
|
94
|
+
changedObject = isObject( changedObject ) ? changedObject : {};
|
|
95
|
+
originalObject = isObject( originalObject ) ? originalObject : {};
|
|
96
|
+
|
|
97
|
+
const allKeys = new Set( [
|
|
98
|
+
...Object.keys( changedObject ),
|
|
99
|
+
...Object.keys( originalObject ),
|
|
100
|
+
] );
|
|
101
|
+
|
|
102
|
+
let diffs = [];
|
|
103
|
+
for ( const key of allKeys ) {
|
|
104
|
+
const path = parentPath ? parentPath + '.' + key : key;
|
|
105
|
+
const changedPath = deepCompare(
|
|
106
|
+
changedObject[ key ],
|
|
107
|
+
originalObject[ key ],
|
|
108
|
+
path
|
|
109
|
+
);
|
|
110
|
+
if ( changedPath ) {
|
|
111
|
+
diffs = diffs.concat( changedPath );
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return diffs;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Returns an array of translated summarized global styles changes.
|
|
119
|
+
* Results are cached using a Map() key of `JSON.stringify( { next, previous } )`.
|
|
120
|
+
*
|
|
121
|
+
* @param {Object} next The changed object to compare.
|
|
122
|
+
* @param {Object} previous The original object to compare against.
|
|
123
|
+
* @return {string[]} An array of translated changes.
|
|
124
|
+
*/
|
|
125
|
+
function getGlobalStylesChangelist( next, previous ) {
|
|
126
|
+
const cacheKey = JSON.stringify( { next, previous } );
|
|
127
|
+
|
|
128
|
+
if ( globalStylesChangesCache.has( cacheKey ) ) {
|
|
129
|
+
return globalStylesChangesCache.get( cacheKey );
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/*
|
|
133
|
+
* Compare the two changesets with normalized keys.
|
|
134
|
+
* The order of these keys determines the order in which
|
|
135
|
+
* they'll appear in the results.
|
|
136
|
+
*/
|
|
137
|
+
const changedValueTree = deepCompare(
|
|
138
|
+
{
|
|
139
|
+
styles: {
|
|
140
|
+
color: next?.styles?.color,
|
|
141
|
+
typography: next?.styles?.typography,
|
|
142
|
+
spacing: next?.styles?.spacing,
|
|
143
|
+
},
|
|
144
|
+
blocks: next?.styles?.blocks,
|
|
145
|
+
elements: next?.styles?.elements,
|
|
146
|
+
settings: next?.settings,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
styles: {
|
|
150
|
+
color: previous?.styles?.color,
|
|
151
|
+
typography: previous?.styles?.typography,
|
|
152
|
+
spacing: previous?.styles?.spacing,
|
|
153
|
+
},
|
|
154
|
+
blocks: previous?.styles?.blocks,
|
|
155
|
+
elements: previous?.styles?.elements,
|
|
156
|
+
settings: previous?.settings,
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
if ( ! changedValueTree.length ) {
|
|
161
|
+
globalStylesChangesCache.set( cacheKey, EMPTY_ARRAY );
|
|
162
|
+
return EMPTY_ARRAY;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Remove duplicate results.
|
|
166
|
+
const result = [ ...new Set( changedValueTree ) ]
|
|
167
|
+
/*
|
|
168
|
+
* Translate the keys.
|
|
169
|
+
* Remove duplicate or empty translations.
|
|
170
|
+
*/
|
|
171
|
+
.reduce( ( acc, curr ) => {
|
|
172
|
+
const translation = getTranslation( curr );
|
|
173
|
+
if ( translation && ! acc.includes( translation ) ) {
|
|
174
|
+
acc.push( translation );
|
|
175
|
+
}
|
|
176
|
+
return acc;
|
|
177
|
+
}, [] );
|
|
178
|
+
|
|
179
|
+
globalStylesChangesCache.set( cacheKey, result );
|
|
180
|
+
|
|
181
|
+
return result;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* From a getGlobalStylesChangelist() result, returns a truncated array of translated changes.
|
|
186
|
+
* Appends a translated string indicating the number of changes that were truncated.
|
|
187
|
+
*
|
|
188
|
+
* @param {Object} next The changed object to compare.
|
|
189
|
+
* @param {Object} previous The original object to compare against.
|
|
190
|
+
* @param {{maxResults:number}} options Options. maxResults: results to return before truncating.
|
|
191
|
+
* @return {string[]} An array of translated changes.
|
|
192
|
+
*/
|
|
193
|
+
export default function getGlobalStylesChanges( next, previous, options = {} ) {
|
|
194
|
+
const changes = getGlobalStylesChangelist( next, previous );
|
|
195
|
+
const changesLength = changes.length;
|
|
196
|
+
const { maxResults } = options;
|
|
197
|
+
|
|
198
|
+
// Truncate to `n` results if necessary.
|
|
199
|
+
if ( !! maxResults && changesLength && changesLength > maxResults ) {
|
|
200
|
+
const deleteCount = changesLength - maxResults;
|
|
201
|
+
const andMoreText = sprintf(
|
|
202
|
+
// translators: %d: number of global styles changes that are not displayed in the UI.
|
|
203
|
+
_n( '…and %d more change.', '…and %d more changes.', deleteCount ),
|
|
204
|
+
deleteCount
|
|
205
|
+
);
|
|
206
|
+
changes.splice( maxResults, deleteCount, andMoreText );
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return changes;
|
|
210
|
+
}
|
|
@@ -24,6 +24,9 @@ const EMPTY_CONFIG = { settings: {}, styles: {} };
|
|
|
24
24
|
const VALID_SETTINGS = [
|
|
25
25
|
'appearanceTools',
|
|
26
26
|
'useRootPaddingAwareAlignments',
|
|
27
|
+
'background.backgroundImage',
|
|
28
|
+
'background.backgroundRepeat',
|
|
29
|
+
'background.backgroundSize',
|
|
27
30
|
'border.color',
|
|
28
31
|
'border.radius',
|
|
29
32
|
'border.style',
|
|
@@ -8,6 +8,11 @@ import {
|
|
|
8
8
|
} from '@wordpress/components';
|
|
9
9
|
import { __, _x } from '@wordpress/i18n';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import { TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';
|
|
15
|
+
|
|
11
16
|
export function useHasImageSettingsPanel( name, value, inheritedValue ) {
|
|
12
17
|
// Note: If lightbox `value` exists, that means it was
|
|
13
18
|
// defined via the the Global Styles UI and will NOT
|
|
@@ -47,6 +52,7 @@ export default function ImageSettingsPanel( {
|
|
|
47
52
|
label={ _x( 'Settings', 'Image settings' ) }
|
|
48
53
|
resetAll={ resetLightbox }
|
|
49
54
|
panelId={ panelId }
|
|
55
|
+
dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }
|
|
50
56
|
>
|
|
51
57
|
<ToolsPanelItem
|
|
52
58
|
// We use the `userSettings` prop instead of `settings`, because `settings`
|