@wordpress/block-editor 15.21.0 → 15.22.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 +23 -1
- package/README.md +2 -2
- package/build/components/block-card/index.cjs +4 -5
- package/build/components/block-card/index.cjs.map +2 -2
- package/build/components/block-compare/index.cjs +2 -2
- package/build/components/block-compare/index.cjs.map +2 -2
- package/build/components/block-editing-mode/index.cjs +13 -7
- package/build/components/block-editing-mode/index.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +35 -20
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-mover/mover-description.cjs +6 -6
- package/build/components/block-mover/mover-description.cjs.map +1 -1
- package/build/components/block-patterns-list/index.cjs +1 -1
- package/build/components/block-patterns-list/index.cjs.map +2 -2
- package/build/components/block-patterns-paging/index.cjs +4 -4
- package/build/components/block-patterns-paging/index.cjs.map +2 -2
- package/build/components/block-popover/use-popover-scroll.cjs.map +1 -1
- package/build/components/block-quick-navigation/index.cjs +7 -5
- package/build/components/block-quick-navigation/index.cjs.map +2 -2
- package/build/components/block-rename/modal.cjs +0 -1
- package/build/components/block-rename/modal.cjs.map +2 -2
- package/build/components/block-switcher/block-transformations-menu.cjs +16 -15
- package/build/components/block-switcher/block-transformations-menu.cjs.map +2 -2
- package/build/components/block-switcher/index.cjs +4 -4
- package/build/components/block-switcher/index.cjs.map +2 -2
- package/build/components/block-toolbar/block-toolbar-icon.cjs +14 -6
- package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
- package/build/components/block-toolbar/edit-section-button.cjs.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.cjs +10 -4
- package/build/components/block-tools/use-block-toolbar-popover-props.cjs.map +2 -2
- package/build/components/child-layout-control/index.cjs +51 -19
- package/build/components/child-layout-control/index.cjs.map +2 -2
- package/build/components/colors-gradients/control.cjs +25 -14
- package/build/components/colors-gradients/control.cjs.map +2 -2
- package/build/components/colors-gradients/dropdown.cjs +4 -1
- package/build/components/colors-gradients/dropdown.cjs.map +3 -3
- package/build/components/contrast-checker/index.cjs +22 -4
- package/build/components/contrast-checker/index.cjs.map +2 -2
- package/build/components/date-format-picker/index.cjs +0 -1
- package/build/components/date-format-picker/index.cjs.map +2 -2
- package/build/components/dimensions-tool/index.cjs +4 -5
- package/build/components/dimensions-tool/index.cjs.map +2 -2
- package/build/components/dimensions-tool/scale-tool.cjs +1 -1
- package/build/components/dimensions-tool/scale-tool.cjs.map +2 -2
- package/build/components/global-styles/advanced-panel.cjs +23 -15
- package/build/components/global-styles/advanced-panel.cjs.map +2 -2
- package/build/components/global-styles/background-panel.cjs +154 -26
- package/build/components/global-styles/background-panel.cjs.map +3 -3
- package/build/components/global-styles/border-panel.cjs +2 -0
- package/build/components/global-styles/border-panel.cjs.map +2 -2
- package/build/components/global-styles/color-gradient-dropdown-item.cjs +227 -0
- package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +7 -0
- package/build/components/global-styles/color-panel.cjs +98 -375
- package/build/components/global-styles/color-panel.cjs.map +3 -3
- package/build/components/global-styles/dimensions-panel.cjs +2 -5
- package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
- package/build/components/global-styles/hooks.cjs +34 -0
- package/build/components/global-styles/hooks.cjs.map +2 -2
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/global-styles/typography-panel.cjs +82 -10
- package/build/components/global-styles/typography-panel.cjs.map +3 -3
- package/build/components/grid/grid-item-resizer.cjs.map +1 -1
- package/build/components/grid/grid-visualizer.cjs.map +1 -1
- package/build/components/iframe/index.cjs +6 -3
- package/build/components/iframe/index.cjs.map +3 -3
- package/build/components/image-editor/use-transform-image.cjs.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.cjs +3 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.cjs.map +2 -2
- package/build/components/inserter/get-appender-label.cjs.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.cjs +1 -1
- package/build/components/inserter/hooks/use-patterns-state.cjs.map +2 -2
- package/build/components/inserter/index.cjs +179 -220
- package/build/components/inserter/index.cjs.map +3 -3
- package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
- package/build/components/inserter/search-items.cjs.map +1 -1
- package/build/components/inserter/search-results.cjs +1 -1
- package/build/components/inserter/search-results.cjs.map +2 -2
- package/build/components/inspector-controls/fill.cjs +1 -3
- package/build/components/inspector-controls/fill.cjs.map +2 -2
- package/build/components/inspector-controls/groups.cjs +2 -0
- package/build/components/inspector-controls/groups.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/index.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/styles-tab.cjs +76 -32
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/keyboard-shortcuts/index.cjs.map +1 -1
- package/build/components/line-height-control/index.cjs.map +1 -1
- package/build/components/link-control/index.cjs +2 -3
- package/build/components/link-control/index.cjs.map +2 -2
- package/build/components/link-control/normalize-url.cjs.map +1 -1
- package/build/components/list-view/block-select-button.cjs +9 -20
- package/build/components/list-view/block-select-button.cjs.map +3 -3
- package/build/components/list-view/block.cjs +2 -1
- package/build/components/list-view/block.cjs.map +2 -2
- package/build/components/list-view/utils.cjs.map +1 -1
- package/build/components/preset-input-control/custom-value-controls.cjs.map +2 -2
- package/build/components/provider/index.cjs.map +1 -1
- package/build/components/provider/use-block-sync.cjs +14 -3
- package/build/components/provider/use-block-sync.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/before-input-rules.cjs +5 -5
- package/build/components/rich-text/event-listeners/before-input-rules.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/delete.cjs +4 -4
- package/build/components/rich-text/event-listeners/delete.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/enter.cjs +7 -2
- package/build/components/rich-text/event-listeners/enter.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/input-events.cjs +4 -4
- package/build/components/rich-text/event-listeners/input-events.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/input-rules.cjs +17 -4
- package/build/components/rich-text/event-listeners/input-rules.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/insert-replacement-text.cjs +4 -4
- package/build/components/rich-text/event-listeners/insert-replacement-text.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/paste-handler.cjs.map +1 -1
- package/build/components/rich-text/event-listeners/remove-browser-shortcuts.cjs +4 -4
- package/build/components/rich-text/event-listeners/remove-browser-shortcuts.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/shortcuts.cjs +4 -4
- package/build/components/rich-text/event-listeners/shortcuts.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/undo-automatic-change.cjs +4 -4
- package/build/components/rich-text/event-listeners/undo-automatic-change.cjs.map +3 -3
- package/build/components/rich-text/index.cjs +1 -23
- package/build/components/rich-text/index.cjs.map +2 -2
- package/build/components/rich-text/prevent-event-discovery.cjs +1 -1
- package/build/components/rich-text/prevent-event-discovery.cjs.map +1 -1
- package/build/components/url-popover/image-url-input-ui.cjs +0 -2
- package/build/components/url-popover/image-url-input-ui.cjs.map +2 -2
- package/build/components/use-block-commands/index.cjs +5 -5
- package/build/components/use-block-commands/index.cjs.map +2 -2
- package/build/components/use-block-display-information/index.cjs +10 -3
- package/build/components/use-block-display-information/index.cjs.map +2 -2
- package/build/components/writing-flow/use-tab-nav.cjs.map +1 -1
- package/build/hooks/anchor.cjs +12 -17
- package/build/hooks/anchor.cjs.map +2 -2
- package/build/hooks/background.cjs +124 -75
- package/build/hooks/background.cjs.map +3 -3
- package/build/hooks/block-fields/index.cjs +13 -2
- package/build/hooks/block-fields/index.cjs.map +2 -2
- package/build/hooks/border.cjs +0 -3
- package/build/hooks/border.cjs.map +2 -2
- package/build/hooks/color.cjs +0 -165
- package/build/hooks/color.cjs.map +3 -3
- package/build/hooks/contrast-checker.cjs +31 -28
- package/build/hooks/contrast-checker.cjs.map +3 -3
- package/build/hooks/custom-class-name.cjs +0 -1
- package/build/hooks/custom-class-name.cjs.map +2 -2
- package/build/hooks/dimensions.cjs +13 -5
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/elements.cjs +142 -0
- package/build/hooks/elements.cjs.map +7 -0
- package/build/hooks/fit-text.cjs +11 -0
- package/build/hooks/fit-text.cjs.map +2 -2
- package/build/hooks/grid-visualizer.cjs +21 -11
- package/build/hooks/grid-visualizer.cjs.map +2 -2
- package/build/hooks/layout-child.cjs +65 -10
- package/build/hooks/layout-child.cjs.map +2 -2
- package/build/hooks/layout.cjs +6 -3
- package/build/hooks/layout.cjs.map +2 -2
- package/build/hooks/list-view.cjs +10 -7
- package/build/hooks/list-view.cjs.map +2 -2
- package/build/hooks/position.cjs +19 -22
- package/build/hooks/position.cjs.map +2 -2
- package/build/hooks/spacing-visualizer.cjs.map +1 -1
- package/build/hooks/state-utils.cjs.map +1 -1
- package/build/hooks/states.cjs +2 -2
- package/build/hooks/states.cjs.map +2 -2
- package/build/hooks/style.cjs +50 -6
- package/build/hooks/style.cjs.map +2 -2
- package/build/hooks/supports.cjs +0 -7
- package/build/hooks/supports.cjs.map +2 -2
- package/build/hooks/typography.cjs +62 -10
- package/build/hooks/typography.cjs.map +3 -3
- package/build/layouts/flex.cjs +99 -6
- package/build/layouts/flex.cjs.map +2 -2
- package/build/private-apis.cjs +4 -0
- package/build/private-apis.cjs.map +2 -2
- package/build/store/actions.cjs +7 -3
- package/build/store/actions.cjs.map +2 -2
- package/build/store/private-actions.cjs +1 -2
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +42 -2
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +14 -6
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +60 -41
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/block-bindings.cjs +9 -9
- package/build/utils/block-bindings.cjs.map +3 -3
- package/build/utils/color-values.cjs +10 -1
- package/build/utils/color-values.cjs.map +3 -3
- package/build/utils/dom.cjs +2 -5
- package/build/utils/dom.cjs.map +3 -3
- package/build/utils/fit-text-frontend.cjs +6 -2
- package/build/utils/fit-text-frontend.cjs.map +3 -3
- package/build/utils/fit-text-utils.cjs +1 -1
- package/build/utils/fit-text-utils.cjs.map +3 -3
- package/build/utils/format-font-style.cjs +1 -1
- package/build/utils/format-font-style.cjs.map +3 -3
- package/build/utils/format-font-weight.cjs +1 -1
- package/build/utils/format-font-weight.cjs.map +3 -3
- package/build/utils/get-editor-region.cjs +4 -2
- package/build/utils/get-editor-region.cjs.map +3 -3
- package/build/utils/get-font-styles-and-weights.cjs +8 -12
- package/build/utils/get-font-styles-and-weights.cjs.map +3 -3
- package/build/utils/get-px-from-css-unit.cjs +1 -1
- package/build/utils/get-px-from-css-unit.cjs.map +1 -1
- package/build/utils/index.cjs +1 -1
- package/build/utils/index.cjs.map +1 -1
- package/build/utils/math.cjs +1 -1
- package/build/utils/math.cjs.map +3 -3
- package/build/utils/object.cjs +8 -8
- package/build/utils/object.cjs.map +3 -3
- package/build/utils/order-inserter-block-items.cjs +1 -1
- package/build/utils/order-inserter-block-items.cjs.map +3 -3
- package/build/utils/pasting.cjs +4 -2
- package/build/utils/pasting.cjs.map +3 -3
- package/build/utils/selection.cjs +3 -2
- package/build/utils/selection.cjs.map +3 -3
- package/build/utils/sorting.cjs +9 -3
- package/build/utils/sorting.cjs.map +3 -3
- package/build/utils/transform-styles/index.cjs +3 -2
- package/build/utils/transform-styles/index.cjs.map +3 -3
- package/build/utils/transform-styles/postcss-urlrebase.d.cjs +2 -0
- package/build/utils/transform-styles/postcss-urlrebase.d.cjs.map +7 -0
- package/build/{components/rich-text/native/index.cjs → utils/transform-styles/types.cjs} +4 -13
- package/build/utils/transform-styles/types.cjs.map +7 -0
- package/build/utils/types.cjs +19 -0
- package/build/utils/types.cjs.map +7 -0
- package/build-module/components/block-card/index.mjs +5 -6
- package/build-module/components/block-card/index.mjs.map +2 -2
- package/build-module/components/block-compare/index.mjs +1 -1
- package/build-module/components/block-compare/index.mjs.map +2 -2
- package/build-module/components/block-editing-mode/index.mjs +14 -8
- package/build-module/components/block-editing-mode/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +35 -21
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-mover/mover-description.mjs +6 -6
- package/build-module/components/block-mover/mover-description.mjs.map +1 -1
- package/build-module/components/block-patterns-list/index.mjs +1 -1
- package/build-module/components/block-patterns-list/index.mjs.map +2 -2
- package/build-module/components/block-patterns-paging/index.mjs +4 -4
- package/build-module/components/block-patterns-paging/index.mjs.map +2 -2
- package/build-module/components/block-popover/use-popover-scroll.mjs.map +1 -1
- package/build-module/components/block-quick-navigation/index.mjs +8 -6
- package/build-module/components/block-quick-navigation/index.mjs.map +2 -2
- package/build-module/components/block-rename/modal.mjs +0 -1
- package/build-module/components/block-rename/modal.mjs.map +2 -2
- package/build-module/components/block-switcher/block-transformations-menu.mjs +16 -15
- package/build-module/components/block-switcher/block-transformations-menu.mjs.map +2 -2
- package/build-module/components/block-switcher/index.mjs +4 -4
- package/build-module/components/block-switcher/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs +14 -6
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
- package/build-module/components/block-toolbar/edit-section-button.mjs.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs +10 -4
- package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs.map +2 -2
- package/build-module/components/child-layout-control/index.mjs +51 -19
- package/build-module/components/child-layout-control/index.mjs.map +2 -2
- package/build-module/components/colors-gradients/control.mjs +27 -15
- package/build-module/components/colors-gradients/control.mjs.map +2 -2
- package/build-module/components/colors-gradients/dropdown.mjs +4 -1
- package/build-module/components/colors-gradients/dropdown.mjs.map +2 -2
- package/build-module/components/contrast-checker/index.mjs +18 -4
- package/build-module/components/contrast-checker/index.mjs.map +2 -2
- package/build-module/components/date-format-picker/index.mjs +0 -1
- package/build-module/components/date-format-picker/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/index.mjs +4 -5
- package/build-module/components/dimensions-tool/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/scale-tool.mjs +1 -1
- package/build-module/components/dimensions-tool/scale-tool.mjs.map +2 -2
- package/build-module/components/global-styles/advanced-panel.mjs +23 -15
- package/build-module/components/global-styles/advanced-panel.mjs.map +2 -2
- package/build-module/components/global-styles/background-panel.mjs +157 -29
- package/build-module/components/global-styles/background-panel.mjs.map +2 -2
- package/build-module/components/global-styles/border-panel.mjs +2 -0
- package/build-module/components/global-styles/border-panel.mjs.map +2 -2
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +207 -0
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +7 -0
- package/build-module/components/global-styles/color-panel.mjs +106 -387
- package/build-module/components/global-styles/color-panel.mjs.map +3 -3
- package/build-module/components/global-styles/dimensions-panel.mjs +3 -7
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/hooks.mjs +33 -0
- package/build-module/components/global-styles/hooks.mjs.map +2 -2
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/global-styles/typography-panel.mjs +84 -10
- package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
- package/build-module/components/grid/grid-item-resizer.mjs.map +1 -1
- package/build-module/components/grid/grid-visualizer.mjs.map +1 -1
- package/build-module/components/iframe/index.mjs +6 -3
- package/build-module/components/iframe/index.mjs.map +2 -2
- package/build-module/components/image-editor/use-transform-image.mjs.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.mjs +3 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.mjs.map +2 -2
- package/build-module/components/inserter/get-appender-label.mjs.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.mjs +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.mjs.map +2 -2
- package/build-module/components/inserter/index.mjs +185 -222
- package/build-module/components/inserter/index.mjs.map +3 -3
- package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
- package/build-module/components/inserter/search-items.mjs.map +1 -1
- package/build-module/components/inserter/search-results.mjs +1 -1
- package/build-module/components/inserter/search-results.mjs.map +2 -2
- package/build-module/components/inspector-controls/fill.mjs +1 -3
- package/build-module/components/inspector-controls/fill.mjs.map +2 -2
- package/build-module/components/inspector-controls/groups.mjs +2 -0
- package/build-module/components/inspector-controls/groups.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +76 -32
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/keyboard-shortcuts/index.mjs.map +1 -1
- package/build-module/components/line-height-control/index.mjs.map +1 -1
- package/build-module/components/link-control/index.mjs +2 -3
- package/build-module/components/link-control/index.mjs.map +2 -2
- package/build-module/components/link-control/normalize-url.mjs.map +1 -1
- package/build-module/components/list-view/block-select-button.mjs +10 -27
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +2 -1
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/components/list-view/utils.mjs.map +1 -1
- package/build-module/components/preset-input-control/custom-value-controls.mjs.map +2 -2
- package/build-module/components/provider/index.mjs.map +1 -1
- package/build-module/components/provider/use-block-sync.mjs +14 -3
- package/build-module/components/provider/use-block-sync.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs +5 -5
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/delete.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/delete.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs +7 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/input-events.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/input-events.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/input-rules.mjs +17 -4
- package/build-module/components/rich-text/event-listeners/input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +1 -1
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/shortcuts.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/shortcuts.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +1 -23
- package/build-module/components/rich-text/index.mjs.map +2 -2
- package/build-module/components/rich-text/prevent-event-discovery.mjs +1 -1
- package/build-module/components/rich-text/prevent-event-discovery.mjs.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.mjs +0 -2
- package/build-module/components/url-popover/image-url-input-ui.mjs.map +2 -2
- package/build-module/components/use-block-commands/index.mjs +5 -5
- package/build-module/components/use-block-commands/index.mjs.map +2 -2
- package/build-module/components/use-block-display-information/index.mjs +10 -3
- package/build-module/components/use-block-display-information/index.mjs.map +2 -2
- package/build-module/components/writing-flow/use-tab-nav.mjs.map +1 -1
- package/build-module/hooks/anchor.mjs +12 -17
- package/build-module/hooks/anchor.mjs.map +2 -2
- package/build-module/hooks/background.mjs +123 -75
- package/build-module/hooks/background.mjs.map +2 -2
- package/build-module/hooks/block-fields/index.mjs +13 -2
- package/build-module/hooks/block-fields/index.mjs.map +2 -2
- package/build-module/hooks/border.mjs +1 -4
- package/build-module/hooks/border.mjs.map +2 -2
- package/build-module/hooks/color.mjs +2 -178
- package/build-module/hooks/color.mjs.map +2 -2
- package/build-module/hooks/contrast-checker.mjs +32 -19
- package/build-module/hooks/contrast-checker.mjs.map +2 -2
- package/build-module/hooks/custom-class-name.mjs +0 -1
- package/build-module/hooks/custom-class-name.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs +13 -6
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/elements.mjs +115 -0
- package/build-module/hooks/elements.mjs.map +7 -0
- package/build-module/hooks/fit-text.mjs +11 -0
- package/build-module/hooks/fit-text.mjs.map +2 -2
- package/build-module/hooks/grid-visualizer.mjs +21 -11
- package/build-module/hooks/grid-visualizer.mjs.map +2 -2
- package/build-module/hooks/layout-child.mjs +68 -10
- package/build-module/hooks/layout-child.mjs.map +2 -2
- package/build-module/hooks/layout.mjs +6 -3
- package/build-module/hooks/layout.mjs.map +2 -2
- package/build-module/hooks/list-view.mjs +10 -7
- package/build-module/hooks/list-view.mjs.map +2 -2
- package/build-module/hooks/position.mjs +20 -23
- package/build-module/hooks/position.mjs.map +2 -2
- package/build-module/hooks/spacing-visualizer.mjs.map +1 -1
- package/build-module/hooks/state-utils.mjs.map +1 -1
- package/build-module/hooks/states.mjs +2 -2
- package/build-module/hooks/states.mjs.map +2 -2
- package/build-module/hooks/style.mjs +53 -8
- package/build-module/hooks/style.mjs.map +2 -2
- package/build-module/hooks/supports.mjs +0 -7
- package/build-module/hooks/supports.mjs.map +2 -2
- package/build-module/hooks/typography.mjs +62 -10
- package/build-module/hooks/typography.mjs.map +2 -2
- package/build-module/layouts/flex.mjs +105 -7
- package/build-module/layouts/flex.mjs.map +2 -2
- package/build-module/private-apis.mjs +8 -0
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs +7 -3
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +1 -2
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +39 -1
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +14 -6
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +62 -42
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/block-bindings.mjs +9 -9
- package/build-module/utils/block-bindings.mjs.map +3 -3
- package/build-module/utils/color-values.mjs +9 -1
- package/build-module/utils/color-values.mjs.map +3 -3
- package/build-module/utils/dom.mjs +2 -5
- package/build-module/utils/dom.mjs.map +3 -3
- package/build-module/utils/fit-text-frontend.mjs +6 -2
- package/build-module/utils/fit-text-frontend.mjs.map +3 -3
- package/build-module/utils/fit-text-utils.mjs +1 -1
- package/build-module/utils/fit-text-utils.mjs.map +3 -3
- package/build-module/utils/format-font-style.mjs +1 -1
- package/build-module/utils/format-font-style.mjs.map +3 -3
- package/build-module/utils/format-font-weight.mjs +1 -1
- package/build-module/utils/format-font-weight.mjs.map +3 -3
- package/build-module/utils/get-editor-region.mjs +4 -2
- package/build-module/utils/get-editor-region.mjs.map +3 -3
- package/build-module/utils/get-font-styles-and-weights.mjs +8 -12
- package/build-module/utils/get-font-styles-and-weights.mjs.map +3 -3
- package/build-module/utils/get-px-from-css-unit.mjs +1 -1
- package/build-module/utils/get-px-from-css-unit.mjs.map +1 -1
- package/build-module/utils/index.mjs +1 -1
- package/build-module/utils/index.mjs.map +1 -1
- package/build-module/utils/math.mjs +1 -1
- package/build-module/utils/math.mjs.map +3 -3
- package/build-module/utils/object.mjs +8 -8
- package/build-module/utils/object.mjs.map +3 -3
- package/build-module/utils/order-inserter-block-items.mjs +1 -1
- package/build-module/utils/order-inserter-block-items.mjs.map +3 -3
- package/build-module/utils/pasting.mjs +4 -2
- package/build-module/utils/pasting.mjs.map +3 -3
- package/build-module/utils/selection.mjs +3 -2
- package/build-module/utils/selection.mjs.map +3 -3
- package/build-module/utils/sorting.mjs +9 -3
- package/build-module/utils/sorting.mjs.map +3 -3
- package/build-module/utils/transform-styles/index.mjs +3 -2
- package/build-module/utils/transform-styles/index.mjs.map +3 -3
- package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs +1 -0
- package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs.map +7 -0
- package/build-module/utils/transform-styles/types.mjs +1 -0
- package/build-module/utils/transform-styles/types.mjs.map +7 -0
- package/build-module/utils/types.mjs +1 -0
- package/build-module/utils/types.mjs.map +7 -0
- package/build-style/content-rtl.css +14 -0
- package/build-style/content.css +14 -0
- package/build-style/style-rtl.css +60 -49
- package/build-style/style.css +60 -49
- package/build-types/utils/block-bindings.d.ts +27 -0
- package/build-types/utils/block-bindings.d.ts.map +1 -0
- package/build-types/utils/color-values.d.ts +40 -0
- package/build-types/utils/color-values.d.ts.map +1 -0
- package/build-types/utils/dom.d.ts +19 -19
- package/build-types/utils/dom.d.ts.map +1 -1
- package/build-types/utils/fit-text-frontend.d.ts +7 -0
- package/build-types/utils/fit-text-frontend.d.ts.map +1 -0
- package/build-types/utils/fit-text-utils.d.ts +15 -0
- package/build-types/utils/fit-text-utils.d.ts.map +1 -0
- package/build-types/utils/format-font-style.d.ts +12 -0
- package/build-types/utils/format-font-style.d.ts.map +1 -0
- package/build-types/utils/format-font-weight.d.ts +12 -0
- package/build-types/utils/format-font-weight.d.ts.map +1 -0
- package/build-types/utils/get-editor-region.d.ts +9 -0
- package/build-types/utils/get-editor-region.d.ts.map +1 -0
- package/build-types/utils/get-font-styles-and-weights.d.ts +16 -0
- package/build-types/utils/get-font-styles-and-weights.d.ts.map +1 -0
- package/build-types/utils/get-px-from-css-unit.d.ts +10 -0
- package/build-types/utils/get-px-from-css-unit.d.ts.map +1 -0
- package/build-types/utils/index.d.ts +3 -0
- package/build-types/utils/index.d.ts.map +1 -0
- package/build-types/utils/math.d.ts +61 -0
- package/build-types/utils/math.d.ts.map +1 -0
- package/build-types/utils/object.d.ts +39 -0
- package/build-types/utils/object.d.ts.map +1 -0
- package/build-types/utils/order-inserter-block-items.d.ts +13 -0
- package/build-types/utils/order-inserter-block-items.d.ts.map +1 -0
- package/build-types/utils/pasting.d.ts +28 -0
- package/build-types/utils/pasting.d.ts.map +1 -0
- package/build-types/utils/selection.d.ts +21 -0
- package/build-types/utils/selection.d.ts.map +1 -0
- package/build-types/utils/sorting.d.ts +17 -0
- package/build-types/utils/sorting.d.ts.map +1 -0
- package/build-types/utils/transform-styles/index.d.ts +15 -0
- package/build-types/utils/transform-styles/index.d.ts.map +1 -0
- package/build-types/utils/transform-styles/types.d.ts +13 -0
- package/build-types/utils/transform-styles/types.d.ts.map +1 -0
- package/build-types/utils/types.d.ts +28 -0
- package/build-types/utils/types.d.ts.map +1 -0
- package/package.json +55 -46
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -0
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -0
- package/src/components/block-breadcrumb/README.md +2 -2
- package/src/components/block-card/index.js +7 -13
- package/src/components/block-compare/README.md +6 -6
- package/src/components/block-compare/index.js +1 -3
- package/src/components/block-editing-mode/index.js +17 -9
- package/src/components/block-icon/test/__snapshots__/index.js.snap +1 -0
- package/src/components/block-inspector/index.js +22 -20
- package/src/components/block-patterns-list/index.js +1 -2
- package/src/components/block-preview/README.md +1 -1
- package/src/components/block-quick-navigation/index.js +7 -7
- package/src/components/block-rename/modal.js +0 -1
- package/src/components/block-switcher/block-transformations-menu.js +16 -18
- package/src/components/block-switcher/index.js +4 -4
- package/src/components/block-toolbar/block-toolbar-icon.js +22 -6
- package/src/components/block-toolbar/test/block-toolbar-icon.js +99 -0
- package/src/components/block-tools/use-block-toolbar-popover-props.js +10 -4
- package/src/components/block-types-list/README.md +0 -19
- package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +4 -0
- package/src/components/child-layout-control/index.js +65 -20
- package/src/components/child-layout-control/test/index.js +64 -0
- package/src/components/colors-gradients/control.js +29 -12
- package/src/components/colors-gradients/dropdown.js +4 -1
- package/src/components/colors-gradients/style.scss +39 -2
- package/src/components/contrast-checker/README.md +9 -0
- package/src/components/contrast-checker/index.js +42 -3
- package/src/components/date-format-picker/index.js +0 -1
- package/src/components/default-block-appender/content.scss +3 -0
- package/src/components/dimensions-tool/index.js +4 -9
- package/src/components/dimensions-tool/scale-tool.js +1 -2
- package/src/components/dimensions-tool/test/index.js +89 -11
- package/src/components/global-styles/advanced-panel.js +5 -1
- package/src/components/global-styles/background-panel.js +203 -36
- package/src/components/global-styles/border-panel.js +2 -0
- package/src/components/global-styles/color-gradient-dropdown-item.js +258 -0
- package/src/components/global-styles/color-panel.js +125 -487
- package/src/components/global-styles/dimensions-panel.js +13 -18
- package/src/components/global-styles/hooks.js +45 -0
- package/src/components/global-styles/shadow-panel-components.js +0 -1
- package/src/components/global-styles/test/background-panel.js +56 -0
- package/src/components/global-styles/test/color-panel.js +172 -118
- package/src/components/global-styles/test/typography-panel.js +167 -0
- package/src/components/global-styles/typography-panel.js +100 -11
- package/src/components/iframe/index.js +8 -3
- package/src/components/inner-blocks/use-inner-block-template-sync.js +3 -1
- package/src/components/inserter/hooks/use-patterns-state.js +1 -1
- package/src/components/inserter/index.js +257 -288
- package/src/components/inserter/media-tab/media-preview.js +0 -1
- package/src/components/inserter/search-results.js +1 -3
- package/src/components/inspector-controls/README.md +0 -2
- package/src/components/inspector-controls/fill.js +6 -8
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/index.js +0 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +78 -28
- package/src/components/justify-content-control/README.md +1 -1
- package/src/components/link-control/index.js +0 -1
- package/src/components/link-control/test/index.js +2 -3
- package/src/components/list-view/block-select-button.js +9 -29
- package/src/components/list-view/block.js +1 -0
- package/src/components/media-placeholder/README.md +1 -29
- package/src/components/media-upload/README.md +0 -19
- package/src/components/preset-input-control/custom-value-controls.js +0 -1
- package/src/components/provider/test/use-block-sync.js +40 -0
- package/src/components/provider/use-block-sync.js +15 -3
- package/src/components/rich-text/content.scss +2 -0
- package/src/components/rich-text/event-listeners/before-input-rules.js +5 -4
- package/src/components/rich-text/event-listeners/delete.js +9 -4
- package/src/components/rich-text/event-listeners/enter.js +9 -2
- package/src/components/rich-text/event-listeners/input-events.js +13 -4
- package/src/components/rich-text/event-listeners/input-rules.js +20 -4
- package/src/components/rich-text/event-listeners/insert-replacement-text.js +9 -4
- package/src/components/rich-text/event-listeners/remove-browser-shortcuts.js +9 -4
- package/src/components/rich-text/event-listeners/shortcuts.js +13 -4
- package/src/components/rich-text/event-listeners/undo-automatic-change.js +5 -4
- package/src/components/rich-text/index.js +1 -33
- package/src/components/unit-control/README.md +1 -1
- package/src/components/url-popover/README.md +1 -1
- package/src/components/url-popover/image-url-input-ui.js +0 -2
- package/src/components/use-block-commands/index.js +5 -5
- package/src/components/use-block-display-information/index.js +15 -2
- package/src/components/use-block-display-information/test/index.js +140 -0
- package/src/hooks/anchor.js +9 -18
- package/src/hooks/background.js +210 -133
- package/src/hooks/background.scss +0 -35
- package/src/hooks/block-fields/index.js +27 -2
- package/src/hooks/border.js +1 -5
- package/src/hooks/color.js +2 -210
- package/src/hooks/color.scss +3 -9
- package/src/hooks/contrast-checker.js +60 -17
- package/src/hooks/custom-class-name.js +0 -1
- package/src/hooks/dimensions.js +15 -8
- package/src/hooks/elements.js +140 -0
- package/src/hooks/elements.scss +8 -0
- package/src/hooks/fit-text.js +16 -0
- package/src/hooks/grid-visualizer.js +59 -45
- package/src/hooks/layout-child.js +92 -14
- package/src/hooks/layout.js +6 -3
- package/src/hooks/list-view.js +10 -11
- package/src/hooks/position.js +23 -27
- package/src/hooks/states.js +2 -2
- package/src/hooks/style.js +91 -9
- package/src/hooks/supports.js +0 -9
- package/src/hooks/test/background.js +59 -0
- package/src/hooks/test/block-style-state.js +14 -14
- package/src/hooks/test/dimensions.js +71 -0
- package/src/hooks/test/layout-child.js +165 -0
- package/src/hooks/test/layout.js +6 -6
- package/src/hooks/test/style.js +133 -11
- package/src/hooks/typography.js +70 -6
- package/src/layouts/flex.js +118 -15
- package/src/private-apis.js +8 -0
- package/src/store/actions.js +13 -3
- package/src/store/private-actions.js +1 -4
- package/src/store/private-selectors.js +89 -0
- package/src/store/reducer.js +19 -7
- package/src/store/selectors.js +91 -53
- package/src/store/test/actions.js +21 -0
- package/src/store/test/private-selectors.js +166 -7
- package/src/store/test/reducer.js +107 -10
- package/src/store/test/selectors.js +77 -0
- package/src/style.scss +1 -0
- package/src/utils/block-bindings.ts +51 -0
- package/src/utils/color-values.ts +63 -0
- package/src/utils/{dom.js → dom.ts} +27 -27
- package/src/utils/{fit-text-frontend.js → fit-text-frontend.ts} +12 -4
- package/src/utils/{fit-text-utils.js → fit-text-utils.ts} +15 -7
- package/src/utils/{format-font-style.js → format-font-style.ts} +10 -3
- package/src/utils/{format-font-weight.js → format-font-weight.ts} +10 -3
- package/src/utils/{get-editor-region.js → get-editor-region.ts} +10 -6
- package/src/utils/{get-font-styles-and-weights.js → get-font-styles-and-weights.ts} +21 -17
- package/src/utils/{math.js → math.ts} +37 -30
- package/src/utils/object.ts +89 -0
- package/src/utils/{order-inserter-block-items.js → order-inserter-block-items.ts} +8 -5
- package/src/utils/{pasting.js → pasting.ts} +18 -11
- package/src/utils/{selection.js → selection.ts} +11 -4
- package/src/utils/sorting.ts +81 -0
- package/src/utils/test/color-values.js +44 -1
- package/src/utils/transform-styles/{index.js → index.ts} +25 -25
- package/src/utils/transform-styles/postcss-urlrebase.d.ts +15 -0
- package/src/utils/transform-styles/types.ts +13 -0
- package/src/utils/types.ts +29 -0
- package/build/components/media-upload-progress/constants.cjs +0 -46
- package/build/components/media-upload-progress/constants.cjs.map +0 -7
- package/build/components/rich-text/native/format-edit.cjs +0 -60
- package/build/components/rich-text/native/format-edit.cjs.map +0 -7
- package/build/components/rich-text/native/index.cjs.map +0 -7
- package/build/components/rich-text/native/use-format-types.cjs +0 -139
- package/build/components/rich-text/native/use-format-types.cjs.map +0 -7
- package/build-module/components/media-upload-progress/constants.mjs +0 -16
- package/build-module/components/media-upload-progress/constants.mjs.map +0 -7
- package/build-module/components/rich-text/native/format-edit.mjs +0 -39
- package/build-module/components/rich-text/native/format-edit.mjs.map +0 -7
- package/build-module/components/rich-text/native/index.mjs +0 -7
- package/build-module/components/rich-text/native/index.mjs.map +0 -7
- package/build-module/components/rich-text/native/use-format-types.mjs +0 -114
- package/build-module/components/rich-text/native/use-format-types.mjs.map +0 -7
- package/src/components/audio-player/audio-url-parser.native.js +0 -20
- package/src/components/audio-player/index.native.js +0 -225
- package/src/components/audio-player/styles.native.scss +0 -114
- package/src/components/audio-player/test/audio-url-parser.native.js +0 -53
- package/src/components/block-alignment-control/test/index.native.js +0 -37
- package/src/components/block-alignment-control/ui.native.js +0 -86
- package/src/components/block-caption/README.md +0 -104
- package/src/components/block-caption/index.native.js +0 -89
- package/src/components/block-caption/styles.native.scss +0 -7
- package/src/components/block-controls/slot.native.js +0 -33
- package/src/components/block-draggable/draggable-chip.native.js +0 -49
- package/src/components/block-draggable/dropping-insertion-point.native.js +0 -181
- package/src/components/block-draggable/dropping-insertion-point.native.scss +0 -8
- package/src/components/block-draggable/index.native.js +0 -467
- package/src/components/block-draggable/style.native.scss +0 -19
- package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +0 -73
- package/src/components/block-draggable/test/helpers.native.js +0 -182
- package/src/components/block-draggable/test/index.native.js +0 -419
- package/src/components/block-draggable/use-scroll-when-dragging.native.js +0 -135
- package/src/components/block-edit/edit.native.js +0 -49
- package/src/components/block-edit/test/edit.native.js +0 -65
- package/src/components/block-heading-level-dropdown/index.native.js +0 -68
- package/src/components/block-icon/index.native.js +0 -47
- package/src/components/block-icon/style.native.scss +0 -7
- package/src/components/block-list/block-crash-boundary.native.js +0 -43
- package/src/components/block-list/block-crash-warning.native.js +0 -21
- package/src/components/block-list/block-invalid-warning.native.js +0 -70
- package/src/components/block-list/block-list-context.native.js +0 -172
- package/src/components/block-list/block-list-item-cell.native.js +0 -62
- package/src/components/block-list/block-list-item.native.js +0 -209
- package/src/components/block-list/block-list-item.native.scss +0 -16
- package/src/components/block-list/block-outline.native.js +0 -77
- package/src/components/block-list/block-selection-button.native.js +0 -100
- package/src/components/block-list/block-selection-button.native.scss +0 -34
- package/src/components/block-list/block.native.js +0 -716
- package/src/components/block-list/block.native.scss +0 -62
- package/src/components/block-list/grid-item.native.js +0 -58
- package/src/components/block-list/index.native.js +0 -437
- package/src/components/block-list/insertion-point.native.js +0 -36
- package/src/components/block-list/style.native.scss +0 -117
- package/src/components/block-list/test/block-invalid-warning.native.js +0 -62
- package/src/components/block-list/test/block-list-context.native.js +0 -243
- package/src/components/block-list/test/block-outline.native.js +0 -255
- package/src/components/block-list/test/fixtures/block-list-context.native.js +0 -79
- package/src/components/block-list/test/index.native.js +0 -205
- package/src/components/block-list/use-block-props/index.native.js +0 -10
- package/src/components/block-list/use-scroll-upon-insertion.native.js +0 -52
- package/src/components/block-list-appender/index.native.js +0 -70
- package/src/components/block-list-appender/style.native.scss +0 -8
- package/src/components/block-media-update-progress/README.md +0 -100
- package/src/components/block-media-update-progress/index.native.js +0 -299
- package/src/components/block-media-update-progress/styles.native.scss +0 -9
- package/src/components/block-media-update-progress/test/index.native.js +0 -543
- package/src/components/block-mover/index.native.js +0 -193
- package/src/components/block-mover/mover-description.native.js +0 -155
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +0 -218
- package/src/components/block-mover/test/index.native.js +0 -186
- package/src/components/block-settings/button.native.js +0 -41
- package/src/components/block-settings/container.native.js +0 -91
- package/src/components/block-settings/container.native.scss +0 -4
- package/src/components/block-settings/index.native.js +0 -5
- package/src/components/block-styles/index.native.js +0 -94
- package/src/components/block-styles/preview.native.js +0 -109
- package/src/components/block-styles/style.native.scss +0 -64
- package/src/components/block-switcher/block-transformations-menu.native.js +0 -91
- package/src/components/block-toolbar/block-toolbar-menu.native.js +0 -477
- package/src/components/block-toolbar/index.native.js +0 -126
- package/src/components/block-toolbar/test/__snapshots__/block-toolbar-menu.native.js.snap +0 -125
- package/src/components/block-toolbar/test/block-toolbar-menu.native.js +0 -405
- package/src/components/block-toolbar/test/index.native.js +0 -36
- package/src/components/block-types-list/index.native.js +0 -175
- package/src/components/block-types-list/style.native.scss +0 -25
- package/src/components/block-variation-picker/index.native.js +0 -107
- package/src/components/block-variation-picker/style.native.scss +0 -32
- package/src/components/button-block-appender/index.native.js +0 -92
- package/src/components/button-block-appender/styles.native.scss +0 -43
- package/src/components/caption/README.md +0 -44
- package/src/components/caption/index.native.js +0 -61
- package/src/components/colors-gradients/panel-color-gradient-settings.native.js +0 -59
- package/src/components/contrast-checker/index.native.js +0 -113
- package/src/components/contrast-checker/style.native.scss +0 -26
- package/src/components/convert-to-group-buttons/index.native.js +0 -79
- package/src/components/default-block-appender/index.native.js +0 -113
- package/src/components/default-block-appender/style.native.scss +0 -18
- package/src/components/floating-toolbar/floatingToolbar.android.scss +0 -4
- package/src/components/floating-toolbar/floatingToolbar.ios.scss +0 -3
- package/src/components/floating-toolbar/index.native.js +0 -141
- package/src/components/floating-toolbar/styles.native.scss +0 -43
- package/src/components/font-sizes/index.native.js +0 -7
- package/src/components/global-styles/color-panel.native.js +0 -207
- package/src/components/global-styles/test/use-global-styles-context.native.js +0 -435
- package/src/components/global-styles/use-global-styles-context.native.js +0 -592
- package/src/components/gradients/index.native.js +0 -2
- package/src/components/image-link-destinations/index.native.js +0 -152
- package/src/components/image-link-destinations/style.native.scss +0 -16
- package/src/components/index.native.js +0 -108
- package/src/components/inner-blocks/constants.native.js +0 -5
- package/src/components/inner-blocks/index.native.js +0 -221
- package/src/components/inner-blocks/warning-max-depth-exceeded.native.js +0 -124
- package/src/components/inserter/block-types-tab.native.js +0 -76
- package/src/components/inserter/hooks/use-block-type-impressions.native.js +0 -47
- package/src/components/inserter/hooks/use-clipboard-block.native.js +0 -40
- package/src/components/inserter/index.native.js +0 -424
- package/src/components/inserter/menu.native.js +0 -237
- package/src/components/inserter/no-results.native.js +0 -49
- package/src/components/inserter/reusable-blocks-tab.native.js +0 -45
- package/src/components/inserter/search-results.native.js +0 -67
- package/src/components/inserter/style.native.scss +0 -83
- package/src/components/inserter/tabs.native.js +0 -152
- package/src/components/inserter/test/__snapshots__/index.native.js.snap +0 -117
- package/src/components/inserter/test/fixtures/index.native.js +0 -12
- package/src/components/inserter/test/index.native.js +0 -273
- package/src/components/inserter/test/reusable-blocks-tab.native.js +0 -62
- package/src/components/inserter/test/utils.native.js +0 -37
- package/src/components/inserter/utils.native.js +0 -46
- package/src/components/inserter-button/index.native.js +0 -108
- package/src/components/inserter-button/style.native.scss +0 -72
- package/src/components/inspector-controls/fill.native.js +0 -62
- package/src/components/inspector-controls/slot.native.js +0 -35
- package/src/components/inspector-controls-tabs/advanced-controls-panel.native.js +0 -31
- package/src/components/line-height-control/index.native.js +0 -28
- package/src/components/media-placeholder/index.native.js +0 -258
- package/src/components/media-placeholder/styles.native.scss +0 -108
- package/src/components/media-replace-flow/index.native.js +0 -12
- package/src/components/media-upload/constants.native.js +0 -14
- package/src/components/media-upload/index.native.js +0 -356
- package/src/components/media-upload/style.native.scss +0 -4
- package/src/components/media-upload/test/index.native.js +0 -172
- package/src/components/media-upload-progress/README.md +0 -100
- package/src/components/media-upload-progress/constants.js +0 -6
- package/src/components/media-upload-progress/index.native.js +0 -233
- package/src/components/media-upload-progress/styles.native.scss +0 -15
- package/src/components/media-upload-progress/test/index.native.js +0 -220
- package/src/components/plain-text/index.native.js +0 -164
- package/src/components/plain-text/style.native.scss +0 -10
- package/src/components/provider/index.native.js +0 -32
- package/src/components/rich-text/embed-handler-picker.native.js +0 -65
- package/src/components/rich-text/file-paste-handler.native.js +0 -3
- package/src/components/rich-text/format-toolbar/index.native.js +0 -21
- package/src/components/rich-text/format-toolbar-container.native.js +0 -16
- package/src/components/rich-text/index.native.js +0 -701
- package/src/components/rich-text/input-event.native.js +0 -10
- package/src/components/rich-text/native/format-edit.js +0 -44
- package/src/components/rich-text/native/get-format-colors.native.js +0 -47
- package/src/components/rich-text/native/index.js +0 -1
- package/src/components/rich-text/native/index.native.js +0 -1389
- package/src/components/rich-text/native/style.native.scss +0 -28
- package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +0 -79
- package/src/components/rich-text/native/test/index.native.js +0 -345
- package/src/components/rich-text/native/test/performance/rich-text.native.js +0 -44
- package/src/components/rich-text/native/toolbar-button-with-options.native.js +0 -61
- package/src/components/rich-text/native/use-format-types.js +0 -146
- package/src/components/rich-text/remove-browser-shortcuts.native.js +0 -1
- package/src/components/rich-text/shortcut.native.js +0 -10
- package/src/components/ungroup-button/README.md +0 -23
- package/src/components/ungroup-button/index.native.js +0 -77
- package/src/components/unsupported-block-details/index.native.js +0 -187
- package/src/components/unsupported-block-details/style.native.scss +0 -56
- package/src/components/url-input/index.native.js +0 -33
- package/src/components/use-block-drop-zone/index.native.js +0 -207
- package/src/components/use-on-block-drop/index.native.js +0 -115
- package/src/components/use-unsupported-block-editor/index.native.js +0 -59
- package/src/components/video-player/gridicon-play.native.js +0 -13
- package/src/components/video-player/index.native.js +0 -133
- package/src/components/video-player/styles.native.scss +0 -29
- package/src/components/warning/index.native.js +0 -64
- package/src/components/warning/style.native.scss +0 -47
- package/src/hooks/align.native.js +0 -49
- package/src/hooks/custom-class-name.native.js +0 -70
- package/src/hooks/index.native.js +0 -36
- package/src/hooks/layout.native.js +0 -23
- package/src/hooks/test/__snapshots__/align.native.js.snap +0 -73
- package/src/hooks/test/__snapshots__/anchor.native.js.snap +0 -7
- package/src/hooks/test/align.native.js +0 -134
- package/src/hooks/test/anchor.native.js +0 -32
- package/src/hooks/test/use-editor-wrapper-styles.native.js +0 -282
- package/src/hooks/typography.native.js +0 -60
- package/src/hooks/use-editor-wrapper-styles.native.js +0 -250
- package/src/hooks/use-editor-wrapper-styles.native.scss +0 -12
- package/src/index.native.js +0 -6
- package/src/private-apis.native.js +0 -21
- package/src/store/defaults.native.js +0 -23
- package/src/utils/block-bindings.js +0 -46
- package/src/utils/color-values.js +0 -28
- package/src/utils/object.js +0 -67
- package/src/utils/sorting.js +0 -54
- /package/src/utils/{get-px-from-css-unit.js → get-px-from-css-unit.ts} +0 -0
- /package/src/utils/{index.js → index.ts} +0 -0
|
@@ -15,8 +15,7 @@ function DimensionsTool({
|
|
|
15
15
|
// Match CSS default value for aspect-ratio.
|
|
16
16
|
scaleOptions,
|
|
17
17
|
// Default options handled by ScaleTool.
|
|
18
|
-
defaultScale = "
|
|
19
|
-
// Match CSS default value for object-fit.
|
|
18
|
+
defaultScale = "cover",
|
|
20
19
|
unitsOptions,
|
|
21
20
|
// Default options handled by UnitControl.
|
|
22
21
|
tools = ["aspectRatio", "widthHeight", "scale"]
|
|
@@ -24,10 +23,11 @@ function DimensionsTool({
|
|
|
24
23
|
const width = value.width === void 0 || value.width === "auto" ? null : value.width;
|
|
25
24
|
const height = value.height === void 0 || value.height === "auto" ? null : value.height;
|
|
26
25
|
const aspectRatio = value.aspectRatio === void 0 || value.aspectRatio === "auto" ? null : value.aspectRatio;
|
|
27
|
-
const scale = value.scale === void 0
|
|
26
|
+
const scale = value.scale === void 0 ? null : value.scale;
|
|
28
27
|
const [lastScale, setLastScale] = useState(scale);
|
|
29
28
|
const [lastAspectRatio, setLastAspectRatio] = useState(aspectRatio);
|
|
30
|
-
const
|
|
29
|
+
const hasCustomAspectRatio = !!(width && height);
|
|
30
|
+
const aspectRatioValue = hasCustomAspectRatio ? "custom" : aspectRatio;
|
|
31
31
|
const showScaleControl = aspectRatio || width && height;
|
|
32
32
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
33
33
|
tools.includes("aspectRatio") && /* @__PURE__ */ jsx(
|
|
@@ -108,7 +108,6 @@ function DimensionsTool({
|
|
|
108
108
|
value: lastScale,
|
|
109
109
|
onChange: (nextScale) => {
|
|
110
110
|
const nextValue = { ...value };
|
|
111
|
-
nextScale = nextScale === "fill" ? null : nextScale;
|
|
112
111
|
setLastScale(nextScale);
|
|
113
112
|
if (!nextScale) {
|
|
114
113
|
delete nextValue.scale;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dimensions-tool/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport AspectRatioTool from './aspect-ratio-tool';\nimport ScaleTool from './scale-tool';\nimport WidthHeightTool from './width-height-tool';\n\n/**\n * @typedef {import('@wordpress/components/build-types/select-control/types').SelectControlProps} SelectControlProps\n */\n\n/**\n * @typedef {import('@wordpress/components/build-types/unit-control/types').WPUnitControlUnit} WPUnitControlUnit\n */\n\n/**\n * @typedef {Object} Dimensions\n * @property {string} [width] CSS width property.\n * @property {string} [height] CSS height property.\n * @property {string} [scale] CSS object-fit property.\n * @property {string} [aspectRatio] CSS aspect-ratio property.\n */\n\n/**\n * @callback DimensionsControlsOnChange\n * @param {Dimensions} nextValue\n * @return {void}\n */\n\n/**\n * @typedef {Object} DimensionsControlsProps\n * @property {string} [panelId] ID of the panel that contains the controls.\n * @property {Dimensions} [value] Current dimensions values.\n * @property {DimensionsControlsOnChange} [onChange] Callback to update the dimensions values.\n * @property {SelectControlProps[]} [aspectRatioOptions] Aspect ratio options.\n * @property {SelectControlProps[]} [scaleOptions] Scale options.\n * @property {WPUnitControlUnit[]} [unitsOptions] Units options.\n */\n\n/**\n * Component that renders controls to edit the dimensions of an image or container.\n *\n * @param {DimensionsControlsProps} props The component props.\n *\n * @return {Element} The dimensions controls.\n */\nfunction DimensionsTool( {\n\tpanelId,\n\tvalue = {},\n\tonChange = () => {},\n\taspectRatioOptions, // Default options handled by AspectRatioTool.\n\tdefaultAspectRatio = 'auto', // Match CSS default value for aspect-ratio.\n\tscaleOptions, // Default options handled by ScaleTool.\n\tdefaultScale = '
|
|
5
|
-
"mappings": ";AAGA,SAAS,gBAAgB;AAKzB,OAAO,qBAAqB;AAC5B,OAAO,eAAe;AACtB,OAAO,qBAAqB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport AspectRatioTool from './aspect-ratio-tool';\nimport ScaleTool from './scale-tool';\nimport WidthHeightTool from './width-height-tool';\n\n/**\n * @typedef {import('@wordpress/components/build-types/select-control/types').SelectControlProps} SelectControlProps\n */\n\n/**\n * @typedef {import('@wordpress/components/build-types/unit-control/types').WPUnitControlUnit} WPUnitControlUnit\n */\n\n/**\n * @typedef {Object} Dimensions\n * @property {string} [width] CSS width property.\n * @property {string} [height] CSS height property.\n * @property {string} [scale] CSS object-fit property.\n * @property {string} [aspectRatio] CSS aspect-ratio property.\n */\n\n/**\n * @callback DimensionsControlsOnChange\n * @param {Dimensions} nextValue\n * @return {void}\n */\n\n/**\n * @typedef {Object} DimensionsControlsProps\n * @property {string} [panelId] ID of the panel that contains the controls.\n * @property {Dimensions} [value] Current dimensions values.\n * @property {DimensionsControlsOnChange} [onChange] Callback to update the dimensions values.\n * @property {SelectControlProps[]} [aspectRatioOptions] Aspect ratio options.\n * @property {SelectControlProps[]} [scaleOptions] Scale options.\n * @property {WPUnitControlUnit[]} [unitsOptions] Units options.\n */\n\n/**\n * Component that renders controls to edit the dimensions of an image or container.\n *\n * @param {DimensionsControlsProps} props The component props.\n *\n * @return {Element} The dimensions controls.\n */\nfunction DimensionsTool( {\n\tpanelId,\n\tvalue = {},\n\tonChange = () => {},\n\taspectRatioOptions, // Default options handled by AspectRatioTool.\n\tdefaultAspectRatio = 'auto', // Match CSS default value for aspect-ratio.\n\tscaleOptions, // Default options handled by ScaleTool.\n\tdefaultScale = 'cover',\n\tunitsOptions, // Default options handled by UnitControl.\n\ttools = [ 'aspectRatio', 'widthHeight', 'scale' ],\n} ) {\n\t// Coerce undefined and CSS default values to be null.\n\tconst width =\n\t\tvalue.width === undefined || value.width === 'auto'\n\t\t\t? null\n\t\t\t: value.width;\n\tconst height =\n\t\tvalue.height === undefined || value.height === 'auto'\n\t\t\t? null\n\t\t\t: value.height;\n\tconst aspectRatio =\n\t\tvalue.aspectRatio === undefined || value.aspectRatio === 'auto'\n\t\t\t? null\n\t\t\t: value.aspectRatio;\n\tconst scale = value.scale === undefined ? null : value.scale;\n\n\t// Keep track of state internally, so when the value is cleared by means\n\t// other than directly editing that field, it's easier to restore the\n\t// previous value.\n\tconst [ lastScale, setLastScale ] = useState( scale );\n\tconst [ lastAspectRatio, setLastAspectRatio ] = useState( aspectRatio );\n\tconst hasCustomAspectRatio = !! ( width && height );\n\n\t// 'custom' is not a valid value for CSS aspect-ratio, but it is used in the\n\t// dropdown to indicate that setting both the width and height is the same\n\t// as a custom aspect ratio.\n\tconst aspectRatioValue = hasCustomAspectRatio ? 'custom' : aspectRatio;\n\n\tconst showScaleControl = aspectRatio || ( width && height );\n\n\treturn (\n\t\t<>\n\t\t\t{ tools.includes( 'aspectRatio' ) && (\n\t\t\t\t<AspectRatioTool\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t\toptions={ aspectRatioOptions }\n\t\t\t\t\tdefaultValue={ defaultAspectRatio }\n\t\t\t\t\tvalue={ aspectRatioValue }\n\t\t\t\t\tonChange={ ( nextAspectRatio ) => {\n\t\t\t\t\t\tconst nextValue = { ...value };\n\n\t\t\t\t\t\t// 'auto' is CSS default, so it gets treated as null.\n\t\t\t\t\t\tnextAspectRatio =\n\t\t\t\t\t\t\tnextAspectRatio === 'auto' ? null : nextAspectRatio;\n\n\t\t\t\t\t\tsetLastAspectRatio( nextAspectRatio );\n\n\t\t\t\t\t\t// Update aspectRatio.\n\t\t\t\t\t\tif ( ! nextAspectRatio ) {\n\t\t\t\t\t\t\tdelete nextValue.aspectRatio;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnextValue.aspectRatio = nextAspectRatio;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Auto-update scale.\n\t\t\t\t\t\tif ( ! nextAspectRatio ) {\n\t\t\t\t\t\t\tdelete nextValue.scale;\n\t\t\t\t\t\t} else if ( lastScale ) {\n\t\t\t\t\t\t\tnextValue.scale = lastScale;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnextValue.scale = defaultScale;\n\t\t\t\t\t\t\tsetLastScale( defaultScale );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Auto-update width and height.\n\t\t\t\t\t\tif ( 'custom' !== nextAspectRatio && width && height ) {\n\t\t\t\t\t\t\tdelete nextValue.height;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tonChange( nextValue );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ tools.includes( 'widthHeight' ) && (\n\t\t\t\t<WidthHeightTool\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t\tunits={ unitsOptions }\n\t\t\t\t\tvalue={ { width, height } }\n\t\t\t\t\tonChange={ ( { width: nextWidth, height: nextHeight } ) => {\n\t\t\t\t\t\tconst nextValue = { ...value };\n\n\t\t\t\t\t\t// 'auto' is CSS default, so it gets treated as null.\n\t\t\t\t\t\tnextWidth = nextWidth === 'auto' ? null : nextWidth;\n\t\t\t\t\t\tnextHeight = nextHeight === 'auto' ? null : nextHeight;\n\n\t\t\t\t\t\t// Update width.\n\t\t\t\t\t\tif ( ! nextWidth ) {\n\t\t\t\t\t\t\tdelete nextValue.width;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnextValue.width = nextWidth;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Update height.\n\t\t\t\t\t\tif ( ! nextHeight ) {\n\t\t\t\t\t\t\tdelete nextValue.height;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnextValue.height = nextHeight;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Auto-update aspectRatio.\n\t\t\t\t\t\tif ( nextWidth && nextHeight ) {\n\t\t\t\t\t\t\tdelete nextValue.aspectRatio;\n\t\t\t\t\t\t} else if ( lastAspectRatio ) {\n\t\t\t\t\t\t\tnextValue.aspectRatio = lastAspectRatio;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// No setting defaultAspectRatio here, because\n\t\t\t\t\t\t\t// aspectRatio is optional in this scenario,\n\t\t\t\t\t\t\t// unlike scale.\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Auto-update scale.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! lastAspectRatio &&\n\t\t\t\t\t\t\t!! nextWidth !== !! nextHeight\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tdelete nextValue.scale;\n\t\t\t\t\t\t} else if ( lastScale ) {\n\t\t\t\t\t\t\tnextValue.scale = lastScale;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnextValue.scale = defaultScale;\n\t\t\t\t\t\t\tsetLastScale( defaultScale );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tonChange( nextValue );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ tools.includes( 'scale' ) && showScaleControl && (\n\t\t\t\t<ScaleTool\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t\toptions={ scaleOptions }\n\t\t\t\t\tdefaultValue={ defaultScale }\n\t\t\t\t\tvalue={ lastScale }\n\t\t\t\t\tonChange={ ( nextScale ) => {\n\t\t\t\t\t\tconst nextValue = { ...value };\n\n\t\t\t\t\t\tsetLastScale( nextScale );\n\n\t\t\t\t\t\t// Update scale.\n\t\t\t\t\t\tif ( ! nextScale ) {\n\t\t\t\t\t\t\tdelete nextValue.scale;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnextValue.scale = nextScale;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tonChange( nextValue );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default DimensionsTool;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,gBAAgB;AAKzB,OAAO,qBAAqB;AAC5B,OAAO,eAAe;AACtB,OAAO,qBAAqB;AAkF1B,mBAEE,KAFF;AAzCF,SAAS,eAAgB;AAAA,EACxB;AAAA,EACA,QAAQ,CAAC;AAAA,EACT,WAAW,MAAM;AAAA,EAAC;AAAA,EAClB;AAAA;AAAA,EACA,qBAAqB;AAAA;AAAA,EACrB;AAA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leTool({
|
|
|
46
46
|
defaultValue = DEFAULT_SCALE_OPTIONS[0].value,
|
|
47
47
|
isShownByDefault = true
|
|
48
48
|
}) {
|
|
49
|
-
const displayValue = value ??
|
|
49
|
+
const displayValue = value ?? defaultValue;
|
|
50
50
|
const scaleHelp = useMemo(() => {
|
|
51
51
|
return options.reduce((acc, option) => {
|
|
52
52
|
acc[option.value] = option.help;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dimensions-tool/scale-tool.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\n\n/**\n * @typedef {import('@wordpress/components/build-types/select-control/types').SelectControlProps} SelectControlProps\n */\n\n/**\n * The descriptions are purposely made generic as object-fit could be used for\n * any replaced element. Provide your own set of options if you need different\n * help text or labels.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Replaced_element\n *\n * @type {SelectControlProps[]}\n */\nconst DEFAULT_SCALE_OPTIONS = [\n\t{\n\t\tvalue: 'fill',\n\t\tlabel: _x( 'Fill', 'Scale option for dimensions control' ),\n\t\thelp: __( 'Fill the space by stretching the content.' ),\n\t},\n\t{\n\t\tvalue: 'contain',\n\t\tlabel: _x( 'Contain', 'Scale option for dimensions control' ),\n\t\thelp: __( 'Fit the content to the space without clipping.' ),\n\t},\n\t{\n\t\tvalue: 'cover',\n\t\tlabel: _x( 'Cover', 'Scale option for dimensions control' ),\n\t\thelp: __( \"Fill the space by clipping what doesn't fit.\" ),\n\t},\n\t{\n\t\tvalue: 'none',\n\t\tlabel: _x( 'None', 'Scale option for dimensions control' ),\n\t\thelp: __(\n\t\t\t'Do not adjust the sizing of the content. Content that is too large will be clipped, and content that is too small will have additional padding.'\n\t\t),\n\t},\n\t{\n\t\tvalue: 'scale-down',\n\t\tlabel: _x( 'Scale down', 'Scale option for dimensions control' ),\n\t\thelp: __(\n\t\t\t'Scale down the content to fit the space if it is too big. Content that is too small will have additional padding.'\n\t\t),\n\t},\n];\n\n/**\n * @callback ScaleToolPropsOnChange\n * @param {string} nextValue New scale value.\n * @return {void}\n */\n\n/**\n * @typedef {Object} ScaleToolProps\n * @property {string} [panelId] ID of the panel that contains the controls.\n * @property {string} [value] Current scale value.\n * @property {ScaleToolPropsOnChange} [onChange] Callback to update the scale value.\n * @property {SelectControlProps[]} [options] Scale options.\n * @property {string} [defaultValue] Default scale value.\n * @property {boolean} [showControl=true] Whether to show the control.\n * @property {boolean} [isShownByDefault=true] Whether the tool panel is shown by default.\n */\n\n/**\n * A tool to select the CSS object-fit property for the image.\n *\n * @param {ScaleToolProps} props\n *\n * @return {React.ReactElement} The scale tool.\n */\nexport default function ScaleTool( {\n\tpanelId,\n\tvalue,\n\tonChange,\n\toptions = DEFAULT_SCALE_OPTIONS,\n\tdefaultValue = DEFAULT_SCALE_OPTIONS[ 0 ].value,\n\tisShownByDefault = true,\n} ) {\n\
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC,gCAAgC;AAAA,EAChC,oCAAoC;AAAA,EACpC,0CAA0C;AAAA,OACpC;AACP,SAAS,eAAe;AACxB,SAAS,IAAI,UAAU;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\n\n/**\n * @typedef {import('@wordpress/components/build-types/select-control/types').SelectControlProps} SelectControlProps\n */\n\n/**\n * The descriptions are purposely made generic as object-fit could be used for\n * any replaced element. Provide your own set of options if you need different\n * help text or labels.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Replaced_element\n *\n * @type {SelectControlProps[]}\n */\nconst DEFAULT_SCALE_OPTIONS = [\n\t{\n\t\tvalue: 'fill',\n\t\tlabel: _x( 'Fill', 'Scale option for dimensions control' ),\n\t\thelp: __( 'Fill the space by stretching the content.' ),\n\t},\n\t{\n\t\tvalue: 'contain',\n\t\tlabel: _x( 'Contain', 'Scale option for dimensions control' ),\n\t\thelp: __( 'Fit the content to the space without clipping.' ),\n\t},\n\t{\n\t\tvalue: 'cover',\n\t\tlabel: _x( 'Cover', 'Scale option for dimensions control' ),\n\t\thelp: __( \"Fill the space by clipping what doesn't fit.\" ),\n\t},\n\t{\n\t\tvalue: 'none',\n\t\tlabel: _x( 'None', 'Scale option for dimensions control' ),\n\t\thelp: __(\n\t\t\t'Do not adjust the sizing of the content. Content that is too large will be clipped, and content that is too small will have additional padding.'\n\t\t),\n\t},\n\t{\n\t\tvalue: 'scale-down',\n\t\tlabel: _x( 'Scale down', 'Scale option for dimensions control' ),\n\t\thelp: __(\n\t\t\t'Scale down the content to fit the space if it is too big. Content that is too small will have additional padding.'\n\t\t),\n\t},\n];\n\n/**\n * @callback ScaleToolPropsOnChange\n * @param {string} nextValue New scale value.\n * @return {void}\n */\n\n/**\n * @typedef {Object} ScaleToolProps\n * @property {string} [panelId] ID of the panel that contains the controls.\n * @property {string} [value] Current scale value.\n * @property {ScaleToolPropsOnChange} [onChange] Callback to update the scale value.\n * @property {SelectControlProps[]} [options] Scale options.\n * @property {string} [defaultValue] Default scale value.\n * @property {boolean} [showControl=true] Whether to show the control.\n * @property {boolean} [isShownByDefault=true] Whether the tool panel is shown by default.\n */\n\n/**\n * A tool to select the CSS object-fit property for the image.\n *\n * @param {ScaleToolProps} props\n *\n * @return {React.ReactElement} The scale tool.\n */\nexport default function ScaleTool( {\n\tpanelId,\n\tvalue,\n\tonChange,\n\toptions = DEFAULT_SCALE_OPTIONS,\n\tdefaultValue = DEFAULT_SCALE_OPTIONS[ 0 ].value,\n\tisShownByDefault = true,\n} ) {\n\tconst displayValue = value ?? defaultValue;\n\n\tconst scaleHelp = useMemo( () => {\n\t\treturn options.reduce( ( acc, option ) => {\n\t\t\tacc[ option.value ] = option.help;\n\t\t\treturn acc;\n\t\t}, {} );\n\t}, [ options ] );\n\n\treturn (\n\t\t<ToolsPanelItem\n\t\t\tlabel={ _x( 'Scale', 'Image scaling options' ) }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\thasValue={ () => displayValue !== defaultValue }\n\t\t\tonDeselect={ () => onChange( defaultValue ) }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t<ToggleGroupControl\n\t\t\t\tlabel={ _x( 'Scale', 'Image scaling options' ) }\n\t\t\t\tisBlock\n\t\t\t\thelp={ scaleHelp[ displayValue ] }\n\t\t\t\tvalue={ displayValue }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tsize=\"__unstable-large\"\n\t\t\t>\n\t\t\t\t{ options.map( ( option ) => (\n\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\tkey={ option.value }\n\t\t\t\t\t\t{ ...option }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</ToggleGroupControl>\n\t\t</ToolsPanelItem>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC,gCAAgC;AAAA,EAChC,oCAAoC;AAAA,EACpC,0CAA0C;AAAA,OACpC;AACP,SAAS,eAAe;AACxB,SAAS,IAAI,UAAU;AAyGlB;AA1FL,IAAM,wBAAwB;AAAA,EAC7B;AAAA,IACC,OAAO;AAAA,IACP,OAAO,GAAI,QAAQ,qCAAsC;AAAA,IACzD,MAAM,GAAI,2CAA4C;AAAA,EACvD;AAAA,EACA;AAAA,IACC,OAAO;AAAA,IACP,OAAO,GAAI,WAAW,qCAAsC;AAAA,IAC5D,MAAM,GAAI,gDAAiD;AAAA,EAC5D;AAAA,EACA;AAAA,IACC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anel({
|
|
|
48
48
|
function handleOnBlur(event) {
|
|
49
49
|
setCSSError(getCSSValidationError(event?.target?.value));
|
|
50
50
|
}
|
|
51
|
-
return /* @__PURE__ */ jsxs(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
51
|
+
return /* @__PURE__ */ jsxs(
|
|
52
|
+
Stack,
|
|
53
|
+
{
|
|
54
|
+
direction: "column",
|
|
55
|
+
gap: "md",
|
|
56
|
+
className: "block-editor-global-styles-advanced-panel",
|
|
57
|
+
children: [
|
|
58
|
+
cssError && /* @__PURE__ */ jsx(Notice, { status: "error", onRemove: () => setCSSError(null), children: cssError }),
|
|
59
|
+
/* @__PURE__ */ jsx(
|
|
60
|
+
TextareaControl,
|
|
61
|
+
{
|
|
62
|
+
label: __("Additional CSS"),
|
|
63
|
+
value: customCSS,
|
|
64
|
+
onChange: (newValue) => handleOnChange(newValue),
|
|
65
|
+
onBlur: handleOnBlur,
|
|
66
|
+
className: "block-editor-global-styles-advanced-panel__custom-css-input",
|
|
67
|
+
spellCheck: false,
|
|
68
|
+
help
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
);
|
|
66
74
|
}
|
|
67
75
|
export {
|
|
68
76
|
AdvancedPanel as default,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/global-styles/advanced-panel.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { TextareaControl, Notice } from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { default as transformStyles } from '../../utils/transform-styles';\n\n/**\n * Validates that a CSS string doesn't contain HTML markup.\n * Uses the same validation as the PHP/global styles REST API.\n *\n * @param {string} css The CSS string to validate.\n * @return {boolean} True if the CSS is valid, false otherwise.\n */\nexport function validateCSS( css ) {\n\t// Check for HTML markup.\n\tif ( typeof css === 'string' && /<\\/?\\w/.test( css ) ) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\n/**\n * Returns the error message string if the CSS contains HTML markup, or null if it is clean.\n *\n * @param {string} css The CSS string to check.\n * @return {string|null} An error message, or null if the CSS is valid.\n */\nfunction getMarkupValidationError( css ) {\n\treturn validateCSS( css )\n\t\t? null\n\t\t: __( 'The custom CSS is invalid. Do not use <> markup.' );\n}\n\n/**\n * Full CSS validation: markup check first (fast), then a CSS parser (slower).\n *\n * @param {string} css The CSS string to validate.\n * @return {string|null} An error message, or null if the CSS is valid.\n */\nfunction getCSSValidationError( css ) {\n\tif ( ! css ) {\n\t\treturn null;\n\t}\n\tconst markupError = getMarkupValidationError( css );\n\tif ( markupError ) {\n\t\treturn markupError;\n\t}\n\tconst [ transformed ] = transformStyles(\n\t\t[ { css } ],\n\t\t'.for-validation-only'\n\t);\n\treturn transformed === null\n\t\t? __( 'There is an error with your CSS structure.' )\n\t\t: null;\n}\n\nexport default function AdvancedPanel( {\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\thelp,\n} ) {\n\t// Custom CSS\n\tconst customCSS = inheritedValue?.css;\n\tconst [ cssError, setCSSError ] = useState( () =>\n\t\tgetCSSValidationError( customCSS )\n\t);\n\tfunction handleOnChange( newValue ) {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\tcss: newValue,\n\t\t} );\n\n\t\tsetCSSError( getMarkupValidationError( newValue ) );\n\t}\n\tfunction handleOnBlur( event ) {\n\t\tsetCSSError( getCSSValidationError( event?.target?.value ) );\n\t}\n\n\treturn (\n\t\t<Stack
|
|
5
|
-
"mappings": ";AAGA,SAAS,iBAAiB,cAAc;AACxC,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,UAAU;AAKnB,SAAS,WAAW,uBAAuB;AA4EzC,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { TextareaControl, Notice } from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { default as transformStyles } from '../../utils/transform-styles';\n\n/**\n * Validates that a CSS string doesn't contain HTML markup.\n * Uses the same validation as the PHP/global styles REST API.\n *\n * @param {string} css The CSS string to validate.\n * @return {boolean} True if the CSS is valid, false otherwise.\n */\nexport function validateCSS( css ) {\n\t// Check for HTML markup.\n\tif ( typeof css === 'string' && /<\\/?\\w/.test( css ) ) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\n/**\n * Returns the error message string if the CSS contains HTML markup, or null if it is clean.\n *\n * @param {string} css The CSS string to check.\n * @return {string|null} An error message, or null if the CSS is valid.\n */\nfunction getMarkupValidationError( css ) {\n\treturn validateCSS( css )\n\t\t? null\n\t\t: __( 'The custom CSS is invalid. Do not use <> markup.' );\n}\n\n/**\n * Full CSS validation: markup check first (fast), then a CSS parser (slower).\n *\n * @param {string} css The CSS string to validate.\n * @return {string|null} An error message, or null if the CSS is valid.\n */\nfunction getCSSValidationError( css ) {\n\tif ( ! css ) {\n\t\treturn null;\n\t}\n\tconst markupError = getMarkupValidationError( css );\n\tif ( markupError ) {\n\t\treturn markupError;\n\t}\n\tconst [ transformed ] = transformStyles(\n\t\t[ { css } ],\n\t\t'.for-validation-only'\n\t);\n\treturn transformed === null\n\t\t? __( 'There is an error with your CSS structure.' )\n\t\t: null;\n}\n\nexport default function AdvancedPanel( {\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\thelp,\n} ) {\n\t// Custom CSS\n\tconst customCSS = inheritedValue?.css;\n\tconst [ cssError, setCSSError ] = useState( () =>\n\t\tgetCSSValidationError( customCSS )\n\t);\n\tfunction handleOnChange( newValue ) {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\tcss: newValue,\n\t\t} );\n\n\t\tsetCSSError( getMarkupValidationError( newValue ) );\n\t}\n\tfunction handleOnBlur( event ) {\n\t\tsetCSSError( getCSSValidationError( event?.target?.value ) );\n\t}\n\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"column\"\n\t\t\tgap=\"md\"\n\t\t\tclassName=\"block-editor-global-styles-advanced-panel\"\n\t\t>\n\t\t\t{ cssError && (\n\t\t\t\t<Notice status=\"error\" onRemove={ () => setCSSError( null ) }>\n\t\t\t\t\t{ cssError }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t<TextareaControl\n\t\t\t\tlabel={ __( 'Additional CSS' ) }\n\t\t\t\tvalue={ customCSS }\n\t\t\t\tonChange={ ( newValue ) => handleOnChange( newValue ) }\n\t\t\t\tonBlur={ handleOnBlur }\n\t\t\t\tclassName=\"block-editor-global-styles-advanced-panel__custom-css-input\"\n\t\t\t\tspellCheck={ false }\n\t\t\t\thelp={ help }\n\t\t\t/>\n\t\t</Stack>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,iBAAiB,cAAc;AACxC,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,UAAU;AAKnB,SAAS,WAAW,uBAAuB;AA4EzC,SAME,KANF;AAnEK,SAAS,YAAa,KAAM;AAElC,MAAK,OAAO,QAAQ,YAAY,SAAS,KAAM,GAAI,GAAI;AACtD,WAAO;AAAA,EACR;AACA,SAAO;AACR;AAQA,SAAS,yBAA0B,KAAM;AACxC,SAAO,YAAa,GAAI,IACrB,OACA,GAAI,kDAAmD;AAC3D;AAQA,SAAS,sBAAuB,KAAM;AACrC,MAAK,CAAE,KAAM;AACZ,WAAO;AAAA,EACR;AACA,QAAM,cAAc,yBAA0B,GAAI;AAClD,MAAK,aAAc;AAClB,WAAO;AAAA,EACR;AACA,QAAM,CAAE,WAAY,IAAI;AAAA,IACvB,CAAE,EAAE,IAAI,CAAE;AAAA,IACV;AAAA,EACD;AACA,SAAO,gBAAgB,OACpB,GAAI,4CAA6C,IACjD;AACJ;AAEe,SAAR,cAAgC;AAAA,EACtC;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB;AACD,GAAI;AAEH,QAAM,YAAY,gBAAgB;AAClC,QAAM,CAAE,UAAU,WAAY,IAAI;AAAA,IAAU,MAC3C,sBAAuB,SAAU;AAAA,EAClC;AACA,WAAS,eAAgB,UAAW;AACnC,aAAU;AAAA,MACT,GAAG;AAAA,MACH,KAAK;AAAA,IACN,CAAE;AAEF,gBAAa,yBAA0B,QAAS,CAAE;AAAA,EACnD;AACA,WAAS,aAAc,OAAQ;AAC9B,gBAAa,sBAAuB,OAAO,QAAQ,KAAM,CAAE;AAAA,EAC5D;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,KAAI;AAAA,MACJ,WAAU;AAAA,MAER;AAAA,oBACD,oBAAC,UAAO,QAAO,SAAQ,UAAW,MAAM,YAAa,IAAK,GACvD,oBACH;AAAA,QAED;AAAA,UAAC;AAAA;AAAA,YACA,OAAQ,GAAI,gBAAiB;AAAA,YAC7B,OAAQ;AAAA,YACR,UAAW,CAAE,aAAc,eAAgB,QAAS;AAAA,YACpD,QAAS;AAAA,YACT,WAAU;AAAA,YACV,YAAa;AAAA,YACb;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,25 +3,31 @@ import {
|
|
|
3
3
|
__experimentalToolsPanel as ToolsPanel,
|
|
4
4
|
__experimentalToolsPanelItem as ToolsPanelItem
|
|
5
5
|
} from "@wordpress/components";
|
|
6
|
-
import { useCallback
|
|
6
|
+
import { useCallback } from "@wordpress/element";
|
|
7
7
|
import { __ } from "@wordpress/i18n";
|
|
8
|
-
import { getValueFromVariable } from "@wordpress/global-styles-engine";
|
|
9
8
|
import BackgroundImageControl from "../background-image-control/index.mjs";
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
9
|
+
import ColorGradientDropdownItem from "./color-gradient-dropdown-item.mjs";
|
|
10
|
+
import { useHasBackgroundColorPanel } from "./color-panel.mjs";
|
|
11
|
+
import { useColorGradientSettings } from "./hooks.mjs";
|
|
12
12
|
import { useToolsPanelDropdownMenuProps } from "./utils.mjs";
|
|
13
13
|
import { setImmutably } from "../../utils/object.mjs";
|
|
14
|
+
import {
|
|
15
|
+
extractPresetSlug,
|
|
16
|
+
encodeColorValueWithPalette
|
|
17
|
+
} from "../../utils/color-values.mjs";
|
|
14
18
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
19
|
var DEFAULT_CONTROLS = {
|
|
16
20
|
backgroundImage: true,
|
|
21
|
+
backgroundColor: true,
|
|
17
22
|
gradient: true
|
|
18
23
|
};
|
|
19
24
|
function useHasBackgroundControl(settings, feature) {
|
|
20
|
-
return
|
|
25
|
+
return settings?.background?.[feature];
|
|
21
26
|
}
|
|
22
27
|
function useHasBackgroundPanel(settings) {
|
|
28
|
+
const hasBackgroundColor = useHasBackgroundColorPanel(settings);
|
|
23
29
|
const { backgroundImage, gradient } = settings?.background || {};
|
|
24
|
-
return
|
|
30
|
+
return backgroundImage || gradient || hasBackgroundColor;
|
|
25
31
|
}
|
|
26
32
|
function hasBackgroundSizeValue(style) {
|
|
27
33
|
return style?.background?.backgroundPosition !== void 0 || style?.background?.backgroundSize !== void 0;
|
|
@@ -33,6 +39,12 @@ function hasBackgroundImageValue(style) {
|
|
|
33
39
|
function hasBackgroundGradientValue(style) {
|
|
34
40
|
return "string" === typeof style?.background?.gradient && style?.background?.gradient !== "";
|
|
35
41
|
}
|
|
42
|
+
function hasBackgroundColorValue(style) {
|
|
43
|
+
return !!style?.color?.background;
|
|
44
|
+
}
|
|
45
|
+
function hasLegacyColorGradientValue(style) {
|
|
46
|
+
return !!style?.color?.gradient;
|
|
47
|
+
}
|
|
36
48
|
function BackgroundToolsPanel({
|
|
37
49
|
resetAllFilter,
|
|
38
50
|
onChange,
|
|
@@ -65,51 +77,63 @@ function BackgroundImagePanel({
|
|
|
65
77
|
as: Wrapper = BackgroundToolsPanel,
|
|
66
78
|
value,
|
|
67
79
|
onChange,
|
|
68
|
-
inheritedValue,
|
|
80
|
+
inheritedValue = value,
|
|
69
81
|
settings,
|
|
70
82
|
panelId,
|
|
71
83
|
defaultControls = DEFAULT_CONTROLS,
|
|
72
84
|
defaultValues = {},
|
|
73
|
-
headerLabel = __("Background")
|
|
85
|
+
headerLabel = __("Background"),
|
|
86
|
+
contrastWarning
|
|
74
87
|
}) {
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
88
|
+
const {
|
|
89
|
+
colors,
|
|
90
|
+
gradients,
|
|
91
|
+
allColors,
|
|
92
|
+
areCustomSolidsEnabled,
|
|
93
|
+
areCustomGradientsEnabled,
|
|
94
|
+
hasSolidColors,
|
|
95
|
+
hasGradientColors,
|
|
96
|
+
decodeValue,
|
|
97
|
+
encodeGradientValue
|
|
98
|
+
} = useColorGradientSettings(settings);
|
|
78
99
|
const hasBackgroundGradientControl = useHasBackgroundControl(
|
|
79
100
|
settings,
|
|
80
101
|
"gradient"
|
|
81
102
|
);
|
|
103
|
+
const hasColorPanelBackgroundSupport = useHasBackgroundColorPanel(settings);
|
|
104
|
+
const showBackgroundColorControl = hasColorPanelBackgroundSupport && hasSolidColors;
|
|
82
105
|
const showBackgroundGradientControl = hasGradientColors && hasBackgroundGradientControl;
|
|
106
|
+
const showLegacyColorGradientControl = hasColorPanelBackgroundSupport && hasGradientColors && !hasBackgroundGradientControl;
|
|
83
107
|
const showBackgroundImageControl = useHasBackgroundControl(
|
|
84
108
|
settings,
|
|
85
109
|
"backgroundImage"
|
|
86
110
|
);
|
|
87
111
|
const resetAllFilter = useCallback(
|
|
88
112
|
(previousValue) => {
|
|
113
|
+
const clearsColorBackground = showBackgroundColorControl;
|
|
114
|
+
const clearsColorGradient = hasBackgroundGradientControl || showLegacyColorGradientControl;
|
|
115
|
+
if (!clearsColorBackground && !clearsColorGradient) {
|
|
116
|
+
return { ...previousValue, background: {} };
|
|
117
|
+
}
|
|
89
118
|
return {
|
|
90
119
|
...previousValue,
|
|
91
120
|
background: {},
|
|
92
|
-
color:
|
|
121
|
+
color: {
|
|
93
122
|
...previousValue?.color,
|
|
94
|
-
|
|
95
|
-
|
|
123
|
+
...clearsColorBackground && { background: void 0 },
|
|
124
|
+
...clearsColorGradient && { gradient: void 0 }
|
|
125
|
+
}
|
|
96
126
|
};
|
|
97
127
|
},
|
|
98
|
-
[
|
|
128
|
+
[
|
|
129
|
+
hasBackgroundGradientControl,
|
|
130
|
+
showBackgroundColorControl,
|
|
131
|
+
showLegacyColorGradientControl
|
|
132
|
+
]
|
|
99
133
|
);
|
|
100
|
-
if (!showBackgroundGradientControl && !
|
|
134
|
+
if (!showBackgroundImageControl && !showBackgroundColorControl && !showBackgroundGradientControl && !showLegacyColorGradientControl) {
|
|
101
135
|
return null;
|
|
102
136
|
}
|
|
103
|
-
const decodeValue = (rawValue) => getValueFromVariable({ settings }, "", rawValue);
|
|
104
|
-
const encodeGradientValue = (gradientValue) => {
|
|
105
|
-
const allGradients = gradients.flatMap(
|
|
106
|
-
({ gradients: originGradients }) => originGradients
|
|
107
|
-
);
|
|
108
|
-
const gradientObject = allGradients.find(
|
|
109
|
-
({ gradient }) => gradient === gradientValue
|
|
110
|
-
);
|
|
111
|
-
return gradientObject ? "var:preset|gradient|" + gradientObject.slug : gradientValue;
|
|
112
|
-
};
|
|
113
137
|
const resetBackground = () => onChange(
|
|
114
138
|
setImmutably(
|
|
115
139
|
value,
|
|
@@ -126,6 +150,42 @@ function BackgroundImagePanel({
|
|
|
126
150
|
newValue = setImmutably(newValue, ["color", "gradient"], void 0);
|
|
127
151
|
onChange(newValue);
|
|
128
152
|
};
|
|
153
|
+
const backgroundColor = decodeValue(inheritedValue?.color?.background);
|
|
154
|
+
const userBackgroundColor = decodeValue(value?.color?.background);
|
|
155
|
+
const setBackgroundColor = (newColor, newSlug) => {
|
|
156
|
+
const newValue = setImmutably(
|
|
157
|
+
value,
|
|
158
|
+
["color", "background"],
|
|
159
|
+
encodeColorValueWithPalette(allColors, newColor, newSlug)
|
|
160
|
+
);
|
|
161
|
+
if (showLegacyColorGradientControl) {
|
|
162
|
+
newValue.color.gradient = void 0;
|
|
163
|
+
}
|
|
164
|
+
onChange(newValue);
|
|
165
|
+
};
|
|
166
|
+
const resetBackgroundColor = () => {
|
|
167
|
+
const newValue = setImmutably(
|
|
168
|
+
value,
|
|
169
|
+
["color", "background"],
|
|
170
|
+
void 0
|
|
171
|
+
);
|
|
172
|
+
if (showLegacyColorGradientControl) {
|
|
173
|
+
newValue.color.gradient = void 0;
|
|
174
|
+
}
|
|
175
|
+
onChange(newValue);
|
|
176
|
+
};
|
|
177
|
+
const legacyColorGradient = decodeValue(inheritedValue?.color?.gradient);
|
|
178
|
+
const userLegacyColorGradient = decodeValue(value?.color?.gradient);
|
|
179
|
+
const setLegacyColorGradient = (newGradient) => {
|
|
180
|
+
const newValue = setImmutably(
|
|
181
|
+
value,
|
|
182
|
+
["color", "gradient"],
|
|
183
|
+
encodeGradientValue(newGradient)
|
|
184
|
+
);
|
|
185
|
+
newValue.color.background = void 0;
|
|
186
|
+
onChange(newValue);
|
|
187
|
+
};
|
|
188
|
+
const resetLegacyColorGradient = () => onChange(setImmutably(value, ["color", "gradient"], void 0));
|
|
129
189
|
const currentGradient = decodeValue(
|
|
130
190
|
value?.background?.gradient ?? value?.color?.gradient
|
|
131
191
|
);
|
|
@@ -153,7 +213,7 @@ function BackgroundImagePanel({
|
|
|
153
213
|
showBackgroundImageControl && /* @__PURE__ */ jsx(
|
|
154
214
|
ToolsPanelItem,
|
|
155
215
|
{
|
|
156
|
-
className: "block-editor-
|
|
216
|
+
className: "block-editor-color-gradient-item",
|
|
157
217
|
hasValue: () => hasBackgroundImageValue(value),
|
|
158
218
|
label: __("Image"),
|
|
159
219
|
onDeselect: resetBackground,
|
|
@@ -172,10 +232,48 @@ function BackgroundImagePanel({
|
|
|
172
232
|
)
|
|
173
233
|
}
|
|
174
234
|
),
|
|
235
|
+
showBackgroundColorControl && /* @__PURE__ */ jsx(
|
|
236
|
+
ColorGradientDropdownItem,
|
|
237
|
+
{
|
|
238
|
+
label: __("Color"),
|
|
239
|
+
hasValue: () => hasBackgroundColorValue(value),
|
|
240
|
+
resetValue: resetBackgroundColor,
|
|
241
|
+
isShownByDefault: defaultControls.backgroundColor,
|
|
242
|
+
indicators: [userBackgroundColor ?? backgroundColor],
|
|
243
|
+
contrastWarning,
|
|
244
|
+
tabs: [
|
|
245
|
+
{
|
|
246
|
+
key: "background",
|
|
247
|
+
label: __("Color"),
|
|
248
|
+
inheritedValue: userBackgroundColor ?? backgroundColor,
|
|
249
|
+
// Resolve the slug from the same source as the
|
|
250
|
+
// displayed value (user value first, then the
|
|
251
|
+
// inherited fallback). For a block instance the
|
|
252
|
+
// selection lives in `value` while `inheritedValue`
|
|
253
|
+
// only holds the global styles fallback, so reading
|
|
254
|
+
// the slug from `inheritedValue` alone would miss it
|
|
255
|
+
// and two same-hex presets would both appear selected.
|
|
256
|
+
inheritedSlug: extractPresetSlug(
|
|
257
|
+
value?.color?.background,
|
|
258
|
+
"color"
|
|
259
|
+
) ?? extractPresetSlug(
|
|
260
|
+
inheritedValue?.color?.background,
|
|
261
|
+
"color"
|
|
262
|
+
),
|
|
263
|
+
setValue: setBackgroundColor,
|
|
264
|
+
userValue: userBackgroundColor
|
|
265
|
+
}
|
|
266
|
+
],
|
|
267
|
+
colorGradientControlSettings: {
|
|
268
|
+
colors,
|
|
269
|
+
disableCustomColors: !areCustomSolidsEnabled
|
|
270
|
+
},
|
|
271
|
+
panelId
|
|
272
|
+
}
|
|
273
|
+
),
|
|
175
274
|
showBackgroundGradientControl && /* @__PURE__ */ jsx(
|
|
176
|
-
|
|
275
|
+
ColorGradientDropdownItem,
|
|
177
276
|
{
|
|
178
|
-
className: "block-editor-background-panel__item",
|
|
179
277
|
label: __("Gradient"),
|
|
180
278
|
hasValue: () => hasBackgroundGradientValue(value),
|
|
181
279
|
resetValue: resetGradient,
|
|
@@ -197,16 +295,46 @@ function BackgroundImagePanel({
|
|
|
197
295
|
},
|
|
198
296
|
panelId
|
|
199
297
|
}
|
|
298
|
+
),
|
|
299
|
+
showLegacyColorGradientControl && /* @__PURE__ */ jsx(
|
|
300
|
+
ColorGradientDropdownItem,
|
|
301
|
+
{
|
|
302
|
+
label: __("Gradient"),
|
|
303
|
+
hasValue: () => hasLegacyColorGradientValue(value),
|
|
304
|
+
resetValue: resetLegacyColorGradient,
|
|
305
|
+
isShownByDefault: defaultControls.gradient,
|
|
306
|
+
indicators: [
|
|
307
|
+
userLegacyColorGradient ?? legacyColorGradient
|
|
308
|
+
],
|
|
309
|
+
tabs: [
|
|
310
|
+
{
|
|
311
|
+
key: "gradient",
|
|
312
|
+
label: __("Gradient"),
|
|
313
|
+
inheritedValue: userLegacyColorGradient ?? legacyColorGradient,
|
|
314
|
+
setValue: setLegacyColorGradient,
|
|
315
|
+
userValue: userLegacyColorGradient,
|
|
316
|
+
isGradient: true
|
|
317
|
+
}
|
|
318
|
+
],
|
|
319
|
+
colorGradientControlSettings: {
|
|
320
|
+
gradients,
|
|
321
|
+
disableCustomGradients: !areCustomGradientsEnabled
|
|
322
|
+
},
|
|
323
|
+
panelId
|
|
324
|
+
}
|
|
200
325
|
)
|
|
201
326
|
]
|
|
202
327
|
}
|
|
203
328
|
);
|
|
204
329
|
}
|
|
205
330
|
export {
|
|
331
|
+
BackgroundToolsPanel,
|
|
206
332
|
BackgroundImagePanel as default,
|
|
333
|
+
hasBackgroundColorValue,
|
|
207
334
|
hasBackgroundGradientValue,
|
|
208
335
|
hasBackgroundImageValue,
|
|
209
336
|
hasBackgroundSizeValue,
|
|
337
|
+
hasLegacyColorGradientValue,
|
|
210
338
|
useHasBackgroundControl,
|
|
211
339
|
useHasBackgroundPanel
|
|
212
340
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/global-styles/background-panel.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useCallback, Platform } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { getValueFromVariable } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport BackgroundImageControl from '../background-image-control';\nimport { ColorPanelDropdown } from './color-panel';\nimport { useGradientsPerOrigin } from './hooks';\nimport { useToolsPanelDropdownMenuProps } from './utils';\nimport { setImmutably } from '../../utils/object';\n\nconst DEFAULT_CONTROLS = {\n\tbackgroundImage: true,\n\tgradient: true,\n};\n\n/**\n * Checks site settings to see if the requested feature's control may be used.\n *\n * @param {Object} settings Site settings.\n * @param {string} feature Background feature to check.\n * @return {boolean} Whether site settings has activated background panel.\n */\nexport function useHasBackgroundControl( settings, feature ) {\n\treturn Platform.OS === 'web' && settings?.background?.[ feature ];\n}\n\n/**\n * Checks site settings to see if the background panel may be used.\n * `settings.background.backgroundSize` exists also,\n * but can only be used if settings?.background?.backgroundImage is `true`.\n *\n * @param {Object} settings Site settings\n * @return {boolean} Whether site settings has activated background panel.\n */\nexport function useHasBackgroundPanel( settings ) {\n\tconst { backgroundImage, gradient } = settings?.background || {};\n\treturn Platform.OS === 'web' && ( backgroundImage || gradient );\n}\n\n/**\n * Checks if there is a current value in the background size block support\n * attributes. Background size values include background size as well\n * as background position.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a background size value set.\n */\nexport function hasBackgroundSizeValue( style ) {\n\treturn (\n\t\tstyle?.background?.backgroundPosition !== undefined ||\n\t\tstyle?.background?.backgroundSize !== undefined\n\t);\n}\n\n/**\n * Checks if there is a current value in the background image block support\n * attributes.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a background image value set.\n */\nexport function hasBackgroundImageValue( style ) {\n\treturn (\n\t\t!! style?.background?.backgroundImage?.id ||\n\t\t// Supports url() string values in theme.json.\n\t\t'string' === typeof style?.background?.backgroundImage ||\n\t\t!! style?.background?.backgroundImage?.url\n\t);\n}\n\n/**\n * Checks if there is a current value in the background gradient block support\n * attributes.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a background gradient value set.\n */\nexport function hasBackgroundGradientValue( style ) {\n\treturn (\n\t\t'string' === typeof style?.background?.gradient &&\n\t\tstyle?.background?.gradient !== ''\n\t);\n}\n\nfunction BackgroundToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n\theaderLabel,\n} ) {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst resetAll = () => {\n\t\tconst updatedValue = resetAllFilter( value );\n\t\tonChange( updatedValue );\n\t};\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ headerLabel }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t\thasInnerWrapper\n\t\t\tclassName=\"background-block-support-panel\"\n\t\t\t__experimentalFirstVisibleItemClass=\"first\"\n\t\t\t__experimentalLastVisibleItemClass=\"last\"\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t>\n\t\t\t<div className=\"background-block-support-panel__inner-wrapper\">\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</ToolsPanel>\n\t);\n}\n\nexport default function BackgroundImagePanel( {\n\tas: Wrapper = BackgroundToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue,\n\tsettings,\n\tpanelId,\n\tdefaultControls = DEFAULT_CONTROLS,\n\tdefaultValues = {},\n\theaderLabel = __( 'Background' ),\n} ) {\n\tconst gradients = useGradientsPerOrigin( settings );\n\tconst areCustomGradientsEnabled = settings?.color?.customGradient;\n\tconst hasGradientColors = gradients.length > 0 || areCustomGradientsEnabled;\n\n\tconst hasBackgroundGradientControl = useHasBackgroundControl(\n\t\tsettings,\n\t\t'gradient'\n\t);\n\tconst showBackgroundGradientControl =\n\t\thasGradientColors && hasBackgroundGradientControl;\n\tconst showBackgroundImageControl = useHasBackgroundControl(\n\t\tsettings,\n\t\t'backgroundImage'\n\t);\n\n\tconst resetAllFilter = useCallback(\n\t\t( previousValue ) => {\n\t\t\treturn {\n\t\t\t\t...previousValue,\n\t\t\t\tbackground: {},\n\t\t\t\tcolor: hasBackgroundGradientControl\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t...previousValue?.color,\n\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t }\n\t\t\t\t\t: previousValue?.color,\n\t\t\t};\n\t\t},\n\t\t[ hasBackgroundGradientControl ]\n\t);\n\n\tif ( ! showBackgroundGradientControl && ! showBackgroundImageControl ) {\n\t\treturn null;\n\t}\n\n\tconst decodeValue = ( rawValue ) =>\n\t\tgetValueFromVariable( { settings }, '', rawValue );\n\tconst encodeGradientValue = ( gradientValue ) => {\n\t\tconst allGradients = gradients.flatMap(\n\t\t\t( { gradients: originGradients } ) => originGradients\n\t\t);\n\t\tconst gradientObject = allGradients.find(\n\t\t\t( { gradient } ) => gradient === gradientValue\n\t\t);\n\t\treturn gradientObject\n\t\t\t? 'var:preset|gradient|' + gradientObject.slug\n\t\t\t: gradientValue;\n\t};\n\n\tconst resetBackground = () =>\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'background', 'backgroundImage' ],\n\t\t\t\tundefined\n\t\t\t)\n\t\t);\n\n\tconst resetGradient = () => {\n\t\tlet newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'background', 'gradient' ],\n\t\t\tundefined\n\t\t);\n\t\tnewValue = setImmutably( newValue, [ 'color', 'gradient' ], undefined );\n\t\tonChange( newValue );\n\t};\n\n\t// Get current gradient value, decoding preset slug references.\n\t// Fall back to color.gradient for legacy blocks that haven't migrated\n\t// to background.gradient yet (mirrors block inspector fallback in\n\t// packages/block-editor/src/hooks/background.js).\n\tconst currentGradient = decodeValue(\n\t\tvalue?.background?.gradient ?? value?.color?.gradient\n\t);\n\tconst inheritedGradient = decodeValue(\n\t\tinheritedValue?.background?.gradient ?? inheritedValue?.color?.gradient\n\t);\n\n\t// Set gradient value, encoding preset matches as slug references.\n\t// Also clear color.gradient to migrate from the legacy location,\n\t// matching the block inspector behavior in hooks/background.js.\n\tconst setGradient = ( newGradient ) => {\n\t\tlet newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'background', 'gradient' ],\n\t\t\tencodeGradientValue( newGradient )\n\t\t);\n\t\tnewValue = setImmutably( newValue, [ 'color', 'gradient' ], undefined );\n\t\tonChange( newValue );\n\t};\n\n\treturn (\n\t\t<Wrapper\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tpanelId={ panelId }\n\t\t\theaderLabel={ headerLabel }\n\t\t>\n\t\t\t{ showBackgroundImageControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"block-editor-background-panel__item\"\n\t\t\t\t\thasValue={ () => hasBackgroundImageValue( value ) }\n\t\t\t\t\tlabel={ __( 'Image' ) }\n\t\t\t\t\tonDeselect={ resetBackground }\n\t\t\t\t\tisShownByDefault={ defaultControls.backgroundImage }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BackgroundImageControl\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\tinheritedValue={ inheritedValue }\n\t\t\t\t\t\tdefaultControls={ defaultControls }\n\t\t\t\t\t\tdefaultValues={ defaultValues }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBackgroundGradientControl && (\n\t\t\t\t<ColorPanelDropdown\n\t\t\t\t\tclassName=\"block-editor-background-panel__item\"\n\t\t\t\t\tlabel={ __( 'Gradient' ) }\n\t\t\t\t\thasValue={ () => hasBackgroundGradientValue( value ) }\n\t\t\t\t\tresetValue={ resetGradient }\n\t\t\t\t\tisShownByDefault={ defaultControls.gradient }\n\t\t\t\t\tindicators={ [ currentGradient ] }\n\t\t\t\t\ttabs={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: 'gradient',\n\t\t\t\t\t\t\tlabel: __( 'Gradient' ),\n\t\t\t\t\t\t\tinheritedValue:\n\t\t\t\t\t\t\t\tcurrentGradient ?? inheritedGradient,\n\t\t\t\t\t\t\tsetValue: setGradient,\n\t\t\t\t\t\t\tuserValue: currentGradient,\n\t\t\t\t\t\t\tisGradient: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t\tcolorGradientControlSettings={ {\n\t\t\t\t\t\tgradients,\n\t\t\t\t\t\tdisableCustomGradients: ! areCustomGradientsEnabled,\n\t\t\t\t\t} }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,OAC1B;AACP,SAAS,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BackgroundImageControl from '../background-image-control';\nimport ColorGradientDropdownItem from './color-gradient-dropdown-item';\nimport { useHasBackgroundColorPanel } from './color-panel';\nimport { useColorGradientSettings } from './hooks';\nimport { useToolsPanelDropdownMenuProps } from './utils';\nimport { setImmutably } from '../../utils/object';\nimport {\n\textractPresetSlug,\n\tencodeColorValueWithPalette,\n} from '../../utils/color-values';\n\nconst DEFAULT_CONTROLS = {\n\tbackgroundImage: true,\n\tbackgroundColor: true,\n\tgradient: true,\n};\n\n/**\n * Checks site settings to see if the requested feature's control may be used.\n *\n * @param {Object} settings Site settings.\n * @param {string} feature Background feature to check.\n * @return {boolean} Whether site settings has activated background panel.\n */\nexport function useHasBackgroundControl( settings, feature ) {\n\treturn settings?.background?.[ feature ];\n}\n\n/**\n * Checks site settings to see if the background panel may be used.\n * `settings.background.backgroundSize` exists also,\n * but can only be used if settings?.background?.backgroundImage is `true`.\n *\n * The panel is also shown when the block has color panel background\n * support (`settings.color.background`), because background color and\n * the legacy `color.gradient` control are rendered here.\n *\n * @param {Object} settings Site settings\n * @return {boolean} Whether site settings has activated background panel.\n */\nexport function useHasBackgroundPanel( settings ) {\n\tconst hasBackgroundColor = useHasBackgroundColorPanel( settings );\n\tconst { backgroundImage, gradient } = settings?.background || {};\n\treturn backgroundImage || gradient || hasBackgroundColor;\n}\n\n/**\n * Checks if there is a current value in the background size block support\n * attributes. Background size values include background size as well\n * as background position.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a background size value set.\n */\nexport function hasBackgroundSizeValue( style ) {\n\treturn (\n\t\tstyle?.background?.backgroundPosition !== undefined ||\n\t\tstyle?.background?.backgroundSize !== undefined\n\t);\n}\n\n/**\n * Checks if there is a current value in the background image block support\n * attributes.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a background image value set.\n */\nexport function hasBackgroundImageValue( style ) {\n\treturn (\n\t\t!! style?.background?.backgroundImage?.id ||\n\t\t// Supports url() string values in theme.json.\n\t\t'string' === typeof style?.background?.backgroundImage ||\n\t\t!! style?.background?.backgroundImage?.url\n\t);\n}\n\n/**\n * Checks if there is a current value in the background gradient block support\n * attributes.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a background gradient value set.\n */\nexport function hasBackgroundGradientValue( style ) {\n\treturn (\n\t\t'string' === typeof style?.background?.gradient &&\n\t\tstyle?.background?.gradient !== ''\n\t);\n}\n\n/**\n * Checks if there is a current value for the background color (written to\n * `color.background`).\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a background color value set.\n */\nexport function hasBackgroundColorValue( style ) {\n\treturn !! style?.color?.background;\n}\n\n/**\n * Checks if there is a current value in the legacy `color.gradient` location\n * (used by blocks with color panel gradient support that haven't adopted the\n * `background.gradient` block support).\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a legacy color gradient value set.\n */\nexport function hasLegacyColorGradientValue( style ) {\n\treturn !! style?.color?.gradient;\n}\n\nexport function BackgroundToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n\theaderLabel,\n} ) {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst resetAll = () => {\n\t\tconst updatedValue = resetAllFilter( value );\n\t\tonChange( updatedValue );\n\t};\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ headerLabel }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t\thasInnerWrapper\n\t\t\tclassName=\"background-block-support-panel\"\n\t\t\t__experimentalFirstVisibleItemClass=\"first\"\n\t\t\t__experimentalLastVisibleItemClass=\"last\"\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t>\n\t\t\t<div className=\"background-block-support-panel__inner-wrapper\">\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</ToolsPanel>\n\t);\n}\n\nexport default function BackgroundImagePanel( {\n\tas: Wrapper = BackgroundToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tpanelId,\n\tdefaultControls = DEFAULT_CONTROLS,\n\tdefaultValues = {},\n\theaderLabel = __( 'Background' ),\n\tcontrastWarning,\n} ) {\n\tconst {\n\t\tcolors,\n\t\tgradients,\n\t\tallColors,\n\t\tareCustomSolidsEnabled,\n\t\tareCustomGradientsEnabled,\n\t\thasSolidColors,\n\t\thasGradientColors,\n\t\tdecodeValue,\n\t\tencodeGradientValue,\n\t} = useColorGradientSettings( settings );\n\n\tconst hasBackgroundGradientControl = useHasBackgroundControl(\n\t\tsettings,\n\t\t'gradient'\n\t);\n\tconst hasColorPanelBackgroundSupport =\n\t\tuseHasBackgroundColorPanel( settings );\n\tconst showBackgroundColorControl =\n\t\thasColorPanelBackgroundSupport && hasSolidColors;\n\t// New `background.gradient` block support — gradient lives under the\n\t// `background` style path.\n\tconst showBackgroundGradientControl =\n\t\thasGradientColors && hasBackgroundGradientControl;\n\t// Legacy `color.gradient` path — only rendered when the block has\n\t// color panel background support and hasn't adopted the newer\n\t// `background.gradient` support. Keeps the UI consistent for blocks\n\t// that still write gradients to `color.gradient`.\n\tconst showLegacyColorGradientControl =\n\t\thasColorPanelBackgroundSupport &&\n\t\thasGradientColors &&\n\t\t! hasBackgroundGradientControl;\n\tconst showBackgroundImageControl = useHasBackgroundControl(\n\t\tsettings,\n\t\t'backgroundImage'\n\t);\n\n\tconst resetAllFilter = useCallback(\n\t\t( previousValue ) => {\n\t\t\tconst clearsColorBackground = showBackgroundColorControl;\n\t\t\tconst clearsColorGradient =\n\t\t\t\thasBackgroundGradientControl || showLegacyColorGradientControl;\n\t\t\tif ( ! clearsColorBackground && ! clearsColorGradient ) {\n\t\t\t\treturn { ...previousValue, background: {} };\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...previousValue,\n\t\t\t\tbackground: {},\n\t\t\t\tcolor: {\n\t\t\t\t\t...previousValue?.color,\n\t\t\t\t\t...( clearsColorBackground && { background: undefined } ),\n\t\t\t\t\t...( clearsColorGradient && { gradient: undefined } ),\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\thasBackgroundGradientControl,\n\t\t\tshowBackgroundColorControl,\n\t\t\tshowLegacyColorGradientControl,\n\t\t]\n\t);\n\n\tif (\n\t\t! showBackgroundImageControl &&\n\t\t! showBackgroundColorControl &&\n\t\t! showBackgroundGradientControl &&\n\t\t! showLegacyColorGradientControl\n\t) {\n\t\treturn null;\n\t}\n\n\tconst resetBackground = () =>\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'background', 'backgroundImage' ],\n\t\t\t\tundefined\n\t\t\t)\n\t\t);\n\n\tconst resetGradient = () => {\n\t\tlet newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'background', 'gradient' ],\n\t\t\tundefined\n\t\t);\n\t\tnewValue = setImmutably( newValue, [ 'color', 'gradient' ], undefined );\n\t\tonChange( newValue );\n\t};\n\n\t// Background color (written to `color.background`).\n\tconst backgroundColor = decodeValue( inheritedValue?.color?.background );\n\tconst userBackgroundColor = decodeValue( value?.color?.background );\n\tconst setBackgroundColor = ( newColor, newSlug ) => {\n\t\tconst newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'color', 'background' ],\n\t\t\tencodeColorValueWithPalette( allColors, newColor, newSlug )\n\t\t);\n\t\t// Legacy `color.gradient` is mutually exclusive with\n\t\t// `color.background`. `background.gradient` is independent and\n\t\t// should not be touched.\n\t\tif ( showLegacyColorGradientControl ) {\n\t\t\tnewValue.color.gradient = undefined;\n\t\t}\n\t\tonChange( newValue );\n\t};\n\tconst resetBackgroundColor = () => {\n\t\tconst newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'color', 'background' ],\n\t\t\tundefined\n\t\t);\n\t\tif ( showLegacyColorGradientControl ) {\n\t\t\tnewValue.color.gradient = undefined;\n\t\t}\n\t\tonChange( newValue );\n\t};\n\n\t// Legacy `color.gradient` setters.\n\tconst legacyColorGradient = decodeValue( inheritedValue?.color?.gradient );\n\tconst userLegacyColorGradient = decodeValue( value?.color?.gradient );\n\tconst setLegacyColorGradient = ( newGradient ) => {\n\t\tconst newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'color', 'gradient' ],\n\t\t\tencodeGradientValue( newGradient )\n\t\t);\n\t\tnewValue.color.background = undefined;\n\t\tonChange( newValue );\n\t};\n\tconst resetLegacyColorGradient = () =>\n\t\tonChange( setImmutably( value, [ 'color', 'gradient' ], undefined ) );\n\n\t// Get current gradient value, decoding preset slug references.\n\t// Fall back to color.gradient for legacy blocks that haven't migrated\n\t// to background.gradient yet (mirrors block inspector fallback in\n\t// packages/block-editor/src/hooks/background.js).\n\tconst currentGradient = decodeValue(\n\t\tvalue?.background?.gradient ?? value?.color?.gradient\n\t);\n\tconst inheritedGradient = decodeValue(\n\t\tinheritedValue?.background?.gradient ?? inheritedValue?.color?.gradient\n\t);\n\n\t// Set gradient value, encoding preset matches as slug references.\n\t// Also clear color.gradient to migrate from the legacy location,\n\t// matching the block inspector behavior in hooks/background.js.\n\tconst setGradient = ( newGradient ) => {\n\t\tlet newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'background', 'gradient' ],\n\t\t\tencodeGradientValue( newGradient )\n\t\t);\n\t\tnewValue = setImmutably( newValue, [ 'color', 'gradient' ], undefined );\n\t\tonChange( newValue );\n\t};\n\n\treturn (\n\t\t<Wrapper\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tpanelId={ panelId }\n\t\t\theaderLabel={ headerLabel }\n\t\t>\n\t\t\t{ showBackgroundImageControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"block-editor-color-gradient-item\"\n\t\t\t\t\thasValue={ () => hasBackgroundImageValue( value ) }\n\t\t\t\t\tlabel={ __( 'Image' ) }\n\t\t\t\t\tonDeselect={ resetBackground }\n\t\t\t\t\tisShownByDefault={ defaultControls.backgroundImage }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BackgroundImageControl\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\tinheritedValue={ inheritedValue }\n\t\t\t\t\t\tdefaultControls={ defaultControls }\n\t\t\t\t\t\tdefaultValues={ defaultValues }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBackgroundColorControl && (\n\t\t\t\t<ColorGradientDropdownItem\n\t\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\t\thasValue={ () => hasBackgroundColorValue( value ) }\n\t\t\t\t\tresetValue={ resetBackgroundColor }\n\t\t\t\t\tisShownByDefault={ defaultControls.backgroundColor }\n\t\t\t\t\tindicators={ [ userBackgroundColor ?? backgroundColor ] }\n\t\t\t\t\tcontrastWarning={ contrastWarning }\n\t\t\t\t\ttabs={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: 'background',\n\t\t\t\t\t\t\tlabel: __( 'Color' ),\n\t\t\t\t\t\t\tinheritedValue:\n\t\t\t\t\t\t\t\tuserBackgroundColor ?? backgroundColor,\n\t\t\t\t\t\t\t// Resolve the slug from the same source as the\n\t\t\t\t\t\t\t// displayed value (user value first, then the\n\t\t\t\t\t\t\t// inherited fallback). For a block instance the\n\t\t\t\t\t\t\t// selection lives in `value` while `inheritedValue`\n\t\t\t\t\t\t\t// only holds the global styles fallback, so reading\n\t\t\t\t\t\t\t// the slug from `inheritedValue` alone would miss it\n\t\t\t\t\t\t\t// and two same-hex presets would both appear selected.\n\t\t\t\t\t\t\tinheritedSlug:\n\t\t\t\t\t\t\t\textractPresetSlug(\n\t\t\t\t\t\t\t\t\tvalue?.color?.background,\n\t\t\t\t\t\t\t\t\t'color'\n\t\t\t\t\t\t\t\t) ??\n\t\t\t\t\t\t\t\textractPresetSlug(\n\t\t\t\t\t\t\t\t\tinheritedValue?.color?.background,\n\t\t\t\t\t\t\t\t\t'color'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tsetValue: setBackgroundColor,\n\t\t\t\t\t\t\tuserValue: userBackgroundColor,\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t\tcolorGradientControlSettings={ {\n\t\t\t\t\t\tcolors,\n\t\t\t\t\t\tdisableCustomColors: ! areCustomSolidsEnabled,\n\t\t\t\t\t} }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showBackgroundGradientControl && (\n\t\t\t\t<ColorGradientDropdownItem\n\t\t\t\t\tlabel={ __( 'Gradient' ) }\n\t\t\t\t\thasValue={ () => hasBackgroundGradientValue( value ) }\n\t\t\t\t\tresetValue={ resetGradient }\n\t\t\t\t\tisShownByDefault={ defaultControls.gradient }\n\t\t\t\t\tindicators={ [ currentGradient ] }\n\t\t\t\t\ttabs={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: 'gradient',\n\t\t\t\t\t\t\tlabel: __( 'Gradient' ),\n\t\t\t\t\t\t\tinheritedValue:\n\t\t\t\t\t\t\t\tcurrentGradient ?? inheritedGradient,\n\t\t\t\t\t\t\tsetValue: setGradient,\n\t\t\t\t\t\t\tuserValue: currentGradient,\n\t\t\t\t\t\t\tisGradient: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t\tcolorGradientControlSettings={ {\n\t\t\t\t\t\tgradients,\n\t\t\t\t\t\tdisableCustomGradients: ! areCustomGradientsEnabled,\n\t\t\t\t\t} }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showLegacyColorGradientControl && (\n\t\t\t\t<ColorGradientDropdownItem\n\t\t\t\t\tlabel={ __( 'Gradient' ) }\n\t\t\t\t\thasValue={ () => hasLegacyColorGradientValue( value ) }\n\t\t\t\t\tresetValue={ resetLegacyColorGradient }\n\t\t\t\t\tisShownByDefault={ defaultControls.gradient }\n\t\t\t\t\tindicators={ [\n\t\t\t\t\t\tuserLegacyColorGradient ?? legacyColorGradient,\n\t\t\t\t\t] }\n\t\t\t\t\ttabs={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: 'gradient',\n\t\t\t\t\t\t\tlabel: __( 'Gradient' ),\n\t\t\t\t\t\t\tinheritedValue:\n\t\t\t\t\t\t\t\tuserLegacyColorGradient ?? legacyColorGradient,\n\t\t\t\t\t\t\tsetValue: setLegacyColorGradient,\n\t\t\t\t\t\t\tuserValue: userLegacyColorGradient,\n\t\t\t\t\t\t\tisGradient: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t\tcolorGradientControlSettings={ {\n\t\t\t\t\t\tgradients,\n\t\t\t\t\t\tdisableCustomGradients: ! areCustomGradientsEnabled,\n\t\t\t\t\t} }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,OAC1B;AACP,SAAS,mBAAmB;AAC5B,SAAS,UAAU;AAKnB,OAAO,4BAA4B;AACnC,OAAO,+BAA+B;AACtC,SAAS,kCAAkC;AAC3C,SAAS,gCAAgC;AACzC,SAAS,sCAAsC;AAC/C,SAAS,oBAAoB;AAC7B;AAAA,EACC;AAAA,EACA;AAAA,OACM;AAkIJ,cAkLD,YAlLC;AAhIH,IAAM,mBAAmB;AAAA,EACxB,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,UAAU;AACX;AASO,SAAS,wBAAyB,UAAU,SAAU;AAC5D,SAAO,UAAU,aAAc,OAAQ;AACxC;AAcO,SAAS,sBAAuB,UAAW;AACjD,QAAM,qBAAqB,2BAA4B,QAAS;AAChE,QAAM,EAAE,iBAAiB,SAAS,IAAI,UAAU,cAAc,CAAC;AAC/D,SAAO,mBAAmB,YAAY;AACvC;AAUO,SAAS,uBAAwB,OAAQ;AAC/C,SACC,OAAO,YAAY,uBAAuB,UAC1C,OAAO,YAAY,mBAAmB;AAExC;AASO,SAAS,wBAAyB,OAAQ;AAChD,SACC,CAAC,CAAE,OAAO,YAAY,iBAAiB;AAAA,EAEvC,aAAa,OAAO,OAAO,YAAY,mBACvC,CAAC,CAAE,OAAO,YAAY,iBAAiB;AAEzC;AASO,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MAAM,4BAA6B,KAAM;AAAA,YACpD,YAAa;AAAA,YACb,kBAAmB,gBAAgB;AAAA,YACnC,YAAa;AAAA,cACZ,2BAA2B;AAAA,YAC5B;AAAA,YACA,MAAO;AAAA,cACN;AAAA,gBACC,KAAK;AAAA,gBACL,OAAO,GAAI,UAAW;AAAA,gBACtB,gBACC,2BAA2B;AAAA,gBAC5B,UAAU;AAAA,gBACV,WAAW;AAAA,gBACX,YAAY;AAAA,cACb;AAAA,YACD;AAAA,YACA,8BAA+B;AAAA,cAC9B;AAAA,cACA,wBAAwB,CAAE;AAAA,YAC3B;AAAA,YACA;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EAEF;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -88,6 +88,7 @@ function BorderPanel({
|
|
|
88
88
|
defaultControls = DEFAULT_CONTROLS
|
|
89
89
|
}) {
|
|
90
90
|
const colors = useColorsPerOrigin(settings);
|
|
91
|
+
const areCustomSolidsEnabled = settings?.color?.custom;
|
|
91
92
|
const decodeValue = useCallback(
|
|
92
93
|
(rawValue) => getValueFromVariable({ settings }, "", rawValue),
|
|
93
94
|
[settings]
|
|
@@ -220,6 +221,7 @@ function BorderPanel({
|
|
|
220
221
|
BorderBoxControl,
|
|
221
222
|
{
|
|
222
223
|
colors,
|
|
224
|
+
disableCustomColors: !areCustomSolidsEnabled,
|
|
223
225
|
enableAlpha: true,
|
|
224
226
|
enableStyle: showBorderStyle,
|
|
225
227
|
onChange: onBorderChange,
|