@wordpress/block-editor 17.1.0 → 17.2.1-next.v.202609171837.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 +32 -0
- package/README.md +214 -214
- package/build/autocompleters/block.cjs.map +2 -2
- package/build/components/alignment-control/ui.cjs.map +2 -2
- package/build/components/background-image-control/index.cjs +1 -1
- package/build/components/background-image-control/index.cjs.map +2 -2
- package/build/components/block-alignment-control/ui.cjs +21 -7
- package/build/components/block-alignment-control/ui.cjs.map +3 -3
- package/build/components/block-alignment-control/use-available-alignments.cjs +60 -13
- package/build/components/block-alignment-control/use-available-alignments.cjs.map +2 -2
- package/build/components/block-allowed-blocks/allowed-blocks-control.cjs.map +2 -2
- package/build/components/block-bindings/attribute-control.cjs +30 -30
- package/build/components/block-bindings/attribute-control.cjs.map +3 -3
- package/build/components/block-bindings/source-fields-list.cjs +27 -32
- package/build/components/block-bindings/source-fields-list.cjs.map +3 -3
- package/build/components/block-canvas/index.cjs.map +2 -2
- package/build/components/block-card/index.cjs +1 -2
- package/build/components/block-card/index.cjs.map +3 -3
- package/build/components/block-edit/edit.cjs.map +2 -2
- package/build/components/block-heading-level-dropdown/index.cjs.map +2 -2
- package/build/components/block-icon/index.cjs.map +2 -2
- package/build/components/block-inspector/edit-contents.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +27 -8
- package/build/components/block-inspector/index.cjs.map +3 -3
- package/build/components/block-keyboard-shortcuts/index.cjs.map +2 -2
- package/build/components/block-list/block-html.cjs +1 -12
- package/build/components/block-list/block-html.cjs.map +3 -3
- package/build/components/block-list/block.cjs +2 -4
- package/build/components/block-list/block.cjs.map +2 -2
- package/build/components/block-list/layout.cjs +1 -1
- package/build/components/block-list/layout.cjs.map +2 -2
- package/build/components/block-list/use-block-props/index.cjs.map +2 -2
- package/build/components/block-lock/modal.cjs +1 -3
- package/build/components/block-lock/modal.cjs.map +2 -2
- package/build/components/block-parent-selector/index.cjs +8 -5
- package/build/components/block-parent-selector/index.cjs.map +2 -2
- package/build/components/block-popover/index.cjs.map +2 -2
- package/build/components/block-rename/modal.cjs.map +2 -2
- package/build/components/block-settings-menu/block-settings-dropdown.cjs.map +2 -2
- package/build/components/block-styles/utils.cjs.map +2 -2
- package/build/components/block-switcher/index.cjs.map +2 -2
- package/build/components/block-toolbar/edit-section-button.cjs.map +2 -2
- package/build/components/block-toolbar/index.cjs +6 -4
- package/build/components/block-toolbar/index.cjs.map +2 -2
- package/build/components/block-toolbar/switch-section-style.cjs.map +2 -2
- package/build/components/block-variation-transforms/index.cjs +28 -18
- package/build/components/block-variation-transforms/index.cjs.map +3 -3
- package/build/components/block-visibility/modal.cjs.map +2 -2
- package/build/components/block-visibility/viewport-visibility-info.cjs.map +2 -2
- package/build/components/border-radius-control/index.cjs.map +2 -2
- package/build/components/color-palette/with-color-context.cjs.map +2 -2
- package/build/components/colors/with-colors.cjs.map +2 -2
- package/build/components/colors-gradients/control.cjs.map +2 -2
- package/build/components/contrast-checker/index.cjs.map +2 -2
- package/build/components/date-format-picker/index.cjs.map +2 -2
- package/build/components/dimensions-tool/aspect-ratio-tool.cjs.map +3 -3
- package/build/components/dimensions-tool/width-height-tool.cjs.map +2 -2
- package/build/components/font-sizes/with-font-sizes.cjs.map +2 -2
- package/build/components/global-styles/background-panel.cjs +1 -1
- package/build/components/global-styles/background-panel.cjs.map +2 -2
- package/build/components/global-styles/border-panel.cjs +1 -1
- package/build/components/global-styles/border-panel.cjs.map +2 -2
- package/build/components/global-styles/color-gradient-dropdown-item.cjs +1 -1
- package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +2 -2
- package/build/components/global-styles/color-panel.cjs +1 -1
- package/build/components/global-styles/color-panel.cjs.map +2 -2
- package/build/components/global-styles/dimensions-panel.cjs +1 -1
- package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
- package/build/components/global-styles/filters-panel.cjs +1 -1
- package/build/components/global-styles/filters-panel.cjs.map +2 -2
- package/build/components/global-styles/hooks.cjs +1 -0
- package/build/components/global-styles/hooks.cjs.map +2 -2
- package/build/components/global-styles/inheritance/index.cjs +3 -3
- package/build/components/global-styles/inheritance/index.cjs.map +2 -2
- package/build/components/global-styles/inherited-value-context.cjs +0 -5
- package/build/components/global-styles/inherited-value-context.cjs.map +2 -2
- package/build/components/global-styles/state-control-badges.cjs +0 -1
- package/build/components/global-styles/state-control-badges.cjs.map +2 -2
- package/build/components/global-styles/state-control.cjs +6 -4
- package/build/components/global-styles/state-control.cjs.map +2 -2
- package/build/components/global-styles/text-shadow-panel.cjs +254 -0
- package/build/components/global-styles/text-shadow-panel.cjs.map +7 -0
- package/build/components/global-styles/typography-panel.cjs +46 -5
- package/build/components/global-styles/typography-panel.cjs.map +2 -2
- package/build/components/global-styles/typography-utils.cjs.map +2 -2
- package/build/components/global-styles/utils.cjs.map +2 -2
- package/build/components/html-element-control/index.cjs.map +3 -3
- package/build/components/iframe/index.cjs.map +2 -2
- package/build/components/iframe/use-scale-canvas.cjs.map +2 -2
- package/build/components/image-size-control/index.cjs.map +3 -3
- package/build/components/inner-blocks/index.cjs +6 -1
- package/build/components/inner-blocks/index.cjs.map +2 -2
- package/build/components/inner-content/index.cjs.map +2 -2
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.cjs +4 -23
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.cjs.map +2 -2
- package/build/components/inserter/block-patterns-tab/utils.cjs +26 -0
- package/build/components/inserter/block-patterns-tab/utils.cjs.map +2 -2
- package/build/components/inserter/hooks/use-block-types-state.cjs.map +2 -2
- package/build/components/inserter/hooks/use-insertion-point.cjs.map +2 -2
- package/build/components/inserter/hooks/use-patterns-state.cjs.map +2 -2
- package/build/components/inserter/media-tab/media-panel.cjs.map +2 -2
- package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
- package/build/components/inserter-list-item/index.cjs.map +2 -2
- package/build/components/inspector-controls/list-view-content-popover.cjs.map +2 -2
- package/build/components/link-control/search-results.cjs.map +2 -2
- package/build/components/link-control/use-search-handler.cjs +3 -0
- package/build/components/link-control/use-search-handler.cjs.map +2 -2
- package/build/components/list-view/branch.cjs.map +2 -2
- package/build/components/list-view/drop-indicator.cjs.map +2 -2
- package/build/components/list-view/index.cjs.map +2 -2
- package/build/components/list-view/use-list-view-drop-zone.cjs.map +2 -2
- package/build/components/list-view/utils.cjs.map +2 -2
- package/build/components/media-replace-flow/index.cjs +4 -1
- package/build/components/media-replace-flow/index.cjs.map +2 -2
- package/build/components/plain-text/index.cjs +1 -2
- package/build/components/plain-text/index.cjs.map +3 -3
- package/build/components/preset-input-control/index.cjs.map +2 -2
- package/build/components/provider/index.cjs +3 -1
- package/build/components/provider/index.cjs.map +2 -2
- package/build/components/provider/use-block-sync.cjs.map +2 -2
- package/build/components/publish-date-time-picker/index.cjs.map +2 -2
- package/build/components/resizable-box-popover/index.cjs +1 -1
- package/build/components/resizable-box-popover/index.cjs.map +1 -1
- package/build/components/resolution-tool/index.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/enter.cjs +8 -22
- package/build/components/rich-text/event-listeners/enter.cjs.map +2 -2
- package/build/components/rich-text/format-edit.cjs.map +2 -2
- package/build/components/rich-text/index.cjs +20 -0
- package/build/components/rich-text/index.cjs.map +2 -2
- package/build/components/rich-text/multiline.cjs +10 -2
- package/build/components/rich-text/multiline.cjs.map +2 -2
- package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.cjs.map +2 -2
- package/build/components/typewriter/index.cjs.map +2 -2
- package/build/components/use-block-commands/index.cjs.map +2 -2
- package/build/components/writing-flow/index.cjs +3 -0
- package/build/components/writing-flow/index.cjs.map +2 -2
- package/build/components/writing-flow/use-clipboard-handler.cjs.map +2 -2
- package/build/components/writing-flow/use-selection-observer.cjs +5 -3
- package/build/components/writing-flow/use-selection-observer.cjs.map +2 -2
- package/build/hooks/align.cjs +3 -5
- package/build/hooks/align.cjs.map +2 -2
- package/build/hooks/background.cjs.map +2 -2
- package/build/hooks/block-bindings.cjs.map +2 -2
- package/build/hooks/border.cjs.map +2 -2
- package/build/hooks/contrast-checker.cjs.map +2 -2
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/duotone.cjs.map +2 -2
- package/build/hooks/elements.cjs.map +2 -2
- package/build/hooks/fit-text.cjs.map +2 -2
- package/build/hooks/gap.cjs +2 -1
- package/build/hooks/gap.cjs.map +3 -3
- package/build/hooks/index.cjs +4 -2
- package/build/hooks/index.cjs.map +3 -3
- package/build/hooks/layout-child.cjs.map +2 -2
- package/build/hooks/layout.cjs +15 -14
- package/build/hooks/layout.cjs.map +3 -3
- package/build/hooks/position.cjs +3 -31
- package/build/hooks/position.cjs.map +2 -2
- package/build/hooks/states.cjs +3 -2
- package/build/hooks/states.cjs.map +2 -2
- package/build/hooks/text-shadow.cjs +100 -0
- package/build/hooks/text-shadow.cjs.map +7 -0
- package/build/hooks/typography.cjs +30 -6
- package/build/hooks/typography.cjs.map +2 -2
- package/build/hooks/utils.cjs +24 -2
- package/build/hooks/utils.cjs.map +2 -2
- package/build/layouts/grid.cjs.map +2 -2
- package/build/layouts/utils.cjs +7 -2
- package/build/layouts/utils.cjs.map +2 -2
- package/build/private-apis.cjs +9 -6
- package/build/private-apis.cjs.map +2 -2
- package/build/store/actions.cjs +26 -4
- package/build/store/actions.cjs.map +3 -3
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/get-font-styles-and-weights.cjs.map +2 -2
- package/build/utils/transform-styles/index.cjs.map +1 -1
- package/build-module/autocompleters/block.mjs.map +2 -2
- package/build-module/components/alignment-control/ui.mjs.map +2 -2
- package/build-module/components/background-image-control/index.mjs +2 -2
- package/build-module/components/background-image-control/index.mjs.map +2 -2
- package/build-module/components/block-alignment-control/ui.mjs +21 -7
- package/build-module/components/block-alignment-control/ui.mjs.map +2 -2
- package/build-module/components/block-alignment-control/use-available-alignments.mjs +56 -13
- package/build-module/components/block-alignment-control/use-available-alignments.mjs.map +2 -2
- package/build-module/components/block-allowed-blocks/allowed-blocks-control.mjs.map +2 -2
- package/build-module/components/block-bindings/attribute-control.mjs +31 -32
- package/build-module/components/block-bindings/attribute-control.mjs.map +2 -2
- package/build-module/components/block-bindings/source-fields-list.mjs +25 -30
- package/build-module/components/block-bindings/source-fields-list.mjs.map +2 -2
- package/build-module/components/block-canvas/index.mjs.map +2 -2
- package/build-module/components/block-card/index.mjs +3 -8
- package/build-module/components/block-card/index.mjs.map +2 -2
- package/build-module/components/block-edit/edit.mjs.map +2 -2
- package/build-module/components/block-heading-level-dropdown/index.mjs.map +2 -2
- package/build-module/components/block-icon/index.mjs.map +2 -2
- package/build-module/components/block-inspector/edit-contents.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +29 -10
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-keyboard-shortcuts/index.mjs.map +2 -2
- package/build-module/components/block-list/block-html.mjs +1 -2
- package/build-module/components/block-list/block-html.mjs.map +2 -2
- package/build-module/components/block-list/block.mjs +2 -4
- package/build-module/components/block-list/block.mjs.map +2 -2
- package/build-module/components/block-list/layout.mjs +1 -1
- package/build-module/components/block-list/layout.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/index.mjs.map +2 -2
- package/build-module/components/block-lock/modal.mjs +1 -3
- package/build-module/components/block-lock/modal.mjs.map +2 -2
- package/build-module/components/block-parent-selector/index.mjs +8 -5
- package/build-module/components/block-parent-selector/index.mjs.map +2 -2
- package/build-module/components/block-popover/index.mjs.map +2 -2
- package/build-module/components/block-rename/modal.mjs.map +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.mjs.map +2 -2
- package/build-module/components/block-styles/utils.mjs.map +2 -2
- package/build-module/components/block-switcher/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/edit-section-button.mjs.map +2 -2
- package/build-module/components/block-toolbar/index.mjs +6 -4
- package/build-module/components/block-toolbar/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/switch-section-style.mjs.map +2 -2
- package/build-module/components/block-variation-transforms/index.mjs +30 -21
- package/build-module/components/block-variation-transforms/index.mjs.map +2 -2
- package/build-module/components/block-visibility/modal.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +2 -2
- package/build-module/components/border-radius-control/index.mjs.map +2 -2
- package/build-module/components/color-palette/with-color-context.mjs.map +2 -2
- package/build-module/components/colors/with-colors.mjs.map +2 -2
- package/build-module/components/colors-gradients/control.mjs.map +2 -2
- package/build-module/components/contrast-checker/index.mjs.map +2 -2
- package/build-module/components/date-format-picker/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs +2 -2
- package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs.map +2 -2
- package/build-module/components/dimensions-tool/width-height-tool.mjs.map +2 -2
- package/build-module/components/font-sizes/with-font-sizes.mjs.map +2 -2
- package/build-module/components/global-styles/background-panel.mjs +2 -2
- package/build-module/components/global-styles/background-panel.mjs.map +2 -2
- package/build-module/components/global-styles/border-panel.mjs +2 -2
- package/build-module/components/global-styles/border-panel.mjs.map +2 -2
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +2 -2
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +2 -2
- package/build-module/components/global-styles/color-panel.mjs +2 -2
- package/build-module/components/global-styles/color-panel.mjs.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/filters-panel.mjs +2 -2
- package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
- package/build-module/components/global-styles/hooks.mjs +1 -0
- package/build-module/components/global-styles/hooks.mjs.map +2 -2
- package/build-module/components/global-styles/inheritance/index.mjs +2 -2
- package/build-module/components/global-styles/inheritance/index.mjs.map +2 -2
- package/build-module/components/global-styles/inherited-value-context.mjs +0 -5
- package/build-module/components/global-styles/inherited-value-context.mjs.map +2 -2
- package/build-module/components/global-styles/state-control-badges.mjs +0 -1
- package/build-module/components/global-styles/state-control-badges.mjs.map +2 -2
- package/build-module/components/global-styles/state-control.mjs +6 -4
- package/build-module/components/global-styles/state-control.mjs.map +2 -2
- package/build-module/components/global-styles/text-shadow-panel.mjs +224 -0
- package/build-module/components/global-styles/text-shadow-panel.mjs.map +7 -0
- package/build-module/components/global-styles/typography-panel.mjs +47 -6
- package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
- package/build-module/components/global-styles/typography-utils.mjs.map +2 -2
- package/build-module/components/global-styles/utils.mjs.map +2 -2
- package/build-module/components/html-element-control/index.mjs +2 -2
- package/build-module/components/html-element-control/index.mjs.map +2 -2
- package/build-module/components/iframe/index.mjs.map +2 -2
- package/build-module/components/iframe/use-scale-canvas.mjs.map +2 -2
- package/build-module/components/image-size-control/index.mjs +2 -2
- package/build-module/components/image-size-control/index.mjs.map +2 -2
- package/build-module/components/inner-blocks/index.mjs +6 -1
- package/build-module/components/inner-blocks/index.mjs.map +2 -2
- package/build-module/components/inner-content/index.mjs.map +2 -2
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.mjs +6 -24
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.mjs.map +2 -2
- package/build-module/components/inserter/block-patterns-tab/utils.mjs +25 -0
- package/build-module/components/inserter/block-patterns-tab/utils.mjs.map +2 -2
- package/build-module/components/inserter/hooks/use-block-types-state.mjs.map +2 -2
- package/build-module/components/inserter/hooks/use-insertion-point.mjs.map +2 -2
- package/build-module/components/inserter/hooks/use-patterns-state.mjs.map +2 -2
- package/build-module/components/inserter/media-tab/media-panel.mjs.map +2 -2
- package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
- package/build-module/components/inserter-list-item/index.mjs.map +2 -2
- package/build-module/components/inspector-controls/list-view-content-popover.mjs.map +2 -2
- package/build-module/components/link-control/search-results.mjs.map +2 -2
- package/build-module/components/link-control/use-search-handler.mjs +3 -0
- package/build-module/components/link-control/use-search-handler.mjs.map +2 -2
- package/build-module/components/list-view/branch.mjs.map +2 -2
- package/build-module/components/list-view/drop-indicator.mjs.map +2 -2
- package/build-module/components/list-view/index.mjs.map +2 -2
- package/build-module/components/list-view/use-list-view-drop-zone.mjs.map +2 -2
- package/build-module/components/list-view/utils.mjs.map +2 -2
- package/build-module/components/media-replace-flow/index.mjs +4 -1
- package/build-module/components/media-replace-flow/index.mjs.map +2 -2
- package/build-module/components/plain-text/index.mjs +1 -2
- package/build-module/components/plain-text/index.mjs.map +2 -2
- package/build-module/components/preset-input-control/index.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +3 -1
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-sync.mjs.map +2 -2
- package/build-module/components/publish-date-time-picker/index.mjs.map +2 -2
- package/build-module/components/resizable-box-popover/index.mjs +1 -1
- package/build-module/components/resizable-box-popover/index.mjs.map +1 -1
- package/build-module/components/resolution-tool/index.mjs +2 -2
- package/build-module/components/resolution-tool/index.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs +8 -22
- package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
- package/build-module/components/rich-text/format-edit.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +21 -0
- package/build-module/components/rich-text/index.mjs.map +2 -2
- package/build-module/components/rich-text/multiline.mjs +11 -3
- package/build-module/components/rich-text/multiline.mjs.map +2 -2
- package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.mjs.map +2 -2
- package/build-module/components/typewriter/index.mjs.map +2 -2
- package/build-module/components/use-block-commands/index.mjs.map +2 -2
- package/build-module/components/writing-flow/index.mjs +3 -0
- package/build-module/components/writing-flow/index.mjs.map +2 -2
- package/build-module/components/writing-flow/use-clipboard-handler.mjs.map +2 -2
- package/build-module/components/writing-flow/use-selection-observer.mjs +5 -3
- package/build-module/components/writing-flow/use-selection-observer.mjs.map +2 -2
- package/build-module/hooks/align.mjs +6 -6
- package/build-module/hooks/align.mjs.map +2 -2
- package/build-module/hooks/background.mjs.map +2 -2
- package/build-module/hooks/block-bindings.mjs.map +2 -2
- package/build-module/hooks/border.mjs.map +2 -2
- package/build-module/hooks/contrast-checker.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/duotone.mjs.map +2 -2
- package/build-module/hooks/elements.mjs.map +2 -2
- package/build-module/hooks/fit-text.mjs.map +2 -2
- package/build-module/hooks/gap.mjs +2 -1
- package/build-module/hooks/gap.mjs.map +2 -2
- package/build-module/hooks/index.mjs +4 -2
- package/build-module/hooks/index.mjs.map +2 -2
- package/build-module/hooks/layout-child.mjs.map +2 -2
- package/build-module/hooks/layout.mjs +6 -5
- package/build-module/hooks/layout.mjs.map +2 -2
- package/build-module/hooks/position.mjs +5 -33
- package/build-module/hooks/position.mjs.map +2 -2
- package/build-module/hooks/states.mjs +3 -2
- package/build-module/hooks/states.mjs.map +2 -2
- package/build-module/hooks/text-shadow.mjs +65 -0
- package/build-module/hooks/text-shadow.mjs.map +7 -0
- package/build-module/hooks/typography.mjs +30 -6
- package/build-module/hooks/typography.mjs.map +2 -2
- package/build-module/hooks/utils.mjs +24 -2
- package/build-module/hooks/utils.mjs.map +2 -2
- package/build-module/layouts/grid.mjs.map +2 -2
- package/build-module/layouts/utils.mjs +5 -1
- package/build-module/layouts/utils.mjs.map +2 -2
- package/build-module/private-apis.mjs +6 -2
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs +28 -5
- package/build-module/store/actions.mjs.map +3 -3
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/get-font-styles-and-weights.mjs.map +2 -2
- package/build-module/utils/transform-styles/index.mjs.map +1 -1
- package/build-style/content-rtl.css +7 -2
- package/build-style/content.css +7 -2
- package/build-style/style-rtl.css +90 -25
- package/build-style/style.css +92 -25
- package/package.json +42 -43
- package/src/autocompleters/block.jsx +4 -4
- package/src/components/alignment-control/ui.jsx +1 -1
- package/src/components/background-image-control/index.jsx +3 -3
- package/src/components/block-alignment-control/test/index.jsdom.test.jsx +267 -0
- package/src/components/block-alignment-control/ui.jsx +47 -9
- package/src/components/block-alignment-control/use-available-alignments.js +106 -20
- package/src/components/block-allowed-blocks/allowed-blocks-control.jsx +1 -1
- package/src/components/block-bindings/attribute-control.jsx +27 -29
- package/src/components/block-bindings/source-fields-list.jsx +22 -32
- package/src/components/block-bindings/test/attribute-control.jsdom.test.jsx +115 -0
- package/src/components/block-canvas/index.jsx +1 -1
- package/src/components/block-card/index.jsx +5 -11
- package/src/components/block-card/style.scss +1 -0
- package/src/components/block-edit/edit.jsx +1 -1
- package/src/components/block-heading-level-dropdown/index.jsx +1 -1
- package/src/components/block-icon/index.jsx +1 -1
- package/src/components/block-icon/test/index.browser.test.jsx +74 -0
- package/src/components/block-inspector/edit-contents.jsx +2 -2
- package/src/components/block-inspector/index.jsx +46 -15
- package/src/components/block-inspector/style.scss +16 -0
- package/src/components/block-keyboard-shortcuts/index.jsx +2 -2
- package/src/components/block-list/block-html.jsx +2 -3
- package/src/components/block-list/block.jsx +7 -5
- package/src/components/block-list/content.scss +3 -2
- package/src/components/block-list/layout.jsx +4 -1
- package/src/components/block-list/test/layout.jsdom.test.js +40 -0
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-lock/modal.jsx +2 -3
- package/src/components/block-lock/style.scss +1 -1
- package/src/components/block-mover/style.scss +0 -13
- package/src/components/block-parent-selector/index.jsx +12 -6
- package/src/components/block-patterns-list/style.scss +1 -1
- package/src/components/block-popover/index.jsx +1 -1
- package/src/components/block-rename/modal.jsx +3 -3
- package/src/components/block-settings-menu/block-settings-dropdown.jsx +1 -1
- package/src/components/block-styles/utils.js +1 -1
- package/src/components/block-switcher/index.jsx +3 -3
- package/src/components/block-toolbar/edit-section-button.jsx +2 -2
- package/src/components/block-toolbar/index.jsx +8 -4
- package/src/components/block-toolbar/switch-section-style.jsx +1 -1
- package/src/components/block-variation-transforms/index.jsx +24 -23
- package/src/components/block-variation-transforms/test/index.jsdom.test.jsx +93 -0
- package/src/components/block-visibility/modal.jsx +7 -7
- package/src/components/block-visibility/style.scss +1 -1
- package/src/components/block-visibility/viewport-visibility-info.jsx +5 -7
- package/src/components/border-radius-control/index.jsx +2 -2
- package/src/components/border-radius-control/test/index.jsdom.test.jsx +0 -22
- package/src/components/border-radius-control/test/select.browser.test.js +30 -0
- package/src/components/color-palette/with-color-context.jsx +1 -1
- package/src/components/colors/with-colors.jsx +1 -1
- package/src/components/colors-gradients/control.jsx +2 -2
- package/src/components/colors-gradients/test/{control.jsdom.test.jsx → control.browser.test.jsx} +6 -9
- package/src/components/contrast-checker/index.jsx +2 -2
- package/src/components/date-format-picker/index.jsx +2 -2
- package/src/components/dimensions-tool/aspect-ratio-tool.jsx +4 -4
- package/src/components/dimensions-tool/test/index.jsdom.test.jsx +17 -11
- package/src/components/dimensions-tool/width-height-tool.jsx +2 -2
- package/src/components/font-sizes/with-font-sizes.jsx +2 -3
- package/src/components/global-styles/background-panel.jsx +2 -2
- package/src/components/global-styles/border-panel.jsx +2 -2
- package/src/components/global-styles/color-gradient-dropdown-item.jsx +3 -3
- package/src/components/global-styles/color-panel.jsx +3 -3
- package/src/components/global-styles/dimensions-panel.jsx +6 -6
- package/src/components/global-styles/filters-panel.jsx +2 -2
- package/src/components/global-styles/hooks.js +1 -0
- package/src/components/global-styles/inheritance/index.jsx +9 -6
- package/src/components/global-styles/inheritance/test/{index.jsdom.test.jsx → index.browser.test.jsx} +34 -28
- package/src/components/global-styles/inherited-value-context.js +1 -9
- package/src/components/global-styles/state-control-badges.jsx +0 -1
- package/src/components/global-styles/state-control.jsx +12 -3
- package/src/components/global-styles/style.scss +68 -0
- package/src/components/global-styles/test/{color-panel.jsdom.test.jsx → color-panel.browser.test.jsx} +53 -54
- package/src/components/global-styles/test/inherited-value-context-core.jsdom.test.js +17 -26
- package/src/components/global-styles/test/{typography-panel-core.jsdom.test.jsx → typography-panel-core.browser.test.jsx} +84 -39
- package/src/components/global-styles/test/{typography-panel.jsdom.test.jsx → typography-panel.browser.test.jsx} +80 -122
- package/src/components/global-styles/text-shadow-panel.tsx +257 -0
- package/src/components/global-styles/typography-panel.jsx +52 -13
- package/src/components/global-styles/typography-utils.js +2 -2
- package/src/components/global-styles/utils.js +1 -1
- package/src/components/html-element-control/index.jsx +2 -2
- package/src/components/iframe/index.jsx +1 -1
- package/src/components/iframe/use-scale-canvas.js +1 -1
- package/src/components/image-size-control/index.jsx +2 -2
- package/src/components/inner-blocks/index.jsx +9 -1
- package/src/components/inner-content/index.jsx +1 -1
- package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +7 -33
- package/src/components/inserter/block-patterns-tab/utils.js +44 -0
- package/src/components/inserter/hooks/use-block-types-state.js +2 -2
- package/src/components/inserter/hooks/use-insertion-point.js +1 -1
- package/src/components/inserter/hooks/use-patterns-state.js +1 -1
- package/src/components/inserter/media-tab/media-panel.jsx +9 -9
- package/src/components/inserter/media-tab/media-preview.jsx +1 -1
- package/src/components/inserter-list-item/index.jsx +1 -1
- package/src/components/inserter-list-item/style.scss +2 -2
- package/src/components/inspector-controls/list-view-content-popover.jsx +1 -1
- package/src/components/link-control/search-results.jsx +1 -1
- package/src/components/link-control/style.scss +1 -1
- package/src/components/link-control/test/index.jsdom.test.jsx +38 -110
- package/src/components/link-control/test/keyboard-selection.browser.test.js +110 -0
- package/src/components/link-control/use-search-handler.js +8 -3
- package/src/components/list-view/branch.jsx +1 -1
- package/src/components/list-view/drop-indicator.jsx +3 -3
- package/src/components/list-view/index.jsx +1 -1
- package/src/components/list-view/style.scss +1 -9
- package/src/components/list-view/use-list-view-drop-zone.js +1 -1
- package/src/components/list-view/utils.js +1 -1
- package/src/components/media-replace-flow/index.jsx +4 -1
- package/src/components/navigable-toolbar/test/index.browser.test.js +6 -7
- package/src/components/plain-text/README.md +3 -2
- package/src/components/plain-text/content.scss +0 -1
- package/src/components/plain-text/index.jsx +2 -3
- package/src/components/plain-text/style.scss +4 -0
- package/src/components/preset-input-control/index.jsx +2 -2
- package/src/components/preset-input-control/test/index.jsdom.test.jsx +0 -56
- package/src/components/preset-input-control/test/interaction.browser.test.js +63 -0
- package/src/components/provider/index.jsx +5 -3
- package/src/components/provider/use-block-sync.js +5 -5
- package/src/components/publish-date-time-picker/index.jsx +1 -1
- package/src/components/resizable-box-popover/index.jsx +1 -1
- package/src/components/resolution-tool/index.jsx +2 -2
- package/src/components/responsive-block-control/style.scss +1 -2
- package/src/components/responsive-block-control/test/index.jsdom.test.jsx +2 -2
- package/src/components/rich-text/event-listeners/enter.js +16 -23
- package/src/components/rich-text/format-edit.jsx +1 -1
- package/src/components/rich-text/index.jsx +39 -2
- package/src/components/rich-text/multiline.jsx +11 -3
- package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
- package/src/components/spacing-sizes-control/test/index.jsdom.test.jsx +0 -21
- package/src/components/spacing-sizes-control/test/select.browser.test.js +58 -0
- package/src/components/typewriter/index.jsx +1 -1
- package/src/components/url-input/test/fixtures/validated-input-control-deprecation.js +1 -1
- package/src/components/use-block-commands/index.js +1 -1
- package/src/components/use-block-drop-zone/test/index.js +2 -2
- package/src/components/writing-flow/index.jsx +8 -0
- package/src/components/writing-flow/use-clipboard-handler.js +1 -1
- package/src/components/writing-flow/use-selection-observer.js +15 -6
- package/src/content.scss +1 -0
- package/src/hooks/align.jsx +22 -6
- package/src/hooks/background.jsx +1 -1
- package/src/hooks/block-bindings.jsx +1 -1
- package/src/hooks/block-hooks.scss +0 -6
- package/src/hooks/border.jsx +2 -2
- package/src/hooks/contrast-checker.js +1 -1
- package/src/hooks/dimensions.jsx +2 -2
- package/src/hooks/duotone.jsx +3 -3
- package/src/hooks/elements.jsx +3 -3
- package/src/hooks/fit-text.jsx +1 -1
- package/src/hooks/gap.js +2 -4
- package/src/hooks/index.js +3 -1
- package/src/hooks/layout-child.jsx +3 -4
- package/src/hooks/layout.jsx +17 -18
- package/src/hooks/position.jsx +5 -36
- package/src/hooks/states.jsx +6 -2
- package/src/hooks/test/layout.jsdom.test.js +44 -1
- package/src/hooks/text-shadow.ts +105 -0
- package/src/hooks/typography.jsx +58 -30
- package/src/hooks/utils.jsx +23 -1
- package/src/layouts/grid.jsx +2 -2
- package/src/layouts/test/flex.jsdom.test.jsx +4 -3
- package/src/layouts/test/utils.js +48 -1
- package/src/layouts/utils.js +19 -0
- package/src/private-apis.js +4 -0
- package/src/store/actions.js +50 -10
- package/src/store/private-selectors.js +5 -5
- package/src/store/reducer.js +6 -6
- package/src/store/selectors.js +3 -3
- package/src/store/test/actions.jsdom.test.js +60 -0
- package/src/style.scss +1 -0
- package/src/utils/get-font-styles-and-weights.ts +1 -1
- package/src/utils/transform-styles/index.ts +1 -1
- package/build/hooks/cross-origin-isolation.cjs +0 -56
- package/build/hooks/cross-origin-isolation.cjs.map +0 -7
- package/build-module/hooks/cross-origin-isolation.mjs +0 -54
- package/build-module/hooks/cross-origin-isolation.mjs.map +0 -7
- package/src/components/block-icon/test/__snapshots__/index.jsdom.test.jsx.snap +0 -27
- package/src/components/block-icon/test/index.jsdom.test.jsx +0 -67
- package/src/hooks/cross-origin-isolation.js +0 -73
- package/src/hooks/test/cross-origin-isolation.jsdom.test.js +0 -173
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
5
|
+
import BlockVariationTransforms from '../';
|
|
6
|
+
|
|
7
|
+
globalThis.wpVitest.mockPointerEvent();
|
|
8
|
+
globalThis.wpVitest.mockScrollIntoView();
|
|
9
|
+
|
|
10
|
+
vi.mock( import( '@wordpress/data' ), async ( importOriginal ) => ( {
|
|
11
|
+
...( await importOriginal() ),
|
|
12
|
+
useDispatch: vi.fn(),
|
|
13
|
+
useSelect: vi.fn(),
|
|
14
|
+
} ) );
|
|
15
|
+
|
|
16
|
+
const updateBlockAttributes = vi.fn();
|
|
17
|
+
const variations = [
|
|
18
|
+
{
|
|
19
|
+
name: 'plain',
|
|
20
|
+
title: 'Plain',
|
|
21
|
+
attributes: { className: 'is-style-plain' },
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'decorated',
|
|
25
|
+
title: 'Decorated',
|
|
26
|
+
attributes: { className: 'is-style-decorated' },
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
describe( 'BlockVariationTransforms', () => {
|
|
31
|
+
beforeEach( () => {
|
|
32
|
+
updateBlockAttributes.mockReset();
|
|
33
|
+
useDispatch.mockReturnValue( { updateBlockAttributes } );
|
|
34
|
+
useSelect.mockReturnValue( {
|
|
35
|
+
activeBlockVariation: variations[ 0 ],
|
|
36
|
+
variations,
|
|
37
|
+
canEdit: true,
|
|
38
|
+
isContentOnly: false,
|
|
39
|
+
isSection: false,
|
|
40
|
+
} );
|
|
41
|
+
} );
|
|
42
|
+
|
|
43
|
+
it( 'selects a variation', async () => {
|
|
44
|
+
const user = userEvent.setup();
|
|
45
|
+
render( <BlockVariationTransforms blockClientId="client-id" /> );
|
|
46
|
+
|
|
47
|
+
await user.click(
|
|
48
|
+
screen.getByRole( 'button', { name: 'Transform to variation' } )
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const decoratedVariation = await screen.findByRole( 'menuitemradio', {
|
|
52
|
+
name: 'Decorated',
|
|
53
|
+
} );
|
|
54
|
+
await user.click( decoratedVariation );
|
|
55
|
+
|
|
56
|
+
expect( updateBlockAttributes ).toHaveBeenCalledWith( 'client-id', {
|
|
57
|
+
className: 'is-style-decorated',
|
|
58
|
+
} );
|
|
59
|
+
} );
|
|
60
|
+
|
|
61
|
+
it( 'reflects a variation that becomes active after the first render', async () => {
|
|
62
|
+
const user = userEvent.setup();
|
|
63
|
+
useSelect.mockReturnValue( {
|
|
64
|
+
activeBlockVariation: undefined,
|
|
65
|
+
variations,
|
|
66
|
+
canEdit: true,
|
|
67
|
+
isContentOnly: false,
|
|
68
|
+
isSection: false,
|
|
69
|
+
} );
|
|
70
|
+
const { rerender } = render(
|
|
71
|
+
<BlockVariationTransforms blockClientId="client-id" />
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
await user.click(
|
|
75
|
+
screen.getByRole( 'button', { name: 'Transform to variation' } )
|
|
76
|
+
);
|
|
77
|
+
const plainVariation = await screen.findByRole( 'menuitemradio', {
|
|
78
|
+
name: 'Plain',
|
|
79
|
+
} );
|
|
80
|
+
expect( plainVariation ).not.toBeChecked();
|
|
81
|
+
|
|
82
|
+
useSelect.mockReturnValue( {
|
|
83
|
+
activeBlockVariation: variations[ 0 ],
|
|
84
|
+
variations,
|
|
85
|
+
canEdit: true,
|
|
86
|
+
isContentOnly: false,
|
|
87
|
+
isSection: false,
|
|
88
|
+
} );
|
|
89
|
+
rerender( <BlockVariationTransforms blockClientId="client-id" /> );
|
|
90
|
+
|
|
91
|
+
await waitFor( () => expect( plainVariation ).toBeChecked() );
|
|
92
|
+
} );
|
|
93
|
+
} );
|
|
@@ -123,13 +123,13 @@ export default function BlockVisibilityModal( { clientIds, onClose } ) {
|
|
|
123
123
|
const message =
|
|
124
124
|
blocks?.length > 1
|
|
125
125
|
? // translators: %s: The shortcut key to access the List View.
|
|
126
|
-
|
|
126
|
+
__(
|
|
127
127
|
'Blocks hidden. You can access them via the List View (%s).'
|
|
128
|
-
|
|
128
|
+
)
|
|
129
129
|
: // translators: %s: The shortcut key to access the List View.
|
|
130
|
-
|
|
130
|
+
__(
|
|
131
131
|
'Block hidden. You can access it via the List View (%s).'
|
|
132
|
-
|
|
132
|
+
);
|
|
133
133
|
|
|
134
134
|
return sprintf( message, listViewShortcut );
|
|
135
135
|
}, [ hideEverywhere, blocks?.length, listViewShortcut ] );
|
|
@@ -185,7 +185,7 @@ export default function BlockVisibilityModal( { clientIds, onClose } ) {
|
|
|
185
185
|
},
|
|
186
186
|
{}
|
|
187
187
|
),
|
|
188
|
-
|
|
188
|
+
};
|
|
189
189
|
const attributesByClientId = Object.fromEntries(
|
|
190
190
|
blocks.map( ( { clientId, attributes } ) => [
|
|
191
191
|
clientId,
|
|
@@ -239,10 +239,10 @@ export default function BlockVisibilityModal( { clientIds, onClose } ) {
|
|
|
239
239
|
{ hasMultipleBlocks
|
|
240
240
|
? __(
|
|
241
241
|
'Select the viewport sizes for which you want to hide the blocks. Changes will apply to all selected blocks.'
|
|
242
|
-
|
|
242
|
+
)
|
|
243
243
|
: __(
|
|
244
244
|
'Select the viewport size for which you want to hide the block.'
|
|
245
|
-
|
|
245
|
+
) }
|
|
246
246
|
</legend>
|
|
247
247
|
<ul className="block-editor-block-visibility-modal__options">
|
|
248
248
|
<li className="block-editor-block-visibility-modal__options-item block-editor-block-visibility-modal__options-item--everywhere">
|
|
@@ -82,13 +82,11 @@ export default function ViewportVisibilityInfo( { clientId } ) {
|
|
|
82
82
|
[ clientId, currentViewport ]
|
|
83
83
|
);
|
|
84
84
|
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
)
|
|
91
|
-
) {
|
|
85
|
+
if ( ! (
|
|
86
|
+
isBlockCurrentlyHidden ||
|
|
87
|
+
hasParentHiddenEverywhere ||
|
|
88
|
+
isBlockParentHiddenAtViewport
|
|
89
|
+
) ) {
|
|
92
90
|
return null;
|
|
93
91
|
}
|
|
94
92
|
|
|
@@ -40,7 +40,7 @@ function useBorderRadiusSizes( presets ) {
|
|
|
40
40
|
size: undefined,
|
|
41
41
|
},
|
|
42
42
|
...sizes,
|
|
43
|
-
|
|
43
|
+
]
|
|
44
44
|
: sizes;
|
|
45
45
|
}, [ customSizes, themeSizes, defaultSizes ] );
|
|
46
46
|
}
|
|
@@ -110,7 +110,7 @@ function createCornerChangeHandler( corner, values, onChange ) {
|
|
|
110
110
|
topRight: values,
|
|
111
111
|
bottomLeft: values,
|
|
112
112
|
bottomRight: values,
|
|
113
|
-
|
|
113
|
+
};
|
|
114
114
|
|
|
115
115
|
onChange( {
|
|
116
116
|
...currentValues,
|
|
@@ -25,7 +25,6 @@ import BorderRadiusControl from '../index';
|
|
|
25
25
|
|
|
26
26
|
globalThis.wpVitest.mockMatchMedia();
|
|
27
27
|
|
|
28
|
-
globalThis.wpVitest.mockVisibleElements();
|
|
29
28
|
globalThis.wpVitest.mockScrollIntoView();
|
|
30
29
|
|
|
31
30
|
describe( 'BorderRadiusControl', () => {
|
|
@@ -483,27 +482,6 @@ describe( 'BorderRadiusControl', () => {
|
|
|
483
482
|
expect( combobox ).toHaveTextContent( 'Default' );
|
|
484
483
|
} );
|
|
485
484
|
} );
|
|
486
|
-
|
|
487
|
-
it( 'can interact with select dropdown options', async () => {
|
|
488
|
-
const user = userEvent.setup();
|
|
489
|
-
|
|
490
|
-
render(
|
|
491
|
-
<BorderRadiusControl
|
|
492
|
-
onChange={ mockOnChange }
|
|
493
|
-
values={ undefined }
|
|
494
|
-
presets={ largePresetSet }
|
|
495
|
-
/>
|
|
496
|
-
);
|
|
497
|
-
|
|
498
|
-
// Click on the combobox to open dropdown
|
|
499
|
-
const combobox = screen.getByRole( 'combobox' );
|
|
500
|
-
await user.click( combobox );
|
|
501
|
-
|
|
502
|
-
// Should show preset options in the dropdown
|
|
503
|
-
await waitFor( () => {
|
|
504
|
-
expect( screen.getByText( 'Size 1' ) ).toBeInTheDocument();
|
|
505
|
-
} );
|
|
506
|
-
} );
|
|
507
485
|
} );
|
|
508
486
|
|
|
509
487
|
describe( 'Edge Cases and Error Handling', () => {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { page, userEvent } from 'vitest/browser';
|
|
3
|
+
import { render } from 'vitest-browser-react';
|
|
4
|
+
import { createElement } from '@wordpress/element';
|
|
5
|
+
import BorderRadiusControl from '../index';
|
|
6
|
+
|
|
7
|
+
describe( 'BorderRadiusControl large preset sets', () => {
|
|
8
|
+
it( 'can interact with select dropdown options', async () => {
|
|
9
|
+
const user = userEvent.setup();
|
|
10
|
+
const presets = {
|
|
11
|
+
default: Array.from( { length: 15 }, ( _, index ) => ( {
|
|
12
|
+
name: `Size ${ index }`,
|
|
13
|
+
slug: `size-${ index }`,
|
|
14
|
+
size: `${ index * 2 }px`,
|
|
15
|
+
} ) ),
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
await render(
|
|
19
|
+
createElement( BorderRadiusControl, {
|
|
20
|
+
onChange: vi.fn(),
|
|
21
|
+
values: undefined,
|
|
22
|
+
presets,
|
|
23
|
+
} )
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
await user.click( page.getByRole( 'combobox' ) );
|
|
27
|
+
|
|
28
|
+
await expect.element( page.getByText( 'Size 1' ) ).toBeVisible();
|
|
29
|
+
} );
|
|
30
|
+
} );
|
|
@@ -23,7 +23,7 @@ export default createHigherOrderComponent( ( WrappedComponent ) => {
|
|
|
23
23
|
...( themeColors || [] ),
|
|
24
24
|
...( defaultColors || [] ),
|
|
25
25
|
...( customColors || [] ),
|
|
26
|
-
|
|
26
|
+
]
|
|
27
27
|
: [ ...( themeColors || [] ), ...( customColors || [] ) ];
|
|
28
28
|
|
|
29
29
|
const { colors = _colors, disableCustomColors = ! enableCustomColors } =
|
|
@@ -56,7 +56,7 @@ function ColorGradientControlInner( {
|
|
|
56
56
|
? ( newColor, _index, newSlug ) => {
|
|
57
57
|
onColorChange( newColor, newSlug );
|
|
58
58
|
onGradientChange();
|
|
59
|
-
|
|
59
|
+
}
|
|
60
60
|
: ( newColor, _index, newSlug ) => onColorChange( newColor, newSlug );
|
|
61
61
|
|
|
62
62
|
const colorPalette = (
|
|
@@ -98,7 +98,7 @@ function ColorGradientControlInner( {
|
|
|
98
98
|
? ( newGradient, _index, newSlug ) => {
|
|
99
99
|
onGradientChange( newGradient, newSlug );
|
|
100
100
|
onColorChange();
|
|
101
|
-
|
|
101
|
+
}
|
|
102
102
|
: ( newGradient, _index, newSlug ) =>
|
|
103
103
|
onGradientChange( newGradient, newSlug )
|
|
104
104
|
}
|
package/src/components/colors-gradients/test/{control.jsdom.test.jsx → control.browser.test.jsx}
RENAMED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { userEvent } from 'vitest/browser';
|
|
2
3
|
import { screen } from '@testing-library/react';
|
|
3
|
-
import {
|
|
4
|
+
import { render } from 'vitest-browser-react';
|
|
4
5
|
import ColorGradientControl from '../control';
|
|
5
6
|
|
|
6
|
-
globalThis.wpVitest.mockMatchMedia();
|
|
7
|
-
|
|
8
|
-
globalThis.wpVitest.mockResizeObserver();
|
|
9
|
-
|
|
10
7
|
const noop = () => {};
|
|
11
8
|
|
|
12
9
|
describe( 'ColorPaletteControl', () => {
|
|
@@ -53,7 +50,7 @@ describe( 'ColorPaletteControl', () => {
|
|
|
53
50
|
} );
|
|
54
51
|
|
|
55
52
|
it( 'renders the color picker and does not render tabs if it is only possible to select a color', async () => {
|
|
56
|
-
render(
|
|
53
|
+
await render(
|
|
57
54
|
<ColorGradientControl
|
|
58
55
|
label="Test Color Gradient"
|
|
59
56
|
colorValue="#f00"
|
|
@@ -82,7 +79,7 @@ describe( 'ColorPaletteControl', () => {
|
|
|
82
79
|
} );
|
|
83
80
|
|
|
84
81
|
it( 'renders the gradient picker and does not render tabs if it is only possible to select a gradient', async () => {
|
|
85
|
-
render(
|
|
82
|
+
await render(
|
|
86
83
|
<ColorGradientControl
|
|
87
84
|
label="Test Color Gradient"
|
|
88
85
|
colorValue="#f00"
|
|
@@ -182,7 +179,7 @@ describe( 'ColorPaletteControl', () => {
|
|
|
182
179
|
|
|
183
180
|
const options = screen.getAllByRole( 'option' );
|
|
184
181
|
// Click the second swatch: color='#000', slug='dark-text'.
|
|
185
|
-
await click( options[ 1 ] );
|
|
182
|
+
await userEvent.click( options[ 1 ] );
|
|
186
183
|
|
|
187
184
|
expect( onColorChange ).toHaveBeenCalledWith( '#000', 'dark-text' );
|
|
188
185
|
} );
|
|
@@ -214,7 +211,7 @@ describe( 'ColorPaletteControl', () => {
|
|
|
214
211
|
// When both colors and gradients are available the color tab is shown
|
|
215
212
|
// by default (no gradientValue). Click the first color swatch.
|
|
216
213
|
const options = screen.getAllByRole( 'option' );
|
|
217
|
-
await click( options[ 0 ] );
|
|
214
|
+
await userEvent.click( options[ 0 ] );
|
|
218
215
|
|
|
219
216
|
// First entry: color='#000', slug='dark-background'.
|
|
220
217
|
expect( onColorChange ).toHaveBeenCalledWith(
|
|
@@ -111,14 +111,14 @@ export function getContrastWarning( {
|
|
|
111
111
|
'This color combination may be hard for people to read. Try using a darker background color and/or a brighter %s.'
|
|
112
112
|
),
|
|
113
113
|
item.description
|
|
114
|
-
|
|
114
|
+
)
|
|
115
115
|
: sprintf(
|
|
116
116
|
// translators: %s is a type of text color, e.g., "text color" or "link color".
|
|
117
117
|
__(
|
|
118
118
|
'This color combination may be hard for people to read. Try using a brighter background color and/or a darker %s.'
|
|
119
119
|
),
|
|
120
120
|
item.description
|
|
121
|
-
|
|
121
|
+
);
|
|
122
122
|
speakMessage = __(
|
|
123
123
|
'This color combination may be hard for people to read.'
|
|
124
124
|
);
|
|
@@ -125,9 +125,9 @@ function NonDefaultControls( { format, onChange } ) {
|
|
|
125
125
|
value={
|
|
126
126
|
isCustom
|
|
127
127
|
? customOption
|
|
128
|
-
: suggestedOptions.find(
|
|
128
|
+
: ( suggestedOptions.find(
|
|
129
129
|
( option ) => option.format === format
|
|
130
|
-
|
|
130
|
+
) ?? customOption )
|
|
131
131
|
}
|
|
132
132
|
onChange={ ( { selectedItem } ) => {
|
|
133
133
|
if ( selectedItem === customOption ) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SelectControl } from '@wordpress/components';
|
|
1
|
+
import { SelectControl as WCSelectControl } from '@wordpress/components';
|
|
2
2
|
import { __, _x } from '@wordpress/i18n';
|
|
3
3
|
import { useSettings } from '../use-settings';
|
|
4
4
|
import { InheritanceToolsPanelItem } from '../global-styles/inheritance';
|
|
@@ -84,8 +84,8 @@ export default function AspectRatioTool( {
|
|
|
84
84
|
const displayValue =
|
|
85
85
|
value === undefined || value === null || value === 'auto'
|
|
86
86
|
? 'auto'
|
|
87
|
-
: findAspectRatioOption( value, resolvedOptions )?.value ??
|
|
88
|
-
|
|
87
|
+
: ( findAspectRatioOption( value, resolvedOptions )?.value ??
|
|
88
|
+
'custom' );
|
|
89
89
|
|
|
90
90
|
return (
|
|
91
91
|
<InheritanceToolsPanelItem
|
|
@@ -100,7 +100,7 @@ export default function AspectRatioTool( {
|
|
|
100
100
|
isShownByDefault={ isShownByDefault }
|
|
101
101
|
panelId={ panelId }
|
|
102
102
|
>
|
|
103
|
-
<
|
|
103
|
+
<WCSelectControl
|
|
104
104
|
label={ __( 'Aspect ratio' ) }
|
|
105
105
|
value={ displayValue }
|
|
106
106
|
options={ resolvedOptions }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
-
import { act, render, screen } from '@testing-library/react';
|
|
2
|
+
import { act, render, screen, waitFor } from '@testing-library/react';
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
|
4
4
|
import { __experimentalToolsPanel as ToolsPanel } from '@wordpress/components';
|
|
5
5
|
import { useEffect, useState } from '@wordpress/element';
|
|
@@ -135,7 +135,7 @@ describe( 'DimensionsTool', () => {
|
|
|
135
135
|
expect( aspectRatioSelect ).toHaveValue( 'auto' );
|
|
136
136
|
} );
|
|
137
137
|
|
|
138
|
-
it( 'displays an aspect ratio that is written differently to the option with the same ratio', () => {
|
|
138
|
+
it( 'displays an aspect ratio that is written differently to the option with the same ratio', async () => {
|
|
139
139
|
const onChange = vi.fn();
|
|
140
140
|
const { rerender } = render(
|
|
141
141
|
<ControlledExample
|
|
@@ -155,10 +155,12 @@ describe( 'DimensionsTool', () => {
|
|
|
155
155
|
onChange={ onChange }
|
|
156
156
|
/>
|
|
157
157
|
);
|
|
158
|
-
|
|
158
|
+
await waitFor( () =>
|
|
159
|
+
expect( aspectRatioSelect ).toHaveValue( '16/9' )
|
|
160
|
+
);
|
|
159
161
|
} );
|
|
160
162
|
|
|
161
|
-
it( 'displays an aspect ratio without a matching option as custom', () => {
|
|
163
|
+
it( 'displays an aspect ratio without a matching option as custom', async () => {
|
|
162
164
|
const onChange = vi.fn();
|
|
163
165
|
render(
|
|
164
166
|
<ControlledExample
|
|
@@ -167,12 +169,14 @@ describe( 'DimensionsTool', () => {
|
|
|
167
169
|
/>
|
|
168
170
|
);
|
|
169
171
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
172
|
+
await waitFor( () =>
|
|
173
|
+
expect(
|
|
174
|
+
screen.getByRole( 'combobox', { name: 'Aspect ratio' } )
|
|
175
|
+
).toHaveValue( 'custom' )
|
|
176
|
+
);
|
|
173
177
|
} );
|
|
174
178
|
|
|
175
|
-
it( 'updates the scale control when the value prop changes', () => {
|
|
179
|
+
it( 'updates the scale control when the value prop changes', async () => {
|
|
176
180
|
const onChange = vi.fn();
|
|
177
181
|
const { rerender } = render(
|
|
178
182
|
<ControlledExample
|
|
@@ -192,9 +196,11 @@ describe( 'DimensionsTool', () => {
|
|
|
192
196
|
/>
|
|
193
197
|
);
|
|
194
198
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
199
|
+
await waitFor( () =>
|
|
200
|
+
expect(
|
|
201
|
+
screen.getByRole( 'radio', { name: 'Contain' } )
|
|
202
|
+
).toBeChecked()
|
|
203
|
+
);
|
|
198
204
|
} );
|
|
199
205
|
} );
|
|
200
206
|
|
|
@@ -44,8 +44,8 @@ export default function WidthHeightTool( {
|
|
|
44
44
|
isShownByDefault = true,
|
|
45
45
|
} ) {
|
|
46
46
|
// null, undefined, and 'auto' all represent the default value.
|
|
47
|
-
const width = value.width === 'auto' ? '' : value.width ?? '';
|
|
48
|
-
const height = value.height === 'auto' ? '' : value.height ?? '';
|
|
47
|
+
const width = value.width === 'auto' ? '' : ( value.width ?? '' );
|
|
48
|
+
const height = value.height === 'auto' ? '' : ( value.height ?? '' );
|
|
49
49
|
|
|
50
50
|
const onDimensionChange = ( dimension ) => ( nextDimension ) => {
|
|
51
51
|
const nextValue = { ...value };
|
|
@@ -33,9 +33,8 @@ export default ( ...fontSizeNames ) => {
|
|
|
33
33
|
*/
|
|
34
34
|
const fontSizeAttributeNames = fontSizeNames.reduce(
|
|
35
35
|
( fontSizeAttributeNamesAccumulator, fontSizeAttributeName ) => {
|
|
36
|
-
fontSizeAttributeNamesAccumulator[
|
|
37
|
-
fontSizeAttributeName
|
|
38
|
-
] = `custom${ upperFirst( fontSizeAttributeName ) }`;
|
|
36
|
+
fontSizeAttributeNamesAccumulator[ fontSizeAttributeName ] =
|
|
37
|
+
`custom${ upperFirst( fontSizeAttributeName ) }`;
|
|
39
38
|
return fontSizeAttributeNamesAccumulator;
|
|
40
39
|
},
|
|
41
40
|
{}
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
getInheritanceProps,
|
|
16
16
|
InheritanceToolsPanelItem,
|
|
17
|
-
|
|
17
|
+
isGlobalStylesInheritanceIndicatorUIEnabled,
|
|
18
18
|
} from './inheritance';
|
|
19
19
|
|
|
20
20
|
const DEFAULT_CONTROLS = {
|
|
@@ -163,7 +163,7 @@ export default function BackgroundImagePanel( {
|
|
|
163
163
|
defaultValues = {},
|
|
164
164
|
headerLabel = __( 'Background' ),
|
|
165
165
|
contrastWarning,
|
|
166
|
-
showInheritanceLabelIndicators =
|
|
166
|
+
showInheritanceLabelIndicators = isGlobalStylesInheritanceIndicatorUIEnabled(),
|
|
167
167
|
} ) {
|
|
168
168
|
const {
|
|
169
169
|
colors,
|
|
@@ -16,7 +16,7 @@ import { ShadowPopover, useShadowPresets } from './shadow-panel-components';
|
|
|
16
16
|
import {
|
|
17
17
|
getInheritanceProps,
|
|
18
18
|
InheritanceToolsPanelItem,
|
|
19
|
-
|
|
19
|
+
isGlobalStylesInheritanceIndicatorUIEnabled,
|
|
20
20
|
} from './inheritance';
|
|
21
21
|
|
|
22
22
|
export function useHasBorderPanel( settings ) {
|
|
@@ -98,7 +98,7 @@ export default function BorderPanel( {
|
|
|
98
98
|
settings,
|
|
99
99
|
panelId,
|
|
100
100
|
defaultControls = DEFAULT_CONTROLS,
|
|
101
|
-
showInheritanceLabelIndicators =
|
|
101
|
+
showInheritanceLabelIndicators = isGlobalStylesInheritanceIndicatorUIEnabled(),
|
|
102
102
|
} ) {
|
|
103
103
|
const colors = useColorsPerOrigin( settings );
|
|
104
104
|
const areCustomSolidsEnabled = settings?.color?.custom;
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
getInheritanceProps,
|
|
20
20
|
InheritanceResetButton,
|
|
21
21
|
InheritanceToolsPanelItem,
|
|
22
|
-
|
|
22
|
+
isGlobalStylesInheritanceIndicatorUIEnabled,
|
|
23
23
|
} from './inheritance';
|
|
24
24
|
|
|
25
25
|
const { Tabs } = unlock( componentsPrivateApis );
|
|
@@ -180,7 +180,7 @@ function ColorGradientTab( {
|
|
|
180
180
|
spokenMessage: null,
|
|
181
181
|
className:
|
|
182
182
|
'block-editor-panel-color-gradient-settings__contrast-notice',
|
|
183
|
-
|
|
183
|
+
}
|
|
184
184
|
: undefined
|
|
185
185
|
}
|
|
186
186
|
/>
|
|
@@ -203,7 +203,7 @@ export default function ColorGradientDropdownItem( {
|
|
|
203
203
|
className = 'block-editor-tools-panel-color-gradient-settings__item',
|
|
204
204
|
isPlaceholder = false,
|
|
205
205
|
hasInheritedValue = false,
|
|
206
|
-
showInheritanceLabelIndicators =
|
|
206
|
+
showInheritanceLabelIndicators = isGlobalStylesInheritanceIndicatorUIEnabled(),
|
|
207
207
|
} ) {
|
|
208
208
|
const colorGradientDropdownButtonRef = useRef( undefined );
|
|
209
209
|
const itemClassName = clsx( 'block-editor-color-gradient-item', className );
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
extractPresetSlug,
|
|
15
15
|
encodeColorValueWithPalette,
|
|
16
16
|
} from '../../utils/color-values';
|
|
17
|
-
import {
|
|
17
|
+
import { isGlobalStylesInheritanceIndicatorUIEnabled } from './inheritance';
|
|
18
18
|
|
|
19
19
|
// Despite the "ColorPanel" name, this gates only the element-level color
|
|
20
20
|
// controls (link, heading, button, caption, h1–h6) — surfaced as the
|
|
@@ -143,7 +143,7 @@ export default function ColorPanel( {
|
|
|
143
143
|
children,
|
|
144
144
|
contrastWarning,
|
|
145
145
|
additionalElements,
|
|
146
|
-
showInheritanceLabelIndicators =
|
|
146
|
+
showInheritanceLabelIndicators = isGlobalStylesInheritanceIndicatorUIEnabled(),
|
|
147
147
|
} ) {
|
|
148
148
|
const {
|
|
149
149
|
colors,
|
|
@@ -477,7 +477,7 @@ export default function ColorPanel( {
|
|
|
477
477
|
elementGradient ??
|
|
478
478
|
elementBackgroundUserColor ??
|
|
479
479
|
elementBackgroundColor,
|
|
480
|
-
|
|
480
|
+
]
|
|
481
481
|
: [ elementTextUserColor ?? elementTextColor ],
|
|
482
482
|
isPlaceholder: isElementPlaceholder,
|
|
483
483
|
hasInheritedValue: hasElementInheritedValue,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
import {
|
|
26
26
|
getInheritanceProps,
|
|
27
27
|
InheritanceToolsPanelItem,
|
|
28
|
-
|
|
28
|
+
isGlobalStylesInheritanceIndicatorUIEnabled,
|
|
29
29
|
} from './inheritance';
|
|
30
30
|
|
|
31
31
|
const AXIAL_SIDES = [ 'horizontal', 'vertical' ];
|
|
@@ -349,7 +349,7 @@ export default function DimensionsPanel( {
|
|
|
349
349
|
includeLayoutControls = false,
|
|
350
350
|
allowAxialBlockGap = true,
|
|
351
351
|
styleState = DEFAULT_BLOCK_STYLE_STATE,
|
|
352
|
-
showInheritanceLabelIndicators =
|
|
352
|
+
showInheritanceLabelIndicators = isGlobalStylesInheritanceIndicatorUIEnabled(),
|
|
353
353
|
} ) {
|
|
354
354
|
const { dimensions, spacing } = settings;
|
|
355
355
|
|
|
@@ -789,7 +789,7 @@ export default function DimensionsPanel( {
|
|
|
789
789
|
isContentSizePlaceholder
|
|
790
790
|
? getNumericPlaceholder(
|
|
791
791
|
inheritedContentSizeValue
|
|
792
|
-
|
|
792
|
+
)
|
|
793
793
|
: undefined
|
|
794
794
|
}
|
|
795
795
|
onChange={ ( nextContentSize ) => {
|
|
@@ -832,7 +832,7 @@ export default function DimensionsPanel( {
|
|
|
832
832
|
isWideSizePlaceholder
|
|
833
833
|
? getNumericPlaceholder(
|
|
834
834
|
inheritedWideSizeValue
|
|
835
|
-
|
|
835
|
+
)
|
|
836
836
|
: undefined
|
|
837
837
|
}
|
|
838
838
|
onChange={ ( nextWideSize ) => {
|
|
@@ -1069,7 +1069,7 @@ export default function DimensionsPanel( {
|
|
|
1069
1069
|
isMinHeightPlaceholder
|
|
1070
1070
|
? getNumericPlaceholder(
|
|
1071
1071
|
inheritedMinHeightValue
|
|
1072
|
-
|
|
1072
|
+
)
|
|
1073
1073
|
: undefined
|
|
1074
1074
|
}
|
|
1075
1075
|
dimensionSizes={ dimensions?.dimensionSizes }
|
|
@@ -1103,7 +1103,7 @@ export default function DimensionsPanel( {
|
|
|
1103
1103
|
isMinWidthPlaceholder
|
|
1104
1104
|
? getNumericPlaceholder(
|
|
1105
1105
|
inheritedMinWidthValue
|
|
1106
|
-
|
|
1106
|
+
)
|
|
1107
1107
|
: undefined
|
|
1108
1108
|
}
|
|
1109
1109
|
dimensionSizes={ dimensions?.dimensionSizes }
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
getInheritanceProps,
|
|
27
27
|
InheritanceToolsPanelItem,
|
|
28
28
|
InheritanceResetButton,
|
|
29
|
-
|
|
29
|
+
isGlobalStylesInheritanceIndicatorUIEnabled,
|
|
30
30
|
} from './inheritance';
|
|
31
31
|
|
|
32
32
|
const EMPTY_ARRAY = [];
|
|
@@ -179,7 +179,7 @@ export default function FiltersPanel( {
|
|
|
179
179
|
settings,
|
|
180
180
|
panelId,
|
|
181
181
|
defaultControls = DEFAULT_CONTROLS,
|
|
182
|
-
showInheritanceLabelIndicators =
|
|
182
|
+
showInheritanceLabelIndicators = isGlobalStylesInheritanceIndicatorUIEnabled(),
|
|
183
183
|
} ) {
|
|
184
184
|
const decodeValue = ( rawValue ) =>
|
|
185
185
|
getValueFromVariable( { settings }, '', rawValue );
|