@wordpress/block-editor 10.2.0 → 10.4.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 +18 -0
- package/README.md +41 -0
- package/build/components/alignment-control/ui.js +1 -1
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/constants.js +1 -1
- package/build/components/block-alignment-control/constants.js.map +1 -1
- package/build/components/block-alignment-matrix-control/index.js +1 -1
- package/build/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build/components/block-compare/index.js +1 -3
- package/build/components/block-compare/index.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.js +4 -2
- package/build/components/block-draggable/draggable-chip.js.map +1 -1
- package/build/components/block-edit/index.js +4 -2
- package/build/components/block-edit/index.js.map +1 -1
- package/build/components/block-inspector/index.js +4 -4
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-list-compact.native.js +1 -0
- package/build/components/block-list/block-list-compact.native.js.map +1 -1
- package/build/components/block-list/block.js +75 -15
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +79 -12
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +7 -23
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-lock/modal.js +9 -6
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-parent-selector/index.js +3 -3
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +5 -4
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-popover/drop-zone.js +85 -0
- package/build/components/block-popover/drop-zone.js.map +1 -0
- package/build/components/block-popover/inbetween.js +2 -1
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +4 -2
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/auto.js +2 -2
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +8 -13
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-preview/live.js +3 -7
- package/build/components/block-preview/live.js.map +1 -1
- package/build/components/block-selection-clearer/index.js +9 -1
- package/build/components/block-selection-clearer/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +19 -19
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/index.js +18 -42
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-switcher/index.js +2 -8
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/preview-block-popover.js +1 -1
- package/build/components/block-switcher/preview-block-popover.js.map +1 -1
- package/build/components/block-toolbar/index.js +4 -4
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/back-compat.js +2 -1
- package/build/components/block-tools/back-compat.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +56 -16
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +15 -3
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-vertical-alignment-control/ui.js +1 -1
- package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build/components/border-radius-control/all-input-control.js +2 -1
- package/build/components/border-radius-control/all-input-control.js.map +1 -1
- package/build/components/border-radius-control/index.js +2 -1
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/border-radius-control/input-controls.js +2 -1
- package/build/components/border-radius-control/input-controls.js.map +1 -1
- package/build/components/colors-gradients/control.js +1 -1
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +2 -2
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/duotone-control/index.js +1 -1
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +256 -0
- package/build/components/font-sizes/fluid-utils.js.map +1 -0
- package/build/components/font-sizes/index.js +8 -0
- package/build/components/font-sizes/index.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js +1 -1
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/iframe/index.js +1 -1
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/constants.js +1 -1
- package/build/components/image-editor/constants.js.map +1 -1
- package/build/components/index.js +0 -9
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +6 -2
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +3 -2
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +151 -78
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js +2 -7
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/menu.js +14 -3
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/search-items.js +23 -2
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +4 -2
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/line-height-control/index.js +2 -1
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/list-view/drop-indicator.js +2 -1
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +1 -14
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/media-replace-flow/index.js +1 -1
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/preview-options/index.js +2 -3
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js +1 -1
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +1 -1
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +1 -1
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/spacing-sizes-control/all-input-control.js +6 -2
- package/build/components/spacing-sizes-control/all-input-control.js.map +1 -1
- package/build/components/spacing-sizes-control/axial-input-controls.js +6 -2
- package/build/components/spacing-sizes-control/axial-input-controls.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +6 -2
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls.js +6 -2
- package/build/components/spacing-sizes-control/input-controls.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +45 -8
- package/build/components/spacing-sizes-control/spacing-input-control.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/use-block-drop-zone/index.js +98 -57
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +12 -12
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-on-block-drop/types.js +6 -0
- package/build/components/use-on-block-drop/types.js.map +1 -0
- package/build/hooks/align.js +1 -3
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/align.native.js +1 -7
- package/build/hooks/align.native.js.map +1 -1
- package/build/hooks/border.js +1 -0
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/dimensions.js +32 -4
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-size.js +61 -0
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/layout.js +4 -3
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/margin.js +24 -17
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +20 -12
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/style.js +126 -4
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/use-typography-props.js +17 -3
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/hooks/utils.js +8 -7
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/constrained.js +0 -1
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/flex.js +1 -1
- package/build/layouts/flex.js.map +1 -1
- package/build/store/actions.js +63 -45
- package/build/store/actions.js.map +1 -1
- package/build/store/array.js +1 -7
- package/build/store/array.js.map +1 -1
- package/build/store/defaults.js +3 -0
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +31 -15
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +46 -29
- package/build/store/selectors.js.map +1 -1
- package/build/utils/math.js +14 -0
- package/build/utils/math.js.map +1 -1
- package/build/utils/pre-parse-patterns.js +19 -2
- package/build/utils/pre-parse-patterns.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +1 -1
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/constants.js +1 -1
- package/build-module/components/block-alignment-control/constants.js.map +1 -1
- package/build-module/components/block-alignment-matrix-control/index.js +1 -1
- package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build-module/components/block-compare/index.js +2 -3
- package/build-module/components/block-compare/index.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.js +7 -3
- package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
- package/build-module/components/block-edit/index.js +4 -2
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +4 -4
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-list-compact.native.js +1 -0
- package/build-module/components/block-list/block-list-compact.native.js.map +1 -1
- package/build-module/components/block-list/block.js +75 -15
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +80 -13
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +8 -24
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-lock/modal.js +10 -8
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +3 -3
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +5 -4
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-popover/drop-zone.js +70 -0
- package/build-module/components/block-popover/drop-zone.js.map +1 -0
- package/build-module/components/block-popover/inbetween.js +2 -1
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +4 -2
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +1 -1
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +8 -12
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-preview/live.js +3 -6
- package/build-module/components/block-preview/live.js.map +1 -1
- package/build-module/components/block-selection-clearer/index.js +9 -1
- package/build-module/components/block-selection-clearer/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +20 -19
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/index.js +19 -44
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +2 -7
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/preview-block-popover.js +1 -1
- package/build-module/components/block-switcher/preview-block-popover.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +4 -4
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/back-compat.js +2 -1
- package/build-module/components/block-tools/back-compat.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +54 -16
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +15 -3
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-vertical-alignment-control/ui.js +1 -1
- package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build-module/components/border-radius-control/all-input-control.js +2 -1
- package/build-module/components/border-radius-control/all-input-control.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +2 -1
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/input-controls.js +2 -1
- package/build-module/components/border-radius-control/input-controls.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +2 -2
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +3 -3
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/duotone-control/index.js +1 -1
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +245 -0
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -0
- package/build-module/components/font-sizes/index.js +1 -0
- package/build-module/components/font-sizes/index.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +2 -2
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/iframe/index.js +1 -1
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/constants.js +1 -1
- package/build-module/components/image-editor/constants.js.map +1 -1
- package/build-module/components/index.js +0 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +6 -2
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +3 -2
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +148 -81
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js +2 -6
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/menu.js +10 -3
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/search-items.js +23 -3
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +4 -2
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +2 -1
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +2 -1
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +1 -14
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +1 -1
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/preview-options/index.js +2 -3
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +1 -1
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/spacing-sizes-control/all-input-control.js +6 -2
- package/build-module/components/spacing-sizes-control/all-input-control.js.map +1 -1
- package/build-module/components/spacing-sizes-control/axial-input-controls.js +6 -2
- package/build-module/components/spacing-sizes-control/axial-input-controls.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +6 -2
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls.js +6 -2
- package/build-module/components/spacing-sizes-control/input-controls.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +44 -8
- package/build-module/components/spacing-sizes-control/spacing-input-control.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/use-block-drop-zone/index.js +98 -58
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +12 -12
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/types.js +2 -0
- package/build-module/components/use-on-block-drop/types.js.map +1 -0
- package/build-module/hooks/align.js +1 -2
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/align.native.js +1 -6
- package/build-module/hooks/align.native.js.map +1 -1
- package/build-module/hooks/border.js +1 -0
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/dimensions.js +32 -4
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-size.js +60 -1
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/layout.js +5 -4
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/margin.js +25 -18
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +21 -13
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/style.js +124 -3
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +17 -4
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/hooks/utils.js +8 -8
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/constrained.js +0 -1
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/flex.js +1 -1
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/store/actions.js +59 -42
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/array.js +1 -6
- package/build-module/store/array.js.map +1 -1
- package/build-module/store/defaults.js +3 -0
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +32 -16
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +47 -30
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/math.js +12 -0
- package/build-module/utils/math.js.map +1 -1
- package/build-module/utils/pre-parse-patterns.js +19 -2
- package/build-module/utils/pre-parse-patterns.js.map +1 -1
- package/build-style/style-rtl.css +292 -206
- package/build-style/style.css +288 -202
- package/package.json +29 -28
- package/src/components/alignment-control/ui.js +1 -1
- package/src/components/block-alignment-control/constants.js +1 -1
- package/src/components/block-alignment-matrix-control/index.js +1 -1
- package/src/components/block-breadcrumb/test/__snapshots__/index.js.snap +13 -11
- package/src/components/block-breadcrumb/test/index.js +2 -2
- package/src/components/block-compare/index.js +3 -2
- package/src/components/block-draggable/draggable-chip.js +4 -2
- package/src/components/block-edit/index.js +2 -1
- package/src/components/block-inspector/index.js +8 -7
- package/src/components/block-list/block-list-compact.native.js +1 -0
- package/src/components/block-list/block.js +113 -7
- package/src/components/block-list/block.native.js +123 -9
- package/src/components/block-list/style.scss +93 -126
- package/src/components/block-list/use-in-between-inserter.js +8 -19
- package/src/components/block-lock/modal.js +12 -7
- package/src/components/block-mover/stories/index.js +1 -1
- package/src/components/block-mover/style.scss +35 -1
- package/src/components/block-parent-selector/index.js +3 -3
- package/src/components/block-patterns-list/index.js +9 -5
- package/src/components/block-patterns-list/style.scss +7 -3
- package/src/components/block-popover/README.md +8 -0
- package/src/components/block-popover/drop-zone.js +63 -0
- package/src/components/block-popover/inbetween.js +1 -0
- package/src/components/block-popover/index.js +3 -1
- package/src/components/block-popover/style.scss +17 -5
- package/src/components/block-preview/auto.js +1 -1
- package/src/components/block-preview/index.js +15 -11
- package/src/components/block-preview/live.js +2 -7
- package/src/components/block-preview/test/index.js +1 -7
- package/src/components/block-selection-clearer/index.js +7 -2
- package/src/components/block-selection-clearer/test/index.js +118 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +29 -18
- package/src/components/block-settings-menu/test/block-mode-toggle.js +17 -17
- package/src/components/block-styles/index.js +26 -49
- package/src/components/block-switcher/index.js +2 -7
- package/src/components/block-switcher/preview-block-popover.js +1 -1
- package/src/components/block-switcher/test/index.js +2 -2
- package/src/components/block-toolbar/index.js +4 -6
- package/src/components/block-toolbar/style.scss +38 -14
- package/src/components/block-tools/back-compat.js +1 -0
- package/src/components/block-tools/insertion-point.js +49 -15
- package/src/components/block-tools/selected-block-popover.js +14 -1
- package/src/components/block-variation-picker/README.md +1 -1
- package/src/components/block-vertical-alignment-control/ui.js +1 -1
- package/src/components/border-radius-control/all-input-control.js +1 -0
- package/src/components/border-radius-control/index.js +1 -0
- package/src/components/border-radius-control/input-controls.js +1 -0
- package/src/components/border-radius-control/style.scss +15 -24
- package/src/components/button-block-appender/style.scss +4 -2
- package/src/components/color-palette/test/__snapshots__/control.js.snap +86 -104
- package/src/components/color-palette/test/control.js +11 -15
- package/src/components/colors-gradients/control.js +2 -2
- package/src/components/colors-gradients/panel-color-gradient-settings.js +3 -4
- package/src/components/colors-gradients/test/control.js +49 -77
- package/src/components/duotone-control/index.js +1 -1
- package/src/components/font-sizes/fluid-utils.js +296 -0
- package/src/components/font-sizes/index.js +1 -0
- package/src/components/font-sizes/test/fluid-utils.js +168 -0
- package/src/components/font-sizes/with-font-sizes.js +2 -3
- package/src/components/iframe/index.js +1 -1
- package/src/components/image-editor/constants.js +1 -1
- package/src/components/image-size-control/test/index.js +47 -60
- package/src/components/index.js +0 -1
- package/src/components/inner-blocks/index.js +5 -1
- package/src/components/inner-blocks/test/index.js +4 -0
- package/src/components/inner-blocks/use-inner-block-template-sync.js +3 -2
- package/src/components/inserter/block-patterns-tab.js +232 -98
- package/src/components/inserter/hooks/use-insertion-point.js +3 -11
- package/src/components/inserter/menu.js +15 -2
- package/src/components/inserter/search-items.js +23 -3
- package/src/components/inserter/style.scss +94 -9
- package/src/components/inserter/test/reusable-blocks-tab.js +6 -6
- package/src/components/inserter/test/search-items.js +6 -0
- package/src/components/inserter-draggable-blocks/index.js +12 -2
- package/src/components/inserter-list-item/style.scss +22 -1
- package/src/components/letter-spacing-control/README.md +55 -0
- package/src/components/line-height-control/index.js +1 -0
- package/src/components/link-control/README.md +3 -3
- package/src/components/link-control/test/index.js +1 -1
- package/src/components/list-view/drop-indicator.js +1 -0
- package/src/components/list-view/style.scss +1 -36
- package/src/components/list-view/use-list-view-drop-zone.js +4 -18
- package/src/components/media-replace-flow/index.js +1 -1
- package/src/components/media-replace-flow/test/index.js +69 -51
- package/src/components/panel-color-settings/test/index.js +4 -4
- package/src/components/preview-options/index.js +2 -2
- package/src/components/preview-options/style.scss +1 -1
- package/src/components/provider/test/use-block-sync.js +131 -165
- package/src/components/responsive-block-control/test/index.js +4 -4
- package/src/components/rich-text/format-toolbar/index.js +1 -1
- package/src/components/rich-text/format-toolbar-container.js +1 -1
- package/src/components/rich-text/use-paste-handler.js +1 -1
- package/src/components/spacing-sizes-control/all-input-control.js +4 -0
- package/src/components/spacing-sizes-control/axial-input-controls.js +4 -0
- package/src/components/spacing-sizes-control/index.js +4 -0
- package/src/components/spacing-sizes-control/input-controls.js +4 -0
- package/src/components/spacing-sizes-control/spacing-input-control.js +26 -3
- package/src/components/spacing-sizes-control/style.scss +27 -19
- package/src/components/url-input/index.js +1 -1
- package/src/components/use-block-drop-zone/index.js +136 -79
- package/src/components/use-block-drop-zone/test/index.js +333 -81
- package/src/components/use-on-block-drop/index.js +11 -12
- package/src/components/use-on-block-drop/types.ts +1 -0
- package/src/hooks/align.js +3 -2
- package/src/hooks/align.native.js +5 -8
- package/src/hooks/border.js +1 -0
- package/src/hooks/dimensions.js +32 -5
- package/src/hooks/font-size.js +76 -0
- package/src/hooks/layout.js +7 -9
- package/src/hooks/margin.js +20 -14
- package/src/hooks/padding.js +20 -16
- package/src/hooks/style.js +122 -3
- package/src/hooks/test/align.js +96 -72
- package/src/hooks/test/style.js +206 -1
- package/src/hooks/test/use-typography-props.js +22 -0
- package/src/hooks/use-typography-props.js +18 -3
- package/src/hooks/utils.js +10 -7
- package/src/layouts/constrained.js +0 -1
- package/src/layouts/flex.js +1 -1
- package/src/store/actions.js +24 -12
- package/src/store/array.js +1 -6
- package/src/store/defaults.js +3 -0
- package/src/store/reducer.js +31 -24
- package/src/store/selectors.js +28 -21
- package/src/store/test/actions.js +0 -9
- package/src/store/test/selectors.js +1 -1
- package/src/utils/math.js +17 -0
- package/src/utils/pre-parse-patterns.js +12 -7
- package/build/components/inserter/pattern-panel.js +0 -87
- package/build/components/inserter/pattern-panel.js.map +0 -1
- package/build-module/components/inserter/pattern-panel.js +0 -74
- package/build-module/components/inserter/pattern-panel.js.map +0 -1
- package/src/components/inserter/pattern-panel.js +0 -93
package/src/hooks/test/align.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -12,10 +12,13 @@ import {
|
|
|
12
12
|
registerBlockType,
|
|
13
13
|
unregisterBlockType,
|
|
14
14
|
} from '@wordpress/blocks';
|
|
15
|
+
import { SlotFillProvider } from '@wordpress/components';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Internal dependencies
|
|
18
19
|
*/
|
|
20
|
+
import BlockControls from '../../components/block-controls';
|
|
21
|
+
import BlockEdit from '../../components/block-edit';
|
|
19
22
|
import BlockEditorProvider from '../../components/provider';
|
|
20
23
|
import {
|
|
21
24
|
getValidAlignments,
|
|
@@ -31,6 +34,7 @@ describe( 'align', () => {
|
|
|
31
34
|
save: noop,
|
|
32
35
|
category: 'text',
|
|
33
36
|
title: 'block title',
|
|
37
|
+
edit: ( { children } ) => <>{ children }</>,
|
|
34
38
|
};
|
|
35
39
|
|
|
36
40
|
afterEach( () => {
|
|
@@ -154,6 +158,12 @@ describe( 'align', () => {
|
|
|
154
158
|
} );
|
|
155
159
|
|
|
156
160
|
describe( 'withToolbarControls', () => {
|
|
161
|
+
const componentProps = {
|
|
162
|
+
name: 'core/foo',
|
|
163
|
+
attributes: {},
|
|
164
|
+
isSelected: true,
|
|
165
|
+
};
|
|
166
|
+
|
|
157
167
|
it( 'should do nothing if no valid alignments', () => {
|
|
158
168
|
registerBlockType( 'core/foo', blockSettings );
|
|
159
169
|
|
|
@@ -161,15 +171,21 @@ describe( 'align', () => {
|
|
|
161
171
|
( { wrapperProps } ) => <div { ...wrapperProps } />
|
|
162
172
|
);
|
|
163
173
|
|
|
164
|
-
|
|
165
|
-
<
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
174
|
+
render(
|
|
175
|
+
<SlotFillProvider>
|
|
176
|
+
<BlockEdit { ...componentProps }>
|
|
177
|
+
<EnhancedComponent { ...componentProps } />
|
|
178
|
+
</BlockEdit>
|
|
179
|
+
<BlockControls.Slot group="block" />
|
|
180
|
+
</SlotFillProvider>
|
|
170
181
|
);
|
|
171
|
-
|
|
172
|
-
expect(
|
|
182
|
+
|
|
183
|
+
expect(
|
|
184
|
+
screen.queryByRole( 'button', {
|
|
185
|
+
name: 'Align',
|
|
186
|
+
expanded: false,
|
|
187
|
+
} )
|
|
188
|
+
).not.toBeInTheDocument();
|
|
173
189
|
} );
|
|
174
190
|
|
|
175
191
|
it( 'should render toolbar controls if valid alignments', () => {
|
|
@@ -185,14 +201,21 @@ describe( 'align', () => {
|
|
|
185
201
|
( { wrapperProps } ) => <div { ...wrapperProps } />
|
|
186
202
|
);
|
|
187
203
|
|
|
188
|
-
|
|
189
|
-
<
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
204
|
+
render(
|
|
205
|
+
<SlotFillProvider>
|
|
206
|
+
<BlockEdit { ...componentProps }>
|
|
207
|
+
<EnhancedComponent { ...componentProps } />
|
|
208
|
+
</BlockEdit>
|
|
209
|
+
<BlockControls.Slot group="block" />
|
|
210
|
+
</SlotFillProvider>
|
|
194
211
|
);
|
|
195
|
-
|
|
212
|
+
|
|
213
|
+
expect(
|
|
214
|
+
screen.getAllByRole( 'button', {
|
|
215
|
+
name: 'Align',
|
|
216
|
+
expanded: false,
|
|
217
|
+
} )
|
|
218
|
+
).toHaveLength( 2 );
|
|
196
219
|
} );
|
|
197
220
|
} );
|
|
198
221
|
|
|
@@ -207,28 +230,27 @@ describe( 'align', () => {
|
|
|
207
230
|
} );
|
|
208
231
|
|
|
209
232
|
const EnhancedComponent = withDataAlign( ( { wrapperProps } ) => (
|
|
210
|
-
<
|
|
233
|
+
<button { ...wrapperProps } />
|
|
211
234
|
) );
|
|
212
235
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
} );
|
|
236
|
+
render(
|
|
237
|
+
<BlockEditorProvider
|
|
238
|
+
settings={ { alignWide: true, supportsLayout: false } }
|
|
239
|
+
value={ [] }
|
|
240
|
+
>
|
|
241
|
+
<EnhancedComponent
|
|
242
|
+
attributes={ {
|
|
243
|
+
align: 'wide',
|
|
244
|
+
} }
|
|
245
|
+
name="core/foo"
|
|
246
|
+
/>
|
|
247
|
+
</BlockEditorProvider>
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
expect( screen.getByRole( 'button' ) ).toHaveAttribute(
|
|
251
|
+
'data-align',
|
|
252
|
+
'wide'
|
|
253
|
+
);
|
|
232
254
|
} );
|
|
233
255
|
|
|
234
256
|
it( 'should not render wide/full wrapper props if wide controls are not enabled', () => {
|
|
@@ -241,26 +263,27 @@ describe( 'align', () => {
|
|
|
241
263
|
} );
|
|
242
264
|
|
|
243
265
|
const EnhancedComponent = withDataAlign( ( { wrapperProps } ) => (
|
|
244
|
-
<
|
|
266
|
+
<button { ...wrapperProps } />
|
|
245
267
|
) );
|
|
246
268
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
269
|
+
render(
|
|
270
|
+
<BlockEditorProvider
|
|
271
|
+
settings={ { alignWide: false } }
|
|
272
|
+
value={ [] }
|
|
273
|
+
>
|
|
274
|
+
<EnhancedComponent
|
|
275
|
+
name="core/foo"
|
|
276
|
+
attributes={ {
|
|
277
|
+
align: 'wide',
|
|
278
|
+
} }
|
|
279
|
+
/>
|
|
280
|
+
</BlockEditorProvider>
|
|
281
|
+
);
|
|
282
|
+
|
|
283
|
+
expect( screen.getByRole( 'button' ) ).not.toHaveAttribute(
|
|
284
|
+
'data-align',
|
|
285
|
+
'wide'
|
|
286
|
+
);
|
|
264
287
|
} );
|
|
265
288
|
|
|
266
289
|
it( 'should not render invalid align', () => {
|
|
@@ -273,26 +296,27 @@ describe( 'align', () => {
|
|
|
273
296
|
} );
|
|
274
297
|
|
|
275
298
|
const EnhancedComponent = withDataAlign( ( { wrapperProps } ) => (
|
|
276
|
-
<
|
|
299
|
+
<button { ...wrapperProps } />
|
|
277
300
|
) );
|
|
278
301
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
302
|
+
render(
|
|
303
|
+
<BlockEditorProvider
|
|
304
|
+
settings={ { alignWide: true } }
|
|
305
|
+
value={ [] }
|
|
306
|
+
>
|
|
307
|
+
<EnhancedComponent
|
|
308
|
+
name="core/foo"
|
|
309
|
+
attributes={ {
|
|
310
|
+
align: 'wide',
|
|
311
|
+
} }
|
|
312
|
+
/>
|
|
313
|
+
</BlockEditorProvider>
|
|
314
|
+
);
|
|
315
|
+
|
|
316
|
+
expect( screen.getByRole( 'button' ) ).not.toHaveAttribute(
|
|
317
|
+
'data-align',
|
|
318
|
+
'wide'
|
|
319
|
+
);
|
|
296
320
|
} );
|
|
297
321
|
} );
|
|
298
322
|
|
package/src/hooks/test/style.js
CHANGED
|
@@ -6,7 +6,7 @@ import { applyFilters } from '@wordpress/hooks';
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { getInlineStyles } from '../style';
|
|
9
|
+
import { getInlineStyles, omitStyle } from '../style';
|
|
10
10
|
|
|
11
11
|
describe( 'getInlineStyles', () => {
|
|
12
12
|
it( 'should return an empty object when called with undefined', () => {
|
|
@@ -202,3 +202,208 @@ describe( 'addSaveProps', () => {
|
|
|
202
202
|
} );
|
|
203
203
|
} );
|
|
204
204
|
} );
|
|
205
|
+
|
|
206
|
+
describe( 'omitStyle', () => {
|
|
207
|
+
it( 'should remove a single path', () => {
|
|
208
|
+
const style = { color: '#d92828', padding: '10px' };
|
|
209
|
+
const path = 'color';
|
|
210
|
+
const expected = { padding: '10px' };
|
|
211
|
+
|
|
212
|
+
expect( omitStyle( style, path ) ).toEqual( expected );
|
|
213
|
+
} );
|
|
214
|
+
|
|
215
|
+
it( 'should remove multiple paths', () => {
|
|
216
|
+
const style = { color: '#d92828', padding: '10px', background: 'red' };
|
|
217
|
+
const path = [ 'color', 'background' ];
|
|
218
|
+
const expected = { padding: '10px' };
|
|
219
|
+
|
|
220
|
+
expect( omitStyle( style, path ) ).toEqual( expected );
|
|
221
|
+
} );
|
|
222
|
+
|
|
223
|
+
it( 'should remove nested paths when specified as a string', () => {
|
|
224
|
+
const style = {
|
|
225
|
+
color: {
|
|
226
|
+
text: '#d92828',
|
|
227
|
+
},
|
|
228
|
+
typography: {
|
|
229
|
+
textDecoration: 'underline',
|
|
230
|
+
textTransform: 'uppercase',
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
const path = 'typography.textTransform';
|
|
234
|
+
const expected = {
|
|
235
|
+
color: {
|
|
236
|
+
text: '#d92828',
|
|
237
|
+
},
|
|
238
|
+
typography: {
|
|
239
|
+
textDecoration: 'underline',
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
expect( omitStyle( style, path ) ).toEqual( expected );
|
|
244
|
+
} );
|
|
245
|
+
|
|
246
|
+
it( 'should remove nested paths when specified as an array', () => {
|
|
247
|
+
const style = {
|
|
248
|
+
color: {
|
|
249
|
+
text: '#d92828',
|
|
250
|
+
},
|
|
251
|
+
typography: {
|
|
252
|
+
textDecoration: 'underline',
|
|
253
|
+
textTransform: 'uppercase',
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
const path = [ [ 'typography', 'textTransform' ] ];
|
|
257
|
+
const expected = {
|
|
258
|
+
color: {
|
|
259
|
+
text: '#d92828',
|
|
260
|
+
},
|
|
261
|
+
typography: {
|
|
262
|
+
textDecoration: 'underline',
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
expect( omitStyle( style, path ) ).toEqual( expected );
|
|
267
|
+
} );
|
|
268
|
+
|
|
269
|
+
it( 'should remove multiple nested paths', () => {
|
|
270
|
+
const style = {
|
|
271
|
+
color: {
|
|
272
|
+
text: '#d92828',
|
|
273
|
+
},
|
|
274
|
+
typography: {
|
|
275
|
+
textDecoration: 'underline',
|
|
276
|
+
textTransform: 'uppercase',
|
|
277
|
+
},
|
|
278
|
+
};
|
|
279
|
+
const path = [
|
|
280
|
+
[ 'typography', 'textTransform' ],
|
|
281
|
+
'typography.textDecoration',
|
|
282
|
+
];
|
|
283
|
+
const expected = {
|
|
284
|
+
color: {
|
|
285
|
+
text: '#d92828',
|
|
286
|
+
},
|
|
287
|
+
typography: {},
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
expect( omitStyle( style, path ) ).toEqual( expected );
|
|
291
|
+
} );
|
|
292
|
+
|
|
293
|
+
it( 'should remove paths with different nesting', () => {
|
|
294
|
+
const style = {
|
|
295
|
+
color: {
|
|
296
|
+
text: '#d92828',
|
|
297
|
+
},
|
|
298
|
+
typography: {
|
|
299
|
+
textDecoration: 'underline',
|
|
300
|
+
textTransform: 'uppercase',
|
|
301
|
+
},
|
|
302
|
+
};
|
|
303
|
+
const path = [
|
|
304
|
+
'color',
|
|
305
|
+
[ 'typography', 'textTransform' ],
|
|
306
|
+
'typography.textDecoration',
|
|
307
|
+
];
|
|
308
|
+
const expected = {
|
|
309
|
+
typography: {},
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
expect( omitStyle( style, path ) ).toEqual( expected );
|
|
313
|
+
} );
|
|
314
|
+
|
|
315
|
+
it( 'should support beyond 2 levels of nesting when passed as a single string', () => {
|
|
316
|
+
const style = {
|
|
317
|
+
border: {
|
|
318
|
+
radius: {
|
|
319
|
+
topLeft: '10px',
|
|
320
|
+
topRight: '0.5rem',
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
};
|
|
324
|
+
const path = 'border.radius.topRight';
|
|
325
|
+
const expected = {
|
|
326
|
+
border: {
|
|
327
|
+
radius: {
|
|
328
|
+
topLeft: '10px',
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
expect( omitStyle( style, path ) ).toEqual( expected );
|
|
334
|
+
} );
|
|
335
|
+
|
|
336
|
+
it( 'should support beyond 2 levels of nesting when passed as array of strings', () => {
|
|
337
|
+
const style = {
|
|
338
|
+
border: {
|
|
339
|
+
radius: {
|
|
340
|
+
topLeft: '10px',
|
|
341
|
+
topRight: '0.5rem',
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
};
|
|
345
|
+
const path = [ 'border.radius.topRight' ];
|
|
346
|
+
const expected = {
|
|
347
|
+
border: {
|
|
348
|
+
radius: {
|
|
349
|
+
topLeft: '10px',
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
expect( omitStyle( style, path ) ).toEqual( expected );
|
|
355
|
+
} );
|
|
356
|
+
|
|
357
|
+
it( 'should support beyond 2 levels of nesting when passed as array of arrays', () => {
|
|
358
|
+
const style = {
|
|
359
|
+
border: {
|
|
360
|
+
radius: {
|
|
361
|
+
topLeft: '10px',
|
|
362
|
+
topRight: '0.5rem',
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
};
|
|
366
|
+
const path = [ [ 'border', 'radius', 'topRight' ] ];
|
|
367
|
+
const expected = {
|
|
368
|
+
border: {
|
|
369
|
+
radius: {
|
|
370
|
+
topLeft: '10px',
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
expect( omitStyle( style, path ) ).toEqual( expected );
|
|
376
|
+
} );
|
|
377
|
+
|
|
378
|
+
it( 'should ignore a nullish style object', () => {
|
|
379
|
+
expect( omitStyle( undefined, 'color' ) ).toEqual( undefined );
|
|
380
|
+
expect( omitStyle( null, 'color' ) ).toEqual( null );
|
|
381
|
+
} );
|
|
382
|
+
|
|
383
|
+
it( 'should ignore a missing object property', () => {
|
|
384
|
+
const style1 = { typography: {} };
|
|
385
|
+
expect( omitStyle( style1, 'color' ) ).toEqual( style1 );
|
|
386
|
+
|
|
387
|
+
const style2 = { color: { text: '#d92828' } };
|
|
388
|
+
expect( omitStyle( style2, 'color.something' ) ).toEqual( style2 );
|
|
389
|
+
|
|
390
|
+
const style3 = {
|
|
391
|
+
border: {
|
|
392
|
+
radius: {
|
|
393
|
+
topLeft: '10px',
|
|
394
|
+
topRight: '0.5rem',
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
};
|
|
398
|
+
expect(
|
|
399
|
+
omitStyle( style3, [ [ 'border', 'radius', 'bottomLeft' ] ] )
|
|
400
|
+
).toEqual( style3 );
|
|
401
|
+
} );
|
|
402
|
+
|
|
403
|
+
it( 'should ignore an empty array path', () => {
|
|
404
|
+
const style = { typography: {}, '': 'test' };
|
|
405
|
+
|
|
406
|
+
expect( omitStyle( style, [] ) ).toEqual( style );
|
|
407
|
+
expect( omitStyle( style, [ [] ] ) ).toEqual( style );
|
|
408
|
+
} );
|
|
409
|
+
} );
|
|
@@ -25,4 +25,26 @@ describe( 'getTypographyClassesAndStyles', () => {
|
|
|
25
25
|
},
|
|
26
26
|
} );
|
|
27
27
|
} );
|
|
28
|
+
|
|
29
|
+
it( 'should return fluid font size styles', () => {
|
|
30
|
+
const attributes = {
|
|
31
|
+
fontFamily: 'tofu',
|
|
32
|
+
style: {
|
|
33
|
+
typography: {
|
|
34
|
+
letterSpacing: '22px',
|
|
35
|
+
fontSize: '2rem',
|
|
36
|
+
textTransform: 'uppercase',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
expect( getTypographyClassesAndStyles( attributes, true ) ).toEqual( {
|
|
41
|
+
className: 'has-tofu-font-family',
|
|
42
|
+
style: {
|
|
43
|
+
letterSpacing: '22px',
|
|
44
|
+
fontSize:
|
|
45
|
+
'clamp(1.5rem, 1.5rem + ((1vw - 0.48rem) * 2.885), 3rem)',
|
|
46
|
+
textTransform: 'uppercase',
|
|
47
|
+
},
|
|
48
|
+
} );
|
|
49
|
+
} );
|
|
28
50
|
} );
|
|
@@ -9,6 +9,7 @@ import classnames from 'classnames';
|
|
|
9
9
|
*/
|
|
10
10
|
import { getInlineStyles } from './style';
|
|
11
11
|
import { getFontSizeClass } from '../components/font-sizes';
|
|
12
|
+
import { getComputedFluidTypographyValue } from '../components/font-sizes/fluid-utils';
|
|
12
13
|
|
|
13
14
|
// This utility is intended to assist where the serialization of the typography
|
|
14
15
|
// block support is being skipped for a block but the typography related CSS
|
|
@@ -18,12 +19,26 @@ import { getFontSizeClass } from '../components/font-sizes';
|
|
|
18
19
|
* Provides the CSS class names and inline styles for a block's typography support
|
|
19
20
|
* attributes.
|
|
20
21
|
*
|
|
21
|
-
* @param {Object}
|
|
22
|
+
* @param {Object} attributes Block attributes.
|
|
23
|
+
* @param {boolean} isFluidFontSizeActive Whether the function should try to convert font sizes to fluid values.
|
|
22
24
|
*
|
|
23
25
|
* @return {Object} Typography block support derived CSS classes & styles.
|
|
24
26
|
*/
|
|
25
|
-
export function getTypographyClassesAndStyles(
|
|
26
|
-
|
|
27
|
+
export function getTypographyClassesAndStyles(
|
|
28
|
+
attributes,
|
|
29
|
+
isFluidFontSizeActive
|
|
30
|
+
) {
|
|
31
|
+
let typographyStyles = attributes?.style?.typography || {};
|
|
32
|
+
|
|
33
|
+
if ( isFluidFontSizeActive ) {
|
|
34
|
+
typographyStyles = {
|
|
35
|
+
...typographyStyles,
|
|
36
|
+
fontSize: getComputedFluidTypographyValue( {
|
|
37
|
+
fontSize: attributes?.style?.typography?.fontSize,
|
|
38
|
+
} ),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
27
42
|
const style = getInlineStyles( { typography: typographyStyles } );
|
|
28
43
|
const fontFamilyClassName = !! attributes?.fontFamily
|
|
29
44
|
? `has-${ kebabCase( attributes.fontFamily ) }-font-family`
|
package/src/hooks/utils.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { isEmpty, mapValues, get, setWith, clone } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { getBlockSupport } from '@wordpress/blocks';
|
|
10
10
|
|
|
11
|
-
const identity = ( x ) => x;
|
|
12
|
-
|
|
13
11
|
/**
|
|
14
12
|
* Removed falsy values from nested object.
|
|
15
13
|
*
|
|
@@ -24,9 +22,10 @@ export const cleanEmptyObject = ( object ) => {
|
|
|
24
22
|
) {
|
|
25
23
|
return object;
|
|
26
24
|
}
|
|
27
|
-
const cleanedNestedObjects =
|
|
28
|
-
mapValues( object, cleanEmptyObject )
|
|
29
|
-
|
|
25
|
+
const cleanedNestedObjects = Object.fromEntries(
|
|
26
|
+
Object.entries( mapValues( object, cleanEmptyObject ) ).filter(
|
|
27
|
+
( [ , value ] ) => Boolean( value )
|
|
28
|
+
)
|
|
30
29
|
);
|
|
31
30
|
return isEmpty( cleanedNestedObjects ) ? undefined : cleanedNestedObjects;
|
|
32
31
|
};
|
|
@@ -44,7 +43,11 @@ export function transformStyles(
|
|
|
44
43
|
results
|
|
45
44
|
) {
|
|
46
45
|
// If there are no active supports return early.
|
|
47
|
-
if (
|
|
46
|
+
if (
|
|
47
|
+
Object.values( activeSupports ?? {} ).every(
|
|
48
|
+
( isActive ) => ! isActive
|
|
49
|
+
)
|
|
50
|
+
) {
|
|
48
51
|
return result;
|
|
49
52
|
}
|
|
50
53
|
// If the condition verifies we are probably in the presence of a wrapping transform
|
package/src/layouts/flex.js
CHANGED
package/src/store/actions.js
CHANGED
|
@@ -26,6 +26,8 @@ import {
|
|
|
26
26
|
START_OF_SELECTED_AREA,
|
|
27
27
|
} from '../utils/selection';
|
|
28
28
|
|
|
29
|
+
/** @typedef {import('../components/use-on-block-drop/types').WPDropOperation} WPDropOperation */
|
|
30
|
+
|
|
29
31
|
const castArray = ( maybeArray ) =>
|
|
30
32
|
Array.isArray( maybeArray ) ? maybeArray : [ maybeArray ];
|
|
31
33
|
|
|
@@ -624,10 +626,13 @@ export const insertBlocks =
|
|
|
624
626
|
/**
|
|
625
627
|
* Action that shows the insertion point.
|
|
626
628
|
*
|
|
627
|
-
* @param
|
|
628
|
-
*
|
|
629
|
-
* @param
|
|
630
|
-
* @param
|
|
629
|
+
* @param {?string} rootClientId Optional root client ID of block list on
|
|
630
|
+
* which to insert.
|
|
631
|
+
* @param {?number} index Index at which block should be inserted.
|
|
632
|
+
* @param {?Object} __unstableOptions Additional options.
|
|
633
|
+
* @property {boolean} __unstableWithInserter Whether or not to show an inserter button.
|
|
634
|
+
* @property {WPDropOperation} operation The operation to perform when applied,
|
|
635
|
+
* either 'insert' or 'replace' for now.
|
|
631
636
|
*
|
|
632
637
|
* @return {Object} Action object.
|
|
633
638
|
*/
|
|
@@ -636,25 +641,28 @@ export function showInsertionPoint(
|
|
|
636
641
|
index,
|
|
637
642
|
__unstableOptions = {}
|
|
638
643
|
) {
|
|
639
|
-
const { __unstableWithInserter } = __unstableOptions;
|
|
644
|
+
const { __unstableWithInserter, operation } = __unstableOptions;
|
|
640
645
|
return {
|
|
641
646
|
type: 'SHOW_INSERTION_POINT',
|
|
642
647
|
rootClientId,
|
|
643
648
|
index,
|
|
644
649
|
__unstableWithInserter,
|
|
650
|
+
operation,
|
|
645
651
|
};
|
|
646
652
|
}
|
|
647
|
-
|
|
648
653
|
/**
|
|
649
654
|
* Action that hides the insertion point.
|
|
650
|
-
*
|
|
651
|
-
* @return {Object} Action object.
|
|
652
655
|
*/
|
|
653
|
-
export
|
|
654
|
-
|
|
655
|
-
|
|
656
|
+
export const hideInsertionPoint =
|
|
657
|
+
() =>
|
|
658
|
+
( { select, dispatch } ) => {
|
|
659
|
+
if ( ! select.isBlockInsertionPointVisible() ) {
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
dispatch( {
|
|
663
|
+
type: 'HIDE_INSERTION_POINT',
|
|
664
|
+
} );
|
|
656
665
|
};
|
|
657
|
-
}
|
|
658
666
|
|
|
659
667
|
/**
|
|
660
668
|
* Action that resets the template validity.
|
|
@@ -1704,6 +1712,10 @@ export function setBlockVisibility( updates ) {
|
|
|
1704
1712
|
/**
|
|
1705
1713
|
* Action that sets whether a block is being temporaritly edited as blocks.
|
|
1706
1714
|
*
|
|
1715
|
+
* DO-NOT-USE in production.
|
|
1716
|
+
* This action is created for internal/experimental only usage and may be
|
|
1717
|
+
* removed anytime without any warning, causing breakage on any plugin or theme invoking it.
|
|
1718
|
+
*
|
|
1707
1719
|
* @param {?string} temporarilyEditingAsBlocks The block's clientId being temporaritly edited as blocks.
|
|
1708
1720
|
*/
|
|
1709
1721
|
export function __unstableSetTemporarilyEditingAsBlocks(
|
package/src/store/array.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { castArray } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* Insert one or multiple elements into a given position of an array.
|
|
8
3
|
*
|
|
@@ -15,7 +10,7 @@ import { castArray } from 'lodash';
|
|
|
15
10
|
export function insertAt( array, elements, index ) {
|
|
16
11
|
return [
|
|
17
12
|
...array.slice( 0, index ),
|
|
18
|
-
...
|
|
13
|
+
...( Array.isArray( elements ) ? elements : [ elements ] ),
|
|
19
14
|
...array.slice( index ),
|
|
20
15
|
];
|
|
21
16
|
}
|