@wordpress/block-editor 9.5.0 → 9.7.1-next.d6164808d3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/components/block-alignment-control/use-available-alignments.js +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-edit-visually-button/index.js +46 -0
- package/build/components/block-edit-visually-button/index.js.map +1 -0
- package/build/components/block-list/block.js +12 -2
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/index.native.js +1 -1
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-lock/modal.js +2 -2
- package/build/components/block-lock/modal.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-mover/mover-description.js +95 -32
- package/build/components/block-mover/mover-description.js.map +1 -1
- package/build/components/block-popover/inbetween.js +5 -3
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-settings-menu/index.js +2 -6
- package/build/components/block-settings-menu/index.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -1
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/index.js +3 -6
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/preview.native.js +1 -3
- package/build/components/block-styles/preview.native.js.map +1 -1
- package/build/components/block-switcher/index.js +10 -16
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +5 -1
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +1 -7
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +4 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-types-list/index.js +1 -1
- package/build/components/block-types-list/index.js.map +1 -1
- package/build/components/block-types-list/index.native.js +65 -23
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/border-radius-control/all-input-control.js +31 -3
- package/build/components/border-radius-control/all-input-control.js.map +1 -1
- package/build/components/border-radius-control/index.js +23 -7
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/border-radius-control/input-controls.js +21 -6
- package/build/components/border-radius-control/input-controls.js.map +1 -1
- package/build/components/border-radius-control/utils.js +13 -16
- package/build/components/border-radius-control/utils.js.map +1 -1
- package/build/components/colors/utils.js +6 -2
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors/with-colors.js +17 -4
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/colors-gradients/control.js +8 -4
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +9 -3
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/copy-handler/index.js +6 -0
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +2 -7
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/duotone/components.js +5 -5
- package/build/components/duotone/components.js.map +1 -1
- package/build/components/font-appearance-control/index.js +10 -4
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/font-family/index.js +1 -1
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js +17 -4
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/image-editor/cropper.js +4 -3
- package/build/components/image-editor/cropper.js.map +1 -1
- package/build/components/image-editor/index.js +3 -1
- package/build/components/image-editor/index.js.map +1 -1
- package/build/components/image-size-control/index.js +3 -1
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.js +22 -6
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +11 -4
- package/build/components/index.native.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js +30 -16
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/index.native.js +8 -3
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/preview-panel.js +8 -8
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +5 -1
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inserter/search-items.js +22 -4
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter/search-results.native.js +5 -2
- package/build/components/inserter/search-results.native.js.map +1 -1
- package/build/components/inserter/utils.native.js +21 -0
- package/build/components/inserter/utils.native.js.map +1 -1
- package/build/components/inserter-list-item/index.js +7 -20
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +6 -3
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/line-height-control/index.js +6 -3
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/is-url-like.js +1 -7
- package/build/components/link-control/is-url-like.js.map +1 -1
- package/build/components/link-control/link-preview.js +0 -1
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/use-search-handler.js +1 -7
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/list-view/block-select-button.js +5 -2
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/branch.js +1 -7
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/expander.js +3 -1
- package/build/components/list-view/expander.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +1 -7
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/media-upload/index.native.js +8 -3
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/observe-typing/index.js +22 -8
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/preview-options/index.js +2 -2
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/{use-no-recursive-renders → recursion-provider}/index.js +40 -18
- package/build/components/recursion-provider/index.js.map +1 -0
- package/build/components/rich-text/format-toolbar-container.js +61 -12
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +8 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +3 -1
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-before-input-rules.js +110 -0
- package/build/components/rich-text/use-before-input-rules.js.map +1 -0
- package/build/components/rich-text/use-enter.js +0 -4
- package/build/components/rich-text/use-enter.js.map +1 -1
- package/build/components/rich-text/use-format-types.js +39 -22
- package/build/components/rich-text/use-format-types.js.map +1 -1
- package/build/components/spacing-sizes-control/all-input-control.js +53 -0
- package/build/components/spacing-sizes-control/all-input-control.js.map +1 -0
- package/build/components/spacing-sizes-control/axial-input-controls.js +69 -0
- package/build/components/spacing-sizes-control/axial-input-controls.js.map +1 -0
- package/build/components/spacing-sizes-control/index.js +100 -0
- package/build/components/spacing-sizes-control/index.js.map +1 -0
- package/build/components/spacing-sizes-control/input-controls.js +52 -0
- package/build/components/spacing-sizes-control/input-controls.js.map +1 -0
- package/build/components/spacing-sizes-control/linked-button.js +38 -0
- package/build/components/spacing-sizes-control/linked-button.js.map +1 -0
- package/build/components/spacing-sizes-control/spacing-input-control.js +208 -0
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -0
- package/build/components/spacing-sizes-control/utils.js +202 -0
- package/build/components/spacing-sizes-control/utils.js.map +1 -0
- package/build/components/text-decoration-control/index.js +3 -1
- package/build/components/text-decoration-control/index.js.map +1 -1
- package/build/components/text-transform-control/index.js +3 -1
- package/build/components/text-transform-control/index.js.map +1 -1
- package/build/components/url-input/index.js +1 -1
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +4 -1
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +4 -25
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/components/writing-flow/use-drag-selection.js +9 -2
- package/build/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js +4 -2
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/components/writing-flow/use-select-all.js +3 -1
- package/build/components/writing-flow/use-select-all.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +10 -2
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +1 -1
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/border-radius.js +2 -7
- package/build/hooks/border-radius.js.map +1 -1
- package/build/hooks/border.js +2 -2
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +4 -1
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/dimensions.js +15 -0
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +4 -4
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/gap.js +6 -4
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/generated-class-name.js +1 -7
- package/build/hooks/generated-class-name.js.map +1 -1
- package/build/hooks/layout.js +42 -15
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/margin.js +28 -12
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +19 -8
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/style.js +40 -76
- package/build/hooks/style.js.map +1 -1
- package/build/layouts/constrained.js +215 -0
- package/build/layouts/constrained.js.map +1 -0
- package/build/layouts/flex.js +1 -1
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +6 -145
- package/build/layouts/flow.js.map +1 -1
- package/build/layouts/index.js +3 -1
- package/build/layouts/index.js.map +1 -1
- package/build/layouts/utils.js +43 -0
- package/build/layouts/utils.js.map +1 -1
- package/build/store/actions.js +25 -3
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +4 -6
- package/build/store/selectors.js.map +1 -1
- package/build/utils/block-variation-transforms.js +15 -9
- package/build/utils/block-variation-transforms.js.map +1 -1
- package/build/utils/pasting.js +9 -1
- package/build/utils/pasting.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-edit-visually-button/index.js +35 -0
- package/build-module/components/block-edit-visually-button/index.js.map +1 -0
- package/build-module/components/block-list/block.js +13 -3
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/index.native.js +1 -1
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-lock/modal.js +2 -2
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +2 -2
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mover/mover-description.js +97 -33
- package/build-module/components/block-mover/mover-description.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +5 -3
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-settings-menu/index.js +3 -6
- package/build-module/components/block-settings-menu/index.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +2 -2
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +4 -7
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/preview.native.js +2 -3
- package/build-module/components/block-styles/preview.native.js.map +1 -1
- package/build-module/components/block-switcher/index.js +10 -16
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +4 -1
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +1 -7
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +4 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-types-list/index.js +1 -1
- package/build-module/components/block-types-list/index.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +67 -25
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/border-radius-control/all-input-control.js +32 -4
- package/build-module/components/border-radius-control/all-input-control.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +24 -8
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/input-controls.js +22 -7
- package/build-module/components/border-radius-control/input-controls.js.map +1 -1
- package/build-module/components/border-radius-control/utils.js +13 -16
- package/build-module/components/border-radius-control/utils.js.map +1 -1
- package/build-module/components/colors/utils.js +7 -3
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors/with-colors.js +16 -3
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +8 -4
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +10 -4
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/copy-handler/index.js +7 -1
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +2 -6
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/duotone/components.js +5 -5
- package/build-module/components/duotone/components.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +7 -4
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/font-family/index.js +1 -1
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +16 -3
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/image-editor/cropper.js +4 -3
- package/build-module/components/image-editor/cropper.js.map +1 -1
- package/build-module/components/image-editor/index.js +3 -1
- package/build-module/components/image-editor/index.js.map +1 -1
- package/build-module/components/image-size-control/index.js +3 -1
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.js +2 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js +31 -15
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/index.native.js +9 -2
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +9 -9
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +6 -2
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inserter/search-items.js +19 -5
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter/search-results.native.js +6 -3
- package/build-module/components/inserter/search-results.native.js.map +1 -1
- package/build-module/components/inserter/utils.native.js +19 -0
- package/build-module/components/inserter/utils.native.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +5 -18
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +5 -3
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +5 -3
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/is-url-like.js +1 -6
- package/build-module/components/link-control/is-url-like.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +0 -1
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js +1 -6
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +5 -2
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/branch.js +1 -6
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/expander.js +3 -2
- package/build-module/components/list-view/expander.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +1 -6
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +9 -2
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/observe-typing/index.js +22 -8
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/preview-options/index.js +2 -2
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/{use-no-recursive-renders → recursion-provider}/index.js +39 -19
- package/build-module/components/recursion-provider/index.js.map +1 -0
- package/build-module/components/rich-text/format-toolbar-container.js +58 -12
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +7 -2
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +3 -1
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-before-input-rules.js +96 -0
- package/build-module/components/rich-text/use-before-input-rules.js.map +1 -0
- package/build-module/components/rich-text/use-enter.js +0 -4
- package/build-module/components/rich-text/use-enter.js.map +1 -1
- package/build-module/components/rich-text/use-format-types.js +39 -22
- package/build-module/components/rich-text/use-format-types.js.map +1 -1
- package/build-module/components/spacing-sizes-control/all-input-control.js +41 -0
- package/build-module/components/spacing-sizes-control/all-input-control.js.map +1 -0
- package/build-module/components/spacing-sizes-control/axial-input-controls.js +57 -0
- package/build-module/components/spacing-sizes-control/axial-input-controls.js.map +1 -0
- package/build-module/components/spacing-sizes-control/index.js +83 -0
- package/build-module/components/spacing-sizes-control/index.js.map +1 -0
- package/build-module/components/spacing-sizes-control/input-controls.js +41 -0
- package/build-module/components/spacing-sizes-control/input-controls.js.map +1 -0
- package/build-module/components/spacing-sizes-control/linked-button.js +28 -0
- package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -0
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +192 -0
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -0
- package/build-module/components/spacing-sizes-control/utils.js +174 -0
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -0
- package/build-module/components/text-decoration-control/index.js +4 -2
- package/build-module/components/text-decoration-control/index.js.map +1 -1
- package/build-module/components/text-transform-control/index.js +4 -2
- package/build-module/components/text-transform-control/index.js.map +1 -1
- package/build-module/components/url-input/index.js +1 -1
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +4 -1
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +5 -26
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js +9 -2
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js +4 -2
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-select-all.js +3 -1
- package/build-module/components/writing-flow/use-select-all.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +10 -2
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/border-radius.js +2 -7
- package/build-module/hooks/border-radius.js.map +1 -1
- package/build-module/hooks/border.js +2 -2
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +4 -1
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/dimensions.js +13 -0
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +4 -4
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/gap.js +3 -2
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/generated-class-name.js +1 -6
- package/build-module/hooks/generated-class-name.js.map +1 -1
- package/build-module/hooks/layout.js +42 -15
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/margin.js +26 -12
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +17 -8
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/style.js +44 -81
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/layouts/constrained.js +197 -0
- package/build-module/layouts/constrained.js.map +1 -0
- package/build-module/layouts/flex.js +1 -1
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/flow.js +7 -140
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/layouts/index.js +2 -1
- package/build-module/layouts/index.js.map +1 -1
- package/build-module/layouts/utils.js +40 -0
- package/build-module/layouts/utils.js.map +1 -1
- package/build-module/store/actions.js +25 -3
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +5 -7
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/block-variation-transforms.js +14 -7
- package/build-module/utils/block-variation-transforms.js.map +1 -1
- package/build-module/utils/pasting.js +9 -1
- package/build-module/utils/pasting.js.map +1 -1
- package/build-style/style-rtl.css +154 -27
- package/build-style/style.css +154 -27
- package/package.json +30 -28
- package/src/components/block-alignment-control/use-available-alignments.js +1 -1
- package/src/components/block-edit-visually-button/index.js +39 -0
- package/src/components/block-list/block.js +13 -2
- package/src/components/block-list/index.native.js +1 -1
- package/src/components/block-lock/modal.js +5 -5
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
- package/src/components/block-mover/mover-description.js +131 -48
- package/src/components/block-mover/test/mover-description.js +55 -3
- package/src/components/block-popover/inbetween.js +5 -1
- package/src/components/block-popover/style.scss +25 -2
- package/src/components/block-settings-menu/index.js +11 -15
- package/src/components/block-settings-menu-controls/index.js +2 -2
- package/src/components/block-styles/index.js +4 -7
- package/src/components/block-styles/preview.native.js +2 -2
- package/src/components/block-styles/style.scss +10 -0
- package/src/components/block-switcher/index.js +9 -13
- package/src/components/block-switcher/test/index.js +1 -0
- package/src/components/block-toolbar/index.js +2 -0
- package/src/components/block-tools/block-selection-button.js +0 -5
- package/src/components/block-tools/index.js +4 -1
- package/src/components/block-types-list/index.js +1 -1
- package/src/components/block-types-list/index.native.js +76 -24
- package/src/components/block-types-list/style.native.scss +18 -0
- package/src/components/border-radius-control/all-input-control.js +41 -4
- package/src/components/border-radius-control/index.js +29 -6
- package/src/components/border-radius-control/input-controls.js +40 -13
- package/src/components/border-radius-control/test/utils.js +22 -60
- package/src/components/border-radius-control/utils.js +12 -16
- package/src/components/color-palette/test/__snapshots__/control.js.snap +91 -79
- package/src/components/colors/test/__snapshots__/with-colors.js.snap +1 -1
- package/src/components/colors/test/with-colors.js +1 -1
- package/src/components/colors/utils.js +5 -2
- package/src/components/colors/with-colors.js +11 -1
- package/src/components/colors-gradients/control.js +13 -8
- package/src/components/colors-gradients/dropdown.js +14 -3
- package/src/components/colors-gradients/style.scss +33 -12
- package/src/components/colors-gradients/test/control.js +3 -3
- package/src/components/copy-handler/index.js +18 -0
- package/src/components/date-format-picker/index.js +12 -14
- package/src/components/date-format-picker/style.scss +0 -4
- package/src/components/duotone/components.js +5 -5
- package/src/components/duotone-control/style.scss +0 -4
- package/src/components/font-appearance-control/index.js +3 -0
- package/src/components/font-appearance-control/style.scss +0 -2
- package/src/components/font-family/index.js +1 -1
- package/src/components/font-sizes/with-font-sizes.js +11 -1
- package/src/components/image-editor/cropper.js +9 -3
- package/src/components/image-editor/index.js +2 -0
- package/src/components/image-size-control/README.md +7 -0
- package/src/components/image-size-control/index.js +2 -0
- package/src/components/index.js +5 -1
- package/src/components/index.native.js +4 -1
- package/src/components/inserter/block-types-tab.native.js +42 -21
- package/src/components/inserter/index.native.js +7 -2
- package/src/components/inserter/preview-panel.js +6 -14
- package/src/components/inserter/reusable-blocks-tab.native.js +4 -2
- package/src/components/inserter/search-items.js +17 -5
- package/src/components/inserter/search-results.native.js +4 -2
- package/src/components/inserter/test/block-types-tab.native.js +2 -0
- package/src/components/inserter/test/utils.native.js +37 -0
- package/src/components/inserter/utils.native.js +11 -0
- package/src/components/inserter-list-item/index.js +5 -18
- package/src/components/letter-spacing-control/index.js +2 -0
- package/src/components/line-height-control/index.js +2 -0
- package/src/components/link-control/is-url-like.js +1 -6
- package/src/components/link-control/link-preview.js +0 -1
- package/src/components/link-control/test/index.js +540 -893
- package/src/components/link-control/use-search-handler.js +1 -6
- package/src/components/list-view/block-select-button.js +7 -2
- package/src/components/list-view/branch.js +1 -6
- package/src/components/list-view/expander.js +4 -2
- package/src/components/list-view/style.scss +11 -4
- package/src/components/list-view/use-block-selection.js +2 -8
- package/src/components/media-replace-flow/style.scss +1 -0
- package/src/components/media-upload/index.native.js +7 -3
- package/src/components/observe-typing/index.js +17 -14
- package/src/components/preview-options/index.js +2 -2
- package/src/components/{use-no-recursive-renders → recursion-provider}/index.js +39 -28
- package/src/components/{use-no-recursive-renders/test/use-no-recursive-renders.js → recursion-provider/test/index.js} +5 -6
- package/src/components/rich-text/README.md +13 -1
- package/src/components/rich-text/format-toolbar-container.js +63 -14
- package/src/components/rich-text/index.js +3 -0
- package/src/components/rich-text/index.native.js +2 -0
- package/src/components/rich-text/use-before-input-rules.js +91 -0
- package/src/components/rich-text/use-enter.js +0 -3
- package/src/components/rich-text/use-format-types.js +38 -17
- package/src/components/spacing-sizes-control/all-input-control.js +40 -0
- package/src/components/spacing-sizes-control/axial-input-controls.js +62 -0
- package/src/components/spacing-sizes-control/index.js +91 -0
- package/src/components/spacing-sizes-control/input-controls.js +46 -0
- package/src/components/spacing-sizes-control/linked-button.js +25 -0
- package/src/components/spacing-sizes-control/spacing-input-control.js +280 -0
- package/src/components/spacing-sizes-control/style.scss +122 -0
- package/src/components/spacing-sizes-control/test/utils.js +156 -0
- package/src/components/spacing-sizes-control/utils.js +195 -0
- package/src/components/text-decoration-control/index.js +4 -2
- package/src/components/text-transform-control/index.js +4 -2
- package/src/components/url-input/index.js +1 -1
- package/src/components/url-input/style.scss +2 -2
- package/src/components/url-popover/image-url-input-ui.js +3 -0
- package/src/components/url-popover/style.scss +0 -3
- package/src/components/writing-flow/use-arrow-nav.js +4 -33
- package/src/components/writing-flow/use-drag-selection.js +7 -1
- package/src/components/writing-flow/use-multi-selection.js +4 -1
- package/src/components/writing-flow/use-select-all.js +2 -1
- package/src/components/writing-flow/use-selection-observer.js +10 -2
- package/src/components/writing-flow/use-tab-nav.js +1 -1
- package/src/hooks/border-radius.js +2 -6
- package/src/hooks/border.js +2 -2
- package/src/hooks/color.js +13 -3
- package/src/hooks/dimensions.js +15 -0
- package/src/hooks/duotone.js +4 -4
- package/src/hooks/gap.js +7 -2
- package/src/hooks/generated-class-name.js +6 -9
- package/src/hooks/layout.js +66 -18
- package/src/hooks/margin.js +49 -17
- package/src/hooks/padding.js +41 -14
- package/src/hooks/style.js +42 -86
- package/src/hooks/test/gap.js +22 -0
- package/src/hooks/typography.scss +0 -1
- package/src/layouts/constrained.js +217 -0
- package/src/layouts/flex.js +1 -1
- package/src/layouts/flow.js +6 -151
- package/src/layouts/index.js +2 -1
- package/src/layouts/test/constrained.js +21 -0
- package/src/layouts/utils.js +34 -0
- package/src/store/actions.js +32 -4
- package/src/store/selectors.js +5 -4
- package/src/style.scss +1 -0
- package/src/utils/block-variation-transforms.js +13 -6
- package/src/utils/pasting.js +10 -1
- package/src/utils/test/block-variation-transforms.js +24 -0
- package/src/utils/test/pasting.js +10 -0
- package/build/components/block-settings-menu/block-edit-visually-button.js +0 -70
- package/build/components/block-settings-menu/block-edit-visually-button.js.map +0 -1
- package/build/components/use-no-recursive-renders/index.js.map +0 -1
- package/build-module/components/block-settings-menu/block-edit-visually-button.js +0 -56
- package/build-module/components/block-settings-menu/block-edit-visually-button.js.map +0 -1
- package/build-module/components/use-no-recursive-renders/index.js.map +0 -1
- package/src/components/block-settings-menu/block-edit-visually-button.js +0 -52
|
@@ -9,73 +9,35 @@ import {
|
|
|
9
9
|
mode,
|
|
10
10
|
} from '../utils';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
expect( getAllUnit( '32apples' ) ).toBe( 'px' );
|
|
20
|
-
} );
|
|
12
|
+
const defaultUnitSelections = {
|
|
13
|
+
flat: undefined,
|
|
14
|
+
topLeft: '%',
|
|
15
|
+
topRight: 'rem',
|
|
16
|
+
bottomLeft: 'rem',
|
|
17
|
+
bottomRight: 'vw',
|
|
18
|
+
};
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
20
|
+
describe( 'getAllUnit', () => {
|
|
21
|
+
it( 'should return flat radius unit when selected', () => {
|
|
22
|
+
const selectedUnits = { ...defaultUnitSelections, flat: 'em' };
|
|
23
|
+
expect( getAllUnit( selectedUnits ) ).toBe( 'em' );
|
|
25
24
|
} );
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
bottomLeft: '2em',
|
|
31
|
-
bottomRight: '2em',
|
|
32
|
-
topLeft: '0',
|
|
33
|
-
topRight: '2px',
|
|
34
|
-
};
|
|
35
|
-
expect( getAllUnit( values ) ).toBe( 'em' );
|
|
36
|
-
} );
|
|
37
|
-
|
|
38
|
-
it( 'should return the real value when the most common value is undefined', () => {
|
|
39
|
-
const values = {
|
|
40
|
-
bottomLeft: '0',
|
|
41
|
-
bottomRight: '0',
|
|
42
|
-
topLeft: '0',
|
|
43
|
-
topRight: '2em',
|
|
44
|
-
};
|
|
45
|
-
expect( getAllUnit( values ) ).toBe( 'em' );
|
|
46
|
-
} );
|
|
26
|
+
it( 'should return most common corner unit', () => {
|
|
27
|
+
expect( getAllUnit( defaultUnitSelections ) ).toBe( 'rem' );
|
|
28
|
+
} );
|
|
47
29
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
bottomRight: '1em',
|
|
52
|
-
topLeft: '2px',
|
|
53
|
-
topRight: '2em',
|
|
54
|
-
};
|
|
55
|
-
expect( getAllUnit( values ) ).toBe( 'em' );
|
|
56
|
-
} );
|
|
30
|
+
it( 'should return a real unit when the most common is undefined', () => {
|
|
31
|
+
expect( getAllUnit( { bottomRight: '%' } ) ).toBe( '%' );
|
|
32
|
+
} );
|
|
57
33
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
bottomRight: undefined,
|
|
62
|
-
topLeft: undefined,
|
|
63
|
-
topRight: '0',
|
|
64
|
-
};
|
|
65
|
-
expect( getAllUnit( values ) ).toBe( 'px' );
|
|
66
|
-
} );
|
|
34
|
+
it( 'should return most common corner unit when some are unselected', () => {
|
|
35
|
+
const selectedUnits = { ...defaultUnitSelections, topLeft: undefined };
|
|
36
|
+
expect( getAllUnit( selectedUnits ) ).toBe( 'rem' );
|
|
67
37
|
} );
|
|
68
38
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
expect( getAllUnit( [] ) ).toBe( 'px' );
|
|
72
|
-
} );
|
|
73
|
-
it( 'should return px when passed a boolean', () => {
|
|
74
|
-
expect( getAllUnit( false ) ).toBe( 'px' );
|
|
75
|
-
} );
|
|
76
|
-
it( 'should return px when passed undefined', () => {
|
|
77
|
-
expect( getAllUnit( false ) ).toBe( 'px' );
|
|
78
|
-
} );
|
|
39
|
+
it( 'should fallback to px when all values are undefined', () => {
|
|
40
|
+
expect( getAllUnit( {} ) ).toBe( 'px' );
|
|
79
41
|
} );
|
|
80
42
|
} );
|
|
81
43
|
|
|
@@ -28,24 +28,20 @@ export function mode( inputArray ) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* Returns the most common CSS unit
|
|
32
|
-
* Falls back to `px` as a default unit.
|
|
31
|
+
* Returns the most common CSS unit from the current CSS unit selections.
|
|
33
32
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
33
|
+
* - If a single flat border radius is set, its unit will be used
|
|
34
|
+
* - If individual corner selections, the most common of those will be used
|
|
35
|
+
* - Failing any unit selections a default of 'px' is returned.
|
|
36
|
+
*
|
|
37
|
+
* @param {Object} selectedUnits Unit selections for flat radius & each corner.
|
|
38
|
+
* @return {string} Most common CSS unit from current selections. Default: `px`.
|
|
36
39
|
*/
|
|
37
|
-
export function getAllUnit(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const allUnits = Object.values( values ).map( ( value ) => {
|
|
44
|
-
const [ , unit ] = parseQuantityAndUnitFromRawValue( value );
|
|
45
|
-
return unit;
|
|
46
|
-
} );
|
|
47
|
-
|
|
48
|
-
return mode( allUnits ) || 'px';
|
|
40
|
+
export function getAllUnit( selectedUnits = {} ) {
|
|
41
|
+
const { flat, ...cornerUnits } = selectedUnits;
|
|
42
|
+
return (
|
|
43
|
+
flat || mode( Object.values( cornerUnits ).filter( Boolean ) ) || 'px'
|
|
44
|
+
);
|
|
49
45
|
}
|
|
50
46
|
|
|
51
47
|
/**
|
|
@@ -4,10 +4,13 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
|
4
4
|
.emotion-0 {
|
|
5
5
|
font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;
|
|
6
6
|
font-size: 13px;
|
|
7
|
+
box-sizing: border-box;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
.emotion-
|
|
10
|
-
|
|
10
|
+
.emotion-0 *,
|
|
11
|
+
.emotion-0 *::before,
|
|
12
|
+
.emotion-0 *::after {
|
|
13
|
+
box-sizing: inherit;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
.components-panel__row .emotion-2 {
|
|
@@ -40,8 +43,13 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
.emotion-6 {
|
|
46
|
+
font-size: 11px;
|
|
47
|
+
font-weight: 500;
|
|
48
|
+
line-height: 1.4;
|
|
49
|
+
text-transform: uppercase;
|
|
43
50
|
display: inline-block;
|
|
44
51
|
margin-bottom: calc(4px * 2);
|
|
52
|
+
padding: 0;
|
|
45
53
|
}
|
|
46
54
|
|
|
47
55
|
.emotion-8 {
|
|
@@ -144,100 +152,104 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
|
144
152
|
</div>
|
|
145
153
|
</legend>
|
|
146
154
|
<div
|
|
147
|
-
className="
|
|
148
|
-
data-wp-c16t={true}
|
|
149
|
-
data-wp-component="VStack"
|
|
155
|
+
className="block-editor-color-gradient-control__panel"
|
|
150
156
|
>
|
|
151
157
|
<div
|
|
152
|
-
className="components-
|
|
153
|
-
|
|
158
|
+
className="components-flex components-h-stack components-v-stack emotion-8 emotion-5"
|
|
159
|
+
data-wp-c16t={true}
|
|
160
|
+
data-wp-component="VStack"
|
|
154
161
|
>
|
|
155
|
-
<
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
aria-label="Custom color picker. The currently selected color is called \\"red\\" and has a value of \\"f00\\"."
|
|
159
|
-
className="components-flex components-color-palette__custom-color emotion-10 emotion-5"
|
|
160
|
-
data-wp-c16t={true}
|
|
161
|
-
data-wp-component="Flex"
|
|
162
|
-
onClick={[Function]}
|
|
163
|
-
style={
|
|
164
|
-
Object {
|
|
165
|
-
"background": "#f00",
|
|
166
|
-
"color": "#000",
|
|
167
|
-
}
|
|
168
|
-
}
|
|
162
|
+
<div
|
|
163
|
+
className="components-dropdown"
|
|
164
|
+
tabIndex="-1"
|
|
169
165
|
>
|
|
170
|
-
<
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
red
|
|
176
|
-
</span>
|
|
177
|
-
<span
|
|
178
|
-
className="components-flex-item components-color-palette__custom-color-value emotion-15 emotion-5"
|
|
166
|
+
<button
|
|
167
|
+
aria-expanded={false}
|
|
168
|
+
aria-haspopup="true"
|
|
169
|
+
aria-label="Custom color picker. The currently selected color is called \\"red\\" and has a value of \\"f00\\"."
|
|
170
|
+
className="components-flex components-color-palette__custom-color emotion-10 emotion-5"
|
|
179
171
|
data-wp-c16t={true}
|
|
180
|
-
data-wp-component="
|
|
172
|
+
data-wp-component="Flex"
|
|
173
|
+
onClick={[Function]}
|
|
174
|
+
style={
|
|
175
|
+
Object {
|
|
176
|
+
"background": "#f00",
|
|
177
|
+
"color": "#000",
|
|
178
|
+
}
|
|
179
|
+
}
|
|
181
180
|
>
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
181
|
+
<span
|
|
182
|
+
className="components-truncate components-flex-item components-color-palette__custom-color-name emotion-5 emotion-13 emotion-5"
|
|
183
|
+
data-wp-c16t={true}
|
|
184
|
+
data-wp-component="FlexItem"
|
|
185
|
+
>
|
|
186
|
+
red
|
|
187
|
+
</span>
|
|
188
|
+
<span
|
|
189
|
+
className="components-flex-item components-color-palette__custom-color-value emotion-15 emotion-5"
|
|
190
|
+
data-wp-c16t={true}
|
|
191
|
+
data-wp-component="FlexItem"
|
|
192
|
+
>
|
|
193
|
+
f00
|
|
194
|
+
</span>
|
|
195
|
+
</button>
|
|
196
|
+
</div>
|
|
189
197
|
<div
|
|
190
|
-
className="components-circular-option-
|
|
198
|
+
className="components-circular-option-picker"
|
|
191
199
|
>
|
|
192
200
|
<div
|
|
193
|
-
className="components-circular-option-
|
|
201
|
+
className="components-circular-option-picker__swatches"
|
|
202
|
+
>
|
|
203
|
+
<div
|
|
204
|
+
className="components-circular-option-picker__option-wrapper"
|
|
205
|
+
>
|
|
206
|
+
<button
|
|
207
|
+
aria-describedby={null}
|
|
208
|
+
aria-label="Color: red"
|
|
209
|
+
aria-pressed={true}
|
|
210
|
+
className="components-button components-circular-option-picker__option is-pressed"
|
|
211
|
+
onBlur={[Function]}
|
|
212
|
+
onClick={[Function]}
|
|
213
|
+
onFocus={[Function]}
|
|
214
|
+
onMouseDown={[Function]}
|
|
215
|
+
onMouseEnter={[Function]}
|
|
216
|
+
onMouseLeave={[Function]}
|
|
217
|
+
style={
|
|
218
|
+
Object {
|
|
219
|
+
"backgroundColor": "#f00",
|
|
220
|
+
"color": "#f00",
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
type="button"
|
|
224
|
+
/>
|
|
225
|
+
<svg
|
|
226
|
+
aria-hidden={true}
|
|
227
|
+
fill="#000"
|
|
228
|
+
focusable={false}
|
|
229
|
+
height={24}
|
|
230
|
+
viewBox="0 0 24 24"
|
|
231
|
+
width={24}
|
|
232
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
233
|
+
>
|
|
234
|
+
<path
|
|
235
|
+
d="M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
|
|
236
|
+
/>
|
|
237
|
+
</svg>
|
|
238
|
+
</div>
|
|
239
|
+
</div>
|
|
240
|
+
<div
|
|
241
|
+
className="components-circular-option-picker__custom-clear-wrapper"
|
|
194
242
|
>
|
|
195
243
|
<button
|
|
196
244
|
aria-describedby={null}
|
|
197
|
-
|
|
198
|
-
aria-pressed={true}
|
|
199
|
-
className="components-button components-circular-option-picker__option is-pressed"
|
|
200
|
-
onBlur={[Function]}
|
|
245
|
+
className="components-button components-circular-option-picker__clear is-tertiary"
|
|
201
246
|
onClick={[Function]}
|
|
202
|
-
onFocus={[Function]}
|
|
203
|
-
onMouseDown={[Function]}
|
|
204
|
-
onMouseEnter={[Function]}
|
|
205
|
-
onMouseLeave={[Function]}
|
|
206
|
-
style={
|
|
207
|
-
Object {
|
|
208
|
-
"backgroundColor": "#f00",
|
|
209
|
-
"color": "#f00",
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
247
|
type="button"
|
|
213
|
-
/>
|
|
214
|
-
<svg
|
|
215
|
-
aria-hidden={true}
|
|
216
|
-
fill="#000"
|
|
217
|
-
focusable={false}
|
|
218
|
-
height={24}
|
|
219
|
-
viewBox="0 0 24 24"
|
|
220
|
-
width={24}
|
|
221
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
222
248
|
>
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
/>
|
|
226
|
-
</svg>
|
|
249
|
+
Clear
|
|
250
|
+
</button>
|
|
227
251
|
</div>
|
|
228
252
|
</div>
|
|
229
|
-
<div
|
|
230
|
-
className="components-circular-option-picker__custom-clear-wrapper"
|
|
231
|
-
>
|
|
232
|
-
<button
|
|
233
|
-
aria-describedby={null}
|
|
234
|
-
className="components-button components-circular-option-picker__clear is-tertiary"
|
|
235
|
-
onClick={[Function]}
|
|
236
|
-
type="button"
|
|
237
|
-
>
|
|
238
|
-
Clear
|
|
239
|
-
</button>
|
|
240
|
-
</div>
|
|
241
253
|
</div>
|
|
242
254
|
</div>
|
|
243
255
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`createCustomColorsHOC provides the
|
|
3
|
+
exports[`createCustomColorsHOC provides the wrapped component with color values and setter functions as props 1`] = `
|
|
4
4
|
<Component
|
|
5
5
|
attributes={
|
|
6
6
|
Object {
|
|
@@ -9,7 +9,7 @@ import { shallow, mount } from 'enzyme';
|
|
|
9
9
|
import { createCustomColorsHOC } from '../with-colors';
|
|
10
10
|
|
|
11
11
|
describe( 'createCustomColorsHOC', () => {
|
|
12
|
-
it( 'provides the
|
|
12
|
+
it( 'provides the wrapped component with color values and setter functions as props', () => {
|
|
13
13
|
const withCustomColors = createCustomColorsHOC( [
|
|
14
14
|
{ name: 'Red', slug: 'red', color: 'ff0000' },
|
|
15
15
|
] );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { find, kebabCase
|
|
4
|
+
import { find, kebabCase } from 'lodash';
|
|
5
5
|
import { colord, extend } from 'colord';
|
|
6
6
|
import namesPlugin from 'colord/plugins/names';
|
|
7
7
|
import a11yPlugin from 'colord/plugins/a11y';
|
|
@@ -77,6 +77,9 @@ export function getColorClassName( colorContextName, colorSlug ) {
|
|
|
77
77
|
*/
|
|
78
78
|
export function getMostReadableColor( colors, colorValue ) {
|
|
79
79
|
const colordColor = colord( colorValue );
|
|
80
|
-
|
|
80
|
+
const getColorContrast = ( { color } ) => colordColor.contrast( color );
|
|
81
|
+
|
|
82
|
+
const maxContrast = Math.max( ...colors.map( getColorContrast ) );
|
|
83
|
+
return colors.find( ( color ) => getColorContrast( color ) === maxContrast )
|
|
81
84
|
.color;
|
|
82
85
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { kebabCase, reduce
|
|
4
|
+
import { kebabCase, reduce } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -20,6 +20,16 @@ import {
|
|
|
20
20
|
} from './utils';
|
|
21
21
|
import useSetting from '../use-setting';
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Capitalizes the first letter in a string.
|
|
25
|
+
*
|
|
26
|
+
* @param {string} str The string whose first letter the function will capitalize.
|
|
27
|
+
*
|
|
28
|
+
* @return {string} Capitalized string.
|
|
29
|
+
*/
|
|
30
|
+
const upperFirst = ( [ firstLetter, ...rest ] ) =>
|
|
31
|
+
firstLetter.toUpperCase() + rest.join( '' );
|
|
32
|
+
|
|
23
33
|
/**
|
|
24
34
|
* Higher order component factory for injecting the `colorsArray` argument as
|
|
25
35
|
* the colors prop in the `withCustomColors` HOC.
|
|
@@ -29,7 +29,7 @@ const colorsAndGradientKeys = [
|
|
|
29
29
|
|
|
30
30
|
const TAB_COLOR = {
|
|
31
31
|
name: 'color',
|
|
32
|
-
title: 'Solid
|
|
32
|
+
title: 'Solid',
|
|
33
33
|
value: 'color',
|
|
34
34
|
};
|
|
35
35
|
const TAB_GRADIENT = {
|
|
@@ -113,8 +113,15 @@ function ColorGradientControlInner( {
|
|
|
113
113
|
),
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
+
const renderPanelType = ( type ) => (
|
|
117
|
+
<div className="block-editor-color-gradient-control__panel">
|
|
118
|
+
{ tabPanels[ type ] }
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
|
|
116
122
|
return (
|
|
117
123
|
<BaseControl
|
|
124
|
+
__nextHasNoMarginBottom
|
|
118
125
|
className={ classnames(
|
|
119
126
|
'block-editor-color-gradient-control',
|
|
120
127
|
className
|
|
@@ -141,15 +148,13 @@ function ColorGradientControlInner( {
|
|
|
141
148
|
: !! canChooseAColor && TAB_COLOR.value
|
|
142
149
|
}
|
|
143
150
|
>
|
|
144
|
-
{ ( tab ) => (
|
|
145
|
-
<div className="block-editor-color-gradient-control__tab-panel">
|
|
146
|
-
{ tabPanels[ tab.value ] }
|
|
147
|
-
</div>
|
|
148
|
-
) }
|
|
151
|
+
{ ( tab ) => renderPanelType( tab.value ) }
|
|
149
152
|
</TabPanel>
|
|
150
153
|
) }
|
|
151
|
-
{ ! canChooseAGradient &&
|
|
152
|
-
|
|
154
|
+
{ ! canChooseAGradient &&
|
|
155
|
+
renderPanelType( TAB_COLOR.value ) }
|
|
156
|
+
{ ! canChooseAColor &&
|
|
157
|
+
renderPanelType( TAB_GRADIENT.value ) }
|
|
153
158
|
</VStack>
|
|
154
159
|
</fieldset>
|
|
155
160
|
</BaseControl>
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
ColorIndicator,
|
|
12
12
|
Dropdown,
|
|
13
13
|
FlexItem,
|
|
14
|
+
__experimentalDropdownContentWrapper as DropdownContentWrapper,
|
|
14
15
|
__experimentalHStack as HStack,
|
|
15
16
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
16
17
|
} from '@wordpress/components';
|
|
@@ -60,7 +61,12 @@ const LabeledColorIndicator = ( { colorValue, label } ) => (
|
|
|
60
61
|
className="block-editor-panel-color-gradient-settings__color-indicator"
|
|
61
62
|
colorValue={ colorValue }
|
|
62
63
|
/>
|
|
63
|
-
<FlexItem
|
|
64
|
+
<FlexItem
|
|
65
|
+
className="block-editor-panel-color-gradient-settings__color-name"
|
|
66
|
+
title={ label }
|
|
67
|
+
>
|
|
68
|
+
{ label }
|
|
69
|
+
</FlexItem>
|
|
64
70
|
</HStack>
|
|
65
71
|
);
|
|
66
72
|
|
|
@@ -155,10 +161,15 @@ export default function ColorGradientSettingsDropdown( {
|
|
|
155
161
|
<Dropdown
|
|
156
162
|
popoverProps={ popoverProps }
|
|
157
163
|
className="block-editor-tools-panel-color-gradient-settings__dropdown"
|
|
158
|
-
contentClassName="block-editor-panel-color-gradient-settings__dropdown-content"
|
|
159
164
|
renderToggle={ renderToggle( toggleSettings ) }
|
|
160
165
|
renderContent={ () => (
|
|
161
|
-
<
|
|
166
|
+
<DropdownContentWrapper paddingSize="none">
|
|
167
|
+
<div className="block-editor-panel-color-gradient-settings__dropdown-content">
|
|
168
|
+
<ColorGradientControl
|
|
169
|
+
{ ...controlProps }
|
|
170
|
+
/>
|
|
171
|
+
</div>
|
|
172
|
+
</DropdownContentWrapper>
|
|
162
173
|
) }
|
|
163
174
|
/>
|
|
164
175
|
</WithToolsPanelItem>
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// Must equal $color-palette-circle-size from:
|
|
2
|
+
// @wordpress/components/src/circular-option-picker/style.scss
|
|
3
|
+
$swatch-size: 28px;
|
|
4
|
+
$swatch-gap: 12px;
|
|
5
|
+
|
|
1
6
|
.block-editor-color-gradient-control {
|
|
2
7
|
.block-editor-color-gradient-control__color-indicator {
|
|
3
8
|
margin-bottom: $grid-unit-15;
|
|
@@ -10,6 +15,12 @@
|
|
|
10
15
|
min-width: 0;
|
|
11
16
|
}
|
|
12
17
|
|
|
18
|
+
.block-editor-color-gradient-control__tabs {
|
|
19
|
+
.block-editor-color-gradient-control__panel {
|
|
20
|
+
padding: $grid-unit-20;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
13
24
|
.block-editor-panel-color-gradient-settings.block-editor-panel-color-gradient-settings {
|
|
14
25
|
&,
|
|
15
26
|
& > div:not(:first-of-type) {
|
|
@@ -18,11 +29,6 @@
|
|
|
18
29
|
}
|
|
19
30
|
|
|
20
31
|
.block-editor-panel-color-gradient-settings {
|
|
21
|
-
|
|
22
|
-
// Must equal $color-palette-circle-size from:
|
|
23
|
-
// @wordpress/components/src/circular-option-picker/style.scss
|
|
24
|
-
$swatch-size: 28px;
|
|
25
|
-
|
|
26
32
|
@media screen and (min-width: $break-medium) {
|
|
27
33
|
.components-circular-option-picker__swatches {
|
|
28
34
|
display: grid;
|
|
@@ -40,10 +46,15 @@
|
|
|
40
46
|
|
|
41
47
|
}
|
|
42
48
|
|
|
43
|
-
.block-editor-panel-color-gradient-settings__dropdown-content
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
.block-editor-panel-color-gradient-settings__dropdown-content {
|
|
50
|
+
.block-editor-color-gradient-control__panel {
|
|
51
|
+
$panelPadding: $grid-unit-20;
|
|
46
52
|
|
|
53
|
+
// Ensure the popover perfectly wraps the swatches.
|
|
54
|
+
width: ( $swatch-size * 6 ) + ( $swatch-gap * 5 ) + ( $panelPadding * 2 );
|
|
55
|
+
padding: $panelPadding;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
47
58
|
|
|
48
59
|
.block-editor-panel-color-gradient-settings__color-indicator {
|
|
49
60
|
// Show a diagonal line (crossed out) for empty swatches.
|
|
@@ -59,6 +70,7 @@
|
|
|
59
70
|
*/
|
|
60
71
|
.block-editor-tools-panel-color-gradient-settings__item {
|
|
61
72
|
padding: 0;
|
|
73
|
+
max-width: 100%;
|
|
62
74
|
|
|
63
75
|
// Border styles.
|
|
64
76
|
border-left: 1px solid rgba(0, 0, 0, 0.1);
|
|
@@ -88,19 +100,28 @@
|
|
|
88
100
|
padding: 0;
|
|
89
101
|
|
|
90
102
|
> button {
|
|
91
|
-
height:
|
|
103
|
+
height: auto;
|
|
104
|
+
padding-top: $grid-unit * 1.25;
|
|
105
|
+
padding-bottom: $grid-unit * 1.25;
|
|
106
|
+
text-align: left;
|
|
92
107
|
|
|
93
108
|
&.is-open {
|
|
94
109
|
background: $gray-100;
|
|
95
110
|
color: var(--wp-admin-theme-color);
|
|
96
111
|
}
|
|
97
112
|
}
|
|
113
|
+
|
|
114
|
+
.block-editor-panel-color-gradient-settings__color-name {
|
|
115
|
+
white-space: nowrap;
|
|
116
|
+
overflow: hidden;
|
|
117
|
+
text-overflow: ellipsis;
|
|
118
|
+
}
|
|
98
119
|
}
|
|
99
120
|
|
|
100
121
|
.block-editor-panel-color-gradient-settings__dropdown {
|
|
101
122
|
width: 100%;
|
|
102
|
-
}
|
|
103
123
|
|
|
104
|
-
.
|
|
105
|
-
|
|
124
|
+
.component-color-indicator {
|
|
125
|
+
flex-shrink: 0;
|
|
126
|
+
}
|
|
106
127
|
}
|
|
@@ -53,7 +53,7 @@ describe( 'ColorPaletteControl', () => {
|
|
|
53
53
|
|
|
54
54
|
// Is showing the two tab buttons.
|
|
55
55
|
expect(
|
|
56
|
-
screen.getByRole( 'tab', { name: 'Solid
|
|
56
|
+
screen.getByRole( 'tab', { name: 'Solid' } )
|
|
57
57
|
).toBeInTheDocument();
|
|
58
58
|
expect(
|
|
59
59
|
screen.getByRole( 'tab', { name: 'Gradient' } )
|
|
@@ -86,7 +86,7 @@ describe( 'ColorPaletteControl', () => {
|
|
|
86
86
|
|
|
87
87
|
// Is not showing the two tab buttons.
|
|
88
88
|
expect(
|
|
89
|
-
screen.queryByRole( 'tab', { name: 'Solid
|
|
89
|
+
screen.queryByRole( 'tab', { name: 'Solid' } )
|
|
90
90
|
).not.toBeInTheDocument();
|
|
91
91
|
expect(
|
|
92
92
|
screen.queryByRole( 'tab', { name: 'Gradient' } )
|
|
@@ -133,7 +133,7 @@ describe( 'ColorPaletteControl', () => {
|
|
|
133
133
|
|
|
134
134
|
// Is not showing the two tab buttons.
|
|
135
135
|
expect(
|
|
136
|
-
screen.queryByRole( 'tab', { name: 'Solid
|
|
136
|
+
screen.queryByRole( 'tab', { name: 'Solid' } )
|
|
137
137
|
).not.toBeInTheDocument();
|
|
138
138
|
expect(
|
|
139
139
|
screen.queryByRole( 'tab', { name: 'Gradient' } )
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
serialize,
|
|
7
7
|
pasteHandler,
|
|
8
8
|
store as blocksStore,
|
|
9
|
+
createBlock,
|
|
9
10
|
} from '@wordpress/blocks';
|
|
10
11
|
import {
|
|
11
12
|
documentHasSelection,
|
|
@@ -155,6 +156,23 @@ export function useClipboardHandler() {
|
|
|
155
156
|
);
|
|
156
157
|
blocks = [ head, ...inBetweenBlocks, tail ];
|
|
157
158
|
}
|
|
159
|
+
|
|
160
|
+
const wrapperBlockName = event.clipboardData.getData(
|
|
161
|
+
'__unstableWrapperBlockName'
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
if ( wrapperBlockName ) {
|
|
165
|
+
blocks = createBlock(
|
|
166
|
+
wrapperBlockName,
|
|
167
|
+
JSON.parse(
|
|
168
|
+
event.clipboardData.getData(
|
|
169
|
+
'__unstableWrapperBlockAttributes'
|
|
170
|
+
)
|
|
171
|
+
),
|
|
172
|
+
blocks
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
158
176
|
const serialized = serialize( blocks );
|
|
159
177
|
|
|
160
178
|
event.clipboardData.setData(
|