@wordpress/block-editor 12.15.0 → 12.16.1-next.79a6196f.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 +12 -10
- package/build/components/block-canvas/index.js +21 -7
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-card/index.js +2 -2
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-controls/hook.js +3 -23
- package/build/components/block-controls/hook.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-edit/context.js +5 -1
- package/build/components/block-edit/context.js.map +1 -1
- package/build/components/block-edit/index.js +18 -9
- package/build/components/block-edit/index.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-info-slot-fill/index.js +3 -4
- package/build/components/block-info-slot-fill/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 +257 -95
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +58 -23
- 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 +49 -69
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -29
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-block-props/use-is-hovered.js +4 -14
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.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 +21 -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 +5 -5
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +2 -9
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-rename/modal.js +3 -0
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-settings/container.native.js +6 -4
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-styles/index.js +1 -1
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/index.native.js +3 -2
- package/build/components/block-styles/index.native.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 +90 -29
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-toolbar-breadcrumb.js +49 -0
- package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
- package/build/components/block-tools/block-toolbar-popover.js +84 -0
- package/build/components/block-tools/block-toolbar-popover.js.map +1 -0
- package/build/components/block-tools/index.js +27 -24
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-types-list/index.native.js +4 -3
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/block-variation-picker/index.native.js +2 -1
- package/build/components/block-variation-picker/index.native.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/colors-gradients/control.js +28 -17
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/duotone-control/index.js +1 -4
- package/build/components/duotone-control/index.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 +24 -21
- 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 +6 -3
- 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 +3 -2
- 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 +43 -36
- 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-link-destinations/index.native.js +118 -0
- package/build/components/image-link-destinations/index.native.js.map +1 -0
- 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 +14 -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/media-tab/media-panel.js +2 -2
- package/build/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build/components/inserter/menu.js +26 -33
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/preview-panel.js +2 -2
- package/build/components/inserter/preview-panel.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-button/index.native.js +98 -0
- package/build/components/inserter-button/index.native.js.map +1 -0
- package/build/components/inserter-button/sparkles.js +23 -0
- package/build/components/inserter-button/sparkles.js.map +1 -0
- package/build/components/inserter-draggable-blocks/index.js +8 -4
- 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/fill.js +3 -3
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +3 -3
- package/build/components/inspector-controls/fill.native.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 +11 -16
- 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/preview-options/index.js +6 -62
- package/build/components/preview-options/index.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/content.js +26 -23
- package/build/components/rich-text/content.js.map +1 -1
- package/build/components/rich-text/get-rich-text-values.js +2 -1
- package/build/components/rich-text/get-rich-text-values.js.map +1 -1
- package/build/components/rich-text/index.js +19 -37
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +9 -16
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/get-format-colors.native.js +22 -24
- package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +22 -57
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +7 -3
- 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/rich-text/with-deprecations.js +50 -0
- package/build/components/rich-text/with-deprecations.js.map +1 -0
- 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 +108 -17
- 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 +9 -12
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +4 -1
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/use-settings/index.js +14 -0
- package/build/components/use-settings/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 +21 -69
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/align.native.js +11 -1
- package/build/hooks/align.native.js.map +1 -1
- package/build/hooks/anchor.js +14 -30
- 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 +198 -36
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +24 -32
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-renaming.js +18 -22
- package/build/hooks/block-renaming.js.map +1 -1
- package/build/hooks/border.js +53 -80
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +79 -90
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +29 -29
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/custom-class-name.js +13 -30
- 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 +13 -14
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +31 -61
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-family.js +23 -28
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +52 -120
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +27 -16
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +15 -6
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout-child.js +68 -0
- package/build/hooks/layout-child.js.map +1 -0
- package/build/hooks/layout.js +25 -104
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/padding.js +2 -2
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/position.js +40 -62
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +52 -89
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +25 -10
- 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 +200 -10
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +2 -6
- 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 +54 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +46 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +18 -2
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +11 -73
- 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 +66 -0
- package/build/store/utils.js.map +1 -0
- 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 +38 -99
- package/build/utils/object.js.map +1 -1
- package/build/utils/selection.js +9 -1
- package/build/utils/selection.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 +22 -8
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-card/index.js +2 -2
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-controls/hook.js +4 -24
- package/build-module/components/block-controls/hook.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-edit/context.js +2 -0
- package/build-module/components/block-edit/context.js.map +1 -1
- package/build-module/components/block-edit/index.js +19 -10
- package/build-module/components/block-edit/index.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-info-slot-fill/index.js +3 -3
- package/build-module/components/block-info-slot-fill/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 +261 -99
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +60 -25
- 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 +50 -70
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -29
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-is-hovered.js +4 -14
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.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 +22 -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 +6 -6
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +3 -10
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js +3 -0
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +4 -2
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-styles/index.js +1 -1
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/index.native.js +3 -2
- package/build-module/components/block-styles/index.native.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 +89 -27
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js +41 -0
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
- package/build-module/components/block-tools/block-toolbar-popover.js +74 -0
- package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -0
- package/build-module/components/block-tools/index.js +27 -24
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +2 -1
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/block-variation-picker/index.native.js +2 -1
- package/build-module/components/block-variation-picker/index.native.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/colors-gradients/control.js +29 -18
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/duotone-control/index.js +1 -4
- package/build-module/components/duotone-control/index.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 +26 -23
- 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 +8 -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 +3 -2
- 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 +45 -38
- 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-link-destinations/index.native.js +109 -0
- package/build-module/components/image-link-destinations/index.native.js.map +1 -0
- 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 +3 -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/media-tab/media-panel.js +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build-module/components/inserter/menu.js +26 -33
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +2 -2
- package/build-module/components/inserter/preview-panel.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-button/index.native.js +89 -0
- package/build-module/components/inserter-button/index.native.js.map +1 -0
- package/build-module/components/inserter-button/sparkles.js +15 -0
- package/build-module/components/inserter-button/sparkles.js.map +1 -0
- package/build-module/components/inserter-draggable-blocks/index.js +9 -5
- 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/fill.js +3 -3
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +3 -3
- package/build-module/components/inspector-controls/fill.native.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 +11 -16
- 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/preview-options/index.js +6 -62
- package/build-module/components/preview-options/index.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/content.js +25 -21
- package/build-module/components/rich-text/content.js.map +1 -1
- package/build-module/components/rich-text/get-rich-text-values.js +2 -1
- package/build-module/components/rich-text/get-rich-text-values.js.map +1 -1
- package/build-module/components/rich-text/index.js +21 -39
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +10 -18
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/get-format-colors.native.js +22 -24
- package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +22 -56
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +7 -3
- 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/rich-text/with-deprecations.js +42 -0
- package/build-module/components/rich-text/with-deprecations.js.map +1 -0
- 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 +107 -18
- 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 +9 -12
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +4 -1
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +13 -1
- package/build-module/components/use-settings/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 +20 -67
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/align.native.js +1 -0
- package/build-module/hooks/align.native.js.map +1 -1
- package/build-module/hooks/anchor.js +12 -27
- 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 +197 -37
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +22 -30
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-renaming.js +17 -21
- package/build-module/hooks/block-renaming.js.map +1 -1
- package/build-module/hooks/border.js +52 -79
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +78 -88
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +27 -27
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +12 -28
- 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 +15 -16
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +30 -61
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-family.js +20 -25
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +50 -120
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +20 -16
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +10 -6
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout-child.js +60 -0
- package/build-module/hooks/layout-child.js.map +1 -0
- package/build-module/hooks/layout.js +21 -100
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/padding.js +2 -2
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/position.js +38 -59
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +52 -85
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/typography.js +26 -11
- 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 +194 -9
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +2 -6
- 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 +52 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +44 -1
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +18 -2
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +4 -65
- 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 +56 -0
- package/build-module/store/utils.js.map +1 -0
- 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 +37 -97
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/selection.js +9 -1
- package/build-module/utils/selection.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 +164 -301
- package/build-style/style.css +164 -301
- 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 +29 -17
- package/src/components/block-canvas/style.scss +6 -0
- package/src/components/block-caption/README.md +2 -7
- package/src/components/block-card/README.md +0 -5
- package/src/components/block-card/index.js +6 -4
- package/src/components/block-card/style.scss +7 -3
- package/src/components/block-controls/hook.js +8 -30
- package/src/components/block-controls/test/index.js +3 -3
- 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-edit/context.js +3 -0
- package/src/components/block-edit/index.js +36 -10
- package/src/components/block-editing-mode/index.js +3 -3
- package/src/components/block-icon/README.md +0 -5
- package/src/components/block-info-slot-fill/index.js +6 -3
- package/src/components/block-inspector/README.md +0 -5
- package/src/components/block-inspector/index.js +3 -1
- package/src/components/block-inspector/style.scss +0 -4
- package/src/components/block-list/block-list-item-cell.native.js +5 -1
- package/src/components/block-list/block.js +309 -104
- package/src/components/block-list/block.native.js +69 -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 +43 -86
- package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -34
- package/src/components/block-list/use-block-props/use-is-hovered.js +2 -13
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +1 -5
- 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 +23 -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 +9 -6
- package/src/components/block-removal-warning-modal/index.js +7 -14
- package/src/components/block-rename/modal.js +7 -1
- package/src/components/block-settings/container.native.js +3 -5
- package/src/components/block-styles/index.js +1 -1
- package/src/components/block-styles/index.native.js +4 -2
- package/src/components/block-styles/style.scss +0 -11
- package/src/components/block-switcher/index.js +49 -59
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +3 -1
- package/src/components/block-toolbar/README.md +0 -5
- package/src/components/block-toolbar/index.js +179 -95
- package/src/components/block-toolbar/style.scss +50 -66
- package/src/components/block-tools/block-toolbar-breadcrumb.js +46 -0
- package/src/components/block-tools/block-toolbar-popover.js +84 -0
- package/src/components/block-tools/index.js +42 -29
- package/src/components/block-tools/style.scss +60 -172
- package/src/components/block-types-list/README.md +0 -5
- package/src/components/block-types-list/index.native.js +2 -1
- package/src/components/block-variation-picker/README.md +0 -5
- package/src/components/block-variation-picker/index.native.js +1 -1
- 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/colors-gradients/control.js +49 -30
- package/src/components/colors-gradients/style.scss +0 -7
- package/src/components/contrast-checker/README.md +0 -4
- package/src/components/copy-handler/README.md +0 -10
- package/src/components/duotone-control/index.js +2 -5
- package/src/components/duotone-control/style.scss +1 -6
- 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 +36 -26
- 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 +6 -5
- package/src/components/global-styles/get-global-styles-changes.js +210 -0
- package/src/components/global-styles/hooks.js +5 -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 +60 -47
- 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-link-destinations/index.native.js +152 -0
- package/src/components/image-link-destinations/style.native.scss +16 -0
- package/src/components/image-size-control/index.js +5 -2
- package/src/components/index.native.js +3 -2
- package/src/components/inner-blocks/README.md +13 -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/media-tab/media-panel.js +1 -1
- package/src/components/inserter/menu.js +26 -36
- package/src/components/inserter/preview-panel.js +2 -2
- package/src/components/inserter/style.scss +21 -21
- package/src/components/inserter/tabs.js +34 -25
- package/src/components/inserter-button/README.md +62 -0
- package/src/components/inserter-button/index.native.js +116 -0
- package/src/components/inserter-button/sparkles.js +15 -0
- package/src/components/inserter-button/style.native.scss +72 -0
- package/src/components/inserter-draggable-blocks/index.js +18 -5
- 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/fill.js +6 -3
- package/src/components/inspector-controls/fill.native.js +6 -3
- 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/link-control/style.scss +1 -1
- package/src/components/link-control/test/index.js +1 -1
- 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/README.md +2 -0
- package/src/components/navigable-toolbar/index.js +15 -13
- package/src/components/plain-text/index.native.js +6 -1
- package/src/components/preview-options/index.js +6 -86
- 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/content.js +27 -20
- package/src/components/rich-text/get-rich-text-values.js +6 -1
- package/src/components/rich-text/index.js +23 -52
- package/src/components/rich-text/index.native.js +8 -25
- package/src/components/rich-text/native/get-format-colors.native.js +33 -40
- package/src/components/rich-text/native/index.native.js +22 -71
- 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 +8 -3
- package/src/components/rich-text/use-mark-persistent.js +1 -2
- package/src/components/rich-text/with-deprecations.js +51 -0
- 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 +181 -30
- package/src/components/use-moving-animation/index.js +107 -103
- package/src/components/use-on-block-drop/index.js +9 -24
- package/src/components/use-on-block-drop/test/index.js +12 -26
- package/src/components/use-resize-canvas/README.md +3 -7
- package/src/components/use-resize-canvas/index.js +4 -1
- package/src/components/use-settings/README.md +0 -4
- package/src/components/use-settings/index.js +15 -1
- 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 +16 -81
- package/src/hooks/align.native.js +1 -0
- package/src/hooks/anchor.js +14 -38
- package/src/hooks/aria-label.js +8 -5
- package/src/hooks/background.js +269 -32
- package/src/hooks/block-hooks.js +22 -51
- package/src/hooks/block-renaming.js +23 -37
- package/src/hooks/border.js +62 -124
- package/src/hooks/color.js +111 -138
- package/src/hooks/content-lock-ui.js +110 -122
- package/src/hooks/custom-class-name.js +9 -45
- package/src/hooks/custom-class-name.native.js +8 -5
- package/src/hooks/dimensions.js +14 -16
- package/src/hooks/duotone.js +70 -127
- package/src/hooks/font-family.js +14 -36
- package/src/hooks/font-size.js +67 -168
- package/src/hooks/index.js +58 -16
- package/src/hooks/index.native.js +22 -6
- package/src/hooks/layout-child.js +53 -0
- package/src/hooks/layout.js +17 -103
- package/src/hooks/padding.js +2 -2
- package/src/hooks/position.js +50 -90
- package/src/hooks/style.js +118 -193
- package/src/hooks/test/align.js +1 -178
- 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 +14 -16
- package/src/hooks/typography.native.js +31 -33
- package/src/hooks/use-typography-props.js +7 -1
- package/src/hooks/utils.js +261 -10
- package/src/private-apis.js +2 -6
- package/src/private-apis.native.js +0 -2
- package/src/store/actions.js +0 -15
- package/src/store/private-actions.js +48 -0
- package/src/store/private-selectors.js +56 -0
- package/src/store/reducer.js +20 -1
- package/src/store/selectors.js +10 -82
- package/src/store/undo-ignore.js +4 -0
- package/src/store/utils.js +74 -0
- package/src/style.scss +1 -2
- package/src/utils/get-px-from-css-unit.js +8 -0
- package/src/utils/index.js +1 -1
- package/src/utils/object.js +34 -104
- package/src/utils/selection.js +9 -2
- 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/components/block-list/use-block-props/use-block-class-names.js +0 -67
- package/build/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js +0 -46
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
- package/build/components/block-list/use-block-props/use-block-default-class-name.js +0 -37
- package/build/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
- package/build/components/block-tools/back-compat.js +0 -45
- package/build/components/block-tools/back-compat.js.map +0 -1
- package/build/components/block-tools/block-contextual-toolbar.js +0 -91
- package/build/components/block-tools/block-contextual-toolbar.js.map +0 -1
- package/build/components/block-tools/selected-block-tools.js +0 -113
- package/build/components/block-tools/selected-block-tools.js.map +0 -1
- package/build/components/inserter/hooks/use-debounced-input.js +0 -22
- package/build/components/inserter/hooks/use-debounced-input.js.map +0 -1
- package/build/components/use-display-block-controls/index.js +0 -39
- package/build/components/use-display-block-controls/index.js.map +0 -1
- package/build/components/use-display-block-controls/index.native.js +0 -39
- package/build/components/use-display-block-controls/index.native.js.map +0 -1
- package/build/hooks/custom-fields.js +0 -120
- package/build/hooks/custom-fields.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/components/block-list/use-block-props/use-block-class-names.js +0 -60
- package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js +0 -40
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js +0 -31
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
- package/build-module/components/block-tools/back-compat.js +0 -35
- package/build-module/components/block-tools/back-compat.js.map +0 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +0 -83
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +0 -1
- package/build-module/components/block-tools/selected-block-tools.js +0 -105
- package/build-module/components/block-tools/selected-block-tools.js.map +0 -1
- package/build-module/components/inserter/hooks/use-debounced-input.js +0 -15
- package/build-module/components/inserter/hooks/use-debounced-input.js.map +0 -1
- package/build-module/components/use-display-block-controls/index.js +0 -32
- package/build-module/components/use-display-block-controls/index.js.map +0 -1
- package/build-module/components/use-display-block-controls/index.native.js +0 -32
- package/build-module/components/use-display-block-controls/index.native.js.map +0 -1
- package/build-module/hooks/custom-fields.js +0 -118
- package/build-module/hooks/custom-fields.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/components/block-list/use-block-props/use-block-class-names.js +0 -66
- package/src/components/block-list/use-block-props/use-block-custom-class-name.js +0 -44
- package/src/components/block-list/use-block-props/use-block-default-class-name.js +0 -35
- package/src/components/block-parent-selector/style.scss +0 -11
- package/src/components/block-tools/back-compat.js +0 -35
- package/src/components/block-tools/block-contextual-toolbar.js +0 -100
- package/src/components/block-tools/selected-block-tools.js +0 -127
- package/src/components/inserter/hooks/use-debounced-input.js +0 -18
- package/src/components/preview-options/README.md +0 -94
- package/src/components/preview-options/style.scss +0 -64
- package/src/components/use-display-block-controls/index.js +0 -36
- package/src/components/use-display-block-controls/index.native.js +0 -37
- package/src/hooks/custom-fields.js +0 -142
- package/src/hooks/test/color.js +0 -112
- 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
package/src/hooks/test/color.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { render } from '@testing-library/react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { registerBlockType, unregisterBlockType } from '@wordpress/blocks';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import BlockEditorProvider from '../../components/provider';
|
|
15
|
-
import { withColorPaletteStyles } from '../color';
|
|
16
|
-
|
|
17
|
-
describe( 'withColorPaletteStyles', () => {
|
|
18
|
-
const settings = {
|
|
19
|
-
__experimentalFeatures: {
|
|
20
|
-
color: {
|
|
21
|
-
palette: {
|
|
22
|
-
default: [
|
|
23
|
-
{
|
|
24
|
-
name: 'Pale pink',
|
|
25
|
-
slug: 'pale-pink',
|
|
26
|
-
color: '#f78da7',
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: 'Vivid green cyan',
|
|
30
|
-
slug: 'vivid-green-cyan',
|
|
31
|
-
color: '#00d084',
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const EnhancedComponent = withColorPaletteStyles(
|
|
40
|
-
( { getStyleObj, wrapperProps } ) => (
|
|
41
|
-
<div>{ getStyleObj( wrapperProps.style ) }</div>
|
|
42
|
-
)
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
beforeAll( () => {
|
|
46
|
-
registerBlockType( 'core/test-block', {
|
|
47
|
-
save: () => undefined,
|
|
48
|
-
edit: () => undefined,
|
|
49
|
-
category: 'text',
|
|
50
|
-
title: 'test block',
|
|
51
|
-
supports: {
|
|
52
|
-
color: {
|
|
53
|
-
text: true,
|
|
54
|
-
background: true,
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
} );
|
|
58
|
-
} );
|
|
59
|
-
|
|
60
|
-
afterAll( () => {
|
|
61
|
-
unregisterBlockType( 'core/test-block' );
|
|
62
|
-
} );
|
|
63
|
-
|
|
64
|
-
it( 'should add color styles from attributes', () => {
|
|
65
|
-
const getStyleObj = jest.fn();
|
|
66
|
-
|
|
67
|
-
render(
|
|
68
|
-
<BlockEditorProvider settings={ settings } value={ [] }>
|
|
69
|
-
<EnhancedComponent
|
|
70
|
-
attributes={ {
|
|
71
|
-
backgroundColor: 'vivid-green-cyan',
|
|
72
|
-
textColor: 'pale-pink',
|
|
73
|
-
} }
|
|
74
|
-
name="core/test-block"
|
|
75
|
-
getStyleObj={ getStyleObj }
|
|
76
|
-
/>
|
|
77
|
-
</BlockEditorProvider>
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
expect( getStyleObj ).toHaveBeenLastCalledWith( {
|
|
81
|
-
color: '#f78da7',
|
|
82
|
-
backgroundColor: '#00d084',
|
|
83
|
-
} );
|
|
84
|
-
} );
|
|
85
|
-
|
|
86
|
-
it( 'should not add undefined style values', () => {
|
|
87
|
-
// This test ensures that undefined `color` and `backgroundColor` styles
|
|
88
|
-
// are not added to the styles object. An undefined `backgroundColor`
|
|
89
|
-
// style causes a React warning when gradients are used, as the gradient
|
|
90
|
-
// style currently uses the `background` shorthand syntax.
|
|
91
|
-
// See: https://github.com/WordPress/gutenberg/issues/36899.
|
|
92
|
-
const getStyleObj = jest.fn();
|
|
93
|
-
|
|
94
|
-
render(
|
|
95
|
-
<BlockEditorProvider settings={ settings } value={ [] }>
|
|
96
|
-
<EnhancedComponent
|
|
97
|
-
attributes={ {
|
|
98
|
-
backgroundColor: undefined,
|
|
99
|
-
textColor: undefined,
|
|
100
|
-
} }
|
|
101
|
-
name="core/test-block"
|
|
102
|
-
getStyleObj={ getStyleObj }
|
|
103
|
-
/>
|
|
104
|
-
</BlockEditorProvider>
|
|
105
|
-
);
|
|
106
|
-
// Check explictly for the object used in the call, because
|
|
107
|
-
// `toHaveBeenCalledWith` does not check for empty keys.
|
|
108
|
-
expect(
|
|
109
|
-
getStyleObj.mock.calls[ getStyleObj.mock.calls.length - 1 ][ 0 ]
|
|
110
|
-
).toStrictEqual( {} );
|
|
111
|
-
} );
|
|
112
|
-
} );
|
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts string to object { value, unit }.
|
|
3
|
-
*
|
|
4
|
-
* @param {string} cssUnit
|
|
5
|
-
* @return {Object} parsedUnit
|
|
6
|
-
*/
|
|
7
|
-
function parseUnit( cssUnit ) {
|
|
8
|
-
const match = cssUnit
|
|
9
|
-
?.trim()
|
|
10
|
-
.match(
|
|
11
|
-
/^(0?[-.]?\d*\.?\d+)(r?e[m|x]|v[h|w|min|max]+|p[x|t|c]|[c|m]m|%|in|ch|Q|lh)$/
|
|
12
|
-
);
|
|
13
|
-
if ( ! isNaN( cssUnit ) && ! isNaN( parseFloat( cssUnit ) ) ) {
|
|
14
|
-
return { value: parseFloat( cssUnit ), unit: 'px' };
|
|
15
|
-
}
|
|
16
|
-
return match
|
|
17
|
-
? { value: parseFloat( match[ 1 ] ) || match[ 1 ], unit: match[ 2 ] }
|
|
18
|
-
: { value: cssUnit, unit: undefined };
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Evaluate a math expression.
|
|
22
|
-
*
|
|
23
|
-
* @param {string} expression
|
|
24
|
-
* @return {number} evaluated expression.
|
|
25
|
-
*/
|
|
26
|
-
function calculate( expression ) {
|
|
27
|
-
try {
|
|
28
|
-
return Function( `'use strict'; return (${ expression })` )();
|
|
29
|
-
} catch ( err ) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Calculates the css function value for the supported css functions such as max, min, clamp and calc.
|
|
36
|
-
*
|
|
37
|
-
* @param {string} functionUnitValue string should be in a particular format (for example min(12px,12px) ) no nested loops.
|
|
38
|
-
* @param {Object} options
|
|
39
|
-
* @return {string} unit containing the unit in PX.
|
|
40
|
-
*/
|
|
41
|
-
function getFunctionUnitValue( functionUnitValue, options ) {
|
|
42
|
-
const functionUnit = functionUnitValue.split( /[(),]/g ).filter( Boolean );
|
|
43
|
-
|
|
44
|
-
const units = functionUnit
|
|
45
|
-
.slice( 1 )
|
|
46
|
-
.map( ( unit ) => parseUnit( getPxFromCssUnit( unit, options ) ).value )
|
|
47
|
-
.filter( Boolean );
|
|
48
|
-
|
|
49
|
-
switch ( functionUnit[ 0 ] ) {
|
|
50
|
-
case 'min':
|
|
51
|
-
return Math.min( ...units ) + 'px';
|
|
52
|
-
case 'max':
|
|
53
|
-
return Math.max( ...units ) + 'px';
|
|
54
|
-
case 'clamp':
|
|
55
|
-
if ( units.length !== 3 ) {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
if ( units[ 1 ] < units[ 0 ] ) {
|
|
59
|
-
return units[ 0 ] + 'px';
|
|
60
|
-
}
|
|
61
|
-
if ( units[ 1 ] > units[ 2 ] ) {
|
|
62
|
-
return units[ 2 ] + 'px';
|
|
63
|
-
}
|
|
64
|
-
return units[ 1 ] + 'px';
|
|
65
|
-
case 'calc':
|
|
66
|
-
return units[ 0 ] + 'px';
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Take a css function such as min, max, calc, clamp and returns parsedUnit
|
|
72
|
-
*
|
|
73
|
-
* How this works for the nested function is that it first replaces the inner function call.
|
|
74
|
-
* Then it tackles the outer onces.
|
|
75
|
-
* So for example: min( max(25px, 35px), 40px )
|
|
76
|
-
* in the first pass we would replace max(25px, 35px) with 35px.
|
|
77
|
-
* then we would try to evaluate min( 35px, 40px )
|
|
78
|
-
* and then finally return 35px.
|
|
79
|
-
*
|
|
80
|
-
* @param {string} cssUnit
|
|
81
|
-
* @return {Object} parsedUnit object.
|
|
82
|
-
*/
|
|
83
|
-
function parseUnitFunction( cssUnit ) {
|
|
84
|
-
while ( true ) {
|
|
85
|
-
const currentCssUnit = cssUnit;
|
|
86
|
-
const regExp = /(max|min|calc|clamp)\(([^()]*)\)/g;
|
|
87
|
-
const matches = regExp.exec( cssUnit ) || [];
|
|
88
|
-
if ( matches[ 0 ] ) {
|
|
89
|
-
const functionUnitValue = getFunctionUnitValue( matches[ 0 ] );
|
|
90
|
-
cssUnit = cssUnit.replace( matches[ 0 ], functionUnitValue );
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// If the unit hasn't been modified or we have a single value break free.
|
|
94
|
-
if ( cssUnit === currentCssUnit || parseFloat( cssUnit ) ) {
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return parseUnit( cssUnit );
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Return true if we think this is a math expression.
|
|
103
|
-
*
|
|
104
|
-
* @param {string} cssUnit the cssUnit value being evaluted.
|
|
105
|
-
* @return {boolean} Whether the cssUnit is a math expression.
|
|
106
|
-
*/
|
|
107
|
-
function isMathExpression( cssUnit ) {
|
|
108
|
-
for ( let i = 0; i < cssUnit.length; i++ ) {
|
|
109
|
-
if ( [ '+', '-', '/', '*' ].includes( cssUnit[ i ] ) ) {
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Evaluates the math expression and return a px value.
|
|
117
|
-
*
|
|
118
|
-
* @param {string} cssUnit the cssUnit value being evaluted.
|
|
119
|
-
* @return {string} return a converfted value to px.
|
|
120
|
-
*/
|
|
121
|
-
function evalMathExpression( cssUnit ) {
|
|
122
|
-
let errorFound = false;
|
|
123
|
-
// Convert every part of the expression to px values.
|
|
124
|
-
// The following regex matches numbers that have a following unit
|
|
125
|
-
// E.g. 5.25rem, 1vw
|
|
126
|
-
const cssUnitsBits = cssUnit.match( /\d+\.?\d*[a-zA-Z]+|\.\d+[a-zA-Z]+/g );
|
|
127
|
-
if ( cssUnitsBits ) {
|
|
128
|
-
for ( const unit of cssUnitsBits ) {
|
|
129
|
-
// Standardize the unit to px and extract the value.
|
|
130
|
-
const parsedUnit = parseUnit( getPxFromCssUnit( unit ) );
|
|
131
|
-
if ( ! parseFloat( parsedUnit.value ) ) {
|
|
132
|
-
errorFound = true;
|
|
133
|
-
// End early since we are dealing with a null value.
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
cssUnit = cssUnit.replace( unit, parsedUnit.value );
|
|
137
|
-
}
|
|
138
|
-
} else {
|
|
139
|
-
errorFound = true;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// For mixed math expressions wrapped within CSS expressions
|
|
143
|
-
const expressionsMatches = cssUnit.match( /(max|min|clamp)/g );
|
|
144
|
-
if ( ! errorFound && expressionsMatches ) {
|
|
145
|
-
const values = cssUnit.split( ',' );
|
|
146
|
-
for ( const currentValue of values ) {
|
|
147
|
-
// Check for nested calc() and remove them to calculate the value.
|
|
148
|
-
const rawCurrentValue = currentValue.replace( /\s|calc/g, '' );
|
|
149
|
-
|
|
150
|
-
if ( isMathExpression( rawCurrentValue ) ) {
|
|
151
|
-
const calculatedExpression = calculate( rawCurrentValue );
|
|
152
|
-
|
|
153
|
-
if ( calculatedExpression ) {
|
|
154
|
-
const calculatedValue =
|
|
155
|
-
calculatedExpression.toFixed( 0 ) + 'px';
|
|
156
|
-
cssUnit = cssUnit.replace( currentValue, calculatedValue );
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
const parsedValue = parseUnitFunction( cssUnit );
|
|
161
|
-
return ! parsedValue ? null : parsedValue.value + parsedValue.unit;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
if ( errorFound ) {
|
|
165
|
-
return null;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const calculatedResult = calculate( cssUnit );
|
|
169
|
-
return calculatedResult ? calculatedResult.toFixed( 0 ) + 'px' : null;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Convert a parsedUnit object to px value.
|
|
174
|
-
*
|
|
175
|
-
* @param {Object} parsedUnit
|
|
176
|
-
* @param {Object} options
|
|
177
|
-
* @return {string} or {null} returns the converted with in a px value format.
|
|
178
|
-
*/
|
|
179
|
-
function convertParsedUnitToPx( parsedUnit, options ) {
|
|
180
|
-
const PIXELS_PER_INCH = 96;
|
|
181
|
-
const ONE_PERCENT = 0.01;
|
|
182
|
-
|
|
183
|
-
const defaultProperties = {
|
|
184
|
-
fontSize: 16,
|
|
185
|
-
lineHeight: 16,
|
|
186
|
-
width: 375,
|
|
187
|
-
height: 812,
|
|
188
|
-
type: 'font',
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
const setOptions = Object.assign( {}, defaultProperties, options );
|
|
192
|
-
|
|
193
|
-
const relativeUnits = {
|
|
194
|
-
em: setOptions.fontSize,
|
|
195
|
-
rem: setOptions.fontSize,
|
|
196
|
-
vh: setOptions.height * ONE_PERCENT,
|
|
197
|
-
vw: setOptions.width * ONE_PERCENT,
|
|
198
|
-
vmin:
|
|
199
|
-
( setOptions.width < setOptions.height
|
|
200
|
-
? setOptions.width
|
|
201
|
-
: setOptions.height ) * ONE_PERCENT,
|
|
202
|
-
vmax:
|
|
203
|
-
( setOptions.width > setOptions.height
|
|
204
|
-
? setOptions.width
|
|
205
|
-
: setOptions.height ) * ONE_PERCENT,
|
|
206
|
-
'%':
|
|
207
|
-
( setOptions.type === 'font'
|
|
208
|
-
? setOptions.fontSize
|
|
209
|
-
: setOptions.width ) * ONE_PERCENT,
|
|
210
|
-
ch: 8, // The advance measure (width) of the glyph "0" of the element's font. Approximate
|
|
211
|
-
ex: 7.15625, // X-height of the element's font. Approximate.
|
|
212
|
-
lh: setOptions.lineHeight,
|
|
213
|
-
};
|
|
214
|
-
relativeUnits.svw = relativeUnits.vmin;
|
|
215
|
-
relativeUnits.lvw = relativeUnits.vmax;
|
|
216
|
-
relativeUnits.dvw = relativeUnits.vw;
|
|
217
|
-
relativeUnits.svh = relativeUnits.vmin;
|
|
218
|
-
relativeUnits.lvh = relativeUnits.vmax;
|
|
219
|
-
relativeUnits.dvh = relativeUnits.vh;
|
|
220
|
-
relativeUnits.vi = relativeUnits.vh;
|
|
221
|
-
relativeUnits.svi = relativeUnits.vmin;
|
|
222
|
-
relativeUnits.lvi = relativeUnits.vmax;
|
|
223
|
-
relativeUnits.dvi = relativeUnits.vw;
|
|
224
|
-
relativeUnits.vb = relativeUnits.vh;
|
|
225
|
-
relativeUnits.svb = relativeUnits.vmin;
|
|
226
|
-
relativeUnits.lvb = relativeUnits.vmax;
|
|
227
|
-
relativeUnits.dvb = relativeUnits.vh;
|
|
228
|
-
relativeUnits.svmin = relativeUnits.vmin;
|
|
229
|
-
relativeUnits.lvmin = relativeUnits.vmin;
|
|
230
|
-
relativeUnits.dvmin = relativeUnits.vmin;
|
|
231
|
-
relativeUnits.svmax = relativeUnits.vmax;
|
|
232
|
-
relativeUnits.lvmax = relativeUnits.vmax;
|
|
233
|
-
relativeUnits.dvmax = relativeUnits.vmax;
|
|
234
|
-
|
|
235
|
-
const absoluteUnits = {
|
|
236
|
-
in: PIXELS_PER_INCH,
|
|
237
|
-
cm: PIXELS_PER_INCH / 2.54,
|
|
238
|
-
mm: PIXELS_PER_INCH / 25.4,
|
|
239
|
-
pt: PIXELS_PER_INCH / 72,
|
|
240
|
-
pc: PIXELS_PER_INCH / 6,
|
|
241
|
-
px: 1,
|
|
242
|
-
Q: PIXELS_PER_INCH / 2.54 / 40,
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
if ( relativeUnits[ parsedUnit.unit ] ) {
|
|
246
|
-
return (
|
|
247
|
-
( relativeUnits[ parsedUnit.unit ] * parsedUnit.value ).toFixed(
|
|
248
|
-
0
|
|
249
|
-
) + 'px'
|
|
250
|
-
);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
if ( absoluteUnits[ parsedUnit.unit ] ) {
|
|
254
|
-
return (
|
|
255
|
-
( absoluteUnits[ parsedUnit.unit ] * parsedUnit.value ).toFixed(
|
|
256
|
-
0
|
|
257
|
-
) + 'px'
|
|
258
|
-
);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
return null;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Returns the px value of a cssUnit.
|
|
266
|
-
*
|
|
267
|
-
* @param {string} cssUnit
|
|
268
|
-
* @param {Object} options
|
|
269
|
-
* @return {string} returns the cssUnit value in a simple px format.
|
|
270
|
-
*/
|
|
271
|
-
export function getPxFromCssUnit( cssUnit, options = {} ) {
|
|
272
|
-
if ( Number.isFinite( cssUnit ) ) {
|
|
273
|
-
return cssUnit.toFixed( 0 ) + 'px';
|
|
274
|
-
}
|
|
275
|
-
if ( cssUnit === undefined ) {
|
|
276
|
-
return null;
|
|
277
|
-
}
|
|
278
|
-
let parsedUnit = parseUnit( cssUnit );
|
|
279
|
-
|
|
280
|
-
if ( ! parsedUnit.unit ) {
|
|
281
|
-
parsedUnit = parseUnitFunction( cssUnit );
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
if ( isMathExpression( cssUnit ) && ! parsedUnit.unit ) {
|
|
285
|
-
return evalMathExpression( cssUnit );
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
return convertParsedUnitToPx( parsedUnit, options );
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// Use simple cache.
|
|
292
|
-
const cache = {};
|
|
293
|
-
/**
|
|
294
|
-
* Returns the px value of a cssUnit. The memoized version of getPxFromCssUnit;
|
|
295
|
-
*
|
|
296
|
-
* @param {string} cssUnit
|
|
297
|
-
* @param {Object} options
|
|
298
|
-
* @return {string} returns the cssUnit value in a simple px format.
|
|
299
|
-
*/
|
|
300
|
-
function memoizedGetPxFromCssUnit( cssUnit, options = {} ) {
|
|
301
|
-
const hash = cssUnit + hashOptions( options );
|
|
302
|
-
|
|
303
|
-
if ( ! cache[ hash ] ) {
|
|
304
|
-
cache[ hash ] = getPxFromCssUnit( cssUnit, options );
|
|
305
|
-
}
|
|
306
|
-
return cache[ hash ];
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
function hashOptions( options ) {
|
|
310
|
-
let hash = '';
|
|
311
|
-
if ( options.hasOwnProperty( 'fontSize' ) ) {
|
|
312
|
-
hash = ':' + options.width;
|
|
313
|
-
}
|
|
314
|
-
if ( options.hasOwnProperty( 'lineHeight' ) ) {
|
|
315
|
-
hash = ':' + options.lineHeight;
|
|
316
|
-
}
|
|
317
|
-
if ( options.hasOwnProperty( 'width' ) ) {
|
|
318
|
-
hash = ':' + options.width;
|
|
319
|
-
}
|
|
320
|
-
if ( options.hasOwnProperty( 'height' ) ) {
|
|
321
|
-
hash = ':' + options.height;
|
|
322
|
-
}
|
|
323
|
-
if ( options.hasOwnProperty( 'type' ) ) {
|
|
324
|
-
hash = ':' + options.type;
|
|
325
|
-
}
|
|
326
|
-
return hash;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
export default memoizedGetPxFromCssUnit;
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
default as memoizedGetPxFromCssUnit,
|
|
6
|
-
getPxFromCssUnit,
|
|
7
|
-
} from '../parse-css-unit-to-px';
|
|
8
|
-
|
|
9
|
-
describe( 'getPxFromCssUnit', () => {
|
|
10
|
-
// Absolute units.
|
|
11
|
-
describe( 'absolute unites should return px values', () => {
|
|
12
|
-
const testData = [
|
|
13
|
-
[ '25px', '25px' ],
|
|
14
|
-
[ '25.5', '26px' ],
|
|
15
|
-
[ '1cm', '38px' ],
|
|
16
|
-
[ '10mm', '38px' ],
|
|
17
|
-
[ '1in', '96px' ],
|
|
18
|
-
[ '12pt', '16px' ],
|
|
19
|
-
[ '1pc', '16px' ],
|
|
20
|
-
[ '40Q', '38px' ], // 40 Q should be 1 cm.
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
test.each( testData )( 'getPxFromCssUnit( %s )', ( unit, expected ) => {
|
|
24
|
-
expect( getPxFromCssUnit( unit ) ).toBe( expected );
|
|
25
|
-
} );
|
|
26
|
-
test.each( testData )(
|
|
27
|
-
'memoizedGetPxFromCssUnit( %s )',
|
|
28
|
-
( unit, expected ) => {
|
|
29
|
-
expect( memoizedGetPxFromCssUnit( unit ) ).toBe( expected );
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
test.each( testData )(
|
|
33
|
-
'cached memoizedGetPxFromCssUnit( %s )',
|
|
34
|
-
( unit, expected ) => {
|
|
35
|
-
expect( memoizedGetPxFromCssUnit( unit ) ).toBe( expected );
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
} );
|
|
39
|
-
|
|
40
|
-
describe( 'relative unites should return px values', () => {
|
|
41
|
-
const settings = {
|
|
42
|
-
fontSize: 10,
|
|
43
|
-
width: 100,
|
|
44
|
-
height: 200,
|
|
45
|
-
lineHeight: 2,
|
|
46
|
-
type: 'font',
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const testData = [
|
|
50
|
-
[ '2em', '20px' ],
|
|
51
|
-
[ '2rem', '20px' ],
|
|
52
|
-
[ '1.125rem', '11px' ],
|
|
53
|
-
[ '20vw', '20px' ],
|
|
54
|
-
[ '20vh', '40px' ],
|
|
55
|
-
[ '20vmin', '20px' ],
|
|
56
|
-
[ '20vmax', '40px' ],
|
|
57
|
-
[ '20lh', '40px' ],
|
|
58
|
-
[ '120%', '12px' ],
|
|
59
|
-
];
|
|
60
|
-
|
|
61
|
-
test.each( testData )( 'getPxFromCssUnit( %s )', ( unit, expected ) => {
|
|
62
|
-
expect( getPxFromCssUnit( unit, settings ) ).toBe( expected );
|
|
63
|
-
} );
|
|
64
|
-
test.each( testData )(
|
|
65
|
-
'memoizedGetPxFromCssUnit( %s )',
|
|
66
|
-
( unit, expected ) => {
|
|
67
|
-
expect( memoizedGetPxFromCssUnit( unit, settings ) ).toBe(
|
|
68
|
-
expected
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
test.each( testData )(
|
|
73
|
-
'cached memoizedGetPxFromCssUnit( %s )',
|
|
74
|
-
( unit, expected ) => {
|
|
75
|
-
expect( memoizedGetPxFromCssUnit( unit, settings ) ).toBe(
|
|
76
|
-
expected
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
);
|
|
80
|
-
} );
|
|
81
|
-
|
|
82
|
-
// Function units.
|
|
83
|
-
|
|
84
|
-
describe( 'function unites should return px values', () => {
|
|
85
|
-
const settings = {
|
|
86
|
-
fontSize: 10,
|
|
87
|
-
width: 100,
|
|
88
|
-
height: 200,
|
|
89
|
-
lineHeight: 2,
|
|
90
|
-
type: 'font',
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const testData = [
|
|
94
|
-
[ 'min(20px, 25px)', '20px' ],
|
|
95
|
-
[ 'min(20px, 9px, 12pt, 25px)', '9px' ],
|
|
96
|
-
[ 'max(20px, 25px)', '25px' ],
|
|
97
|
-
[ 'clamp(10px, 9px, 25px)', '10px' ],
|
|
98
|
-
[ 'clamp(10px, 35px, 25px)', '25px' ],
|
|
99
|
-
[ 'clamp(10px, 15px, 25px)', '15px' ],
|
|
100
|
-
[ 'min(max(20px,25px), 35px)', '25px' ],
|
|
101
|
-
[ 'max(min(20px,25px), 35px)', '35px' ],
|
|
102
|
-
[ '10px + 25px', '35px' ],
|
|
103
|
-
[ 'calc(10px + 25px)', '35px' ],
|
|
104
|
-
[ 'calc( 2 * 20px)', '40px' ],
|
|
105
|
-
[ 'calc(25px - 10px)', '15px' ],
|
|
106
|
-
[ 'min(10px + 25px, 55pt)', '35px' ],
|
|
107
|
-
[ 'calc(12vw * 10px)', '450px' ],
|
|
108
|
-
[ 'calc(45vw / 10px)', '17px' ],
|
|
109
|
-
[ '', null ],
|
|
110
|
-
[ undefined, null ],
|
|
111
|
-
[ 123, '123px' ],
|
|
112
|
-
[ 123.456, '123px' ],
|
|
113
|
-
[ 'abc', null ],
|
|
114
|
-
[ 'console.log("howdy"); + 10px', null ],
|
|
115
|
-
[ 'calc(12vw * 10px', null ], // Missing closing bracket.
|
|
116
|
-
[ 'calc( 1em + 0.875rem )', '30px' ], // Decimals
|
|
117
|
-
[
|
|
118
|
-
'clamp(1.8rem, 1.8rem + ((1vw / 0.48rem + 1rem) * 2.885), 3rem)',
|
|
119
|
-
'48px',
|
|
120
|
-
],
|
|
121
|
-
[
|
|
122
|
-
'clamp(5rem, 5.25rem + ((1vw - 0.48rem) * 9.096), 8rem)',
|
|
123
|
-
'80px',
|
|
124
|
-
],
|
|
125
|
-
[
|
|
126
|
-
'clamp(2.625rem, calc(2.625rem + ((1vw - 0.48rem) * 8.4135)), 3.25rem)',
|
|
127
|
-
'42px',
|
|
128
|
-
],
|
|
129
|
-
[ 'var:preset|font-size|medium', null ],
|
|
130
|
-
];
|
|
131
|
-
|
|
132
|
-
test.each( testData )( 'getPxFromCssUnit( %s )', ( unit, expected ) => {
|
|
133
|
-
expect( getPxFromCssUnit( unit, settings ) ).toBe( expected );
|
|
134
|
-
} );
|
|
135
|
-
test.each( testData )(
|
|
136
|
-
'memoizedGetPxFromCssUnit( %s )',
|
|
137
|
-
( unit, expected ) => {
|
|
138
|
-
expect( memoizedGetPxFromCssUnit( unit, settings ) ).toBe(
|
|
139
|
-
expected
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
);
|
|
143
|
-
test.each( testData )(
|
|
144
|
-
'cached memoizedGetPxFromCssUnit( %s )',
|
|
145
|
-
( unit, expected ) => {
|
|
146
|
-
expect( memoizedGetPxFromCssUnit( unit, settings ) ).toBe(
|
|
147
|
-
expected
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
);
|
|
151
|
-
} );
|
|
152
|
-
// Skip this test it might be useful in dev.
|
|
153
|
-
it.skip( 'test performance of memoizedGetPxFromCssUnit function', () => {
|
|
154
|
-
const start = Date.now();
|
|
155
|
-
let i = 0;
|
|
156
|
-
const intervals = 1000;
|
|
157
|
-
while ( i < intervals ) {
|
|
158
|
-
getPxFromCssUnit( 'max(25px, 35px)', { width: 200 } );
|
|
159
|
-
i++;
|
|
160
|
-
}
|
|
161
|
-
const rawDuration = Date.now() - start;
|
|
162
|
-
|
|
163
|
-
const startM = Date.now();
|
|
164
|
-
i = 0;
|
|
165
|
-
// The memoized Version should be at 10X better then the non default one.
|
|
166
|
-
while ( i < intervals * 10 ) {
|
|
167
|
-
memoizedGetPxFromCssUnit( 'max(25px, 35px)', { width: 201 } );
|
|
168
|
-
i++;
|
|
169
|
-
}
|
|
170
|
-
expect( rawDuration > Date.now() - startM ).toBe( true );
|
|
171
|
-
} );
|
|
172
|
-
} );
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useSelect } from '@wordpress/data';
|
|
5
|
-
import { isUnmodifiedDefaultBlock } from '@wordpress/blocks';
|
|
6
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { store as blockEditorStore } from '../store';
|
|
12
|
-
import { unlock } from '../lock-unlock';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Returns true if the contextual block toolbar should show, or false if it should be hidden.
|
|
16
|
-
*
|
|
17
|
-
* @return {boolean} Whether the block toolbar is hidden.
|
|
18
|
-
*/
|
|
19
|
-
export function useShouldContextualToolbarShow() {
|
|
20
|
-
const isLargeViewport = useViewportMatch( 'medium' );
|
|
21
|
-
|
|
22
|
-
const {
|
|
23
|
-
shouldShowContextualToolbar,
|
|
24
|
-
canFocusHiddenToolbar,
|
|
25
|
-
fixedToolbarCanBeFocused,
|
|
26
|
-
} = useSelect(
|
|
27
|
-
( select ) => {
|
|
28
|
-
const {
|
|
29
|
-
__unstableGetEditorMode,
|
|
30
|
-
isMultiSelecting,
|
|
31
|
-
isTyping,
|
|
32
|
-
isBlockInterfaceHidden,
|
|
33
|
-
getBlock,
|
|
34
|
-
getSettings,
|
|
35
|
-
isNavigationMode,
|
|
36
|
-
getSelectedBlockClientId,
|
|
37
|
-
getFirstMultiSelectedBlockClientId,
|
|
38
|
-
} = unlock( select( blockEditorStore ) );
|
|
39
|
-
|
|
40
|
-
const isEditMode = __unstableGetEditorMode() === 'edit';
|
|
41
|
-
const hasFixedToolbar = getSettings().hasFixedToolbar;
|
|
42
|
-
const isDistractionFree = getSettings().isDistractionFree;
|
|
43
|
-
const selectedBlockId =
|
|
44
|
-
getFirstMultiSelectedBlockClientId() ||
|
|
45
|
-
getSelectedBlockClientId();
|
|
46
|
-
const hasSelectedBlockId = !! selectedBlockId;
|
|
47
|
-
const isEmptyDefaultBlock = isUnmodifiedDefaultBlock(
|
|
48
|
-
getBlock( selectedBlockId ) || {}
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
const _shouldShowContextualToolbar =
|
|
52
|
-
isEditMode &&
|
|
53
|
-
! hasFixedToolbar &&
|
|
54
|
-
( ! isDistractionFree || isNavigationMode() ) &&
|
|
55
|
-
isLargeViewport &&
|
|
56
|
-
! isMultiSelecting() &&
|
|
57
|
-
! isTyping() &&
|
|
58
|
-
hasSelectedBlockId &&
|
|
59
|
-
! isEmptyDefaultBlock &&
|
|
60
|
-
! isBlockInterfaceHidden();
|
|
61
|
-
|
|
62
|
-
const _canFocusHiddenToolbar =
|
|
63
|
-
isEditMode &&
|
|
64
|
-
hasSelectedBlockId &&
|
|
65
|
-
! _shouldShowContextualToolbar &&
|
|
66
|
-
! hasFixedToolbar &&
|
|
67
|
-
! isDistractionFree &&
|
|
68
|
-
! isEmptyDefaultBlock;
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
shouldShowContextualToolbar: _shouldShowContextualToolbar,
|
|
72
|
-
canFocusHiddenToolbar: _canFocusHiddenToolbar,
|
|
73
|
-
fixedToolbarCanBeFocused:
|
|
74
|
-
( hasFixedToolbar || ! isLargeViewport ) && selectedBlockId,
|
|
75
|
-
};
|
|
76
|
-
},
|
|
77
|
-
[ isLargeViewport ]
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
return {
|
|
81
|
-
shouldShowContextualToolbar,
|
|
82
|
-
canFocusHiddenToolbar,
|
|
83
|
-
fixedToolbarCanBeFocused,
|
|
84
|
-
};
|
|
85
|
-
}
|