@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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useSelect } from '@wordpress/data';
|
|
2
2
|
import { useLayout } from '../block-list/layout';
|
|
3
|
+
import { useSettings } from '../use-settings';
|
|
3
4
|
import { store as blockEditorStore } from '../../store';
|
|
4
5
|
import { getLayoutType } from '../../layouts';
|
|
5
6
|
|
|
@@ -7,6 +8,32 @@ const EMPTY_ARRAY = [];
|
|
|
7
8
|
const DEFAULT_CONTROLS = [ 'none', 'left', 'center', 'right', 'wide', 'full' ];
|
|
8
9
|
const WIDE_CONTROLS = [ 'wide', 'full' ];
|
|
9
10
|
|
|
11
|
+
function useAlignmentSettings( isNoneOnly ) {
|
|
12
|
+
return useSelect(
|
|
13
|
+
( select ) => {
|
|
14
|
+
// If `isNoneOnly` is true, we'll be returning early because there is
|
|
15
|
+
// nothing to filter on an empty array. We won't need the info from
|
|
16
|
+
// the `useSelect` but we must call it anyway because Rules of Hooks.
|
|
17
|
+
// So the callback returns early to avoid block editor subscription.
|
|
18
|
+
if ( isNoneOnly ) {
|
|
19
|
+
return {
|
|
20
|
+
wideControlsEnabled: false,
|
|
21
|
+
themeSupportsLayout: false,
|
|
22
|
+
isBlockBasedTheme: false,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const settings = select( blockEditorStore ).getSettings();
|
|
27
|
+
return {
|
|
28
|
+
wideControlsEnabled: settings.alignWide ?? false,
|
|
29
|
+
themeSupportsLayout: settings.supportsLayout,
|
|
30
|
+
isBlockBasedTheme: settings.__unstableIsBlockBasedTheme,
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
[ isNoneOnly ]
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
10
37
|
export default function useAvailableAlignments( controls = DEFAULT_CONTROLS ) {
|
|
11
38
|
// Always add the `none` option if not exists.
|
|
12
39
|
if ( ! controls.includes( 'none' ) ) {
|
|
@@ -14,32 +41,34 @@ export default function useAvailableAlignments( controls = DEFAULT_CONTROLS ) {
|
|
|
14
41
|
}
|
|
15
42
|
const isNoneOnly = controls.length === 1 && controls[ 0 ] === 'none';
|
|
16
43
|
|
|
17
|
-
const
|
|
18
|
-
useSelect(
|
|
19
|
-
( select ) => {
|
|
20
|
-
// If `isNoneOnly` is true, we'll be returning early because there is
|
|
21
|
-
// nothing to filter on an empty array. We won't need the info from
|
|
22
|
-
// the `useSelect` but we must call it anyway because Rules of Hooks.
|
|
23
|
-
// So the callback returns early to avoid block editor subscription.
|
|
24
|
-
if ( isNoneOnly ) {
|
|
25
|
-
return [ false, false, false ];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const settings = select( blockEditorStore ).getSettings();
|
|
29
|
-
return [
|
|
30
|
-
settings.alignWide ?? false,
|
|
31
|
-
settings.supportsLayout,
|
|
32
|
-
settings.__unstableIsBlockBasedTheme,
|
|
33
|
-
];
|
|
34
|
-
},
|
|
35
|
-
[ isNoneOnly ]
|
|
36
|
-
);
|
|
44
|
+
const settings = useAlignmentSettings( isNoneOnly );
|
|
37
45
|
const layout = useLayout();
|
|
38
46
|
|
|
39
47
|
if ( isNoneOnly ) {
|
|
40
48
|
return EMPTY_ARRAY;
|
|
41
49
|
}
|
|
42
50
|
|
|
51
|
+
return getAvailableAlignments( controls, layout, settings );
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The store-free part of `useAvailableAlignments`, so the same rules can be
|
|
56
|
+
* evaluated against more than one layout without a subscription for each.
|
|
57
|
+
*
|
|
58
|
+
* @param {string[]} controls Alignments the block supports, including `none`.
|
|
59
|
+
* @param {Object} layout Layout to evaluate against.
|
|
60
|
+
* @param {Object} settings Editor settings from `useAlignmentSettings`.
|
|
61
|
+
* @param {boolean} settings.wideControlsEnabled Whether the theme enables wide alignments.
|
|
62
|
+
* @param {boolean} settings.themeSupportsLayout Whether the theme supports the layout config.
|
|
63
|
+
* @param {boolean} settings.isBlockBasedTheme Whether the theme is block based.
|
|
64
|
+
*
|
|
65
|
+
* @return {Object[]} The alignments the layout offers.
|
|
66
|
+
*/
|
|
67
|
+
function getAvailableAlignments(
|
|
68
|
+
controls,
|
|
69
|
+
layout,
|
|
70
|
+
{ wideControlsEnabled, themeSupportsLayout, isBlockBasedTheme }
|
|
71
|
+
) {
|
|
43
72
|
const layoutType = getLayoutType( layout?.type );
|
|
44
73
|
|
|
45
74
|
if ( themeSupportsLayout ) {
|
|
@@ -85,3 +114,60 @@ export default function useAvailableAlignments( controls = DEFAULT_CONTROLS ) {
|
|
|
85
114
|
|
|
86
115
|
return alignments;
|
|
87
116
|
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Returns the alignments a block supports, split into the ones the parent
|
|
120
|
+
* layout offers (`enabled`) and the wide alignments it does not (`unavailable`).
|
|
121
|
+
*
|
|
122
|
+
* An alignment is only `unavailable` when the block supports it, the theme
|
|
123
|
+
* offers it at the root, and the parent layout does not. The theme check is
|
|
124
|
+
* measured against the global layout settings, so a theme that sets no wide
|
|
125
|
+
* size, or no layout at all, is curating its own options rather than
|
|
126
|
+
* withholding them. Flex and Grid parents never offer alignments to anything,
|
|
127
|
+
* so under those both lists are empty.
|
|
128
|
+
*
|
|
129
|
+
* @param {string[]} controls Alignments the block supports.
|
|
130
|
+
*
|
|
131
|
+
* @return {{enabled: Object[], unavailable: string[]}} The split alignments.
|
|
132
|
+
*/
|
|
133
|
+
export function useAlignmentMenu( controls = DEFAULT_CONTROLS ) {
|
|
134
|
+
// Always add the `none` option if not exists.
|
|
135
|
+
if ( ! controls.includes( 'none' ) ) {
|
|
136
|
+
controls = [ 'none', ...controls ];
|
|
137
|
+
}
|
|
138
|
+
const isNoneOnly = controls.length === 1 && controls[ 0 ] === 'none';
|
|
139
|
+
|
|
140
|
+
const settings = useAlignmentSettings( isNoneOnly );
|
|
141
|
+
const layout = useLayout();
|
|
142
|
+
const [ globalLayout ] = useSettings( 'layout' );
|
|
143
|
+
|
|
144
|
+
if ( isNoneOnly ) {
|
|
145
|
+
return { enabled: EMPTY_ARRAY, unavailable: EMPTY_ARRAY };
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const enabled = getAvailableAlignments( controls, layout, settings );
|
|
149
|
+
const layoutOffersAlignments = !! getAvailableAlignments(
|
|
150
|
+
DEFAULT_CONTROLS,
|
|
151
|
+
layout,
|
|
152
|
+
settings
|
|
153
|
+
).length;
|
|
154
|
+
|
|
155
|
+
if ( ! layoutOffersAlignments ) {
|
|
156
|
+
return { enabled, unavailable: EMPTY_ARRAY };
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const themeNames = getAvailableAlignments(
|
|
160
|
+
DEFAULT_CONTROLS,
|
|
161
|
+
{ ...globalLayout, type: 'constrained' },
|
|
162
|
+
settings
|
|
163
|
+
).map( ( { name } ) => name );
|
|
164
|
+
const enabledNames = enabled.map( ( { name } ) => name );
|
|
165
|
+
const unavailable = controls.filter(
|
|
166
|
+
( name ) =>
|
|
167
|
+
WIDE_CONTROLS.includes( name ) &&
|
|
168
|
+
themeNames.includes( name ) &&
|
|
169
|
+
! enabledNames.includes( name )
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
return { enabled, unavailable };
|
|
173
|
+
}
|
|
@@ -36,7 +36,7 @@ export default function BlockAllowedBlocksControl( { clientId } ) {
|
|
|
36
36
|
? filteredBlockTypes
|
|
37
37
|
: filteredBlockTypes.filter( ( blockType ) =>
|
|
38
38
|
selectedBlockNames.includes( blockType.name )
|
|
39
|
-
|
|
39
|
+
);
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
42
|
<div className="block-editor-block-allowed-blocks-control">
|
|
@@ -9,19 +9,18 @@ import {
|
|
|
9
9
|
__experimentalText as WCText,
|
|
10
10
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
11
11
|
__experimentalVStack as VStack,
|
|
12
|
-
privateApis as componentsPrivateApis,
|
|
13
12
|
} from '@wordpress/components';
|
|
14
13
|
import { useSelect } from '@wordpress/data';
|
|
15
14
|
import { useContext } from '@wordpress/element';
|
|
16
15
|
import { useViewportMatch } from '@wordpress/compose';
|
|
16
|
+
// eslint-disable-next-line @wordpress/use-recommended-components -- Intentional early adoption of the new Menu, pending WordPress/gutenberg#76135.
|
|
17
|
+
import { Menu } from '@wordpress/ui';
|
|
17
18
|
import BlockContext from '../block-context';
|
|
18
19
|
import BlockBindingsSourceFieldsList from './source-fields-list';
|
|
19
20
|
import useBlockBindingsUtils from './use-block-bindings-utils';
|
|
20
21
|
import { unlock } from '../../lock-unlock';
|
|
21
22
|
import { store as blockEditorStore } from '../../store';
|
|
22
23
|
|
|
23
|
-
const { Menu } = unlock( componentsPrivateApis );
|
|
24
|
-
|
|
25
24
|
/**
|
|
26
25
|
* Renders a control for viewing and editing a block attribute binding.
|
|
27
26
|
*
|
|
@@ -132,11 +131,8 @@ export default function BlockBindingsAttributeControl( {
|
|
|
132
131
|
} )
|
|
133
132
|
}
|
|
134
133
|
>
|
|
135
|
-
<Menu
|
|
136
|
-
<Menu.
|
|
137
|
-
render={ <Item /> }
|
|
138
|
-
disabled={ ! hasCompatibleFields }
|
|
139
|
-
>
|
|
134
|
+
<Menu.Root disabled={ ! hasCompatibleFields }>
|
|
135
|
+
<Menu.Trigger render={ <Item /> }>
|
|
140
136
|
<VStack
|
|
141
137
|
className="block-editor-bindings__item"
|
|
142
138
|
spacing={ 0 }
|
|
@@ -150,29 +146,31 @@ export default function BlockBindingsAttributeControl( {
|
|
|
150
146
|
{ displayText }
|
|
151
147
|
</WCText>
|
|
152
148
|
</VStack>
|
|
153
|
-
</Menu.
|
|
149
|
+
</Menu.Trigger>
|
|
154
150
|
{ ! isAttributeReadOnly && (
|
|
155
|
-
<Menu.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
isMobile ? 'bottom
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
151
|
+
<Menu.Popup
|
|
152
|
+
positioner={
|
|
153
|
+
<Menu.Positioner
|
|
154
|
+
side={ isMobile ? 'bottom' : 'inline-start' }
|
|
155
|
+
align="start"
|
|
156
|
+
sideOffset={ isMobile ? 8 : 36 }
|
|
157
|
+
/>
|
|
158
|
+
}
|
|
159
|
+
>
|
|
160
|
+
{ Object.entries( compatibleFields ).map(
|
|
161
|
+
( [ sourceKey, fields ] ) => (
|
|
162
|
+
<BlockBindingsSourceFieldsList
|
|
163
|
+
key={ sourceKey }
|
|
164
|
+
args={ binding?.args }
|
|
165
|
+
attribute={ attribute }
|
|
166
|
+
sourceKey={ sourceKey }
|
|
167
|
+
fields={ fields }
|
|
168
|
+
/>
|
|
169
|
+
)
|
|
170
|
+
) }
|
|
171
|
+
</Menu.Popup>
|
|
174
172
|
) }
|
|
175
|
-
</Menu>
|
|
173
|
+
</Menu.Root>
|
|
176
174
|
</ToolsPanelItem>
|
|
177
175
|
);
|
|
178
176
|
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import fastDeepEqual from 'fast-deep-equal/es6/index.js';
|
|
2
2
|
import { getBlockBindingsSource } from '@wordpress/blocks';
|
|
3
|
-
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
4
3
|
import { useSelect } from '@wordpress/data';
|
|
5
4
|
import { useContext, useMemo } from '@wordpress/element';
|
|
6
5
|
import { useViewportMatch } from '@wordpress/compose';
|
|
6
|
+
// eslint-disable-next-line @wordpress/use-recommended-components -- Intentional early adoption of the new Menu, pending WordPress/gutenberg#76135.
|
|
7
|
+
import { Menu } from '@wordpress/ui';
|
|
7
8
|
import useBlockBindingsUtils from './use-block-bindings-utils';
|
|
8
|
-
import { unlock } from '../../lock-unlock';
|
|
9
9
|
import BlockContext from '../block-context';
|
|
10
10
|
|
|
11
|
-
const { Menu } = unlock( componentsPrivateApis );
|
|
12
|
-
|
|
13
11
|
function BlockBindingsSourceFieldsListItem( {
|
|
14
12
|
args,
|
|
15
13
|
attribute,
|
|
@@ -43,25 +41,11 @@ function BlockBindingsSourceFieldsListItem( {
|
|
|
43
41
|
|
|
44
42
|
return (
|
|
45
43
|
<Menu.CheckboxItem
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
field.key === args?.key;
|
|
51
|
-
|
|
52
|
-
if ( isCurrentlySelected ) {
|
|
53
|
-
// Unset if the same field is selected again.
|
|
54
|
-
updateBlockBindings( {
|
|
55
|
-
[ attribute ]: undefined,
|
|
56
|
-
} );
|
|
57
|
-
} else {
|
|
58
|
-
updateBlockBindings( {
|
|
59
|
-
[ attribute ]: itemBindings,
|
|
60
|
-
} );
|
|
61
|
-
}
|
|
44
|
+
onCheckedChange={ ( checked ) => {
|
|
45
|
+
updateBlockBindings( {
|
|
46
|
+
[ attribute ]: checked ? itemBindings : undefined,
|
|
47
|
+
} );
|
|
62
48
|
} }
|
|
63
|
-
name={ attribute + '-binding' }
|
|
64
|
-
value={ values[ attribute ] }
|
|
65
49
|
checked={
|
|
66
50
|
fastDeepEqual( args, field.args ) ??
|
|
67
51
|
// Deprecate key dependency in 7.0.
|
|
@@ -69,7 +53,7 @@ function BlockBindingsSourceFieldsListItem( {
|
|
|
69
53
|
}
|
|
70
54
|
>
|
|
71
55
|
<Menu.ItemLabel>{ field.label }</Menu.ItemLabel>
|
|
72
|
-
<Menu.
|
|
56
|
+
<Menu.ItemDescription>{ values[ attribute ] }</Menu.ItemDescription>
|
|
73
57
|
</Menu.CheckboxItem>
|
|
74
58
|
);
|
|
75
59
|
}
|
|
@@ -90,14 +74,20 @@ export default function BlockBindingsSourceFieldsList( {
|
|
|
90
74
|
const source = getBlockBindingsSource( sourceKey );
|
|
91
75
|
|
|
92
76
|
return (
|
|
93
|
-
<Menu
|
|
94
|
-
|
|
95
|
-
placement={ isMobile ? 'bottom-start' : 'left-start' }
|
|
96
|
-
>
|
|
97
|
-
<Menu.SubmenuTriggerItem>
|
|
77
|
+
<Menu.SubmenuRoot key={ sourceKey }>
|
|
78
|
+
<Menu.SubmenuTrigger>
|
|
98
79
|
<Menu.ItemLabel>{ source.label }</Menu.ItemLabel>
|
|
99
|
-
</Menu.
|
|
100
|
-
<Menu.
|
|
80
|
+
</Menu.SubmenuTrigger>
|
|
81
|
+
<Menu.Popup
|
|
82
|
+
positioner={
|
|
83
|
+
<Menu.Positioner
|
|
84
|
+
side={ isMobile ? 'bottom' : 'inline-start' }
|
|
85
|
+
align="start"
|
|
86
|
+
sideOffset={ 8 }
|
|
87
|
+
alignOffset={ -4 }
|
|
88
|
+
/>
|
|
89
|
+
}
|
|
90
|
+
>
|
|
101
91
|
<Menu.Group>
|
|
102
92
|
{ fields.map( ( field ) => (
|
|
103
93
|
<BlockBindingsSourceFieldsListItem
|
|
@@ -113,7 +103,7 @@ export default function BlockBindingsSourceFieldsList( {
|
|
|
113
103
|
/>
|
|
114
104
|
) ) }
|
|
115
105
|
</Menu.Group>
|
|
116
|
-
</Menu.
|
|
117
|
-
</Menu>
|
|
106
|
+
</Menu.Popup>
|
|
107
|
+
</Menu.SubmenuRoot>
|
|
118
108
|
);
|
|
119
109
|
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { getBlockBindingsSource } from '@wordpress/blocks';
|
|
5
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
6
|
+
import { useSelect } from '@wordpress/data';
|
|
7
|
+
import BlockBindingsAttributeControl from '../attribute-control';
|
|
8
|
+
import useBlockBindingsUtils from '../use-block-bindings-utils';
|
|
9
|
+
|
|
10
|
+
globalThis.wpVitest.mockMatchMedia();
|
|
11
|
+
globalThis.wpVitest.mockPointerEvent();
|
|
12
|
+
globalThis.wpVitest.mockScrollIntoView();
|
|
13
|
+
|
|
14
|
+
vi.mock( import( '@wordpress/blocks' ), async ( importOriginal ) => ( {
|
|
15
|
+
...( await importOriginal() ),
|
|
16
|
+
getBlockBindingsSource: vi.fn(),
|
|
17
|
+
} ) );
|
|
18
|
+
vi.mock( import( '@wordpress/components' ), async ( importOriginal ) => ( {
|
|
19
|
+
...( await importOriginal() ),
|
|
20
|
+
__experimentalToolsPanelItem: ( { children } ) => children,
|
|
21
|
+
} ) );
|
|
22
|
+
vi.mock( import( '@wordpress/compose' ), async ( importOriginal ) => ( {
|
|
23
|
+
...( await importOriginal() ),
|
|
24
|
+
useViewportMatch: vi.fn(),
|
|
25
|
+
} ) );
|
|
26
|
+
vi.mock( import( '@wordpress/data' ), async ( importOriginal ) => ( {
|
|
27
|
+
...( await importOriginal() ),
|
|
28
|
+
useSelect: vi.fn(),
|
|
29
|
+
} ) );
|
|
30
|
+
vi.mock( import( '../use-block-bindings-utils' ), () => ( {
|
|
31
|
+
default: vi.fn(),
|
|
32
|
+
} ) );
|
|
33
|
+
|
|
34
|
+
const updateBlockBindings = vi.fn();
|
|
35
|
+
const field = {
|
|
36
|
+
args: { key: 'seo_title' },
|
|
37
|
+
key: 'seo_title',
|
|
38
|
+
label: 'SEO title',
|
|
39
|
+
type: 'string',
|
|
40
|
+
};
|
|
41
|
+
const source = {
|
|
42
|
+
getValues: vi.fn(),
|
|
43
|
+
label: 'Post meta',
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
function renderControl( binding ) {
|
|
47
|
+
useViewportMatch.mockReturnValue( false );
|
|
48
|
+
getBlockBindingsSource.mockReturnValue( source );
|
|
49
|
+
useBlockBindingsUtils.mockReturnValue( { updateBlockBindings } );
|
|
50
|
+
useSelect.mockImplementation( ( _mapSelect, dependencies ) => {
|
|
51
|
+
if ( dependencies?.length === 3 ) {
|
|
52
|
+
return { 'core/post-meta': [ field ] };
|
|
53
|
+
}
|
|
54
|
+
if ( dependencies?.length === 4 ) {
|
|
55
|
+
return {};
|
|
56
|
+
}
|
|
57
|
+
return { canUpdateBlockBindings: true };
|
|
58
|
+
} );
|
|
59
|
+
|
|
60
|
+
return render(
|
|
61
|
+
<BlockBindingsAttributeControl
|
|
62
|
+
attribute="content"
|
|
63
|
+
binding={ binding }
|
|
64
|
+
blockName="core/paragraph"
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async function openFieldMenu( user ) {
|
|
70
|
+
await user.click( screen.getByRole( 'button', { name: /content/i } ) );
|
|
71
|
+
const sourceItem = await screen.findByRole( 'menuitem', {
|
|
72
|
+
name: 'Post meta',
|
|
73
|
+
} );
|
|
74
|
+
await user.click( sourceItem );
|
|
75
|
+
const fieldItem = await screen.findByRole( 'menuitemcheckbox', {
|
|
76
|
+
name: 'SEO title',
|
|
77
|
+
} );
|
|
78
|
+
return fieldItem;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
describe( 'BlockBindingsAttributeControl', () => {
|
|
82
|
+
beforeEach( () => {
|
|
83
|
+
updateBlockBindings.mockReset();
|
|
84
|
+
} );
|
|
85
|
+
|
|
86
|
+
it( 'selects a source field', async () => {
|
|
87
|
+
const user = userEvent.setup();
|
|
88
|
+
renderControl();
|
|
89
|
+
|
|
90
|
+
const fieldItem = await openFieldMenu( user );
|
|
91
|
+
fireEvent.click( fieldItem );
|
|
92
|
+
|
|
93
|
+
expect( updateBlockBindings ).toHaveBeenCalledWith( {
|
|
94
|
+
content: {
|
|
95
|
+
source: 'core/post-meta',
|
|
96
|
+
args: field.args,
|
|
97
|
+
},
|
|
98
|
+
} );
|
|
99
|
+
} );
|
|
100
|
+
|
|
101
|
+
it( 'clears the selected source field', async () => {
|
|
102
|
+
const user = userEvent.setup();
|
|
103
|
+
renderControl( {
|
|
104
|
+
source: 'core/post-meta',
|
|
105
|
+
args: field.args,
|
|
106
|
+
} );
|
|
107
|
+
|
|
108
|
+
const fieldItem = await openFieldMenu( user );
|
|
109
|
+
fireEvent.click( fieldItem );
|
|
110
|
+
|
|
111
|
+
expect( updateBlockBindings ).toHaveBeenCalledWith( {
|
|
112
|
+
content: undefined,
|
|
113
|
+
} );
|
|
114
|
+
} );
|
|
115
|
+
} );
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
Icon as WCIcon,
|
|
5
|
-
privateApis as componentsPrivateApis,
|
|
6
|
-
} from '@wordpress/components';
|
|
7
|
-
import { Text, Stack } from '@wordpress/ui';
|
|
2
|
+
import { Button, Icon as WCIcon } from '@wordpress/components';
|
|
3
|
+
import { Badge, Text, Stack } from '@wordpress/ui';
|
|
8
4
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
9
5
|
import deprecated from '@wordpress/deprecated';
|
|
10
6
|
import { __, sprintf, isRTL } from '@wordpress/i18n';
|
|
@@ -19,8 +15,6 @@ import { unlock } from '../../lock-unlock';
|
|
|
19
15
|
import { store as blockEditorStore } from '../../store';
|
|
20
16
|
import BlockIcon from '../block-icon';
|
|
21
17
|
|
|
22
|
-
const { Badge: WCBadge } = unlock( componentsPrivateApis );
|
|
23
|
-
|
|
24
18
|
function OptionalParentSelectButton( { children, onClick } ) {
|
|
25
19
|
if ( ! onClick ) {
|
|
26
20
|
return children;
|
|
@@ -148,7 +142,7 @@ function BlockCard( {
|
|
|
148
142
|
__( 'Go to "%s" block' ),
|
|
149
143
|
getBlockType( parentBlockName )
|
|
150
144
|
?.title
|
|
151
|
-
|
|
145
|
+
)
|
|
152
146
|
: __( 'Go to parent block' )
|
|
153
147
|
}
|
|
154
148
|
style={
|
|
@@ -172,7 +166,7 @@ function BlockCard( {
|
|
|
172
166
|
parentClientId
|
|
173
167
|
? () => {
|
|
174
168
|
selectBlock( parentClientId );
|
|
175
|
-
|
|
169
|
+
}
|
|
176
170
|
: undefined
|
|
177
171
|
}
|
|
178
172
|
>
|
|
@@ -185,7 +179,7 @@ function BlockCard( {
|
|
|
185
179
|
{ ! parentClientId &&
|
|
186
180
|
! isChild &&
|
|
187
181
|
!! name?.length && (
|
|
188
|
-
<
|
|
182
|
+
<Badge>{ title }</Badge>
|
|
189
183
|
) }
|
|
190
184
|
</TitleElement>
|
|
191
185
|
{ children }
|
|
@@ -63,7 +63,7 @@ const EditWithGeneratedProps = ( props ) => {
|
|
|
63
63
|
attributes?.metadata?.bindings
|
|
64
64
|
? Object.values( attributes.metadata.bindings ).map(
|
|
65
65
|
( binding ) => registeredSources[ binding?.source ]
|
|
66
|
-
|
|
66
|
+
)
|
|
67
67
|
: undefined
|
|
68
68
|
),
|
|
69
69
|
hasPatternOverrides: hasPatternOverridesDefaultBinding(
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { render } from 'vitest-browser-react';
|
|
3
|
+
import { image } from '@wordpress/icons';
|
|
4
|
+
import BlockIcon from '../';
|
|
5
|
+
|
|
6
|
+
function getIconWrapper( container ) {
|
|
7
|
+
// The wrapper is intentionally non-semantic.
|
|
8
|
+
return container.firstChild;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
describe( 'BlockIcon', () => {
|
|
12
|
+
it( 'renders an icon', async () => {
|
|
13
|
+
const { container } = await render( <BlockIcon icon={ image } /> );
|
|
14
|
+
|
|
15
|
+
// The decorative SVG is intentionally hidden from the accessibility tree.
|
|
16
|
+
|
|
17
|
+
const icon = container.querySelector( 'svg' );
|
|
18
|
+
expect( icon ).toHaveAttribute( 'aria-hidden', 'true' );
|
|
19
|
+
expect( icon ).toHaveAttribute( 'focusable', 'false' );
|
|
20
|
+
} );
|
|
21
|
+
|
|
22
|
+
it( 'renders a span without the has-colors classname', async () => {
|
|
23
|
+
const { container } = await render( <BlockIcon icon={ image } /> );
|
|
24
|
+
|
|
25
|
+
expect( getIconWrapper( container ) ).not.toHaveClass( 'has-colors' );
|
|
26
|
+
} );
|
|
27
|
+
|
|
28
|
+
it( 'renders a span with the has-colors classname', async () => {
|
|
29
|
+
const { container } = await render(
|
|
30
|
+
<BlockIcon icon={ image } showColors />
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
expect( getIconWrapper( container ) ).toHaveClass( 'has-colors' );
|
|
34
|
+
} );
|
|
35
|
+
|
|
36
|
+
it( 'supports adding a className to the wrapper', async () => {
|
|
37
|
+
const { container } = await render(
|
|
38
|
+
<BlockIcon icon={ image } className="foo-bar" />
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
expect( getIconWrapper( container ) ).toHaveClass( 'foo-bar' );
|
|
42
|
+
} );
|
|
43
|
+
|
|
44
|
+
it( 'skips adding background and foreground styles when colors are not enabled', async () => {
|
|
45
|
+
const { container } = await render(
|
|
46
|
+
<BlockIcon
|
|
47
|
+
icon={ {
|
|
48
|
+
background: 'white',
|
|
49
|
+
foreground: 'black',
|
|
50
|
+
src: 'image',
|
|
51
|
+
} }
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
expect( getIconWrapper( container ) ).not.toHaveAttribute( 'style' );
|
|
56
|
+
} );
|
|
57
|
+
|
|
58
|
+
it( 'adds background and foreground styles when colors are enabled', async () => {
|
|
59
|
+
const { container } = await render(
|
|
60
|
+
<BlockIcon
|
|
61
|
+
icon={ {
|
|
62
|
+
background: 'white',
|
|
63
|
+
foreground: 'black',
|
|
64
|
+
src: 'image',
|
|
65
|
+
} }
|
|
66
|
+
showColors
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const styles = window.getComputedStyle( getIconWrapper( container ) );
|
|
71
|
+
expect( styles.backgroundColor ).toBe( 'rgb(255, 255, 255)' );
|
|
72
|
+
expect( styles.color ).toBe( 'rgb(0, 0, 0)' );
|
|
73
|
+
} );
|
|
74
|
+
} );
|
|
@@ -77,9 +77,9 @@ function InlineEditButton( {
|
|
|
77
77
|
>
|
|
78
78
|
{ editedContentOnlySection
|
|
79
79
|
? /* translators: Button label to leave pattern editing mode. */
|
|
80
|
-
|
|
80
|
+
__( 'Exit pattern' )
|
|
81
81
|
: /* translators: Button label to enter pattern editing mode. */
|
|
82
|
-
|
|
82
|
+
__( 'Edit pattern' ) }
|
|
83
83
|
</Button>
|
|
84
84
|
</Stack>
|
|
85
85
|
);
|