@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
package/src/content.scss
CHANGED
|
@@ -12,5 +12,6 @@
|
|
|
12
12
|
@use "./components/iframe/content.scss" as *;
|
|
13
13
|
@use "./components/media-placeholder/content.scss" as *;
|
|
14
14
|
@use "./components/plain-text/content.scss" as *;
|
|
15
|
+
@use "./components/plain-text/style.scss" as *;
|
|
15
16
|
@use "./components/rich-text/content.scss" as *;
|
|
16
17
|
@use "./components/warning/content.scss" as *;
|
package/src/hooks/align.jsx
CHANGED
|
@@ -6,7 +6,9 @@ import {
|
|
|
6
6
|
hasBlockSupport,
|
|
7
7
|
} from '@wordpress/blocks';
|
|
8
8
|
import { BlockControls, BlockAlignmentControl } from '../components';
|
|
9
|
-
import useAvailableAlignments
|
|
9
|
+
import useAvailableAlignments, {
|
|
10
|
+
useAlignmentMenu,
|
|
11
|
+
} from '../components/block-alignment-control/use-available-alignments';
|
|
10
12
|
import { useBlockEditingMode } from '../components/block-editing-mode';
|
|
11
13
|
|
|
12
14
|
/**
|
|
@@ -110,11 +112,18 @@ function BlockEditAlignmentToolbarControlsPure( {
|
|
|
110
112
|
hasBlockSupport( blockName, 'alignWide', true )
|
|
111
113
|
);
|
|
112
114
|
|
|
113
|
-
const
|
|
114
|
-
blockAllowedAlignments
|
|
115
|
-
).map( ( { name } ) => name );
|
|
115
|
+
const { enabled, unavailable } = useAlignmentMenu( blockAllowedAlignments );
|
|
116
116
|
const blockEditingMode = useBlockEditingMode();
|
|
117
|
-
|
|
117
|
+
/*
|
|
118
|
+
* Render whenever there is something to say, which includes having only
|
|
119
|
+
* unavailable alignments to report: a Group supports nothing but wide and
|
|
120
|
+
* full, so in a layout offering neither the control would otherwise vanish
|
|
121
|
+
* from the block most likely to want them.
|
|
122
|
+
*/
|
|
123
|
+
if (
|
|
124
|
+
( ! enabled.length && ! unavailable.length ) ||
|
|
125
|
+
blockEditingMode !== 'default'
|
|
126
|
+
) {
|
|
118
127
|
return null;
|
|
119
128
|
}
|
|
120
129
|
|
|
@@ -134,7 +143,14 @@ function BlockEditAlignmentToolbarControlsPure( {
|
|
|
134
143
|
<BlockAlignmentControl
|
|
135
144
|
value={ align }
|
|
136
145
|
onChange={ updateAlignment }
|
|
137
|
-
|
|
146
|
+
/*
|
|
147
|
+
* Pass the alignments the block itself supports rather than the
|
|
148
|
+
* ones the current layout leaves available. The control filters
|
|
149
|
+
* them again, but keeping the unfiltered list lets it tell the
|
|
150
|
+
* difference between an alignment this block never had and one a
|
|
151
|
+
* parent layout has taken away.
|
|
152
|
+
*/
|
|
153
|
+
controls={ blockAllowedAlignments }
|
|
138
154
|
/>
|
|
139
155
|
</BlockControls>
|
|
140
156
|
);
|
package/src/hooks/background.jsx
CHANGED
|
@@ -219,7 +219,7 @@ export function BackgroundImagePanel( {
|
|
|
219
219
|
...style?.background,
|
|
220
220
|
gradient: gradient
|
|
221
221
|
? 'var:preset|gradient|' + gradient
|
|
222
|
-
: style?.background?.gradient ?? style?.color?.gradient,
|
|
222
|
+
: ( style?.background?.gradient ?? style?.color?.gradient ),
|
|
223
223
|
},
|
|
224
224
|
} ),
|
|
225
225
|
};
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
@use "@wordpress/base-styles/colors" as *;
|
|
3
3
|
|
|
4
4
|
.block-editor-hooks__block-hooks {
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* Un-reverse the flex direction for the toggle's label.
|
|
8
7
|
*/
|
|
@@ -16,8 +15,3 @@
|
|
|
16
15
|
margin-bottom: $grid-unit-20;
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
|
-
|
|
20
|
-
.block-editor-hooks__position-control-item-hint {
|
|
21
|
-
color: var(--wpds-color-foreground-content-neutral-weak);
|
|
22
|
-
margin-block-start: $grid-unit-05;
|
|
23
|
-
}
|
package/src/hooks/border.jsx
CHANGED
|
@@ -173,10 +173,10 @@ export function BorderPanel( { clientId, name, setAttributes, settings } ) {
|
|
|
173
173
|
setAttributes( {
|
|
174
174
|
style: setStyleForState( style, selectedState, newStyle ),
|
|
175
175
|
} );
|
|
176
|
-
|
|
176
|
+
}
|
|
177
177
|
: ( newStyle ) => {
|
|
178
178
|
setAttributes( styleToAttributes( newStyle ) );
|
|
179
|
-
|
|
179
|
+
};
|
|
180
180
|
|
|
181
181
|
if ( ! isEnabled ) {
|
|
182
182
|
return null;
|
|
@@ -156,7 +156,7 @@ export default function useBlockColorContrastWarning( {
|
|
|
156
156
|
linkColor: checkLinkColor ? colors.linkColor : undefined,
|
|
157
157
|
messageOverride,
|
|
158
158
|
enableAlphaChecker: true,
|
|
159
|
-
|
|
159
|
+
} )
|
|
160
160
|
: null;
|
|
161
161
|
|
|
162
162
|
// The popover Notice that displays this warning is muted
|
package/src/hooks/dimensions.jsx
CHANGED
|
@@ -101,12 +101,12 @@ export function DimensionsPanel( { clientId, name, setAttributes, settings } ) {
|
|
|
101
101
|
setAttributes( {
|
|
102
102
|
style: setStyleForState( style, selectedState, newStyle ),
|
|
103
103
|
} );
|
|
104
|
-
|
|
104
|
+
}
|
|
105
105
|
: ( newStyle ) => {
|
|
106
106
|
setAttributes( {
|
|
107
107
|
style: cleanEmptyObject( newStyle ),
|
|
108
108
|
} );
|
|
109
|
-
|
|
109
|
+
};
|
|
110
110
|
|
|
111
111
|
if ( ! isEnabled ) {
|
|
112
112
|
return null;
|
package/src/hooks/duotone.jsx
CHANGED
|
@@ -186,7 +186,7 @@ function DuotonePanelPure( { style, setAttributes, name, clientId } ) {
|
|
|
186
186
|
: getDuotonePresetFromColors(
|
|
187
187
|
newDuotone,
|
|
188
188
|
duotonePalette
|
|
189
|
-
|
|
189
|
+
);
|
|
190
190
|
|
|
191
191
|
const newStyle = {
|
|
192
192
|
...style,
|
|
@@ -301,7 +301,7 @@ function useDuotoneStyles( {
|
|
|
301
301
|
? getDuotoneStylesheet( selector, filterId )
|
|
302
302
|
: getDuotoneUnsetStylesheet( selector ),
|
|
303
303
|
__unstableType: 'presets',
|
|
304
|
-
|
|
304
|
+
}
|
|
305
305
|
: undefined
|
|
306
306
|
);
|
|
307
307
|
usePrivateStyleOverride(
|
|
@@ -312,7 +312,7 @@ function useDuotoneStyles( {
|
|
|
312
312
|
? getDuotoneFilter( filterId, colors )
|
|
313
313
|
: '',
|
|
314
314
|
__unstableType: 'svgs',
|
|
315
|
-
|
|
315
|
+
}
|
|
316
316
|
: undefined
|
|
317
317
|
);
|
|
318
318
|
|
package/src/hooks/elements.jsx
CHANGED
|
@@ -88,10 +88,10 @@ export function ElementsEdit( {
|
|
|
88
88
|
setAttributes( {
|
|
89
89
|
style: setStyleForState( style, selectedState, newStyle ),
|
|
90
90
|
} );
|
|
91
|
-
|
|
91
|
+
}
|
|
92
92
|
: ( newStyle ) => {
|
|
93
93
|
setAttributes( { style: cleanEmptyObject( newStyle ) } );
|
|
94
|
-
|
|
94
|
+
};
|
|
95
95
|
|
|
96
96
|
// Text and background color failures are reported by the Typography and
|
|
97
97
|
// Background panels, which own those selections.
|
|
@@ -123,7 +123,7 @@ export function ElementsEdit( {
|
|
|
123
123
|
: getBlockSupport( name, [
|
|
124
124
|
COLOR_SUPPORT_KEY,
|
|
125
125
|
'__experimentalDefaultControls',
|
|
126
|
-
|
|
126
|
+
] );
|
|
127
127
|
|
|
128
128
|
const Wrapper = asWrapper || ElementsInspectorControl;
|
|
129
129
|
|
package/src/hooks/fit-text.jsx
CHANGED
package/src/hooks/gap.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getSpacingPresetCssVar } from '../components/spacing-sizes-control/utils';
|
|
2
|
+
import { normalizeLegacyLayout } from '../layouts/utils';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Returns whether the current layout can use separate row and column gaps.
|
|
@@ -8,10 +9,7 @@ import { getSpacingPresetCssVar } from '../components/spacing-sizes-control/util
|
|
|
8
9
|
* @return {boolean} Whether axial block gap controls should be available.
|
|
9
10
|
*/
|
|
10
11
|
export function isAxialBlockGapAllowed( layout, defaultLayout ) {
|
|
11
|
-
const usedLayout =
|
|
12
|
-
layout?.inherit || layout?.contentSize || layout?.wideSize
|
|
13
|
-
? { ...layout, type: 'constrained' }
|
|
14
|
-
: layout || defaultLayout || {};
|
|
12
|
+
const usedLayout = normalizeLegacyLayout( layout ) || defaultLayout || {};
|
|
15
13
|
|
|
16
14
|
return [ 'flex', 'grid' ].includes( usedLayout?.type );
|
|
17
15
|
}
|
package/src/hooks/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
createBlockSaveFilter,
|
|
5
5
|
} from './utils';
|
|
6
6
|
import './compat';
|
|
7
|
-
import './cross-origin-isolation';
|
|
8
7
|
import align from './align';
|
|
9
8
|
import background from './background';
|
|
10
9
|
import './lock';
|
|
@@ -21,6 +20,7 @@ import duotone from './duotone';
|
|
|
21
20
|
import fontFamily from './font-family';
|
|
22
21
|
import fontSize from './font-size';
|
|
23
22
|
import textAlign from './text-align';
|
|
23
|
+
import textShadow from './text-shadow';
|
|
24
24
|
import fitText from './fit-text';
|
|
25
25
|
import border from './border';
|
|
26
26
|
import customCSS from './custom-css';
|
|
@@ -66,6 +66,7 @@ createBlockListBlockFilter( [
|
|
|
66
66
|
duotone,
|
|
67
67
|
fontFamily,
|
|
68
68
|
fontSize,
|
|
69
|
+
textShadow,
|
|
69
70
|
fitText,
|
|
70
71
|
border,
|
|
71
72
|
customCSS,
|
|
@@ -86,6 +87,7 @@ createBlockSaveFilter( [
|
|
|
86
87
|
style,
|
|
87
88
|
fontFamily,
|
|
88
89
|
fontSize,
|
|
90
|
+
textShadow,
|
|
89
91
|
] );
|
|
90
92
|
|
|
91
93
|
export { useCustomSides } from './dimensions';
|
|
@@ -65,7 +65,7 @@ export function getChildLayoutStyleRules( {
|
|
|
65
65
|
? {
|
|
66
66
|
...layout,
|
|
67
67
|
...viewportOverrides,
|
|
68
|
-
|
|
68
|
+
}
|
|
69
69
|
: layout;
|
|
70
70
|
const hasViewportOverride = ( key ) =>
|
|
71
71
|
Object.hasOwn( viewportOverrides || {}, key );
|
|
@@ -121,9 +121,8 @@ export function getChildLayoutStyleRules( {
|
|
|
121
121
|
hasViewportOverride( 'columnSpan' )
|
|
122
122
|
) {
|
|
123
123
|
if ( columnStart && columnSpan ) {
|
|
124
|
-
declarations[
|
|
125
|
-
|
|
126
|
-
] = `${ columnStart } / span ${ columnSpan }`;
|
|
124
|
+
declarations[ 'grid-column' ] =
|
|
125
|
+
`${ columnStart } / span ${ columnSpan }`;
|
|
127
126
|
} else if ( columnStart ) {
|
|
128
127
|
declarations[ 'grid-column' ] = `${ columnStart }`;
|
|
129
128
|
} else if ( columnSpan ) {
|
package/src/hooks/layout.jsx
CHANGED
|
@@ -23,6 +23,7 @@ import { useSettings } from '../components/use-settings';
|
|
|
23
23
|
import { getLayoutType, getLayoutTypes } from '../layouts';
|
|
24
24
|
import { useBlockEditingMode } from '../components/block-editing-mode';
|
|
25
25
|
import { LAYOUT_DEFINITIONS } from '../layouts/definitions';
|
|
26
|
+
import { normalizeLegacyLayout } from '../layouts/utils';
|
|
26
27
|
import { cleanEmptyObject, useBlockSettings, useStyleOverride } from './utils';
|
|
27
28
|
import { unlock } from '../lock-unlock';
|
|
28
29
|
import { globalStylesDataKey } from '../store/private-keys';
|
|
@@ -162,9 +163,7 @@ export function useLayoutClasses( blockAttributes = {}, blockName = '' ) {
|
|
|
162
163
|
const { default: defaultBlockLayout } =
|
|
163
164
|
getBlockSupport( blockName, layoutBlockSupportKey ) || {};
|
|
164
165
|
const usedLayout =
|
|
165
|
-
layout
|
|
166
|
-
? { ...layout, type: 'constrained' }
|
|
167
|
-
: layout || defaultBlockLayout || {};
|
|
166
|
+
normalizeLegacyLayout( layout ) || defaultBlockLayout || {};
|
|
168
167
|
|
|
169
168
|
const layoutClassnames = [];
|
|
170
169
|
|
|
@@ -231,14 +230,13 @@ export function useLayoutClasses( blockAttributes = {}, blockName = '' ) {
|
|
|
231
230
|
*/
|
|
232
231
|
export function useLayoutStyles( blockAttributes = {}, blockName, selector ) {
|
|
233
232
|
const { layout = {}, style = {} } = blockAttributes;
|
|
234
|
-
|
|
235
|
-
const usedLayout =
|
|
236
|
-
layout?.inherit || layout?.contentSize || layout?.wideSize
|
|
237
|
-
? { ...layout, type: 'constrained' }
|
|
238
|
-
: layout || {};
|
|
233
|
+
const usedLayout = normalizeLegacyLayout( layout ) || {};
|
|
239
234
|
const fullLayoutType = getLayoutType( usedLayout?.type || 'default' );
|
|
240
235
|
const [ blockGapSupport ] = useSettings( 'spacing.blockGap' );
|
|
241
|
-
|
|
236
|
+
// Like the server's `isset()` check, an unset or `null` setting means the
|
|
237
|
+
// theme has not opted into block gap.
|
|
238
|
+
const hasBlockGapSupport =
|
|
239
|
+
blockGapSupport !== null && blockGapSupport !== undefined;
|
|
242
240
|
return fullLayoutType?.getLayoutStyle?.( {
|
|
243
241
|
blockName,
|
|
244
242
|
selector,
|
|
@@ -444,7 +442,7 @@ function LayoutPanelPure( {
|
|
|
444
442
|
? cleanEmptyObject( {
|
|
445
443
|
...baseLayout,
|
|
446
444
|
...stateLayout,
|
|
447
|
-
|
|
445
|
+
} ) || {}
|
|
448
446
|
: baseLayout;
|
|
449
447
|
const resetLayoutDefaults = isViewportLayoutState
|
|
450
448
|
? baseLayout
|
|
@@ -524,7 +522,7 @@ function LayoutPanelPure( {
|
|
|
524
522
|
const hasInheritToggleValue = () =>
|
|
525
523
|
isViewportLayoutState
|
|
526
524
|
? ( usedLayout?.type ?? 'default' ) !==
|
|
527
|
-
|
|
525
|
+
( resetLayoutDefaults?.type ?? 'default' )
|
|
528
526
|
: layout?.type === 'constrained';
|
|
529
527
|
const hasLayoutTypeValue = () =>
|
|
530
528
|
( usedLayout?.type ?? 'default' ) !==
|
|
@@ -559,10 +557,10 @@ function LayoutPanelPure( {
|
|
|
559
557
|
isUsingContentWidth()
|
|
560
558
|
? __(
|
|
561
559
|
'Nested blocks use content width with options for full and wide widths.'
|
|
562
|
-
|
|
560
|
+
)
|
|
563
561
|
: __(
|
|
564
562
|
'Nested blocks will fill the width of this container.'
|
|
565
|
-
|
|
563
|
+
)
|
|
566
564
|
}
|
|
567
565
|
/>
|
|
568
566
|
</ToolsPanelItem>
|
|
@@ -696,14 +694,15 @@ function BlockWithLayoutStyles( {
|
|
|
696
694
|
const { default: defaultBlockLayout } =
|
|
697
695
|
getBlockSupport( name, layoutBlockSupportKey ) || {};
|
|
698
696
|
const usedLayout =
|
|
699
|
-
layout
|
|
700
|
-
? { ...layout, type: 'constrained' }
|
|
701
|
-
: layout || defaultBlockLayout || {};
|
|
697
|
+
normalizeLegacyLayout( layout ) || defaultBlockLayout || {};
|
|
702
698
|
|
|
703
699
|
const selectorPrefix = `wp-container-${ kebabCase( name ) }-is-layout-`;
|
|
704
700
|
// Higher specificity to override defaults from theme.json.
|
|
705
701
|
const selector = `.${ selectorPrefix }${ id }`;
|
|
706
|
-
|
|
702
|
+
// Like the server's `isset()` check, an unset or `null` setting means the
|
|
703
|
+
// theme has not opted into block gap.
|
|
704
|
+
const hasBlockGapSupport =
|
|
705
|
+
blockGapSupport !== null && blockGapSupport !== undefined;
|
|
707
706
|
|
|
708
707
|
// Get CSS string for the current layout type.
|
|
709
708
|
// The CSS and `style` element is only output if it is not empty.
|
|
@@ -800,7 +799,7 @@ export const withLayoutStyles = createHigherOrderComponent(
|
|
|
800
799
|
variationBlockGapValue = variationName
|
|
801
800
|
? globalStyles?.blocks?.[ name ]?.variations?.[
|
|
802
801
|
variationName
|
|
803
|
-
|
|
802
|
+
]?.spacing?.blockGap
|
|
804
803
|
: undefined;
|
|
805
804
|
}
|
|
806
805
|
|
package/src/hooks/position.jsx
CHANGED
|
@@ -3,8 +3,7 @@ import { __, _x, sprintf } from '@wordpress/i18n';
|
|
|
3
3
|
import { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';
|
|
4
4
|
import { useInstanceId } from '@wordpress/compose';
|
|
5
5
|
import { useSelect } from '@wordpress/data';
|
|
6
|
-
import {
|
|
7
|
-
// eslint-disable-next-line @wordpress/use-recommended-components -- Use the portal-based popup to avoid inspector clipping.
|
|
6
|
+
import { useMemo } from '@wordpress/element';
|
|
8
7
|
import { SelectControl } from '@wordpress/ui';
|
|
9
8
|
import { useSettings } from '../components/use-settings';
|
|
10
9
|
import InspectorControls from '../components/inspector-controls';
|
|
@@ -15,25 +14,22 @@ import { store as blockEditorStore } from '../store';
|
|
|
15
14
|
const POSITION_SUPPORT_KEY = 'position';
|
|
16
15
|
|
|
17
16
|
const DEFAULT_OPTION = {
|
|
18
|
-
key: 'default',
|
|
19
17
|
value: '',
|
|
20
18
|
label: __( 'Default' ),
|
|
21
19
|
};
|
|
22
20
|
|
|
23
21
|
const STICKY_OPTION = {
|
|
24
|
-
key: 'sticky',
|
|
25
22
|
value: 'sticky',
|
|
26
23
|
label: _x( 'Sticky', 'Name for the value of the CSS position property' ),
|
|
27
|
-
|
|
24
|
+
description: __(
|
|
28
25
|
'The block will stick to the top of the window instead of scrolling.'
|
|
29
26
|
),
|
|
30
27
|
};
|
|
31
28
|
|
|
32
29
|
const FIXED_OPTION = {
|
|
33
|
-
key: 'fixed',
|
|
34
30
|
value: 'fixed',
|
|
35
31
|
label: _x( 'Fixed', 'Name for the value of the CSS position property' ),
|
|
36
|
-
|
|
32
|
+
description: __( 'The block will not move when the page is scrolled.' ),
|
|
37
33
|
};
|
|
38
34
|
|
|
39
35
|
const POSITION_SIDES = [ 'top', 'right', 'bottom', 'left' ];
|
|
@@ -210,7 +206,7 @@ export function PositionPanelPure( {
|
|
|
210
206
|
'The block will stick to the scrollable area of the parent %s block.'
|
|
211
207
|
),
|
|
212
208
|
blockInformation.title
|
|
213
|
-
|
|
209
|
+
)
|
|
214
210
|
: null;
|
|
215
211
|
|
|
216
212
|
const options = useMemo( () => {
|
|
@@ -252,7 +248,6 @@ export function PositionPanelPure( {
|
|
|
252
248
|
const selectedOption = value
|
|
253
249
|
? options.find( ( option ) => option.value === value ) || DEFAULT_OPTION
|
|
254
250
|
: DEFAULT_OPTION;
|
|
255
|
-
const hintIdPrefix = useId();
|
|
256
251
|
|
|
257
252
|
// Only display position controls if there is at least one option to choose from.
|
|
258
253
|
return options.length > 1 ? (
|
|
@@ -267,33 +262,7 @@ export function PositionPanelPure( {
|
|
|
267
262
|
onValueChange={ ( selectedItem ) => {
|
|
268
263
|
onChangeType( selectedItem.value );
|
|
269
264
|
} }
|
|
270
|
-
|
|
271
|
-
{ options.map( ( option ) => {
|
|
272
|
-
const hintId = option.hint
|
|
273
|
-
? `${ hintIdPrefix }-${ option.key }`
|
|
274
|
-
: undefined;
|
|
275
|
-
|
|
276
|
-
return (
|
|
277
|
-
<SelectControl.Item
|
|
278
|
-
key={ option.key }
|
|
279
|
-
value={ option }
|
|
280
|
-
label={ option.label }
|
|
281
|
-
aria-describedby={ hintId }
|
|
282
|
-
>
|
|
283
|
-
<div>{ option.label }</div>
|
|
284
|
-
{ option.hint && (
|
|
285
|
-
<div
|
|
286
|
-
id={ hintId }
|
|
287
|
-
className="block-editor-hooks__position-control-item-hint"
|
|
288
|
-
aria-hidden="true"
|
|
289
|
-
>
|
|
290
|
-
{ option.hint }
|
|
291
|
-
</div>
|
|
292
|
-
) }
|
|
293
|
-
</SelectControl.Item>
|
|
294
|
-
);
|
|
295
|
-
} ) }
|
|
296
|
-
</SelectControl>
|
|
265
|
+
/>
|
|
297
266
|
</InspectorControls>
|
|
298
267
|
) : null;
|
|
299
268
|
}
|
package/src/hooks/states.jsx
CHANGED
|
@@ -71,9 +71,11 @@ const EMPTY_STATE_OPTIONS = [];
|
|
|
71
71
|
* @param {string} props.name Block name.
|
|
72
72
|
* @param {Object} props.value Currently selected style-state value.
|
|
73
73
|
* @param {Function} props.onChange Callback when style-state selection changes.
|
|
74
|
+
* @param {Element} props.children Optional menu content rendered after the
|
|
75
|
+
* state groups.
|
|
74
76
|
* @return {Element|null} State control component, or null if not applicable.
|
|
75
77
|
*/
|
|
76
|
-
export function BlockStatesControl( { name, value, onChange } ) {
|
|
78
|
+
export function BlockStatesControl( { name, value, onChange, children } ) {
|
|
77
79
|
const pseudoStateOptions = useMemo(
|
|
78
80
|
() => getPseudoStateOptions( name ),
|
|
79
81
|
[ name ]
|
|
@@ -91,7 +93,9 @@ export function BlockStatesControl( { name, value, onChange } ) {
|
|
|
91
93
|
onChangePseudoState={ ( pseudo ) => onChange( { pseudo } ) }
|
|
92
94
|
popoverProps={ dropdownMenuProps.popoverProps }
|
|
93
95
|
showText={ false }
|
|
94
|
-
|
|
96
|
+
>
|
|
97
|
+
{ children }
|
|
98
|
+
</StateControl>
|
|
95
99
|
);
|
|
96
100
|
}
|
|
97
101
|
|
|
@@ -1,13 +1,56 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { renderHook } from '@testing-library/react';
|
|
2
3
|
import {
|
|
3
4
|
getLayoutStateOverrides,
|
|
4
5
|
getResetLayout,
|
|
5
6
|
getResponsiveLayoutStyles,
|
|
6
7
|
hasLayoutPanelControls,
|
|
8
|
+
useLayoutStyles,
|
|
7
9
|
} from '../layout';
|
|
8
10
|
import { getLayoutType } from '../../layouts';
|
|
11
|
+
import { useSettings } from '../../components/use-settings';
|
|
12
|
+
|
|
13
|
+
vi.mock(
|
|
14
|
+
import( '../../components/use-settings' ),
|
|
15
|
+
async ( importOriginal ) => ( {
|
|
16
|
+
...( await importOriginal() ),
|
|
17
|
+
useSettings: vi.fn(),
|
|
18
|
+
} )
|
|
19
|
+
);
|
|
9
20
|
|
|
10
21
|
describe( 'layout', () => {
|
|
22
|
+
describe( 'useLayoutStyles()', () => {
|
|
23
|
+
const attributes = {
|
|
24
|
+
layout: { type: 'flex' },
|
|
25
|
+
style: { spacing: { blockGap: '10px' } },
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
it.each( [ null, undefined ] )(
|
|
29
|
+
'outputs no layout styles when the block gap setting is %s',
|
|
30
|
+
( blockGapSetting ) => {
|
|
31
|
+
useSettings.mockReturnValue( [ blockGapSetting ] );
|
|
32
|
+
|
|
33
|
+
const { result } = renderHook( () =>
|
|
34
|
+
useLayoutStyles( attributes, 'test/block', '.my-container' )
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
expect( result.current ).toBe( '' );
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
it( 'outputs block gap styles when the theme opts into block gap', () => {
|
|
42
|
+
useSettings.mockReturnValue( [ true ] );
|
|
43
|
+
|
|
44
|
+
const { result } = renderHook( () =>
|
|
45
|
+
useLayoutStyles( attributes, 'test/block', '.my-container' )
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
expect( result.current ).toContain(
|
|
49
|
+
'.my-container { gap: 10px; }'
|
|
50
|
+
);
|
|
51
|
+
} );
|
|
52
|
+
} );
|
|
53
|
+
|
|
11
54
|
describe( 'hasLayoutPanelControls()', () => {
|
|
12
55
|
it( 'does not show the layout panel when every flex layout control is disabled', () => {
|
|
13
56
|
expect(
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { addFilter } from '@wordpress/hooks';
|
|
2
|
+
import { hasBlockSupport } from '@wordpress/blocks';
|
|
3
|
+
import type { BlockType } from '@wordpress/blocks';
|
|
4
|
+
import TokenList from '@wordpress/token-list';
|
|
5
|
+
import { kebabCase } from '@wordpress/kebab-case';
|
|
6
|
+
import { shouldSkipSerialization } from './utils';
|
|
7
|
+
import { TYPOGRAPHY_SUPPORT_KEY } from './typography';
|
|
8
|
+
|
|
9
|
+
export const TEXT_SHADOW_SUPPORT_KEY = 'typography.textShadow';
|
|
10
|
+
|
|
11
|
+
interface TextShadowAttributes {
|
|
12
|
+
textShadow?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface SaveProps {
|
|
16
|
+
className?: string;
|
|
17
|
+
[ key: string ]: unknown;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Filters registered block settings, extending attributes to include
|
|
22
|
+
* the `textShadow` attribute.
|
|
23
|
+
*
|
|
24
|
+
* @param settings Original block settings.
|
|
25
|
+
* @return Filtered block settings.
|
|
26
|
+
*/
|
|
27
|
+
function addAttributes( settings: BlockType ) {
|
|
28
|
+
if ( ! hasBlockSupport( settings, TEXT_SHADOW_SUPPORT_KEY ) ) {
|
|
29
|
+
return settings;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Allow blocks to specify a default value if needed.
|
|
33
|
+
if ( ! settings.attributes.textShadow ) {
|
|
34
|
+
Object.assign( settings.attributes, {
|
|
35
|
+
textShadow: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
},
|
|
38
|
+
} );
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return settings;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Override props assigned to save component to inject the text shadow preset
|
|
46
|
+
* class name.
|
|
47
|
+
*
|
|
48
|
+
* @param props Additional props applied to save element.
|
|
49
|
+
* @param blockType Block type.
|
|
50
|
+
* @param attributes Block attributes.
|
|
51
|
+
* @return Filtered props applied to save element.
|
|
52
|
+
*/
|
|
53
|
+
function addSaveProps(
|
|
54
|
+
props: SaveProps,
|
|
55
|
+
blockType: string | BlockType,
|
|
56
|
+
attributes: TextShadowAttributes | undefined
|
|
57
|
+
) {
|
|
58
|
+
if ( ! hasBlockSupport( blockType, TEXT_SHADOW_SUPPORT_KEY ) ) {
|
|
59
|
+
return props;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (
|
|
63
|
+
shouldSkipSerialization(
|
|
64
|
+
blockType,
|
|
65
|
+
TYPOGRAPHY_SUPPORT_KEY,
|
|
66
|
+
'textShadow'
|
|
67
|
+
)
|
|
68
|
+
) {
|
|
69
|
+
return props;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if ( ! attributes?.textShadow ) {
|
|
73
|
+
return props;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Use TokenList to dedupe classes.
|
|
77
|
+
const classes = new TokenList( props.className );
|
|
78
|
+
classes.add( `has-${ kebabCase( attributes.textShadow ) }-text-shadow` );
|
|
79
|
+
const newClassName = classes.value;
|
|
80
|
+
props.className = newClassName ? newClassName : undefined;
|
|
81
|
+
|
|
82
|
+
return props;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function useBlockProps( {
|
|
86
|
+
name,
|
|
87
|
+
textShadow,
|
|
88
|
+
}: TextShadowAttributes & { name: string } ) {
|
|
89
|
+
return addSaveProps( {}, name, { textShadow } );
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export default {
|
|
93
|
+
useBlockProps,
|
|
94
|
+
addSaveProps,
|
|
95
|
+
attributeKeys: [ 'textShadow' ],
|
|
96
|
+
hasSupport( name: string ) {
|
|
97
|
+
return hasBlockSupport( name, TEXT_SHADOW_SUPPORT_KEY );
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
addFilter(
|
|
102
|
+
'blocks.registerBlockType',
|
|
103
|
+
'core/textShadow/addAttribute',
|
|
104
|
+
addAttributes
|
|
105
|
+
);
|