@wordpress/block-editor 14.0.0 → 14.2.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 +4 -0
- package/README.md +10 -24
- package/build/autocompleters/block.js +1 -1
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/block-alignment-matrix-control/index.js +2 -2
- package/build/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build/components/block-breadcrumb/index.js +8 -2
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-canvas/index.js +8 -1
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-compare/block-view.js +4 -1
- package/build/components/block-compare/block-view.js.map +1 -1
- package/build/components/block-draggable/index.js +4 -4
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.js +25 -25
- package/build/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
- package/build/components/block-edit/multiple-usage-warning.js +8 -2
- package/build/components/block-edit/multiple-usage-warning.js.map +1 -1
- package/build/components/block-inspector/index.js +27 -9
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.js +6 -3
- package/build/components/block-list/block-invalid-warning.js.map +1 -1
- package/build/components/block-list/block.js +5 -1
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +7 -3
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +1 -0
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +46 -0
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -0
- package/build/components/block-list/use-in-between-inserter.js +11 -4
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-lock/toolbar.js +3 -3
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mover/button.js +4 -1
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +4 -1
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +4 -1
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +1 -4
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +22 -7
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-patterns-list/index.js +11 -14
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +12 -3
- package/build/components/block-patterns-paging/index.js.map +1 -1
- package/build/components/block-popover/index.js +2 -15
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-quick-navigation/index.js +4 -1
- package/build/components/block-quick-navigation/index.js.map +1 -1
- package/build/components/block-settings-menu/block-mode-toggle.js +28 -34
- package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +4 -0
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/index.js +22 -17
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +1 -4
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-toolbar/index.js +12 -11
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +6 -2
- package/build/components/block-toolbar/shuffle.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +8 -2
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/block-toolbar-popover.js +10 -6
- package/build/components/block-tools/block-toolbar-popover.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +14 -3
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js +2 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +2 -1
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +4 -5
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-popover.js +3 -4
- package/build/components/block-tools/zoom-out-popover.js.map +1 -1
- package/build/components/block-tools/zoom-out-toolbar.js +14 -5
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build/components/block-variation-picker/index.js +4 -1
- package/build/components/block-variation-picker/index.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +4 -1
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/border-radius-control/index.js +1 -0
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/button-block-appender/index.js +14 -3
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +4 -1
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/content-lock/index.js +13 -0
- package/build/components/content-lock/index.js.map +1 -0
- package/build/components/content-lock/modify-content-lock-menu-item.js +64 -0
- package/build/components/content-lock/modify-content-lock-menu-item.js.map +1 -0
- package/build/components/convert-to-group-buttons/index.js +1 -1
- package/build/components/convert-to-group-buttons/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +2 -0
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/editor-styles/index.js +4 -3
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +3 -0
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/font-family/index.js +3 -0
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +118 -50
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +8 -5
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.native.js +1 -1
- package/build/components/global-styles/color-panel.native.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +34 -37
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +4 -1
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +3 -1
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build/components/global-styles/hooks.js +0 -7
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +0 -6
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/shadow-panel-components.js +13 -7
- package/build/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +17 -6
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +3 -3
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +11 -29
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/grid/grid-item-movers.js +2 -2
- package/build/components/grid/grid-item-movers.js.map +1 -1
- package/build/components/grid/grid-visualizer.js +20 -5
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/height-control/index.js +1 -0
- package/build/components/height-control/index.js.map +1 -1
- package/build/components/iframe/index.js +8 -6
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/zoom-dropdown.js +11 -7
- package/build/components/image-editor/zoom-dropdown.js.map +1 -1
- package/build/components/inner-blocks/button-block-appender.js +8 -8
- package/build/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build/components/inner-blocks/default-block-appender.js +7 -25
- package/build/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build/components/inner-blocks/index.js +8 -12
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +3 -3
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +4 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/index.js +4 -1
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +3 -3
- package/build/components/inserter/media-tab/hooks.js.map +1 -1
- package/build/components/inserter/media-tab/media-list.js +1 -4
- package/build/components/inserter/media-tab/media-list.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +8 -2
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/media-tab/media-tab.js +4 -1
- package/build/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build/components/inserter/menu.js +14 -13
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +8 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter-list-item/index.js +4 -4
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/inserter-listbox/index.js +3 -7
- package/build/components/inserter-listbox/index.js.map +1 -1
- package/build/components/inserter-listbox/item.js +4 -1
- package/build/components/inserter-listbox/item.js.map +1 -1
- package/build/components/inspector-controls/groups.js +2 -0
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +4 -1
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/settings-tab.js +3 -1
- package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -1
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build/components/inspector-popover-header/index.js +8 -2
- package/build/components/inspector-popover-header/index.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +7 -4
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/line-height-control/index.js +3 -0
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/index.js +19 -10
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +4 -1
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/list-view/block-select-button.js +4 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/media-placeholder/index.js +36 -10
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +8 -1
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-upload/index.native.js +4 -1
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +12 -12
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +19 -19
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/event-listeners/paste-handler.js +12 -1
- package/build/components/rich-text/event-listeners/paste-handler.js.map +1 -1
- package/build/components/rich-text/index.js +38 -30
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-mark-persistent.js +5 -5
- package/build/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +4 -1
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -2
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/text-alignment-control/index.js +13 -8
- package/build/components/text-alignment-control/index.js.map +1 -1
- package/build/components/text-decoration-control/index.js +13 -8
- package/build/components/text-decoration-control/index.js.map +1 -1
- package/build/components/text-transform-control/index.js +13 -8
- package/build/components/text-transform-control/index.js.map +1 -1
- package/build/components/tool-selector/index.js +4 -1
- package/build/components/tool-selector/index.js.map +1 -1
- package/build/components/url-input/button.js +12 -3
- package/build/components/url-input/button.js.map +1 -1
- package/build/components/url-input/index.js +4 -1
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +2 -0
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +12 -2
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/writing-flow/index.js +2 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +4 -1
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/components/writing-flow/use-event-redirect.js +66 -0
- package/build/components/writing-flow/use-event-redirect.js.map +1 -0
- package/build/components/writing-flow/use-input.js +31 -1
- package/build/components/writing-flow/use-input.js.map +1 -1
- package/build/components/writing-flow/use-select-all.js +14 -1
- package/build/components/writing-flow/use-select-all.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +20 -6
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +4 -4
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/components/writing-flow/utils.js +27 -0
- package/build/components/writing-flow/utils.js.map +1 -1
- package/build/components/writing-mode-control/index.js +13 -8
- package/build/components/writing-mode-control/index.js.map +1 -1
- package/build/hooks/background.js +19 -23
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-bindings.js +64 -103
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/content-lock-ui.js +8 -26
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/duotone.js +0 -4
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/layout.js +4 -1
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/spacing-visualizer.js +3 -3
- package/build/hooks/spacing-visualizer.js.map +1 -1
- package/build/hooks/style.js +1 -5
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +19 -20
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/use-zoom-out.js +7 -7
- package/build/hooks/use-zoom-out.js.map +1 -1
- package/build/layouts/constrained.js +42 -41
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/flex.js +6 -1
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/grid.js +3 -0
- package/build/layouts/grid.js.map +1 -1
- package/build/layouts/utils.js +1 -7
- package/build/layouts/utils.js.map +1 -1
- package/build/private-apis.js +4 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +2 -7
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +1 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-keys.js +2 -1
- package/build/store/private-keys.js.map +1 -1
- package/build/store/private-selectors.js +39 -11
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +2 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +19 -43
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +48 -0
- package/build/store/utils.js.map +1 -1
- package/build/utils/block-bindings.js +117 -0
- package/build/utils/block-bindings.js.map +1 -0
- package/build/utils/dom.js +101 -0
- package/build/utils/dom.js.map +1 -1
- package/build/utils/get-font-styles-and-weights.js +4 -4
- package/build/utils/get-font-styles-and-weights.js.map +1 -1
- package/build/utils/transform-styles/index.js +120 -16
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/autocompleters/block.js +1 -1
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/components/block-alignment-matrix-control/index.js +1 -1
- package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +8 -2
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-canvas/index.js +9 -1
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-compare/block-view.js +4 -1
- package/build-module/components/block-compare/block-view.js.map +1 -1
- package/build-module/components/block-draggable/index.js +4 -4
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.js +25 -25
- package/build-module/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
- package/build-module/components/block-edit/multiple-usage-warning.js +8 -2
- package/build-module/components/block-edit/multiple-usage-warning.js.map +1 -1
- package/build-module/components/block-inspector/index.js +27 -9
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.js +6 -3
- package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
- package/build-module/components/block-list/block.js +5 -1
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +7 -3
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +1 -0
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +40 -0
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -0
- package/build-module/components/block-list/use-in-between-inserter.js +11 -4
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +3 -3
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-mover/button.js +4 -1
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +4 -1
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +4 -1
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +1 -4
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +23 -8
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +11 -14
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +12 -3
- package/build-module/components/block-patterns-paging/index.js.map +1 -1
- package/build-module/components/block-popover/index.js +2 -15
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-quick-navigation/index.js +4 -1
- package/build-module/components/block-quick-navigation/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-mode-toggle.js +29 -34
- package/build-module/components/block-settings-menu/block-mode-toggle.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +4 -0
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +22 -17
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +1 -4
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +12 -11
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +6 -2
- package/build-module/components/block-toolbar/shuffle.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +8 -2
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-popover.js +10 -6
- package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +14 -3
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js +2 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +2 -1
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +4 -5
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-popover.js +3 -4
- package/build-module/components/block-tools/zoom-out-popover.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +15 -6
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +4 -1
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +4 -1
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +1 -0
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/button-block-appender/index.js +15 -4
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +4 -1
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/content-lock/index.js +2 -0
- package/build-module/components/content-lock/index.js.map +1 -0
- package/build-module/components/content-lock/modify-content-lock-menu-item.js +57 -0
- package/build-module/components/content-lock/modify-content-lock-menu-item.js.map +1 -0
- package/build-module/components/convert-to-group-buttons/index.js +1 -1
- package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +2 -0
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/editor-styles/index.js +4 -3
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +3 -0
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/font-family/index.js +3 -0
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +121 -53
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +7 -4
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.native.js +2 -2
- package/build-module/components/global-styles/color-panel.native.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +36 -39
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +4 -1
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +3 -1
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +0 -6
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +1 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +13 -7
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +17 -6
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +5 -5
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +11 -28
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +3 -3
- package/build-module/components/grid/grid-item-movers.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js +20 -5
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/height-control/index.js +1 -0
- package/build-module/components/height-control/index.js.map +1 -1
- package/build-module/components/iframe/index.js +8 -6
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/zoom-dropdown.js +12 -8
- package/build-module/components/image-editor/zoom-dropdown.js.map +1 -1
- package/build-module/components/inner-blocks/button-block-appender.js +7 -6
- package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build-module/components/inner-blocks/default-block-appender.js +6 -23
- package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +8 -12
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +3 -3
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +4 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js +4 -1
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +3 -3
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-list.js +1 -4
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +8 -2
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-tab.js +4 -1
- package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build-module/components/inserter/menu.js +14 -13
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +9 -2
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +4 -4
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/inserter-listbox/index.js +3 -7
- package/build-module/components/inserter-listbox/index.js.map +1 -1
- package/build-module/components/inserter-listbox/item.js +4 -1
- package/build-module/components/inserter-listbox/item.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +2 -0
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +4 -1
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.js +3 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -1
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build-module/components/inspector-popover-header/index.js +8 -2
- package/build-module/components/inspector-popover-header/index.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +7 -4
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +3 -0
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +19 -10
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +4 -1
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +4 -1
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +36 -10
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +8 -1
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +4 -1
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +12 -12
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +19 -19
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/paste-handler.js +12 -1
- package/build-module/components/rich-text/event-listeners/paste-handler.js.map +1 -1
- package/build-module/components/rich-text/index.js +39 -31
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-mark-persistent.js +5 -5
- package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js +4 -1
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -2
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/text-alignment-control/index.js +13 -8
- package/build-module/components/text-alignment-control/index.js.map +1 -1
- package/build-module/components/text-decoration-control/index.js +13 -8
- package/build-module/components/text-decoration-control/index.js.map +1 -1
- package/build-module/components/text-transform-control/index.js +13 -8
- package/build-module/components/text-transform-control/index.js.map +1 -1
- package/build-module/components/tool-selector/index.js +4 -1
- package/build-module/components/tool-selector/index.js.map +1 -1
- package/build-module/components/url-input/button.js +12 -3
- package/build-module/components/url-input/button.js.map +1 -1
- package/build-module/components/url-input/index.js +4 -1
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +2 -0
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +12 -2
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/writing-flow/index.js +2 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +4 -1
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/components/writing-flow/use-event-redirect.js +60 -0
- package/build-module/components/writing-flow/use-event-redirect.js.map +1 -0
- package/build-module/components/writing-flow/use-input.js +31 -1
- package/build-module/components/writing-flow/use-input.js.map +1 -1
- package/build-module/components/writing-flow/use-select-all.js +14 -1
- package/build-module/components/writing-flow/use-select-all.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +16 -2
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +4 -4
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/components/writing-flow/utils.js +26 -0
- package/build-module/components/writing-flow/utils.js.map +1 -1
- package/build-module/components/writing-mode-control/index.js +13 -8
- package/build-module/components/writing-mode-control/index.js.map +1 -1
- package/build-module/hooks/background.js +19 -23
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-bindings.js +66 -105
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +10 -30
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/duotone.js +0 -4
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/layout.js +4 -1
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/spacing-visualizer.js +3 -3
- package/build-module/hooks/spacing-visualizer.js.map +1 -1
- package/build-module/hooks/style.js +1 -5
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +19 -20
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +7 -7
- package/build-module/hooks/use-zoom-out.js.map +1 -1
- package/build-module/layouts/constrained.js +44 -43
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/flex.js +6 -1
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/grid.js +3 -0
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/layouts/utils.js +1 -7
- package/build-module/layouts/utils.js.map +1 -1
- package/build-module/private-apis.js +5 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +2 -7
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +1 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-keys.js +1 -0
- package/build-module/store/private-keys.js.map +1 -1
- package/build-module/store/private-selectors.js +36 -12
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +2 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +22 -46
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +46 -0
- package/build-module/store/utils.js.map +1 -1
- package/build-module/utils/block-bindings.js +110 -0
- package/build-module/utils/block-bindings.js.map +1 -0
- package/build-module/utils/dom.js +99 -0
- package/build-module/utils/dom.js.map +1 -1
- package/build-module/utils/get-font-styles-and-weights.js +4 -4
- package/build-module/utils/get-font-styles-and-weights.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +120 -16
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +9 -25
- package/build-style/content.css +9 -25
- package/build-style/default-editor-styles-rtl.css +2 -2
- package/build-style/default-editor-styles.css +2 -2
- package/build-style/style-rtl.css +53 -76
- package/build-style/style.css +53 -76
- package/build-types/utils/dom.d.ts +25 -0
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +34 -32
- package/src/autocompleters/block.js +2 -1
- package/src/components/block-alignment-matrix-control/index.js +1 -1
- package/src/components/block-breadcrumb/index.js +4 -0
- package/src/components/block-breadcrumb/style.scss +1 -1
- package/src/components/block-canvas/index.js +9 -1
- package/src/components/block-compare/block-view.js +7 -1
- package/src/components/block-draggable/content.scss +1 -1
- package/src/components/block-draggable/index.js +4 -4
- package/src/components/block-draggable/style.scss +1 -1
- package/src/components/block-draggable/use-scroll-when-dragging.js +25 -25
- package/src/components/block-edit/multiple-usage-warning.js +4 -0
- package/src/components/block-inspector/index.js +22 -6
- package/src/components/block-list/block-invalid-warning.js +4 -2
- package/src/components/block-list/block.js +6 -2
- package/src/components/block-list/content.scss +7 -16
- package/src/components/block-list/use-block-props/index.js +5 -2
- package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -0
- package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +44 -0
- package/src/components/block-list/use-in-between-inserter.js +17 -5
- package/src/components/block-lock/style.scss +1 -1
- package/src/components/block-lock/toolbar.js +3 -3
- package/src/components/block-mover/button.js +2 -0
- package/src/components/block-mover/index.js +2 -0
- package/src/components/block-mover/style.scss +1 -1
- package/src/components/block-navigation/dropdown.js +2 -0
- package/src/components/block-pattern-setup/index.js +3 -7
- package/src/components/block-pattern-setup/setup-toolbar.js +17 -4
- package/src/components/block-pattern-setup/style.scss +2 -2
- package/src/components/block-patterns-list/index.js +15 -13
- package/src/components/block-patterns-list/style.scss +2 -2
- package/src/components/block-patterns-paging/index.js +6 -0
- package/src/components/block-popover/index.js +7 -28
- package/src/components/block-popover/style.scss +1 -1
- package/src/components/block-quick-navigation/index.js +2 -0
- package/src/components/block-settings-menu/block-mode-toggle.js +28 -31
- package/src/components/block-settings-menu/test/block-mode-toggle.js +26 -23
- package/src/components/block-settings-menu-controls/index.js +7 -1
- package/src/components/block-switcher/index.js +26 -20
- package/src/components/block-switcher/pattern-transformations-menu.js +3 -7
- package/src/components/block-switcher/style.scss +5 -6
- package/src/components/block-toolbar/index.js +17 -8
- package/src/components/block-toolbar/shuffle.js +9 -7
- package/src/components/block-tools/block-selection-button.js +4 -0
- package/src/components/block-tools/block-toolbar-popover.js +10 -6
- package/src/components/block-tools/insertion-point.js +11 -0
- package/src/components/block-tools/style.scss +4 -5
- package/src/components/block-tools/use-block-toolbar-popover-props.js +2 -1
- package/src/components/block-tools/use-show-block-tools.js +4 -1
- package/src/components/block-tools/zoom-out-mode-inserters.js +5 -2
- package/src/components/block-tools/zoom-out-popover.js +3 -7
- package/src/components/block-tools/zoom-out-toolbar.js +20 -6
- package/src/components/block-variation-picker/README.md +2 -2
- package/src/components/block-variation-picker/index.js +6 -1
- package/src/components/block-variation-transforms/index.js +2 -0
- package/src/components/block-variation-transforms/style.scss +2 -2
- package/src/components/border-radius-control/index.js +1 -0
- package/src/components/border-radius-control/style.scss +0 -10
- package/src/components/button-block-appender/content.scss +0 -1
- package/src/components/button-block-appender/index.js +14 -3
- package/src/components/color-palette/test/control.js +15 -2
- package/src/components/colors-gradients/dropdown.js +5 -1
- package/src/components/colors-gradients/style.scss +4 -4
- package/src/components/content-lock/index.js +1 -0
- package/src/components/content-lock/modify-content-lock-menu-item.js +58 -0
- package/src/components/convert-to-group-buttons/index.js +1 -1
- package/src/components/date-format-picker/index.js +2 -0
- package/src/components/default-block-appender/content.scss +0 -1
- package/src/components/editor-styles/index.js +4 -3
- package/src/components/font-appearance-control/index.js +3 -0
- package/src/components/font-family/README.md +11 -2
- package/src/components/font-family/index.js +3 -0
- package/src/components/global-styles/background-panel.js +135 -64
- package/src/components/global-styles/color-panel.js +8 -4
- package/src/components/global-styles/color-panel.native.js +2 -2
- package/src/components/global-styles/dimensions-panel.js +40 -40
- package/src/components/global-styles/filters-panel.js +5 -1
- package/src/components/global-styles/get-global-styles-changes.js +4 -1
- package/src/components/global-styles/hooks.js +0 -5
- package/src/components/global-styles/index.js +0 -1
- package/src/components/global-styles/shadow-panel-components.js +12 -8
- package/src/components/global-styles/style.scss +16 -6
- package/src/components/global-styles/test/typography-utils.js +96 -5
- package/src/components/global-styles/test/use-global-styles-output.js +20 -4
- package/src/components/global-styles/test/utils.js +10 -0
- package/src/components/global-styles/typography-utils.js +22 -6
- package/src/components/global-styles/use-global-styles-output.js +5 -6
- package/src/components/global-styles/utils.js +11 -35
- package/src/components/grid/grid-item-movers.js +3 -3
- package/src/components/grid/grid-visualizer.js +22 -7
- package/src/components/grid/style.scss +1 -1
- package/src/components/height-control/index.js +1 -0
- package/src/components/iframe/index.js +8 -6
- package/src/components/image-editor/zoom-dropdown.js +17 -9
- package/src/components/inner-blocks/button-block-appender.js +5 -7
- package/src/components/inner-blocks/default-block-appender.js +4 -23
- package/src/components/inner-blocks/index.js +11 -10
- package/src/components/inner-blocks/use-inner-block-template-sync.js +3 -3
- package/src/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +2 -0
- package/src/components/inserter/block-patterns-tab/index.js +2 -0
- package/src/components/inserter/media-tab/hooks.js +3 -3
- package/src/components/inserter/media-tab/media-list.js +1 -4
- package/src/components/inserter/media-tab/media-preview.js +12 -2
- package/src/components/inserter/media-tab/media-tab.js +2 -0
- package/src/components/inserter/menu.js +13 -22
- package/src/components/inserter/quick-inserter.js +6 -1
- package/src/components/inserter/style.scss +7 -9
- package/src/components/inserter-list-item/index.js +4 -4
- package/src/components/inserter-list-item/style.scss +2 -3
- package/src/components/inserter-listbox/index.js +2 -8
- package/src/components/inserter-listbox/item.js +9 -1
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/index.js +2 -0
- package/src/components/inspector-controls-tabs/settings-tab.js +1 -0
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +5 -2
- package/src/components/inspector-popover-header/index.js +4 -0
- package/src/components/letter-spacing-control/README.md +8 -1
- package/src/components/letter-spacing-control/index.js +7 -4
- package/src/components/line-height-control/README.md +7 -0
- package/src/components/line-height-control/index.js +3 -0
- package/src/components/link-control/index.js +17 -8
- package/src/components/link-control/settings-drawer.js +2 -0
- package/src/components/link-control/style.scss +2 -4
- package/src/components/list-view/block-select-button.js +2 -0
- package/src/components/list-view/style.scss +14 -16
- package/src/components/media-placeholder/index.js +26 -7
- package/src/components/media-replace-flow/index.js +12 -1
- package/src/components/media-upload/README.md +2 -0
- package/src/components/media-upload/index.native.js +2 -0
- package/src/components/multi-selection-inspector/index.js +8 -9
- package/src/components/provider/use-block-sync.js +20 -20
- package/src/components/responsive-block-control/README.md +3 -26
- package/src/components/responsive-block-control/test/index.js +1 -0
- package/src/components/rich-text/content.scss +1 -1
- package/src/components/rich-text/event-listeners/paste-handler.js +6 -1
- package/src/components/rich-text/index.js +54 -41
- package/src/components/rich-text/style.scss +1 -1
- package/src/components/rich-text/use-mark-persistent.js +5 -5
- package/src/components/skip-to-selected-block/index.js +2 -0
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +8 -4
- package/src/components/spacing-sizes-control/style.scss +17 -16
- package/src/components/text-alignment-control/index.js +20 -8
- package/src/components/text-decoration-control/index.js +20 -8
- package/src/components/text-decoration-control/stories/index.story.js +0 -4
- package/src/components/text-transform-control/index.js +20 -8
- package/src/components/text-transform-control/stories/index.story.js +0 -4
- package/src/components/tool-selector/index.js +2 -0
- package/src/components/url-input/button.js +6 -0
- package/src/components/url-input/index.js +2 -0
- package/src/components/url-input/style.scss +2 -2
- package/src/components/url-popover/image-url-input-ui.js +2 -0
- package/src/components/url-popover/stories/index.story.js +7 -1
- package/src/components/use-block-drop-zone/index.js +21 -3
- package/src/components/warning/content.scss +3 -10
- package/src/components/writing-flow/index.js +2 -0
- package/src/components/writing-flow/use-arrow-nav.js +9 -2
- package/src/components/writing-flow/use-event-redirect.js +72 -0
- package/src/components/writing-flow/use-input.js +36 -1
- package/src/components/writing-flow/use-select-all.js +18 -1
- package/src/components/writing-flow/use-selection-observer.js +23 -3
- package/src/components/writing-flow/use-tab-nav.js +4 -4
- package/src/components/writing-flow/utils.js +30 -0
- package/src/components/writing-mode-control/index.js +20 -8
- package/src/hooks/background.js +21 -27
- package/src/hooks/block-bindings.js +64 -122
- package/src/hooks/block-bindings.scss +2 -10
- package/src/hooks/content-lock-ui.js +11 -36
- package/src/hooks/duotone.js +0 -4
- package/src/hooks/layout.js +2 -0
- package/src/hooks/layout.scss +3 -11
- package/src/hooks/spacing-visualizer.js +3 -3
- package/src/hooks/style.js +1 -4
- package/src/hooks/test/background.js +60 -0
- package/src/hooks/use-bindings-attributes.js +23 -24
- package/src/hooks/use-zoom-out.js +7 -7
- package/src/layouts/constrained.js +51 -47
- package/src/layouts/flex.js +4 -0
- package/src/layouts/grid.js +3 -0
- package/src/layouts/test/grid.js +2 -2
- package/src/layouts/test/utils.js +6 -8
- package/src/layouts/utils.js +1 -9
- package/src/private-apis.js +4 -0
- package/src/store/actions.js +4 -6
- package/src/store/private-actions.js +1 -0
- package/src/store/private-keys.js +1 -0
- package/src/store/private-selectors.js +44 -7
- package/src/store/reducer.js +2 -0
- package/src/store/selectors.js +32 -51
- package/src/store/test/private-selectors.js +89 -0
- package/src/store/utils.js +50 -0
- package/src/style.scss +0 -1
- package/src/utils/block-bindings.js +97 -0
- package/src/utils/dom.js +117 -0
- package/src/utils/get-font-styles-and-weights.js +12 -4
- package/src/utils/test/get-font-styles-and-weights.js +148 -0
- package/src/utils/test/transform-styles.js +284 -26
- package/src/utils/transform-styles/index.js +132 -21
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/global-styles/theme-file-uri-utils.js +0 -21
- package/build/components/global-styles/theme-file-uri-utils.js.map +0 -1
- package/build/components/inner-blocks/with-client-id.js +0 -28
- package/build/components/inner-blocks/with-client-id.js.map +0 -1
- package/build/components/segmented-text-control/index.js +0 -63
- package/build/components/segmented-text-control/index.js.map +0 -1
- package/build-module/components/global-styles/theme-file-uri-utils.js +0 -15
- package/build-module/components/global-styles/theme-file-uri-utils.js.map +0 -1
- package/build-module/components/inner-blocks/with-client-id.js +0 -21
- package/build-module/components/inner-blocks/with-client-id.js.map +0 -1
- package/build-module/components/segmented-text-control/index.js +0 -58
- package/build-module/components/segmented-text-control/index.js.map +0 -1
- package/src/components/global-styles/test/theme-file-uri-utils.js +0 -41
- package/src/components/global-styles/theme-file-uri-utils.js +0 -18
- package/src/components/inner-blocks/with-client-id.js +0 -19
- package/src/components/segmented-text-control/index.js +0 -63
- package/src/components/segmented-text-control/style.scss +0 -15
- package/src/utils/test/__snapshots__/transform-styles.js.snap +0 -109
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_element","_i18n","_getFontStylesAndWeights","_jsxRuntime","getFontAppearanceLabel","hasFontStyles","hasFontWeights","__","FontAppearanceControl","props","onChange","fontFamilyFaces","value","fontStyle","fontWeight","otherProps","hasStylesOrWeights","label","defaultOption","key","name","style","undefined","fontStyles","fontWeights","combinedStyleAndWeightOptions","getFontStylesAndWeights","combineOptions","combinedOptions","push","styleOptions","forEach","weightOptions","selectOptions","useMemo","options","currentSelection","find","option","getDescribedBy","sprintf","jsx","CustomSelectControl","className","describedBy","selectedItem"],"sources":["@wordpress/block-editor/src/components/font-appearance-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { CustomSelectControl } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getFontStylesAndWeights } from '../../utils/get-font-styles-and-weights';\n\n/**\n * Adjusts font appearance field label in case either font styles or weights\n * are disabled.\n *\n * @param {boolean} hasFontStyles Whether font styles are enabled and present.\n * @param {boolean} hasFontWeights Whether font weights are enabled and present.\n * @return {string} A label representing what font appearance is being edited.\n */\nconst getFontAppearanceLabel = ( hasFontStyles, hasFontWeights ) => {\n\tif ( ! hasFontStyles ) {\n\t\treturn __( 'Font weight' );\n\t}\n\n\tif ( ! hasFontWeights ) {\n\t\treturn __( 'Font style' );\n\t}\n\n\treturn __( 'Appearance' );\n};\n\n/**\n * Control to display font style and weight options of the active font.\n *\n * @param {Object} props Component props.\n *\n * @return {Element} Font appearance control.\n */\nexport default function FontAppearanceControl( props ) {\n\tconst {\n\t\tonChange,\n\t\thasFontStyles = true,\n\t\thasFontWeights = true,\n\t\tfontFamilyFaces,\n\t\tvalue: { fontStyle, fontWeight },\n\t\t...otherProps\n\t} = props;\n\tconst hasStylesOrWeights = hasFontStyles || hasFontWeights;\n\tconst label = getFontAppearanceLabel( hasFontStyles, hasFontWeights );\n\tconst defaultOption = {\n\t\tkey: 'default',\n\t\tname: __( 'Default' ),\n\t\tstyle: { fontStyle: undefined, fontWeight: undefined },\n\t};\n\tconst { fontStyles, fontWeights, combinedStyleAndWeightOptions } =\n\t\tgetFontStylesAndWeights( fontFamilyFaces );\n\n\t// Generates select options for combined font styles and weights.\n\tconst combineOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tif ( combinedStyleAndWeightOptions ) {\n\t\t\tcombinedOptions.push( ...combinedStyleAndWeightOptions );\n\t\t}\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font styles only.\n\tconst styleOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tfontStyles.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: value, fontWeight: undefined },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font weights only.\n\tconst weightOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tfontWeights.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: undefined, fontWeight: value },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Map font styles and weights to select options.\n\tconst selectOptions = useMemo( () => {\n\t\t// Display combined available font style and weight options.\n\t\tif ( hasFontStyles && hasFontWeights ) {\n\t\t\treturn combineOptions();\n\t\t}\n\n\t\t// Display only font style options or font weight options.\n\t\treturn hasFontStyles ? styleOptions() : weightOptions();\n\t}, [\n\t\tprops.options,\n\t\tfontStyles,\n\t\tfontWeights,\n\t\tcombinedStyleAndWeightOptions,\n\t] );\n\n\t// Find current selection by comparing font style & weight against options,\n\t// and fall back to the Default option if there is no matching option.\n\tconst currentSelection =\n\t\tselectOptions.find(\n\t\t\t( option ) =>\n\t\t\t\toption.style.fontStyle === fontStyle &&\n\t\t\t\toption.style.fontWeight === fontWeight\n\t\t) || selectOptions[ 0 ];\n\n\t// Adjusts screen reader description based on styles or weights.\n\tconst getDescribedBy = () => {\n\t\tif ( ! currentSelection ) {\n\t\t\treturn __( 'No selected font appearance' );\n\t\t}\n\n\t\tif ( ! hasFontStyles ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font weight.\n\t\t\t\t__( 'Currently selected font weight: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\tif ( ! hasFontWeights ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font style.\n\t\t\t\t__( 'Currently selected font style: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\treturn sprintf(\n\t\t\t// translators: %s: Currently selected font appearance.\n\t\t\t__( 'Currently selected font appearance: %s' ),\n\t\t\tcurrentSelection.name\n\t\t);\n\t};\n\n\treturn (\n\t\thasStylesOrWeights && (\n\t\t\t<CustomSelectControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\tclassName=\"components-font-appearance-control\"\n\t\t\t\tlabel={ label }\n\t\t\t\tdescribedBy={ getDescribedBy() }\n\t\t\t\toptions={ selectOptions }\n\t\t\t\tvalue={ currentSelection }\n\t\t\t\tonChange={ ( { selectedItem } ) =>\n\t\t\t\t\tonChange( selectedItem.style )\n\t\t\t\t}\n\t\t\t/>\n\t\t)\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,wBAAA,GAAAH,OAAA;AAAkF,IAAAI,WAAA,GAAAJ,OAAA;AAVlF;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,MAAMK,sBAAsB,GAAGA,CAAEC,aAAa,EAAEC,cAAc,KAAM;EACnE,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAAE,QAAE,EAAE,aAAc,CAAC;EAC3B;EAEA,IAAK,CAAED,cAAc,EAAG;IACvB,OAAO,IAAAC,QAAE,EAAE,YAAa,CAAC;EAC1B;EAEA,OAAO,IAAAA,QAAE,EAAE,YAAa,CAAC;AAC1B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,qBAAqBA,CAAEC,KAAK,EAAG;EACtD,MAAM;
|
|
1
|
+
{"version":3,"names":["_components","require","_element","_i18n","_getFontStylesAndWeights","_jsxRuntime","getFontAppearanceLabel","hasFontStyles","hasFontWeights","__","FontAppearanceControl","props","__next40pxDefaultSize","onChange","fontFamilyFaces","value","fontStyle","fontWeight","otherProps","hasStylesOrWeights","label","defaultOption","key","name","style","undefined","fontStyles","fontWeights","combinedStyleAndWeightOptions","getFontStylesAndWeights","combineOptions","combinedOptions","push","styleOptions","forEach","weightOptions","selectOptions","useMemo","options","currentSelection","find","option","getDescribedBy","sprintf","jsx","CustomSelectControl","className","describedBy","selectedItem"],"sources":["@wordpress/block-editor/src/components/font-appearance-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { CustomSelectControl } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getFontStylesAndWeights } from '../../utils/get-font-styles-and-weights';\n\n/**\n * Adjusts font appearance field label in case either font styles or weights\n * are disabled.\n *\n * @param {boolean} hasFontStyles Whether font styles are enabled and present.\n * @param {boolean} hasFontWeights Whether font weights are enabled and present.\n * @return {string} A label representing what font appearance is being edited.\n */\nconst getFontAppearanceLabel = ( hasFontStyles, hasFontWeights ) => {\n\tif ( ! hasFontStyles ) {\n\t\treturn __( 'Font weight' );\n\t}\n\n\tif ( ! hasFontWeights ) {\n\t\treturn __( 'Font style' );\n\t}\n\n\treturn __( 'Appearance' );\n};\n\n/**\n * Control to display font style and weight options of the active font.\n *\n * @param {Object} props Component props.\n *\n * @return {Element} Font appearance control.\n */\nexport default function FontAppearanceControl( props ) {\n\tconst {\n\t\t/** Start opting into the larger default height that will become the default size in a future version. */\n\t\t__next40pxDefaultSize = false,\n\t\tonChange,\n\t\thasFontStyles = true,\n\t\thasFontWeights = true,\n\t\tfontFamilyFaces,\n\t\tvalue: { fontStyle, fontWeight },\n\t\t...otherProps\n\t} = props;\n\tconst hasStylesOrWeights = hasFontStyles || hasFontWeights;\n\tconst label = getFontAppearanceLabel( hasFontStyles, hasFontWeights );\n\tconst defaultOption = {\n\t\tkey: 'default',\n\t\tname: __( 'Default' ),\n\t\tstyle: { fontStyle: undefined, fontWeight: undefined },\n\t};\n\tconst { fontStyles, fontWeights, combinedStyleAndWeightOptions } =\n\t\tgetFontStylesAndWeights( fontFamilyFaces );\n\n\t// Generates select options for combined font styles and weights.\n\tconst combineOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tif ( combinedStyleAndWeightOptions ) {\n\t\t\tcombinedOptions.push( ...combinedStyleAndWeightOptions );\n\t\t}\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font styles only.\n\tconst styleOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tfontStyles.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: value, fontWeight: undefined },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font weights only.\n\tconst weightOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tfontWeights.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: undefined, fontWeight: value },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Map font styles and weights to select options.\n\tconst selectOptions = useMemo( () => {\n\t\t// Display combined available font style and weight options.\n\t\tif ( hasFontStyles && hasFontWeights ) {\n\t\t\treturn combineOptions();\n\t\t}\n\n\t\t// Display only font style options or font weight options.\n\t\treturn hasFontStyles ? styleOptions() : weightOptions();\n\t}, [\n\t\tprops.options,\n\t\tfontStyles,\n\t\tfontWeights,\n\t\tcombinedStyleAndWeightOptions,\n\t] );\n\n\t// Find current selection by comparing font style & weight against options,\n\t// and fall back to the Default option if there is no matching option.\n\tconst currentSelection =\n\t\tselectOptions.find(\n\t\t\t( option ) =>\n\t\t\t\toption.style.fontStyle === fontStyle &&\n\t\t\t\toption.style.fontWeight === fontWeight\n\t\t) || selectOptions[ 0 ];\n\n\t// Adjusts screen reader description based on styles or weights.\n\tconst getDescribedBy = () => {\n\t\tif ( ! currentSelection ) {\n\t\t\treturn __( 'No selected font appearance' );\n\t\t}\n\n\t\tif ( ! hasFontStyles ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font weight.\n\t\t\t\t__( 'Currently selected font weight: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\tif ( ! hasFontWeights ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font style.\n\t\t\t\t__( 'Currently selected font style: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\treturn sprintf(\n\t\t\t// translators: %s: Currently selected font appearance.\n\t\t\t__( 'Currently selected font appearance: %s' ),\n\t\t\tcurrentSelection.name\n\t\t);\n\t};\n\n\treturn (\n\t\thasStylesOrWeights && (\n\t\t\t<CustomSelectControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\tclassName=\"components-font-appearance-control\"\n\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\tlabel={ label }\n\t\t\t\tdescribedBy={ getDescribedBy() }\n\t\t\t\toptions={ selectOptions }\n\t\t\t\tvalue={ currentSelection }\n\t\t\t\tonChange={ ( { selectedItem } ) =>\n\t\t\t\t\tonChange( selectedItem.style )\n\t\t\t\t}\n\t\t\t/>\n\t\t)\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,wBAAA,GAAAH,OAAA;AAAkF,IAAAI,WAAA,GAAAJ,OAAA;AAVlF;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,MAAMK,sBAAsB,GAAGA,CAAEC,aAAa,EAAEC,cAAc,KAAM;EACnE,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAAE,QAAE,EAAE,aAAc,CAAC;EAC3B;EAEA,IAAK,CAAED,cAAc,EAAG;IACvB,OAAO,IAAAC,QAAE,EAAE,YAAa,CAAC;EAC1B;EAEA,OAAO,IAAAA,QAAE,EAAE,YAAa,CAAC;AAC1B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,qBAAqBA,CAAEC,KAAK,EAAG;EACtD,MAAM;IACL;IACAC,qBAAqB,GAAG,KAAK;IAC7BC,QAAQ;IACRN,aAAa,GAAG,IAAI;IACpBC,cAAc,GAAG,IAAI;IACrBM,eAAe;IACfC,KAAK,EAAE;MAAEC,SAAS;MAAEC;IAAW,CAAC;IAChC,GAAGC;EACJ,CAAC,GAAGP,KAAK;EACT,MAAMQ,kBAAkB,GAAGZ,aAAa,IAAIC,cAAc;EAC1D,MAAMY,KAAK,GAAGd,sBAAsB,CAAEC,aAAa,EAAEC,cAAe,CAAC;EACrE,MAAMa,aAAa,GAAG;IACrBC,GAAG,EAAE,SAAS;IACdC,IAAI,EAAE,IAAAd,QAAE,EAAE,SAAU,CAAC;IACrBe,KAAK,EAAE;MAAER,SAAS,EAAES,SAAS;MAAER,UAAU,EAAEQ;IAAU;EACtD,CAAC;EACD,MAAM;IAAEC,UAAU;IAAEC,WAAW;IAAEC;EAA8B,CAAC,GAC/D,IAAAC,gDAAuB,EAAEf,eAAgB,CAAC;;EAE3C;EACA,MAAMgB,cAAc,GAAGA,CAAA,KAAM;IAC5B,MAAMC,eAAe,GAAG,CAAEV,aAAa,CAAE;IACzC,IAAKO,6BAA6B,EAAG;MACpCG,eAAe,CAACC,IAAI,CAAE,GAAGJ,6BAA8B,CAAC;IACzD;IACA,OAAOG,eAAe;EACvB,CAAC;;EAED;EACA,MAAME,YAAY,GAAGA,CAAA,KAAM;IAC1B,MAAMF,eAAe,GAAG,CAAEV,aAAa,CAAE;IACzCK,UAAU,CAACQ,OAAO,CAAE,CAAE;MAAEX,IAAI;MAAER;IAAM,CAAC,KAAM;MAC1CgB,eAAe,CAACC,IAAI,CAAE;QACrBV,GAAG,EAAEP,KAAK;QACVQ,IAAI;QACJC,KAAK,EAAE;UAAER,SAAS,EAAED,KAAK;UAAEE,UAAU,EAAEQ;QAAU;MAClD,CAAE,CAAC;IACJ,CAAE,CAAC;IACH,OAAOM,eAAe;EACvB,CAAC;;EAED;EACA,MAAMI,aAAa,GAAGA,CAAA,KAAM;IAC3B,MAAMJ,eAAe,GAAG,CAAEV,aAAa,CAAE;IACzCM,WAAW,CAACO,OAAO,CAAE,CAAE;MAAEX,IAAI;MAAER;IAAM,CAAC,KAAM;MAC3CgB,eAAe,CAACC,IAAI,CAAE;QACrBV,GAAG,EAAEP,KAAK;QACVQ,IAAI;QACJC,KAAK,EAAE;UAAER,SAAS,EAAES,SAAS;UAAER,UAAU,EAAEF;QAAM;MAClD,CAAE,CAAC;IACJ,CAAE,CAAC;IACH,OAAOgB,eAAe;EACvB,CAAC;;EAED;EACA,MAAMK,aAAa,GAAG,IAAAC,gBAAO,EAAE,MAAM;IACpC;IACA,IAAK9B,aAAa,IAAIC,cAAc,EAAG;MACtC,OAAOsB,cAAc,CAAC,CAAC;IACxB;;IAEA;IACA,OAAOvB,aAAa,GAAG0B,YAAY,CAAC,CAAC,GAAGE,aAAa,CAAC,CAAC;EACxD,CAAC,EAAE,CACFxB,KAAK,CAAC2B,OAAO,EACbZ,UAAU,EACVC,WAAW,EACXC,6BAA6B,CAC5B,CAAC;;EAEH;EACA;EACA,MAAMW,gBAAgB,GACrBH,aAAa,CAACI,IAAI,CACfC,MAAM,IACPA,MAAM,CAACjB,KAAK,CAACR,SAAS,KAAKA,SAAS,IACpCyB,MAAM,CAACjB,KAAK,CAACP,UAAU,KAAKA,UAC9B,CAAC,IAAImB,aAAa,CAAE,CAAC,CAAE;;EAExB;EACA,MAAMM,cAAc,GAAGA,CAAA,KAAM;IAC5B,IAAK,CAAEH,gBAAgB,EAAG;MACzB,OAAO,IAAA9B,QAAE,EAAE,6BAA8B,CAAC;IAC3C;IAEA,IAAK,CAAEF,aAAa,EAAG;MACtB,OAAO,IAAAoC,aAAO;MACb;MACA,IAAAlC,QAAE,EAAE,oCAAqC,CAAC,EAC1C8B,gBAAgB,CAAChB,IAClB,CAAC;IACF;IAEA,IAAK,CAAEf,cAAc,EAAG;MACvB,OAAO,IAAAmC,aAAO;MACb;MACA,IAAAlC,QAAE,EAAE,mCAAoC,CAAC,EACzC8B,gBAAgB,CAAChB,IAClB,CAAC;IACF;IAEA,OAAO,IAAAoB,aAAO;IACb;IACA,IAAAlC,QAAE,EAAE,wCAAyC,CAAC,EAC9C8B,gBAAgB,CAAChB,IAClB,CAAC;EACF,CAAC;EAED,OACCJ,kBAAkB,iBACjB,IAAAd,WAAA,CAAAuC,GAAA,EAAC5C,WAAA,CAAA6C,mBAAmB;IAAA,GACd3B,UAAU;IACf4B,SAAS,EAAC,oCAAoC;IAC9ClC,qBAAqB,EAAGA,qBAAuB;IAC/CQ,KAAK,EAAGA,KAAO;IACf2B,WAAW,EAAGL,cAAc,CAAC,CAAG;IAChCJ,OAAO,EAAGF,aAAe;IACzBrB,KAAK,EAAGwB,gBAAkB;IAC1B1B,QAAQ,EAAGA,CAAE;MAAEmC;IAAa,CAAC,KAC5BnC,QAAQ,CAAEmC,YAAY,CAACxB,KAAM;EAC7B,CACD,CACD;AAEH","ignoreList":[]}
|
|
@@ -19,6 +19,8 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
function FontFamilyControl({
|
|
22
|
+
/** Start opting into the larger default height that will become the default size in a future version. */
|
|
23
|
+
__next40pxDefaultSize = false,
|
|
22
24
|
/** Start opting into the new margin-free styles that will become the default in a future version. */
|
|
23
25
|
__nextHasNoMarginBottom = false,
|
|
24
26
|
value = '',
|
|
@@ -53,6 +55,7 @@ function FontFamilyControl({
|
|
|
53
55
|
});
|
|
54
56
|
}
|
|
55
57
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectControl, {
|
|
58
|
+
__next40pxDefaultSize: __next40pxDefaultSize,
|
|
56
59
|
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
|
|
57
60
|
label: (0, _i18n.__)('Font'),
|
|
58
61
|
options: options,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_deprecated","_interopRequireDefault","_i18n","_useSettings","_jsxRuntime","FontFamilyControl","__nextHasNoMarginBottom","value","onChange","fontFamilies","props","blockLevelFontFamilies","useSettings","length","options","label","__","map","fontFamily","name","deprecated","since","version","hint","jsx","SelectControl","labelPosition"],"sources":["@wordpress/block-editor/src/components/font-family/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SelectControl } from '@wordpress/components';\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\n\nexport default function FontFamilyControl( {\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMarginBottom = false,\n\tvalue = '',\n\tonChange,\n\tfontFamilies,\n\t...props\n} ) {\n\tconst [ blockLevelFontFamilies ] = useSettings( 'typography.fontFamilies' );\n\tif ( ! fontFamilies ) {\n\t\tfontFamilies = blockLevelFontFamilies;\n\t}\n\n\tif ( ! fontFamilies || fontFamilies.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst options = [\n\t\t{ value: '', label: __( 'Default' ) },\n\t\t...fontFamilies.map( ( { fontFamily, name } ) => {\n\t\t\treturn {\n\t\t\t\tvalue: fontFamily,\n\t\t\t\tlabel: name || fontFamily,\n\t\t\t};\n\t\t} ),\n\t];\n\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\tdeprecated(\n\t\t\t'Bottom margin styles for wp.blockEditor.FontFamilyControl',\n\t\t\t{\n\t\t\t\tsince: '6.7',\n\t\t\t\tversion: '7.0',\n\t\t\t\thint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version',\n\t\t\t}\n\t\t);\n\t}\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\tlabel={ __( 'Font' ) }\n\t\t\toptions={ options }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tlabelPosition=\"top\"\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,YAAA,GAAAJ,OAAA;AAA8C,IAAAK,WAAA,GAAAL,OAAA;AAV9C;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASM,iBAAiBA,CAAE;EAC1C;EACAC,uBAAuB,GAAG,KAAK;EAC/BC,KAAK,GAAG,EAAE;EACVC,QAAQ;EACRC,YAAY;EACZ,GAAGC;AACJ,CAAC,EAAG;EACH,MAAM,CAAEC,sBAAsB,CAAE,GAAG,IAAAC,wBAAW,EAAE,yBAA0B,CAAC;EAC3E,IAAK,CAAEH,YAAY,EAAG;IACrBA,YAAY,GAAGE,sBAAsB;EACtC;EAEA,IAAK,CAAEF,YAAY,IAAIA,YAAY,CAACI,MAAM,KAAK,CAAC,EAAG;IAClD,OAAO,IAAI;EACZ;EAEA,MAAMC,OAAO,GAAG,CACf;IAAEP,KAAK,EAAE,EAAE;IAAEQ,KAAK,EAAE,IAAAC,QAAE,EAAE,SAAU;EAAE,CAAC,EACrC,GAAGP,YAAY,CAACQ,GAAG,CAAE,CAAE;IAAEC,UAAU;IAAEC;EAAK,CAAC,KAAM;IAChD,OAAO;MACNZ,KAAK,EAAEW,UAAU;MACjBH,KAAK,EAAEI,IAAI,IAAID;IAChB,CAAC;EACF,CAAE,CAAC,CACH;EAED,IAAK,CAAEZ,uBAAuB,EAAG;IAChC,IAAAc,mBAAU,EACT,2DAA2D,EAC3D;MACCC,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAAK;MACdC,IAAI,EAAE;IACP,CACD,CAAC;EACF;EAEA,oBACC,
|
|
1
|
+
{"version":3,"names":["_components","require","_deprecated","_interopRequireDefault","_i18n","_useSettings","_jsxRuntime","FontFamilyControl","__next40pxDefaultSize","__nextHasNoMarginBottom","value","onChange","fontFamilies","props","blockLevelFontFamilies","useSettings","length","options","label","__","map","fontFamily","name","deprecated","since","version","hint","jsx","SelectControl","labelPosition"],"sources":["@wordpress/block-editor/src/components/font-family/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SelectControl } from '@wordpress/components';\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\n\nexport default function FontFamilyControl( {\n\t/** Start opting into the larger default height that will become the default size in a future version. */\n\t__next40pxDefaultSize = false,\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMarginBottom = false,\n\tvalue = '',\n\tonChange,\n\tfontFamilies,\n\t...props\n} ) {\n\tconst [ blockLevelFontFamilies ] = useSettings( 'typography.fontFamilies' );\n\tif ( ! fontFamilies ) {\n\t\tfontFamilies = blockLevelFontFamilies;\n\t}\n\n\tif ( ! fontFamilies || fontFamilies.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst options = [\n\t\t{ value: '', label: __( 'Default' ) },\n\t\t...fontFamilies.map( ( { fontFamily, name } ) => {\n\t\t\treturn {\n\t\t\t\tvalue: fontFamily,\n\t\t\t\tlabel: name || fontFamily,\n\t\t\t};\n\t\t} ),\n\t];\n\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\tdeprecated(\n\t\t\t'Bottom margin styles for wp.blockEditor.FontFamilyControl',\n\t\t\t{\n\t\t\t\tsince: '6.7',\n\t\t\t\tversion: '7.0',\n\t\t\t\thint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version',\n\t\t\t}\n\t\t);\n\t}\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\tlabel={ __( 'Font' ) }\n\t\t\toptions={ options }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tlabelPosition=\"top\"\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,YAAA,GAAAJ,OAAA;AAA8C,IAAAK,WAAA,GAAAL,OAAA;AAV9C;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASM,iBAAiBA,CAAE;EAC1C;EACAC,qBAAqB,GAAG,KAAK;EAC7B;EACAC,uBAAuB,GAAG,KAAK;EAC/BC,KAAK,GAAG,EAAE;EACVC,QAAQ;EACRC,YAAY;EACZ,GAAGC;AACJ,CAAC,EAAG;EACH,MAAM,CAAEC,sBAAsB,CAAE,GAAG,IAAAC,wBAAW,EAAE,yBAA0B,CAAC;EAC3E,IAAK,CAAEH,YAAY,EAAG;IACrBA,YAAY,GAAGE,sBAAsB;EACtC;EAEA,IAAK,CAAEF,YAAY,IAAIA,YAAY,CAACI,MAAM,KAAK,CAAC,EAAG;IAClD,OAAO,IAAI;EACZ;EAEA,MAAMC,OAAO,GAAG,CACf;IAAEP,KAAK,EAAE,EAAE;IAAEQ,KAAK,EAAE,IAAAC,QAAE,EAAE,SAAU;EAAE,CAAC,EACrC,GAAGP,YAAY,CAACQ,GAAG,CAAE,CAAE;IAAEC,UAAU;IAAEC;EAAK,CAAC,KAAM;IAChD,OAAO;MACNZ,KAAK,EAAEW,UAAU;MACjBH,KAAK,EAAEI,IAAI,IAAID;IAChB,CAAC;EACF,CAAE,CAAC,CACH;EAED,IAAK,CAAEZ,uBAAuB,EAAG;IAChC,IAAAc,mBAAU,EACT,2DAA2D,EAC3D;MACCC,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAAK;MACdC,IAAI,EAAE;IACP,CACD,CAAC;EACF;EAEA,oBACC,IAAApB,WAAA,CAAAqB,GAAA,EAAC3B,WAAA,CAAA4B,aAAa;IACbpB,qBAAqB,EAAGA,qBAAuB;IAC/CC,uBAAuB,EAAGA,uBAAyB;IACnDS,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;IACtBF,OAAO,EAAGA,OAAS;IACnBP,KAAK,EAAGA,KAAO;IACfC,QAAQ,EAAGA,QAAU;IACrBkB,aAAa,EAAC,KAAK;IAAA,GACdhB;EAAK,CACV,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -22,7 +22,7 @@ var _utils = require("./utils");
|
|
|
22
22
|
var _object = require("../../utils/object");
|
|
23
23
|
var _mediaReplaceFlow = _interopRequireDefault(require("../media-replace-flow"));
|
|
24
24
|
var _store = require("../../store");
|
|
25
|
-
var
|
|
25
|
+
var _privateKeys = require("../../store/private-keys");
|
|
26
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
27
|
/**
|
|
28
28
|
* External dependencies
|
|
@@ -230,15 +230,25 @@ function BackgroundControlsPanel({
|
|
|
230
230
|
})
|
|
231
231
|
});
|
|
232
232
|
}
|
|
233
|
+
function LoadingSpinner() {
|
|
234
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Placeholder, {
|
|
235
|
+
className: "block-editor-global-styles-background-panel__loading",
|
|
236
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {})
|
|
237
|
+
});
|
|
238
|
+
}
|
|
233
239
|
function BackgroundImageControls({
|
|
234
240
|
onChange,
|
|
235
241
|
style,
|
|
236
242
|
inheritedValue,
|
|
237
243
|
onRemoveImage = noop,
|
|
244
|
+
onResetImage = noop,
|
|
238
245
|
displayInPanel,
|
|
239
|
-
|
|
246
|
+
defaultValues
|
|
240
247
|
}) {
|
|
241
|
-
const
|
|
248
|
+
const [isUploading, setIsUploading] = (0, _element.useState)(false);
|
|
249
|
+
const {
|
|
250
|
+
getSettings
|
|
251
|
+
} = (0, _data.useSelect)(_store.store);
|
|
242
252
|
const {
|
|
243
253
|
id,
|
|
244
254
|
title,
|
|
@@ -254,14 +264,17 @@ function BackgroundImageControls({
|
|
|
254
264
|
createErrorNotice(message, {
|
|
255
265
|
type: 'snackbar'
|
|
256
266
|
});
|
|
267
|
+
setIsUploading(false);
|
|
257
268
|
};
|
|
258
269
|
const resetBackgroundImage = () => onChange((0, _object.setImmutably)(style, ['background', 'backgroundImage'], undefined));
|
|
259
270
|
const onSelectMedia = media => {
|
|
260
271
|
if (!media || !media.url) {
|
|
261
272
|
resetBackgroundImage();
|
|
273
|
+
setIsUploading(false);
|
|
262
274
|
return;
|
|
263
275
|
}
|
|
264
276
|
if ((0, _blob.isBlobURL)(media.url)) {
|
|
277
|
+
setIsUploading(true);
|
|
265
278
|
return;
|
|
266
279
|
}
|
|
267
280
|
|
|
@@ -270,8 +283,8 @@ function BackgroundImageControls({
|
|
|
270
283
|
onUploadError((0, _i18n.__)('Only images can be used as a background image.'));
|
|
271
284
|
return;
|
|
272
285
|
}
|
|
273
|
-
const sizeValue = style?.background?.backgroundSize ||
|
|
274
|
-
const positionValue = style?.background?.backgroundPosition
|
|
286
|
+
const sizeValue = style?.background?.backgroundSize || defaultValues?.backgroundSize;
|
|
287
|
+
const positionValue = style?.background?.backgroundPosition;
|
|
275
288
|
onChange((0, _object.setImmutably)(style, ['background'], {
|
|
276
289
|
...style?.background,
|
|
277
290
|
backgroundImage: {
|
|
@@ -280,18 +293,29 @@ function BackgroundImageControls({
|
|
|
280
293
|
source: 'file',
|
|
281
294
|
title: media.title || undefined
|
|
282
295
|
},
|
|
283
|
-
backgroundPosition:
|
|
296
|
+
backgroundPosition:
|
|
297
|
+
/*
|
|
298
|
+
* A background image uploaded and set in the editor receives a default background position of '50% 0',
|
|
299
|
+
* when the background image size is the equivalent of "Tile".
|
|
300
|
+
* This is to increase the chance that the image's focus point is visible.
|
|
301
|
+
* This is in-editor only to assist with the user experience.
|
|
302
|
+
*/
|
|
303
|
+
!positionValue && ('auto' === sizeValue || !sizeValue) ? '50% 0' : positionValue,
|
|
284
304
|
backgroundSize: sizeValue
|
|
285
305
|
}));
|
|
306
|
+
setIsUploading(false);
|
|
286
307
|
};
|
|
308
|
+
|
|
309
|
+
// Drag and drop callback, restricting image to one.
|
|
287
310
|
const onFilesDrop = filesList => {
|
|
288
|
-
|
|
311
|
+
if (filesList?.length > 1) {
|
|
312
|
+
onUploadError((0, _i18n.__)('Only one image can be used as a background image.'));
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
getSettings().mediaUpload({
|
|
289
316
|
allowedTypes: [IMAGE_BACKGROUND_TYPE],
|
|
290
317
|
filesList,
|
|
291
318
|
onFileChange([image]) {
|
|
292
|
-
if ((0, _blob.isBlobURL)(image?.url)) {
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
319
|
onSelectMedia(image);
|
|
296
320
|
},
|
|
297
321
|
onError: onUploadError
|
|
@@ -306,13 +330,15 @@ function BackgroundImageControls({
|
|
|
306
330
|
toggleButton?.focus();
|
|
307
331
|
toggleButton?.click();
|
|
308
332
|
};
|
|
309
|
-
const onRemove = () => onChange((0, _object.setImmutably)(style, ['background'
|
|
333
|
+
const onRemove = () => onChange((0, _object.setImmutably)(style, ['background'], {
|
|
334
|
+
backgroundImage: 'none'
|
|
335
|
+
}));
|
|
310
336
|
const canRemove = !hasValue && hasBackgroundImageValue(inheritedValue);
|
|
311
337
|
const imgLabel = title || (0, _url.getFilename)(url) || (0, _i18n.__)('Add background image');
|
|
312
338
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
313
339
|
ref: replaceContainerRef,
|
|
314
340
|
className: "block-editor-global-styles-background-panel__image-tools-panel-item",
|
|
315
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
341
|
+
children: [isUploading && /*#__PURE__*/(0, _jsxRuntime.jsx)(LoadingSpinner, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_mediaReplaceFlow.default, {
|
|
316
342
|
mediaId: id,
|
|
317
343
|
mediaURL: url,
|
|
318
344
|
allowedTypes: [IMAGE_BACKGROUND_TYPE],
|
|
@@ -325,24 +351,24 @@ function BackgroundImageControls({
|
|
|
325
351
|
},
|
|
326
352
|
name: /*#__PURE__*/(0, _jsxRuntime.jsx)(InspectorImagePreviewItem, {
|
|
327
353
|
className: "block-editor-global-styles-background-panel__image-preview",
|
|
328
|
-
imgUrl:
|
|
354
|
+
imgUrl: url,
|
|
329
355
|
filename: title,
|
|
330
356
|
label: imgLabel
|
|
331
357
|
}),
|
|
332
358
|
variant: "secondary",
|
|
333
|
-
|
|
359
|
+
onError: onUploadError,
|
|
360
|
+
onReset: () => {
|
|
361
|
+
closeAndFocus();
|
|
362
|
+
onResetImage();
|
|
363
|
+
},
|
|
364
|
+
children: canRemove && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
|
|
334
365
|
onClick: () => {
|
|
335
366
|
closeAndFocus();
|
|
336
367
|
onRemove();
|
|
337
|
-
},
|
|
338
|
-
children: (0, _i18n.__)('Remove')
|
|
339
|
-
}), hasValue && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
|
|
340
|
-
onClick: () => {
|
|
341
|
-
closeAndFocus();
|
|
342
368
|
onRemoveImage();
|
|
343
369
|
},
|
|
344
|
-
children: (0, _i18n.__)('
|
|
345
|
-
})
|
|
370
|
+
children: (0, _i18n.__)('Remove')
|
|
371
|
+
})
|
|
346
372
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropZone, {
|
|
347
373
|
onFilesDrop: onFilesDrop,
|
|
348
374
|
label: (0, _i18n.__)('Drop to upload')
|
|
@@ -353,13 +379,12 @@ function BackgroundSizeControls({
|
|
|
353
379
|
onChange,
|
|
354
380
|
style,
|
|
355
381
|
inheritedValue,
|
|
356
|
-
defaultValues
|
|
357
|
-
themeFileURIs
|
|
382
|
+
defaultValues
|
|
358
383
|
}) {
|
|
359
384
|
const sizeValue = style?.background?.backgroundSize || inheritedValue?.background?.backgroundSize;
|
|
360
385
|
const repeatValue = style?.background?.backgroundRepeat || inheritedValue?.background?.backgroundRepeat;
|
|
361
386
|
const imageValue = style?.background?.backgroundImage?.url || inheritedValue?.background?.backgroundImage?.url;
|
|
362
|
-
const isUploadedImage = style?.background?.backgroundImage?.id
|
|
387
|
+
const isUploadedImage = style?.background?.backgroundImage?.id;
|
|
363
388
|
const positionValue = style?.background?.backgroundPosition || inheritedValue?.background?.backgroundPosition;
|
|
364
389
|
const attachmentValue = style?.background?.backgroundAttachment || inheritedValue?.background?.backgroundAttachment;
|
|
365
390
|
|
|
@@ -369,8 +394,12 @@ function BackgroundSizeControls({
|
|
|
369
394
|
* Block-level controls may have different defaults to root-level controls.
|
|
370
395
|
* A falsy value is treated by default as `auto` (Tile).
|
|
371
396
|
*/
|
|
372
|
-
|
|
373
|
-
|
|
397
|
+
let currentValueForToggle = !sizeValue && isUploadedImage ? defaultValues?.backgroundSize : sizeValue || 'auto';
|
|
398
|
+
/*
|
|
399
|
+
* The incoming value could be a value + unit, e.g. '20px'.
|
|
400
|
+
* In this case set the value to 'tile'.
|
|
401
|
+
*/
|
|
402
|
+
currentValueForToggle = !['cover', 'contain', 'auto'].includes(currentValueForToggle) ? 'auto' : currentValueForToggle;
|
|
374
403
|
/*
|
|
375
404
|
* If the current value is `cover` and the repeat value is `undefined`, then
|
|
376
405
|
* the toggle should be unchecked as the default state. Otherwise, the toggle
|
|
@@ -396,6 +425,7 @@ function BackgroundSizeControls({
|
|
|
396
425
|
* receives a default background position of '50% 0',
|
|
397
426
|
* when the toggle switches to "Tile". This is to increase the chance that
|
|
398
427
|
* the image's focus point is visible.
|
|
428
|
+
* This is in-editor only to assist with the user experience.
|
|
399
429
|
*/
|
|
400
430
|
if (!!style?.background?.backgroundImage?.id) {
|
|
401
431
|
nextPosition = '50% 0';
|
|
@@ -421,22 +451,23 @@ function BackgroundSizeControls({
|
|
|
421
451
|
};
|
|
422
452
|
const toggleIsRepeated = () => onChange((0, _object.setImmutably)(style, ['background', 'backgroundRepeat'], repeatCheckedValue === true ? 'no-repeat' : 'repeat'));
|
|
423
453
|
const toggleScrollWithPage = () => onChange((0, _object.setImmutably)(style, ['background', 'backgroundAttachment'], attachmentValue === 'fixed' ? 'scroll' : 'fixed'));
|
|
454
|
+
|
|
455
|
+
// Set a default background position for non-site-wide, uploaded images with a size of 'contain'.
|
|
456
|
+
const backgroundPositionValue = !positionValue && isUploadedImage && 'contain' === sizeValue ? defaultValues?.backgroundPosition : positionValue;
|
|
424
457
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
425
|
-
spacing:
|
|
458
|
+
spacing: 3,
|
|
426
459
|
className: "single-column",
|
|
427
460
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FocalPointPicker, {
|
|
428
|
-
__next40pxDefaultSize: true,
|
|
429
461
|
__nextHasNoMarginBottom: true,
|
|
430
462
|
label: (0, _i18n.__)('Focal point'),
|
|
431
|
-
url:
|
|
432
|
-
value: backgroundPositionToCoords(
|
|
463
|
+
url: imageValue,
|
|
464
|
+
value: backgroundPositionToCoords(backgroundPositionValue),
|
|
433
465
|
onChange: updateBackgroundPosition
|
|
434
466
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
|
|
435
467
|
__nextHasNoMarginBottom: true,
|
|
436
468
|
label: (0, _i18n.__)('Fixed background'),
|
|
437
469
|
checked: attachmentValue === 'fixed',
|
|
438
|
-
onChange: toggleScrollWithPage
|
|
439
|
-
help: (0, _i18n.__)('Whether your image should scroll with the page or stay fixed in place.')
|
|
470
|
+
onChange: toggleScrollWithPage
|
|
440
471
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalToggleGroupControl, {
|
|
441
472
|
__nextHasNoMarginBottom: true,
|
|
442
473
|
size: "__unstable-large",
|
|
@@ -491,9 +522,7 @@ function BackgroundToolsPanel({
|
|
|
491
522
|
const updatedValue = resetAllFilter(value);
|
|
492
523
|
onChange(updatedValue);
|
|
493
524
|
};
|
|
494
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.
|
|
495
|
-
as: _components.__experimentalToolsPanel,
|
|
496
|
-
spacing: 4,
|
|
525
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanel, {
|
|
497
526
|
label: headerLabel,
|
|
498
527
|
resetAll: resetAll,
|
|
499
528
|
panelId: panelId,
|
|
@@ -510,9 +539,42 @@ function BackgroundPanel({
|
|
|
510
539
|
panelId,
|
|
511
540
|
defaultControls = DEFAULT_CONTROLS,
|
|
512
541
|
defaultValues = {},
|
|
513
|
-
headerLabel = (0, _i18n.__)('Background image')
|
|
514
|
-
themeFileURIs
|
|
542
|
+
headerLabel = (0, _i18n.__)('Background image')
|
|
515
543
|
}) {
|
|
544
|
+
/*
|
|
545
|
+
* Resolve any inherited "ref" pointers.
|
|
546
|
+
* Should the block editor need resolved, inherited values
|
|
547
|
+
* across all controls, this could be abstracted into a hook,
|
|
548
|
+
* e.g., useResolveGlobalStyle
|
|
549
|
+
*/
|
|
550
|
+
const {
|
|
551
|
+
globalStyles,
|
|
552
|
+
_links
|
|
553
|
+
} = (0, _data.useSelect)(select => {
|
|
554
|
+
const {
|
|
555
|
+
getSettings
|
|
556
|
+
} = select(_store.store);
|
|
557
|
+
const _settings = getSettings();
|
|
558
|
+
return {
|
|
559
|
+
globalStyles: _settings[_privateKeys.globalStylesDataKey],
|
|
560
|
+
_links: _settings[_privateKeys.globalStylesLinksDataKey]
|
|
561
|
+
};
|
|
562
|
+
}, []);
|
|
563
|
+
const resolvedInheritedValue = (0, _element.useMemo)(() => {
|
|
564
|
+
const resolvedValues = {
|
|
565
|
+
background: {}
|
|
566
|
+
};
|
|
567
|
+
if (!inheritedValue?.background) {
|
|
568
|
+
return inheritedValue;
|
|
569
|
+
}
|
|
570
|
+
Object.entries(inheritedValue?.background).forEach(([key, backgroundValue]) => {
|
|
571
|
+
resolvedValues.background[key] = (0, _utils.getResolvedValue)(backgroundValue, {
|
|
572
|
+
styles: globalStyles,
|
|
573
|
+
_links
|
|
574
|
+
});
|
|
575
|
+
});
|
|
576
|
+
return resolvedValues;
|
|
577
|
+
}, [globalStyles, _links, inheritedValue]);
|
|
516
578
|
const resetAllFilter = (0, _element.useCallback)(previousValue => {
|
|
517
579
|
return {
|
|
518
580
|
...previousValue,
|
|
@@ -524,10 +586,11 @@ function BackgroundPanel({
|
|
|
524
586
|
title,
|
|
525
587
|
url
|
|
526
588
|
} = value?.background?.backgroundImage || {
|
|
527
|
-
...
|
|
589
|
+
...resolvedInheritedValue?.background?.backgroundImage
|
|
528
590
|
};
|
|
529
|
-
const hasImageValue = hasBackgroundImageValue(value) || hasBackgroundImageValue(
|
|
530
|
-
const
|
|
591
|
+
const hasImageValue = hasBackgroundImageValue(value) || hasBackgroundImageValue(resolvedInheritedValue);
|
|
592
|
+
const imageValue = value?.background?.backgroundImage || inheritedValue?.background?.backgroundImage;
|
|
593
|
+
const shouldShowBackgroundImageControls = hasImageValue && 'none' !== imageValue && (settings?.background?.backgroundSize || settings?.background?.backgroundPosition || settings?.background?.backgroundRepeat);
|
|
531
594
|
const [isDropDownOpen, setIsDropDownOpen] = (0, _element.useState)(false);
|
|
532
595
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapper, {
|
|
533
596
|
resetAllFilter: resetAllFilter,
|
|
@@ -540,7 +603,7 @@ function BackgroundPanel({
|
|
|
540
603
|
'is-open': isDropDownOpen
|
|
541
604
|
}),
|
|
542
605
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
543
|
-
hasValue: () =>
|
|
606
|
+
hasValue: () => !!value?.background,
|
|
544
607
|
label: (0, _i18n.__)('Image'),
|
|
545
608
|
onDeselect: resetBackground,
|
|
546
609
|
isShownByDefault: defaultControls.backgroundImage,
|
|
@@ -548,7 +611,7 @@ function BackgroundPanel({
|
|
|
548
611
|
children: shouldShowBackgroundImageControls ? /*#__PURE__*/(0, _jsxRuntime.jsx)(BackgroundControlsPanel, {
|
|
549
612
|
label: title,
|
|
550
613
|
filename: title,
|
|
551
|
-
url:
|
|
614
|
+
url: url,
|
|
552
615
|
onToggle: setIsDropDownOpen,
|
|
553
616
|
hasImageValue: hasImageValue,
|
|
554
617
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
@@ -557,27 +620,32 @@ function BackgroundPanel({
|
|
|
557
620
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(BackgroundImageControls, {
|
|
558
621
|
onChange: onChange,
|
|
559
622
|
style: value,
|
|
560
|
-
inheritedValue:
|
|
561
|
-
themeFileURIs: themeFileURIs,
|
|
623
|
+
inheritedValue: resolvedInheritedValue,
|
|
562
624
|
displayInPanel: true,
|
|
563
|
-
|
|
625
|
+
onResetImage: () => {
|
|
564
626
|
setIsDropDownOpen(false);
|
|
565
627
|
resetBackground();
|
|
566
|
-
}
|
|
628
|
+
},
|
|
629
|
+
onRemoveImage: () => setIsDropDownOpen(false),
|
|
630
|
+
defaultValues: defaultValues
|
|
567
631
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(BackgroundSizeControls, {
|
|
568
632
|
onChange: onChange,
|
|
569
633
|
panelId: panelId,
|
|
570
634
|
style: value,
|
|
571
635
|
defaultValues: defaultValues,
|
|
572
|
-
inheritedValue:
|
|
573
|
-
themeFileURIs: themeFileURIs
|
|
636
|
+
inheritedValue: resolvedInheritedValue
|
|
574
637
|
})]
|
|
575
638
|
})
|
|
576
639
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(BackgroundImageControls, {
|
|
577
640
|
onChange: onChange,
|
|
578
641
|
style: value,
|
|
579
|
-
inheritedValue:
|
|
580
|
-
|
|
642
|
+
inheritedValue: resolvedInheritedValue,
|
|
643
|
+
defaultValues: defaultValues,
|
|
644
|
+
onResetImage: () => {
|
|
645
|
+
setIsDropDownOpen(false);
|
|
646
|
+
resetBackground();
|
|
647
|
+
},
|
|
648
|
+
onRemoveImage: () => setIsDropDownOpen(false)
|
|
581
649
|
})
|
|
582
650
|
})
|
|
583
651
|
})
|