@wordpress/block-editor 12.3.0 → 12.3.2
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 +10 -0
- package/README.md +13 -0
- package/build/autocompleters/block.js +5 -3
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/alignment-control/index.js +4 -6
- package/build/components/alignment-control/index.js.map +1 -1
- package/build/components/alignment-control/ui.js +5 -9
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/autocomplete/index.js +2 -4
- package/build/components/autocomplete/index.js.map +1 -1
- package/build/components/block-actions/index.js +4 -0
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/constants.js +1 -5
- package/build/components/block-alignment-control/constants.js.map +1 -1
- package/build/components/block-alignment-control/index.js +4 -6
- package/build/components/block-alignment-control/index.js.map +1 -1
- package/build/components/block-alignment-control/ui.js +3 -4
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.native.js +3 -3
- package/build/components/block-alignment-control/ui.native.js.map +1 -1
- package/build/components/block-alignment-matrix-control/index.js +0 -1
- package/build/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build/components/block-breadcrumb/index.js +2 -3
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-controls/fill.js +2 -1
- package/build/components/block-controls/fill.js.map +1 -1
- package/build/components/block-controls/index.js +8 -8
- package/build/components/block-controls/index.js.map +1 -1
- package/build/components/block-controls/slot.js +2 -4
- package/build/components/block-controls/slot.js.map +1 -1
- package/build/components/block-controls/slot.native.js +4 -2
- package/build/components/block-controls/slot.native.js.map +1 -1
- package/build/components/block-edit/edit.js +4 -6
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-edit/edit.native.js +2 -4
- package/build/components/block-edit/edit.native.js.map +1 -1
- package/build/components/block-edit/index.js +3 -2
- package/build/components/block-edit/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/heading-level-icon.js +47 -0
- package/build/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -0
- package/build/components/block-heading-level-dropdown/index.js +83 -0
- package/build/components/block-heading-level-dropdown/index.js.map +1 -0
- package/build/components/block-heading-level-dropdown/index.native.js +72 -0
- package/build/components/block-heading-level-dropdown/index.native.js.map +1 -0
- package/build/components/block-icon/index.native.js +6 -7
- package/build/components/block-icon/index.native.js.map +1 -1
- package/build/components/block-info-slot-fill/index.js +4 -2
- package/build/components/block-info-slot-fill/index.js.map +1 -1
- package/build/components/block-inspector/index.js +20 -87
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js +4 -2
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block.js +6 -4
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +1 -0
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +7 -4
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/index.native.js +8 -9
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/subdirectory-icon.js +4 -7
- package/build/components/block-list/subdirectory-icon.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +1 -3
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list-appender/index.js +21 -19
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-lock/toolbar.js +25 -6
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-mover/button.js +12 -12
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +11 -10
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +4 -6
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-parent-selector/index.js +4 -5
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +6 -8
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +6 -8
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-popover/inbetween.js +4 -6
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +4 -6
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/auto.js +2 -4
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +7 -7
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-quick-navigation/index.js +83 -0
- package/build/components/block-quick-navigation/index.js.map +1 -0
- package/build/components/block-removal-warning-modal/index.js +90 -0
- package/build/components/block-removal-warning-modal/index.js.map +1 -0
- package/build/components/block-selection-clearer/index.js +4 -7
- package/build/components/block-selection-clearer/index.js.map +1 -1
- package/build/components/block-settings/button.native.js +2 -1
- package/build/components/block-settings/button.native.js.map +1 -1
- package/build/components/block-settings/container.native.js +6 -6
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +10 -11
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu/index.js +4 -5
- package/build/components/block-settings-menu/index.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +4 -5
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/index.js +1 -2
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +6 -8
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-toolbar/index.js +10 -8
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +4 -5
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +4 -5
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +13 -6
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +5 -5
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +8 -8
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-types-list/index.native.js +4 -6
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/block-vertical-alignment-control/index.js +4 -6
- package/build/components/block-vertical-alignment-control/index.js.map +1 -1
- package/build/components/block-vertical-alignment-control/ui.js +5 -12
- package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build/components/border-radius-control/all-input-control.js +2 -6
- package/build/components/border-radius-control/all-input-control.js.map +1 -1
- package/build/components/border-radius-control/input-controls.js +2 -6
- package/build/components/border-radius-control/input-controls.js.map +1 -1
- package/build/components/border-radius-control/linked-button.js +2 -6
- package/build/components/border-radius-control/linked-button.js.map +1 -1
- package/build/components/color-palette/control.js +2 -4
- package/build/components/color-palette/control.js.map +1 -1
- package/build/components/color-palette/with-color-context.js +2 -4
- package/build/components/color-palette/with-color-context.js.map +1 -1
- package/build/components/colors/utils.js +7 -3
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors/with-colors.js +11 -16
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/colors-gradients/control.js +7 -5
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +12 -11
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +7 -5
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/copy-handler/index.js +5 -6
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/dimensions-tool/aspect-ratio-tool.js +99 -0
- package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
- package/build/components/dimensions-tool/index.js +207 -0
- package/build/components/dimensions-tool/index.js.map +1 -0
- package/build/components/dimensions-tool/scale-tool.js +111 -0
- package/build/components/dimensions-tool/scale-tool.js.map +1 -0
- package/build/components/dimensions-tool/width-height-tool.js +125 -0
- package/build/components/dimensions-tool/width-height-tool.js.map +1 -0
- package/build/components/duotone-control/index.js +1 -2
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/editable-text/index.js +6 -7
- package/build/components/editable-text/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +2 -6
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/font-family/index.js +4 -5
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/font-sizes/font-size-picker.js +2 -4
- package/build/components/font-sizes/font-size-picker.js.map +1 -1
- package/build/components/font-sizes/utils.js +3 -3
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js +7 -7
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/global-styles/color-panel.js +15 -16
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/effects-panel.js +2 -1
- package/build/components/global-styles/effects-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +2 -1
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/index.js +6 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +7 -7
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +19 -16
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/gradients/with-gradient.js +2 -6
- package/build/components/gradients/with-gradient.js.map +1 -1
- package/build/components/iframe/index.js +5 -7
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build/components/image-editor/constants.js +1 -2
- package/build/components/image-editor/constants.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +1 -2
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-size-control/index.js +6 -0
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.js +9 -9
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +9 -0
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/index.js +9 -8
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +8 -7
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +24 -30
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inner-blocks/with-client-id.js +2 -6
- package/build/components/inner-blocks/with-client-id.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/explorer.js +2 -1
- package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +33 -5
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +4 -3
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/index.js +8 -8
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +4 -5
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/library.js +1 -1
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/media-tab/media-list.js +2 -6
- package/build/components/inserter/media-tab/media-list.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +4 -6
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/media-tab/media-tab.js +1 -1
- package/build/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.js +3 -3
- package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build/components/inserter/tabs.js +3 -3
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inserter-list-item/index.js +4 -5
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/inserter-listbox/group.js +4 -7
- package/build/components/inserter-listbox/group.js.map +1 -1
- package/build/components/inserter-listbox/item.js +8 -7
- package/build/components/inserter-listbox/item.js.map +1 -1
- package/build/components/inserter-listbox/row.js +4 -5
- package/build/components/inserter-listbox/row.js.map +1 -1
- package/build/components/inspector-controls/block-support-slot-container.js +2 -6
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +2 -1
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/index.js +4 -6
- package/build/components/inspector-controls/index.js.map +1 -1
- package/build/components/inspector-controls/slot.js +4 -6
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls/slot.native.js +2 -1
- package/build/components/inspector-controls/slot.native.js.map +1 -1
- package/build/components/justify-content-control/index.js +4 -6
- package/build/components/justify-content-control/index.js.map +1 -1
- package/build/components/justify-content-control/ui.js +4 -7
- package/build/components/justify-content-control/ui.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +2 -4
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/line-height-control/index.js +2 -4
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/index.js +20 -24
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-create-button.js +2 -4
- package/build/components/link-control/search-create-button.js.map +1 -1
- package/build/components/link-control/search-input.js +7 -5
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/search-item.js +2 -4
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/link-control/search-results.js +2 -4
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +2 -3
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/list-view/appender.js +4 -6
- package/build/components/list-view/appender.js.map +1 -1
- package/build/components/list-view/aria-referenced-text.js +4 -8
- package/build/components/list-view/aria-referenced-text.js.map +1 -1
- package/build/components/list-view/block-contents.js +4 -5
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block-select-button.js +13 -2
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/branch.js +9 -8
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/drop-indicator.js +62 -11
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js +4 -6
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/leaf.js +4 -5
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +2 -22
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +46 -34
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/media-placeholder/index.js +38 -13
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +1 -3
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +8 -8
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/panel-color-settings/index.js +4 -5
- package/build/components/panel-color-settings/index.js.map +1 -1
- package/build/components/plain-text/index.js +8 -8
- package/build/components/plain-text/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +7 -6
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +5 -4
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/provider/index.js +2 -4
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +21 -0
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/provider/with-registry-provider.js +8 -10
- package/build/components/provider/with-registry-provider.js.map +1 -1
- package/build/components/publish-date-time-picker/index.js +4 -5
- package/build/components/publish-date-time-picker/index.js.map +1 -1
- package/build/components/resizable-box-popover/index.js +5 -5
- package/build/components/resizable-box-popover/index.js.map +1 -1
- package/build/components/resolution-tool/index.js +55 -0
- package/build/components/resolution-tool/index.js.map +1 -0
- package/build/components/rich-text/content.js +99 -0
- package/build/components/rich-text/content.js.map +1 -0
- package/build/components/rich-text/format-toolbar/index.js +1 -2
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +8 -42
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +6 -34
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/toolbar-button.js +2 -6
- package/build/components/rich-text/toolbar-button.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +8 -8
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/tool-selector/index.js +2 -6
- package/build/components/tool-selector/index.js.map +1 -1
- package/build/components/unit-control/index.js +4 -5
- package/build/components/unit-control/index.js.map +1 -1
- package/build/components/url-input/index.js +12 -10
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-input/index.native.js +4 -7
- package/build/components/url-input/index.native.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +21 -14
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/url-popover/index.js +4 -5
- package/build/components/url-popover/index.js.map +1 -1
- package/build/components/url-popover/link-editor.js +4 -5
- package/build/components/url-popover/link-editor.js.map +1 -1
- package/build/components/url-popover/link-viewer.js +4 -5
- package/build/components/url-popover/link-viewer.js.map +1 -1
- package/build/components/use-block-display-information/index.js +30 -2
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/video-player/index.native.js +2 -4
- package/build/components/video-player/index.native.js.map +1 -1
- package/build/components/warning/index.native.js +4 -5
- package/build/components/warning/index.native.js.map +1 -1
- package/build/components/writing-flow/index.js +2 -4
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-drag-selection.js +1 -1
- package/build/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +32 -4
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js +8 -8
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/anchor.js +4 -2
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/behaviors.js +75 -37
- package/build/hooks/behaviors.js.map +1 -1
- package/build/hooks/border.js +4 -5
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +4 -5
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +8 -10
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/custom-class-name.js +4 -2
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/dimensions.js +7 -7
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +5 -5
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-family.js +2 -6
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +10 -8
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/layout.js +30 -28
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +24 -16
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +8 -5
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/supports.js +1 -1
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.native.js +3 -1
- package/build/hooks/typography.native.js.map +1 -1
- package/build/hooks/use-typography-props.js +10 -17
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/index.js +0 -14
- package/build/index.js.map +1 -1
- package/build/layouts/constrained.js +3 -1
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/definitions.js +154 -0
- package/build/layouts/definitions.js.map +1 -0
- package/build/layouts/flex.js +8 -5
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +3 -1
- package/build/layouts/flow.js.map +1 -1
- package/build/layouts/grid.js +3 -1
- package/build/layouts/grid.js.map +1 -1
- package/build/layouts/utils.js +8 -2
- package/build/layouts/utils.js.map +1 -1
- package/build/private-apis.js +23 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +2 -62
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +1 -0
- package/build/store/defaults.js.map +1 -1
- package/build/store/private-actions.js +200 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +72 -4
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +52 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +42 -42
- package/build/store/selectors.js.map +1 -1
- package/build/utils/object.js +39 -0
- package/build/utils/object.js.map +1 -1
- package/build-module/autocompleters/block.js +5 -3
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/components/alignment-control/index.js +4 -5
- package/build-module/components/alignment-control/index.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +5 -6
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/autocomplete/index.js +2 -3
- package/build-module/components/autocomplete/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +4 -0
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/constants.js +0 -3
- package/build-module/components/block-alignment-control/constants.js.map +1 -1
- package/build-module/components/block-alignment-control/index.js +4 -5
- package/build-module/components/block-alignment-control/index.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +4 -4
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.native.js +3 -2
- package/build-module/components/block-alignment-control/ui.native.js.map +1 -1
- package/build-module/components/block-alignment-matrix-control/index.js +0 -1
- package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +2 -3
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-controls/fill.js +2 -1
- package/build-module/components/block-controls/fill.js.map +1 -1
- package/build-module/components/block-controls/index.js +8 -7
- package/build-module/components/block-controls/index.js.map +1 -1
- package/build-module/components/block-controls/slot.js +2 -3
- package/build-module/components/block-controls/slot.js.map +1 -1
- package/build-module/components/block-controls/slot.native.js +4 -2
- package/build-module/components/block-controls/slot.native.js.map +1 -1
- package/build-module/components/block-edit/edit.js +4 -5
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-edit/edit.native.js +2 -3
- package/build-module/components/block-edit/edit.native.js.map +1 -1
- package/build-module/components/block-edit/index.js +3 -2
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/heading-level-icon.js +39 -0
- package/build-module/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -0
- package/build-module/components/block-heading-level-dropdown/index.js +71 -0
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -0
- package/build-module/components/block-heading-level-dropdown/index.native.js +60 -0
- package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -0
- package/build-module/components/block-icon/index.native.js +6 -6
- package/build-module/components/block-icon/index.native.js.map +1 -1
- package/build-module/components/block-info-slot-fill/index.js +4 -2
- package/build-module/components/block-info-slot-fill/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +20 -88
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +4 -2
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block.js +6 -4
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +1 -0
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +7 -4
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/index.native.js +8 -8
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/subdirectory-icon.js +4 -4
- package/build-module/components/block-list/subdirectory-icon.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +1 -3
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +21 -19
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +25 -7
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mover/button.js +12 -11
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +11 -9
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +4 -5
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +4 -4
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +6 -7
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +6 -7
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +4 -5
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +4 -5
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +2 -3
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +7 -7
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-quick-navigation/index.js +69 -0
- package/build-module/components/block-quick-navigation/index.js.map +1 -0
- package/build-module/components/block-removal-warning-modal/index.js +76 -0
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -0
- package/build-module/components/block-selection-clearer/index.js +4 -4
- package/build-module/components/block-selection-clearer/index.js.map +1 -1
- package/build-module/components/block-settings/button.native.js +2 -1
- package/build-module/components/block-settings/button.native.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +6 -5
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +10 -10
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu/index.js +4 -4
- package/build-module/components/block-settings-menu/index.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +4 -4
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +1 -2
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +6 -7
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +10 -7
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +4 -4
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +4 -4
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +13 -5
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +5 -4
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +8 -7
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +4 -5
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/block-vertical-alignment-control/index.js +4 -5
- package/build-module/components/block-vertical-alignment-control/index.js.map +1 -1
- package/build-module/components/block-vertical-alignment-control/ui.js +5 -9
- package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build-module/components/border-radius-control/all-input-control.js +2 -3
- package/build-module/components/border-radius-control/all-input-control.js.map +1 -1
- package/build-module/components/border-radius-control/input-controls.js +2 -3
- package/build-module/components/border-radius-control/input-controls.js.map +1 -1
- package/build-module/components/border-radius-control/linked-button.js +2 -3
- package/build-module/components/border-radius-control/linked-button.js.map +1 -1
- package/build-module/components/color-palette/control.js +2 -3
- package/build-module/components/color-palette/control.js.map +1 -1
- package/build-module/components/color-palette/with-color-context.js +2 -3
- package/build-module/components/color-palette/with-color-context.js.map +1 -1
- package/build-module/components/colors/utils.js +5 -1
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors/with-colors.js +10 -14
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +7 -4
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +12 -10
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +7 -4
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/copy-handler/index.js +5 -6
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/dimensions-tool/aspect-ratio-tool.js +87 -0
- package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
- package/build-module/components/dimensions-tool/index.js +195 -0
- package/build-module/components/dimensions-tool/index.js.map +1 -0
- package/build-module/components/dimensions-tool/scale-tool.js +103 -0
- package/build-module/components/dimensions-tool/scale-tool.js.map +1 -0
- package/build-module/components/dimensions-tool/width-height-tool.js +122 -0
- package/build-module/components/dimensions-tool/width-height-tool.js.map +1 -0
- package/build-module/components/duotone-control/index.js +1 -2
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/editable-text/index.js +6 -6
- package/build-module/components/editable-text/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +2 -3
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/font-family/index.js +4 -4
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/font-sizes/font-size-picker.js +2 -3
- package/build-module/components/font-sizes/font-size-picker.js.map +1 -1
- package/build-module/components/font-sizes/utils.js +2 -2
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +7 -6
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +15 -15
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/effects-panel.js +2 -1
- package/build-module/components/global-styles/effects-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +2 -1
- package/build-module/components/global-styles/filters-panel.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/typography-panel.js +7 -7
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +11 -10
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/gradients/with-gradient.js +2 -3
- package/build-module/components/gradients/with-gradient.js.map +1 -1
- package/build-module/components/iframe/index.js +5 -6
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/image-editor/constants.js +1 -2
- package/build-module/components/image-editor/constants.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +1 -2
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-size-control/index.js +5 -0
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.js +1 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -0
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +9 -7
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +8 -6
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +24 -27
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inner-blocks/with-client-id.js +2 -3
- package/build-module/components/inner-blocks/with-client-id.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/explorer.js +2 -1
- package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +33 -7
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +4 -3
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/index.js +8 -7
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +4 -4
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/library.js +1 -1
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-list.js +2 -3
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +4 -5
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-tab.js +3 -3
- package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.js +3 -3
- package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build-module/components/inserter/tabs.js +3 -3
- package/build-module/components/inserter/tabs.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/group.js +4 -4
- package/build-module/components/inserter-listbox/group.js.map +1 -1
- package/build-module/components/inserter-listbox/item.js +8 -6
- package/build-module/components/inserter-listbox/item.js.map +1 -1
- package/build-module/components/inserter-listbox/row.js +4 -4
- package/build-module/components/inserter-listbox/row.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-slot-container.js +2 -3
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +2 -1
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/index.js +4 -5
- package/build-module/components/inspector-controls/index.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +4 -5
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls/slot.native.js +2 -1
- package/build-module/components/inspector-controls/slot.native.js.map +1 -1
- package/build-module/components/justify-content-control/index.js +4 -5
- package/build-module/components/justify-content-control/index.js.map +1 -1
- package/build-module/components/justify-content-control/ui.js +4 -4
- package/build-module/components/justify-content-control/ui.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +2 -3
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +2 -3
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +20 -24
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-create-button.js +2 -3
- package/build-module/components/link-control/search-create-button.js.map +1 -1
- package/build-module/components/link-control/search-input.js +7 -5
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/search-item.js +2 -3
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/link-control/search-results.js +2 -3
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +4 -5
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/list-view/appender.js +4 -5
- package/build-module/components/list-view/appender.js.map +1 -1
- package/build-module/components/list-view/aria-referenced-text.js +4 -5
- package/build-module/components/list-view/aria-referenced-text.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +4 -4
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +14 -4
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/branch.js +9 -7
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +61 -11
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js +4 -5
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/leaf.js +4 -4
- package/build-module/components/list-view/leaf.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +2 -22
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +45 -34
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +38 -13
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +1 -3
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +8 -7
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/panel-color-settings/index.js +4 -4
- package/build-module/components/panel-color-settings/index.js.map +1 -1
- package/build-module/components/plain-text/index.js +8 -7
- package/build-module/components/plain-text/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +7 -5
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +5 -4
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/provider/index.js +2 -3
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +21 -0
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/provider/with-registry-provider.js +8 -7
- package/build-module/components/provider/with-registry-provider.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +4 -4
- package/build-module/components/publish-date-time-picker/index.js.map +1 -1
- package/build-module/components/resizable-box-popover/index.js +5 -4
- package/build-module/components/resizable-box-popover/index.js.map +1 -1
- package/build-module/components/resolution-tool/index.js +45 -0
- package/build-module/components/resolution-tool/index.js.map +1 -0
- package/build-module/components/rich-text/content.js +85 -0
- package/build-module/components/rich-text/content.js.map +1 -0
- package/build-module/components/rich-text/format-toolbar/index.js +1 -2
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +8 -42
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +6 -34
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/toolbar-button.js +2 -3
- package/build-module/components/rich-text/toolbar-button.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +8 -7
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/tool-selector/index.js +2 -3
- package/build-module/components/tool-selector/index.js.map +1 -1
- package/build-module/components/unit-control/index.js +4 -4
- package/build-module/components/unit-control/index.js.map +1 -1
- package/build-module/components/url-input/index.js +12 -9
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-input/index.native.js +4 -4
- package/build-module/components/url-input/index.native.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +22 -15
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/url-popover/index.js +4 -4
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/components/url-popover/link-editor.js +4 -4
- package/build-module/components/url-popover/link-editor.js.map +1 -1
- package/build-module/components/url-popover/link-viewer.js +4 -4
- package/build-module/components/url-popover/link-viewer.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +29 -2
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/video-player/index.native.js +2 -3
- package/build-module/components/video-player/index.native.js.map +1 -1
- package/build-module/components/warning/index.native.js +4 -4
- package/build-module/components/warning/index.native.js.map +1 -1
- package/build-module/components/writing-flow/index.js +2 -3
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +32 -5
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js +8 -7
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/anchor.js +4 -2
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/behaviors.js +76 -34
- package/build-module/hooks/behaviors.js.map +1 -1
- package/build-module/hooks/border.js +4 -4
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +4 -4
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +8 -7
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +4 -2
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/dimensions.js +7 -6
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +5 -4
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-family.js +1 -5
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +10 -9
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/layout.js +26 -24
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +23 -15
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +8 -4
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/supports.js +1 -1
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.native.js +3 -1
- package/build-module/hooks/typography.native.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +8 -15
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/constrained.js +2 -1
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/definitions.js +147 -0
- package/build-module/layouts/definitions.js.map +1 -0
- package/build-module/layouts/flex.js +8 -6
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/flow.js +2 -1
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/layouts/grid.js +2 -1
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/layouts/utils.js +7 -2
- package/build-module/layouts/utils.js.map +1 -1
- package/build-module/private-apis.js +16 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +2 -62
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +1 -0
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/private-actions.js +186 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +63 -3
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +52 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +42 -42
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/object.js +37 -1
- package/build-module/utils/object.js.map +1 -1
- package/build-style/style-rtl.css +58 -67
- package/build-style/style.css +58 -67
- package/package.json +32 -31
- package/src/autocompleters/block.js +4 -2
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -6
- package/src/components/alignment-control/ui.js +1 -2
- package/src/components/block-actions/index.js +10 -0
- package/src/components/block-alignment-control/constants.js +0 -4
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -5
- package/src/components/block-alignment-control/ui.js +1 -6
- package/src/components/block-alignment-matrix-control/index.js +1 -1
- package/src/components/block-breadcrumb/index.js +2 -6
- package/src/components/block-edit/index.js +3 -5
- package/src/components/block-heading-level-dropdown/README.md +52 -0
- package/src/components/block-heading-level-dropdown/heading-level-icon.js +43 -0
- package/src/components/block-heading-level-dropdown/index.js +77 -0
- package/src/components/block-heading-level-dropdown/index.native.js +63 -0
- package/src/components/block-inspector/index.js +18 -92
- package/src/components/block-inspector/style.scss +0 -5
- package/src/components/block-list/block.native.js +1 -0
- package/src/components/block-list/index.js +1 -1
- package/src/components/block-list/use-in-between-inserter.js +0 -4
- package/src/components/block-list-appender/index.js +29 -22
- package/src/components/block-lock/style.scss +11 -4
- package/src/components/block-lock/toolbar.js +34 -6
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
- package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +2 -2
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +3 -3
- package/src/components/block-mover/test/index.native.js +1 -20
- package/src/components/block-preview/index.js +7 -14
- package/src/components/block-quick-navigation/index.js +81 -0
- package/src/components/block-removal-warning-modal/index.js +94 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +15 -13
- package/src/components/block-switcher/index.js +1 -2
- package/src/components/block-toolbar/index.js +9 -6
- package/src/components/block-toolbar/style.scss +0 -4
- package/src/components/block-tools/index.js +10 -1
- package/src/components/block-tools/style.scss +4 -0
- package/src/components/block-vertical-alignment-control/ui.js +1 -3
- package/src/components/colors/utils.js +5 -1
- package/src/components/colors/with-colors.js +1 -5
- package/src/components/copy-handler/index.js +5 -5
- package/src/components/dimensions-tool/aspect-ratio-tool.js +124 -0
- package/src/components/dimensions-tool/index.js +212 -0
- package/src/components/dimensions-tool/scale-tool.js +124 -0
- package/src/components/dimensions-tool/stories/aspect-ratio-tool.js +52 -0
- package/src/components/dimensions-tool/stories/index.js +54 -0
- package/src/components/dimensions-tool/stories/scale-tool.js +48 -0
- package/src/components/dimensions-tool/stories/width-height-tool.js +54 -0
- package/src/components/dimensions-tool/test/index.js +641 -0
- package/src/components/dimensions-tool/width-height-tool.js +113 -0
- package/src/components/duotone-control/index.js +0 -1
- package/src/components/font-sizes/test/fluid-utils.js +97 -76
- package/src/components/font-sizes/utils.js +2 -2
- package/src/components/global-styles/color-panel.js +3 -3
- package/src/components/global-styles/index.js +1 -0
- package/src/components/global-styles/test/use-global-styles-output.js +14 -9
- package/src/components/global-styles/typography-panel.js +19 -16
- package/src/components/global-styles/use-global-styles-output.js +12 -12
- package/src/components/iframe/index.js +1 -1
- package/src/components/image-editor/aspect-ratio-dropdown.js +1 -1
- package/src/components/image-editor/constants.js +0 -1
- package/src/components/image-editor/use-save-image.js +0 -1
- package/src/components/image-size-control/index.js +6 -0
- package/src/components/index.js +1 -1
- package/src/components/index.native.js +1 -0
- package/src/components/inner-blocks/index.js +4 -2
- package/src/components/inner-blocks/index.native.js +1 -1
- package/src/components/inner-blocks/use-nested-settings-update.js +31 -36
- package/src/components/inserter/block-patterns-tab.js +63 -8
- package/src/components/inserter/hooks/use-block-types-state.js +4 -3
- package/src/components/inserter/hooks/use-insertion-point.js +1 -0
- package/src/components/inserter/library.js +2 -1
- package/src/components/inserter/media-tab/media-tab.js +9 -3
- package/src/components/inserter/reusable-blocks-tab.js +3 -3
- package/src/components/inserter/tabs.js +3 -3
- package/src/components/link-control/index.js +34 -37
- package/src/components/link-control/search-input.js +5 -3
- package/src/components/link-control/settings-drawer.js +6 -5
- package/src/components/link-control/style.scss +33 -55
- package/src/components/link-control/test/index.js +161 -159
- package/src/components/list-view/block-select-button.js +19 -1
- package/src/components/list-view/branch.js +6 -3
- package/src/components/list-view/drop-indicator.js +94 -9
- package/src/components/list-view/style.scss +13 -12
- package/src/components/list-view/test/use-list-view-drop-zone.js +188 -93
- package/src/components/list-view/use-list-view-client-ids.js +3 -20
- package/src/components/list-view/use-list-view-drop-zone.js +97 -54
- package/src/components/media-placeholder/index.js +54 -20
- package/src/components/media-replace-flow/index.js +1 -3
- package/src/components/media-replace-flow/test/index.js +1 -1
- package/src/components/preview-options/index.js +3 -2
- package/src/components/provider/test/experimental-provider.js +9 -6
- package/src/components/provider/test/use-block-sync.js +21 -6
- package/src/components/provider/use-block-sync.js +19 -0
- package/src/components/resolution-tool/index.js +56 -0
- package/src/components/resolution-tool/stories/index.js +48 -0
- package/src/components/rich-text/content.js +85 -0
- package/src/components/rich-text/format-toolbar/index.js +1 -2
- package/src/components/rich-text/index.js +2 -35
- package/src/components/rich-text/index.native.js +3 -33
- package/src/components/url-input/index.js +2 -0
- package/src/components/url-popover/image-url-input-ui.js +15 -15
- package/src/components/url-popover/test/__snapshots__/index.js.snap +3 -3
- package/src/components/use-block-display-information/index.js +26 -0
- package/src/components/writing-flow/use-drag-selection.js +1 -1
- package/src/components/writing-flow/use-tab-nav.js +42 -6
- package/src/hooks/behaviors.js +82 -39
- package/src/hooks/font-family.js +1 -5
- package/src/hooks/font-size.js +12 -17
- package/src/hooks/layout.js +17 -25
- package/src/hooks/position.js +24 -12
- package/src/hooks/supports.js +1 -1
- package/src/hooks/use-typography-props.js +14 -19
- package/src/index.js +0 -2
- package/src/layouts/constrained.js +2 -1
- package/src/layouts/definitions.js +174 -0
- package/src/layouts/flex.js +7 -5
- package/src/layouts/flow.js +2 -1
- package/src/layouts/grid.js +2 -1
- package/src/layouts/test/utils.js +2 -7
- package/src/layouts/utils.js +7 -2
- package/src/private-apis.js +15 -0
- package/src/store/actions.js +7 -56
- package/src/store/defaults.js +1 -0
- package/src/store/private-actions.js +193 -0
- package/src/store/private-selectors.js +108 -35
- package/src/store/reducer.js +44 -0
- package/src/store/selectors.js +61 -39
- package/src/store/test/private-selectors.js +269 -1
- package/src/store/test/selectors.js +18 -17
- package/src/utils/object.js +35 -0
- package/src/utils/test/object.js +96 -1
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* External dependencies
|
|
6
5
|
*/
|
|
7
6
|
import classnames from 'classnames';
|
|
8
|
-
import { kebabCase } from 'lodash';
|
|
9
7
|
/**
|
|
10
8
|
* WordPress dependencies
|
|
11
9
|
*/
|
|
@@ -28,7 +26,13 @@ import { LayoutStyle } from '../components/block-list/layout';
|
|
|
28
26
|
import BlockList from '../components/block-list';
|
|
29
27
|
import { getLayoutType, getLayoutTypes } from '../layouts';
|
|
30
28
|
import { useBlockEditingMode } from '../components/block-editing-mode';
|
|
31
|
-
|
|
29
|
+
import { LAYOUT_DEFINITIONS } from '../layouts/definitions';
|
|
30
|
+
import { kebabCase } from '../utils/object';
|
|
31
|
+
const layoutBlockSupportKey = 'layout';
|
|
32
|
+
|
|
33
|
+
function hasLayoutBlockSupport(blockName) {
|
|
34
|
+
return hasBlockSupport(blockName, 'layout') || hasBlockSupport(blockName, '__experimentalLayout');
|
|
35
|
+
}
|
|
32
36
|
/**
|
|
33
37
|
* Generates the utility classnames for the given block's layout attributes.
|
|
34
38
|
*
|
|
@@ -38,6 +42,7 @@ const layoutBlockSupportKey = '__experimentalLayout';
|
|
|
38
42
|
* @return { Array } Array of CSS classname strings.
|
|
39
43
|
*/
|
|
40
44
|
|
|
45
|
+
|
|
41
46
|
export function useLayoutClasses(blockAttributes = {}, blockName = '') {
|
|
42
47
|
const rootPaddingAlignment = useSelect(select => {
|
|
43
48
|
const {
|
|
@@ -45,7 +50,6 @@ export function useLayoutClasses(blockAttributes = {}, blockName = '') {
|
|
|
45
50
|
} = select(blockEditorStore);
|
|
46
51
|
return getSettings().__experimentalFeatures?.useRootPaddingAwareAlignments;
|
|
47
52
|
}, []);
|
|
48
|
-
const globalLayoutSettings = useSetting('layout') || {};
|
|
49
53
|
const {
|
|
50
54
|
layout
|
|
51
55
|
} = blockAttributes;
|
|
@@ -57,8 +61,8 @@ export function useLayoutClasses(blockAttributes = {}, blockName = '') {
|
|
|
57
61
|
} : layout || defaultBlockLayout || {};
|
|
58
62
|
const layoutClassnames = [];
|
|
59
63
|
|
|
60
|
-
if (
|
|
61
|
-
const baseClassName =
|
|
64
|
+
if (LAYOUT_DEFINITIONS[usedLayout?.type || 'default']?.className) {
|
|
65
|
+
const baseClassName = LAYOUT_DEFINITIONS[usedLayout?.type || 'default']?.className;
|
|
62
66
|
const compoundClassName = `wp-block-${blockName.split('/').pop()}-${baseClassName}`;
|
|
63
67
|
layoutClassnames.push(baseClassName, compoundClassName);
|
|
64
68
|
}
|
|
@@ -101,14 +105,12 @@ export function useLayoutStyles(blockAttributes = {}, blockName, selector) {
|
|
|
101
105
|
type: 'constrained'
|
|
102
106
|
} : layout || {};
|
|
103
107
|
const fullLayoutType = getLayoutType(usedLayout?.type || 'default');
|
|
104
|
-
const globalLayoutSettings = useSetting('layout') || {};
|
|
105
108
|
const blockGapSupport = useSetting('spacing.blockGap');
|
|
106
109
|
const hasBlockGapSupport = blockGapSupport !== null;
|
|
107
110
|
const css = fullLayoutType?.getLayoutStyle?.({
|
|
108
111
|
blockName,
|
|
109
112
|
selector,
|
|
110
113
|
layout,
|
|
111
|
-
layoutDefinitions: globalLayoutSettings?.definitions,
|
|
112
114
|
style,
|
|
113
115
|
hasBlockGapSupport
|
|
114
116
|
});
|
|
@@ -244,7 +246,7 @@ export function addAttribute(settings) {
|
|
|
244
246
|
return settings;
|
|
245
247
|
}
|
|
246
248
|
|
|
247
|
-
if (
|
|
249
|
+
if (hasLayoutBlockSupport(settings)) {
|
|
248
250
|
settings.attributes = { ...settings.attributes,
|
|
249
251
|
layout: {
|
|
250
252
|
type: 'object'
|
|
@@ -266,13 +268,15 @@ export const withInspectorControls = createHigherOrderComponent(BlockEdit => pro
|
|
|
266
268
|
const {
|
|
267
269
|
name: blockName
|
|
268
270
|
} = props;
|
|
269
|
-
const supportLayout =
|
|
271
|
+
const supportLayout = hasLayoutBlockSupport(blockName);
|
|
270
272
|
const blockEditingMode = useBlockEditingMode();
|
|
271
|
-
return [supportLayout && blockEditingMode === 'default' && createElement(LayoutPanel,
|
|
272
|
-
key: "layout"
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
273
|
+
return [supportLayout && blockEditingMode === 'default' && createElement(LayoutPanel, {
|
|
274
|
+
key: "layout",
|
|
275
|
+
...props
|
|
276
|
+
}), createElement(BlockEdit, {
|
|
277
|
+
key: "edit",
|
|
278
|
+
...props
|
|
279
|
+
})];
|
|
276
280
|
}, 'withInspectorControls');
|
|
277
281
|
/**
|
|
278
282
|
* Override the default block element to add the layout styles.
|
|
@@ -287,16 +291,15 @@ export const withLayoutStyles = createHigherOrderComponent(BlockListBlock => pro
|
|
|
287
291
|
name,
|
|
288
292
|
attributes
|
|
289
293
|
} = props;
|
|
290
|
-
const
|
|
294
|
+
const blockSupportsLayout = hasLayoutBlockSupport(name);
|
|
291
295
|
const disableLayoutStyles = useSelect(select => {
|
|
292
296
|
const {
|
|
293
297
|
getSettings
|
|
294
298
|
} = select(blockEditorStore);
|
|
295
299
|
return !!getSettings().disableLayoutStyles;
|
|
296
300
|
});
|
|
297
|
-
const shouldRenderLayoutStyles =
|
|
301
|
+
const shouldRenderLayoutStyles = blockSupportsLayout && !disableLayoutStyles;
|
|
298
302
|
const id = useInstanceId(BlockListBlock);
|
|
299
|
-
const defaultThemeLayout = useSetting('layout') || {};
|
|
300
303
|
const element = useContext(BlockList.__unstableElementContext);
|
|
301
304
|
const {
|
|
302
305
|
layout
|
|
@@ -307,7 +310,7 @@ export const withLayoutStyles = createHigherOrderComponent(BlockListBlock => pro
|
|
|
307
310
|
const usedLayout = layout?.inherit || layout?.contentSize || layout?.wideSize ? { ...layout,
|
|
308
311
|
type: 'constrained'
|
|
309
312
|
} : layout || defaultBlockLayout || {};
|
|
310
|
-
const layoutClasses =
|
|
313
|
+
const layoutClasses = blockSupportsLayout ? useLayoutClasses(attributes, name) : null; // Higher specificity to override defaults from theme.json.
|
|
311
314
|
|
|
312
315
|
const selector = `.wp-container-${id}.wp-container-${id}`;
|
|
313
316
|
const blockGapSupport = useSetting('spacing.blockGap');
|
|
@@ -322,7 +325,6 @@ export const withLayoutStyles = createHigherOrderComponent(BlockListBlock => pro
|
|
|
322
325
|
blockName: name,
|
|
323
326
|
selector,
|
|
324
327
|
layout: usedLayout,
|
|
325
|
-
layoutDefinitions: defaultThemeLayout?.definitions,
|
|
326
328
|
style: attributes?.style,
|
|
327
329
|
hasBlockGapSupport
|
|
328
330
|
});
|
|
@@ -339,9 +341,9 @@ export const withLayoutStyles = createHigherOrderComponent(BlockListBlock => pro
|
|
|
339
341
|
css: css,
|
|
340
342
|
layout: usedLayout,
|
|
341
343
|
style: attributes?.style
|
|
342
|
-
}), element), createElement(BlockListBlock,
|
|
344
|
+
}), element), createElement(BlockListBlock, { ...props,
|
|
343
345
|
__unstableLayoutClassNames: layoutClassNames
|
|
344
|
-
}))
|
|
346
|
+
}));
|
|
345
347
|
}, 'withLayoutStyles');
|
|
346
348
|
/**
|
|
347
349
|
* Override the default block element to add the child layout styles.
|
|
@@ -393,9 +395,9 @@ export const withChildLayoutStyles = createHigherOrderComponent(BlockListBlock =
|
|
|
393
395
|
[`wp-container-content-${id}`]: shouldRenderChildLayoutStyles && !!css // Only attach a container class if there is generated CSS to be attached.
|
|
394
396
|
|
|
395
397
|
});
|
|
396
|
-
return createElement(Fragment, null, shouldRenderChildLayoutStyles && element && !!css && createPortal(createElement("style", null, css), element), createElement(BlockListBlock,
|
|
398
|
+
return createElement(Fragment, null, shouldRenderChildLayoutStyles && element && !!css && createPortal(createElement("style", null, css), element), createElement(BlockListBlock, { ...props,
|
|
397
399
|
className: className
|
|
398
|
-
}))
|
|
400
|
+
}));
|
|
399
401
|
}, 'withChildLayoutStyles');
|
|
400
402
|
addFilter('blocks.registerBlockType', 'core/layout/addAttribute', addAttribute);
|
|
401
403
|
addFilter('editor.BlockListBlock', 'core/editor/layout/with-layout-styles', withLayoutStyles);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/layout.js"],"names":["classnames","kebabCase","createHigherOrderComponent","useInstanceId","addFilter","getBlockSupport","hasBlockSupport","useSelect","Button","ButtonGroup","ToggleControl","PanelBody","__","useContext","createPortal","store","blockEditorStore","InspectorControls","useSetting","LayoutStyle","BlockList","getLayoutType","getLayoutTypes","useBlockEditingMode","layoutBlockSupportKey","useLayoutClasses","blockAttributes","blockName","rootPaddingAlignment","select","getSettings","__experimentalFeatures","useRootPaddingAwareAlignments","globalLayoutSettings","layout","default","defaultBlockLayout","usedLayout","inherit","contentSize","wideSize","type","layoutClassnames","definitions","className","baseClassName","compoundClassName","split","pop","push","orientation","justifyContent","flexWrap","useLayoutStyles","selector","style","fullLayoutType","blockGapSupport","hasBlockGapSupport","css","getLayoutStyle","layoutDefinitions","LayoutPanel","setAttributes","attributes","name","defaultThemeLayout","themeSupportsLayout","supportsLayout","blockEditingMode","layoutBlockSupport","allowSwitching","allowEditing","allowInheriting","showInheritToggle","layoutType","constrainedType","displayControlsForLegacyLayouts","hasContentSizeOrLegacySettings","onChangeType","newType","onChangeLayout","newLayout","LayoutTypeSwitcher","onChange","map","label","addAttribute","settings","withInspectorControls","BlockEdit","props","supportLayout","withLayoutStyles","BlockListBlock","hasLayoutBlockSupport","disableLayoutStyles","shouldRenderLayoutStyles","id","element","__unstableElementContext","layoutClasses","layoutClassNames","withChildLayoutStyles","selfStretch","flexSize","hasChildLayout","shouldRenderChildLayoutStyles"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UA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\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tButtonGroup,\n\tToggleControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useContext, createPortal } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport useSetting from '../components/use-setting';\nimport { LayoutStyle } from '../components/block-list/layout';\nimport BlockList from '../components/block-list';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\nconst layoutBlockSupportKey = '__experimentalLayout';\n\n/**\n * Generates the utility classnames for the given block's layout attributes.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n *\n * @return { Array } Array of CSS classname strings.\n */\nexport function useLayoutClasses( blockAttributes = {}, blockName = '' ) {\n\tconst rootPaddingAlignment = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().__experimentalFeatures\n\t\t\t?.useRootPaddingAwareAlignments;\n\t}, [] );\n\tconst globalLayoutSettings = useSetting( 'layout' ) || {};\n\n\tconst { layout } = blockAttributes;\n\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( blockName, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst layoutClassnames = [];\n\n\tif (\n\t\tglobalLayoutSettings?.definitions?.[ usedLayout?.type || 'default' ]\n\t\t\t?.className\n\t) {\n\t\tconst baseClassName =\n\t\t\tglobalLayoutSettings?.definitions?.[ usedLayout?.type || 'default' ]\n\t\t\t\t?.className;\n\t\tconst compoundClassName = `wp-block-${ blockName\n\t\t\t.split( '/' )\n\t\t\t.pop() }-${ baseClassName }`;\n\t\tlayoutClassnames.push( baseClassName, compoundClassName );\n\t}\n\n\tif (\n\t\t( usedLayout?.inherit ||\n\t\t\tusedLayout?.contentSize ||\n\t\t\tusedLayout?.type === 'constrained' ) &&\n\t\trootPaddingAlignment\n\t) {\n\t\tlayoutClassnames.push( 'has-global-padding' );\n\t}\n\n\tif ( usedLayout?.orientation ) {\n\t\tlayoutClassnames.push( `is-${ kebabCase( usedLayout.orientation ) }` );\n\t}\n\n\tif ( usedLayout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase(\n\t\t\t\tusedLayout.justifyContent\n\t\t\t) }`\n\t\t);\n\t}\n\n\tif ( usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap' ) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\n/**\n * Generates a CSS rule with the given block's layout styles.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n * @param { string } selector A selector to use in generating the CSS rule.\n *\n * @return { string } CSS rule.\n */\nexport function useLayoutStyles( blockAttributes = {}, blockName, selector ) {\n\tconst { layout = {}, style = {} } = blockAttributes;\n\t// Update type for blocks using legacy layouts.\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || {};\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst globalLayoutSettings = useSetting( 'layout' ) || {};\n\tconst blockGapSupport = useSetting( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\tconst css = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName,\n\t\tselector,\n\t\tlayout,\n\t\tlayoutDefinitions: globalLayoutSettings?.definitions,\n\t\tstyle,\n\t\thasBlockGapSupport,\n\t} );\n\treturn css;\n}\n\nfunction LayoutPanel( { setAttributes, attributes, name: blockName } ) {\n\tconst { layout } = attributes;\n\tconst defaultThemeLayout = useSetting( 'layout' );\n\tconst { themeSupportsLayout } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\tthemeSupportsLayout: getSettings().supportsLayout,\n\t\t};\n\t}, [] );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = layoutBlockSupport;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t// Only show the inherit toggle if it's supported,\n\t// a default theme layout is set (e.g. one that provides `contentSize` and/or `wideSize` values),\n\t// and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t!! defaultThemeLayout &&\n\t\t( ! layout?.type ||\n\t\t\tlayout?.type === 'default' ||\n\t\t\tlayout?.type === 'constrained' ||\n\t\t\tlayout?.inherit )\n\t);\n\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst {\n\t\tinherit = false,\n\t\ttype = 'default',\n\t\tcontentSize = null,\n\t} = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow` or\n\t * `constrained` layouts and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif (\n\t\t( type === 'default' || type === 'constrained' ) &&\n\t\t! themeSupportsLayout\n\t) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( type );\n\tconst constrainedType = getLayoutType( 'constrained' );\n\tconst displayControlsForLegacyLayouts =\n\t\t! usedLayout.type && ( contentSize || inherit );\n\tconst hasContentSizeOrLegacySettings = !! inherit || !! contentSize;\n\n\tconst onChangeType = ( newType ) =>\n\t\tsetAttributes( { layout: { type: newType } } );\n\tconst onChangeLayout = ( newLayout ) =>\n\t\tsetAttributes( { layout: newLayout } );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Layout' ) }>\n\t\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tclassName=\"block-editor-hooks__toggle-control\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use content width' ) }\n\t\t\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t\t\ttype:\n\t\t\t\t\t\t\t\t\t\t\t\tlayoutType?.name ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t'constrained' ||\n\t\t\t\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'constrained',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container. Toggle to constrain.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && allowSwitching && (\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ layoutType && layoutType.name !== 'default' && (\n\t\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ constrainedType && displayControlsForLegacyLayouts && (\n\t\t\t\t\t\t<constrainedType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && blockEditingMode === 'default' && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ButtonGroup>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tisPressed={ type === name }\n\t\t\t\t\t\tonClick={ () => onChange( name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ButtonGroup>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( 'type' in ( settings.attributes?.layout ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, layoutBlockSupportKey ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include layout controls\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withInspectorControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { name: blockName } = props;\n\t\tconst supportLayout = hasBlockSupport(\n\t\t\tblockName,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\n\t\tconst blockEditingMode = useBlockEditingMode();\n\t\treturn [\n\t\t\tsupportLayout && blockEditingMode === 'default' && (\n\t\t\t\t<LayoutPanel key=\"layout\" { ...props } />\n\t\t\t),\n\t\t\t<BlockEdit key=\"edit\" { ...props } />,\n\t\t];\n\t},\n\t'withInspectorControls'\n);\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst hasLayoutBlockSupport = hasBlockSupport(\n\t\t\tname,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\t\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\treturn !! getSettings().disableLayoutStyles;\n\t\t} );\n\t\tconst shouldRenderLayoutStyles =\n\t\t\thasLayoutBlockSupport && ! disableLayoutStyles;\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst defaultThemeLayout = useSetting( 'layout' ) || {};\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\t\tconst { layout } = attributes;\n\t\tconst { default: defaultBlockLayout } =\n\t\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\t\tconst usedLayout =\n\t\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t\t: layout || defaultBlockLayout || {};\n\t\tconst layoutClasses = hasLayoutBlockSupport\n\t\t\t? useLayoutClasses( attributes, name )\n\t\t\t: null;\n\t\t// Higher specificity to override defaults from theme.json.\n\t\tconst selector = `.wp-container-${ id }.wp-container-${ id }`;\n\t\tconst blockGapSupport = useSetting( 'spacing.blockGap' );\n\t\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t\t// Get CSS string for the current layout type.\n\t\t// The CSS and `style` element is only output if it is not empty.\n\t\tlet css;\n\t\tif ( shouldRenderLayoutStyles ) {\n\t\t\tconst fullLayoutType = getLayoutType(\n\t\t\t\tusedLayout?.type || 'default'\n\t\t\t);\n\t\t\tcss = fullLayoutType?.getLayoutStyle?.( {\n\t\t\t\tblockName: name,\n\t\t\t\tselector,\n\t\t\t\tlayout: usedLayout,\n\t\t\t\tlayoutDefinitions: defaultThemeLayout?.definitions,\n\t\t\t\tstyle: attributes?.style,\n\t\t\t\thasBlockGapSupport,\n\t\t\t} );\n\t\t}\n\n\t\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\t\tconst layoutClassNames = classnames(\n\t\t\t{\n\t\t\t\t[ `wp-container-${ id }` ]: shouldRenderLayoutStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t\t},\n\t\t\tlayoutClasses\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRenderLayoutStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\tblockName={ name }\n\t\t\t\t\t\t\tselector={ selector }\n\t\t\t\t\t\t\tcss={ css }\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tstyle={ attributes?.style }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\t__unstableLayoutClassNames={ layoutClassNames }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n\t'withLayoutStyles'\n);\n\n/**\n * Override the default block element to add the child layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withChildLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { attributes } = props;\n\t\tconst { style: { layout = {} } = {} } = attributes;\n\t\tconst { selfStretch, flexSize } = layout;\n\t\tconst hasChildLayout = selfStretch || flexSize;\n\t\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\treturn !! getSettings().disableLayoutStyles;\n\t\t} );\n\t\tconst shouldRenderChildLayoutStyles =\n\t\t\thasChildLayout && ! disableLayoutStyles;\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst selector = `.wp-container-content-${ id }`;\n\n\t\tlet css = '';\n\n\t\tif ( selfStretch === 'fixed' && flexSize ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tflex-basis: ${ flexSize };\n\t\t\t\tbox-sizing: border-box;\n\t\t\t}`;\n\t\t} else if ( selfStretch === 'fill' ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tflex-grow: 1;\n\t\t\t}`;\n\t\t}\n\n\t\t// Attach a `wp-container-content` id-based classname.\n\t\tconst className = classnames( props?.className, {\n\t\t\t[ `wp-container-content-${ id }` ]:\n\t\t\t\tshouldRenderChildLayoutStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t} );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRenderChildLayoutStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal( <style>{ css }</style>, element ) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withChildLayoutStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-child-layout-styles',\n\twithChildLayoutStyles\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/layout/with-inspector-controls',\n\twithInspectorControls\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/layout.js"],"names":["classnames","createHigherOrderComponent","useInstanceId","addFilter","getBlockSupport","hasBlockSupport","useSelect","Button","ButtonGroup","ToggleControl","PanelBody","__","useContext","createPortal","store","blockEditorStore","InspectorControls","useSetting","LayoutStyle","BlockList","getLayoutType","getLayoutTypes","useBlockEditingMode","LAYOUT_DEFINITIONS","kebabCase","layoutBlockSupportKey","hasLayoutBlockSupport","blockName","useLayoutClasses","blockAttributes","rootPaddingAlignment","select","getSettings","__experimentalFeatures","useRootPaddingAwareAlignments","layout","default","defaultBlockLayout","usedLayout","inherit","contentSize","wideSize","type","layoutClassnames","className","baseClassName","compoundClassName","split","pop","push","orientation","justifyContent","flexWrap","useLayoutStyles","selector","style","fullLayoutType","blockGapSupport","hasBlockGapSupport","css","getLayoutStyle","LayoutPanel","setAttributes","attributes","name","defaultThemeLayout","themeSupportsLayout","supportsLayout","blockEditingMode","layoutBlockSupport","allowSwitching","allowEditing","allowInheriting","showInheritToggle","layoutType","constrainedType","displayControlsForLegacyLayouts","hasContentSizeOrLegacySettings","onChangeType","newType","onChangeLayout","newLayout","LayoutTypeSwitcher","onChange","map","label","addAttribute","settings","withInspectorControls","BlockEdit","props","supportLayout","withLayoutStyles","BlockListBlock","blockSupportsLayout","disableLayoutStyles","shouldRenderLayoutStyles","id","element","__unstableElementContext","layoutClasses","layoutClassNames","withChildLayoutStyles","selfStretch","flexSize","hasChildLayout","shouldRenderChildLayoutStyles"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,MADD,EAECC,WAFD,EAGCC,aAHD,EAICC,SAJD,QAKO,uBALP;AAMA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,oBAAzC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AACA,SAASC,iBAAT,QAAkC,eAAlC;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,SAASC,WAAT,QAA4B,iCAA5B;AACA,OAAOC,SAAP,MAAsB,0BAAtB;AACA,SAASC,aAAT,EAAwBC,cAAxB,QAA8C,YAA9C;AACA,SAASC,mBAAT,QAAoC,kCAApC;AACA,SAASC,kBAAT,QAAmC,wBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA,MAAMC,qBAAqB,GAAG,QAA9B;;AAEA,SAASC,qBAAT,CAAgCC,SAAhC,EAA4C;AAC3C,SACCtB,eAAe,CAAEsB,SAAF,EAAa,QAAb,CAAf,IACAtB,eAAe,CAAEsB,SAAF,EAAa,sBAAb,CAFhB;AAIA;AAED;AACA;AACA;AACA;AACA;AAC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,CACR,uBADQ,EAER,6CAFQ,EAGRmG,qBAHQ,CAAT;AAKAnG,SAAS,CACR,kBADQ,EAER,4CAFQ,EAGRqF,qBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tButtonGroup,\n\tToggleControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useContext, createPortal } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport useSetting from '../components/use-setting';\nimport { LayoutStyle } from '../components/block-list/layout';\nimport BlockList from '../components/block-list';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { LAYOUT_DEFINITIONS } from '../layouts/definitions';\nimport { kebabCase } from '../utils/object';\n\nconst layoutBlockSupportKey = 'layout';\n\nfunction hasLayoutBlockSupport( blockName ) {\n\treturn (\n\t\thasBlockSupport( blockName, 'layout' ) ||\n\t\thasBlockSupport( blockName, '__experimentalLayout' )\n\t);\n}\n\n/**\n * Generates the utility classnames for the given block's layout attributes.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n *\n * @return { Array } Array of CSS classname strings.\n */\nexport function useLayoutClasses( blockAttributes = {}, blockName = '' ) {\n\tconst rootPaddingAlignment = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().__experimentalFeatures\n\t\t\t?.useRootPaddingAwareAlignments;\n\t}, [] );\n\tconst { layout } = blockAttributes;\n\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( blockName, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst layoutClassnames = [];\n\n\tif ( LAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className ) {\n\t\tconst baseClassName =\n\t\t\tLAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className;\n\t\tconst compoundClassName = `wp-block-${ blockName\n\t\t\t.split( '/' )\n\t\t\t.pop() }-${ baseClassName }`;\n\t\tlayoutClassnames.push( baseClassName, compoundClassName );\n\t}\n\n\tif (\n\t\t( usedLayout?.inherit ||\n\t\t\tusedLayout?.contentSize ||\n\t\t\tusedLayout?.type === 'constrained' ) &&\n\t\trootPaddingAlignment\n\t) {\n\t\tlayoutClassnames.push( 'has-global-padding' );\n\t}\n\n\tif ( usedLayout?.orientation ) {\n\t\tlayoutClassnames.push( `is-${ kebabCase( usedLayout.orientation ) }` );\n\t}\n\n\tif ( usedLayout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase(\n\t\t\t\tusedLayout.justifyContent\n\t\t\t) }`\n\t\t);\n\t}\n\n\tif ( usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap' ) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\n/**\n * Generates a CSS rule with the given block's layout styles.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n * @param { string } selector A selector to use in generating the CSS rule.\n *\n * @return { string } CSS rule.\n */\nexport function useLayoutStyles( blockAttributes = {}, blockName, selector ) {\n\tconst { layout = {}, style = {} } = blockAttributes;\n\t// Update type for blocks using legacy layouts.\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || {};\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst blockGapSupport = useSetting( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\tconst css = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName,\n\t\tselector,\n\t\tlayout,\n\t\tstyle,\n\t\thasBlockGapSupport,\n\t} );\n\treturn css;\n}\n\nfunction LayoutPanel( { setAttributes, attributes, name: blockName } ) {\n\tconst { layout } = attributes;\n\tconst defaultThemeLayout = useSetting( 'layout' );\n\tconst { themeSupportsLayout } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\tthemeSupportsLayout: getSettings().supportsLayout,\n\t\t};\n\t}, [] );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = layoutBlockSupport;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t// Only show the inherit toggle if it's supported,\n\t// a default theme layout is set (e.g. one that provides `contentSize` and/or `wideSize` values),\n\t// and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t!! defaultThemeLayout &&\n\t\t( ! layout?.type ||\n\t\t\tlayout?.type === 'default' ||\n\t\t\tlayout?.type === 'constrained' ||\n\t\t\tlayout?.inherit )\n\t);\n\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst {\n\t\tinherit = false,\n\t\ttype = 'default',\n\t\tcontentSize = null,\n\t} = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow` or\n\t * `constrained` layouts and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif (\n\t\t( type === 'default' || type === 'constrained' ) &&\n\t\t! themeSupportsLayout\n\t) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( type );\n\tconst constrainedType = getLayoutType( 'constrained' );\n\tconst displayControlsForLegacyLayouts =\n\t\t! usedLayout.type && ( contentSize || inherit );\n\tconst hasContentSizeOrLegacySettings = !! inherit || !! contentSize;\n\n\tconst onChangeType = ( newType ) =>\n\t\tsetAttributes( { layout: { type: newType } } );\n\tconst onChangeLayout = ( newLayout ) =>\n\t\tsetAttributes( { layout: newLayout } );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Layout' ) }>\n\t\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tclassName=\"block-editor-hooks__toggle-control\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use content width' ) }\n\t\t\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t\t\ttype:\n\t\t\t\t\t\t\t\t\t\t\t\tlayoutType?.name ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t'constrained' ||\n\t\t\t\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'constrained',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container. Toggle to constrain.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && allowSwitching && (\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ layoutType && layoutType.name !== 'default' && (\n\t\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ constrainedType && displayControlsForLegacyLayouts && (\n\t\t\t\t\t\t<constrainedType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && blockEditingMode === 'default' && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ButtonGroup>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tisPressed={ type === name }\n\t\t\t\t\t\tonClick={ () => onChange( name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ButtonGroup>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( 'type' in ( settings.attributes?.layout ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasLayoutBlockSupport( settings ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include layout controls\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withInspectorControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { name: blockName } = props;\n\t\tconst supportLayout = hasLayoutBlockSupport( blockName );\n\n\t\tconst blockEditingMode = useBlockEditingMode();\n\t\treturn [\n\t\t\tsupportLayout && blockEditingMode === 'default' && (\n\t\t\t\t<LayoutPanel key=\"layout\" { ...props } />\n\t\t\t),\n\t\t\t<BlockEdit key=\"edit\" { ...props } />,\n\t\t];\n\t},\n\t'withInspectorControls'\n);\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst blockSupportsLayout = hasLayoutBlockSupport( name );\n\t\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\treturn !! getSettings().disableLayoutStyles;\n\t\t} );\n\t\tconst shouldRenderLayoutStyles =\n\t\t\tblockSupportsLayout && ! disableLayoutStyles;\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\t\tconst { layout } = attributes;\n\t\tconst { default: defaultBlockLayout } =\n\t\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\t\tconst usedLayout =\n\t\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t\t: layout || defaultBlockLayout || {};\n\t\tconst layoutClasses = blockSupportsLayout\n\t\t\t? useLayoutClasses( attributes, name )\n\t\t\t: null;\n\t\t// Higher specificity to override defaults from theme.json.\n\t\tconst selector = `.wp-container-${ id }.wp-container-${ id }`;\n\t\tconst blockGapSupport = useSetting( 'spacing.blockGap' );\n\t\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t\t// Get CSS string for the current layout type.\n\t\t// The CSS and `style` element is only output if it is not empty.\n\t\tlet css;\n\t\tif ( shouldRenderLayoutStyles ) {\n\t\t\tconst fullLayoutType = getLayoutType(\n\t\t\t\tusedLayout?.type || 'default'\n\t\t\t);\n\t\t\tcss = fullLayoutType?.getLayoutStyle?.( {\n\t\t\t\tblockName: name,\n\t\t\t\tselector,\n\t\t\t\tlayout: usedLayout,\n\t\t\t\tstyle: attributes?.style,\n\t\t\t\thasBlockGapSupport,\n\t\t\t} );\n\t\t}\n\n\t\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\t\tconst layoutClassNames = classnames(\n\t\t\t{\n\t\t\t\t[ `wp-container-${ id }` ]: shouldRenderLayoutStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t\t},\n\t\t\tlayoutClasses\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRenderLayoutStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\tblockName={ name }\n\t\t\t\t\t\t\tselector={ selector }\n\t\t\t\t\t\t\tcss={ css }\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tstyle={ attributes?.style }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\t__unstableLayoutClassNames={ layoutClassNames }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n\t'withLayoutStyles'\n);\n\n/**\n * Override the default block element to add the child layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withChildLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { attributes } = props;\n\t\tconst { style: { layout = {} } = {} } = attributes;\n\t\tconst { selfStretch, flexSize } = layout;\n\t\tconst hasChildLayout = selfStretch || flexSize;\n\t\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\treturn !! getSettings().disableLayoutStyles;\n\t\t} );\n\t\tconst shouldRenderChildLayoutStyles =\n\t\t\thasChildLayout && ! disableLayoutStyles;\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst selector = `.wp-container-content-${ id }`;\n\n\t\tlet css = '';\n\n\t\tif ( selfStretch === 'fixed' && flexSize ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tflex-basis: ${ flexSize };\n\t\t\t\tbox-sizing: border-box;\n\t\t\t}`;\n\t\t} else if ( selfStretch === 'fill' ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tflex-grow: 1;\n\t\t\t}`;\n\t\t}\n\n\t\t// Attach a `wp-container-content` id-based classname.\n\t\tconst className = classnames( props?.className, {\n\t\t\t[ `wp-container-content-${ id }` ]:\n\t\t\t\tshouldRenderChildLayoutStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t} );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRenderChildLayoutStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal( <style>{ css }</style>, element ) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withChildLayoutStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-child-layout-styles',\n\twithChildLayoutStyles\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/layout/with-inspector-controls',\n\twithInspectorControls\n);\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -23,6 +22,7 @@ import { addFilter } from '@wordpress/hooks';
|
|
|
23
22
|
import BlockList from '../components/block-list';
|
|
24
23
|
import useSetting from '../components/use-setting';
|
|
25
24
|
import InspectorControls from '../components/inspector-controls';
|
|
25
|
+
import useBlockDisplayInformation from '../components/use-block-display-information';
|
|
26
26
|
import { cleanEmptyObject } from './utils';
|
|
27
27
|
import { unlock } from '../lock-unlock';
|
|
28
28
|
import { store as blockEditorStore } from '../store';
|
|
@@ -214,21 +214,25 @@ export function PositionPanel(props) {
|
|
|
214
214
|
const allowSticky = hasStickyPositionSupport(blockName);
|
|
215
215
|
const value = style?.position?.type;
|
|
216
216
|
const {
|
|
217
|
-
|
|
217
|
+
firstParentClientId
|
|
218
218
|
} = useSelect(select => {
|
|
219
219
|
const {
|
|
220
220
|
getBlockParents
|
|
221
221
|
} = select(blockEditorStore);
|
|
222
222
|
const parents = getBlockParents(clientId);
|
|
223
223
|
return {
|
|
224
|
-
|
|
224
|
+
firstParentClientId: parents[parents.length - 1]
|
|
225
225
|
};
|
|
226
226
|
}, [clientId]);
|
|
227
|
+
const blockInformation = useBlockDisplayInformation(firstParentClientId);
|
|
228
|
+
const stickyHelpText = allowSticky && value === STICKY_OPTION.value && blockInformation ? sprintf(
|
|
229
|
+
/* translators: %s: the name of the parent block. */
|
|
230
|
+
__('The block will stick to the scrollable area of the parent %s block.'), blockInformation.title) : null;
|
|
227
231
|
const options = useMemo(() => {
|
|
228
|
-
const availableOptions = [DEFAULT_OPTION]; //
|
|
229
|
-
//
|
|
232
|
+
const availableOptions = [DEFAULT_OPTION]; // Display options if they are allowed, or if a block already has a valid value set.
|
|
233
|
+
// This allows for a block to be switched off from a position type that is not allowed.
|
|
230
234
|
|
|
231
|
-
if (allowSticky
|
|
235
|
+
if (allowSticky || value === STICKY_OPTION.value) {
|
|
232
236
|
availableOptions.push(STICKY_OPTION);
|
|
233
237
|
}
|
|
234
238
|
|
|
@@ -237,7 +241,7 @@ export function PositionPanel(props) {
|
|
|
237
241
|
}
|
|
238
242
|
|
|
239
243
|
return availableOptions;
|
|
240
|
-
}, [allowFixed, allowSticky,
|
|
244
|
+
}, [allowFixed, allowSticky, value]);
|
|
241
245
|
|
|
242
246
|
const onChangeType = next => {
|
|
243
247
|
// For now, use a hard-coded `0px` value for the position.
|
|
@@ -261,7 +265,9 @@ export function PositionPanel(props) {
|
|
|
261
265
|
web: options.length > 1 ? createElement(InspectorControls, {
|
|
262
266
|
group: "position"
|
|
263
267
|
}, createElement(BaseControl, {
|
|
264
|
-
className: "block-editor-hooks__position-selection"
|
|
268
|
+
className: "block-editor-hooks__position-selection",
|
|
269
|
+
__nextHasNoMarginBottom: true,
|
|
270
|
+
help: stickyHelpText
|
|
265
271
|
}, createElement(CustomSelectControl, {
|
|
266
272
|
__nextUnconstrainedWidth: true,
|
|
267
273
|
__next36pxDefaultSize: true,
|
|
@@ -297,11 +303,13 @@ export const withInspectorControls = createHigherOrderComponent(BlockEdit => pro
|
|
|
297
303
|
} = props;
|
|
298
304
|
const positionSupport = hasBlockSupport(blockName, POSITION_SUPPORT_KEY);
|
|
299
305
|
const showPositionControls = positionSupport && !useIsPositionDisabled(props);
|
|
300
|
-
return [showPositionControls && createElement(PositionPanel,
|
|
301
|
-
key: "position"
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
306
|
+
return [showPositionControls && createElement(PositionPanel, {
|
|
307
|
+
key: "position",
|
|
308
|
+
...props
|
|
309
|
+
}), createElement(BlockEdit, {
|
|
310
|
+
key: "edit",
|
|
311
|
+
...props
|
|
312
|
+
})];
|
|
305
313
|
}, 'withInspectorControls');
|
|
306
314
|
/**
|
|
307
315
|
* Override the default block element to add the position styles.
|
|
@@ -338,9 +346,9 @@ export const withPositionStyles = createHigherOrderComponent(BlockListBlock => p
|
|
|
338
346
|
// Only attach a container class if there is generated CSS to be attached.
|
|
339
347
|
[`is-position-${attributes?.style?.position?.type}`]: allowPositionStyles && !!css && !!attributes?.style?.position?.type
|
|
340
348
|
});
|
|
341
|
-
return createElement(Fragment, null, allowPositionStyles && element && !!css && createPortal(createElement("style", null, css), element), createElement(BlockListBlock,
|
|
349
|
+
return createElement(Fragment, null, allowPositionStyles && element && !!css && createPortal(createElement("style", null, css), element), createElement(BlockListBlock, { ...props,
|
|
342
350
|
className: className
|
|
343
|
-
}))
|
|
351
|
+
}));
|
|
344
352
|
}, 'withPositionStyles');
|
|
345
353
|
addFilter('editor.BlockListBlock', 'core/editor/position/with-position-styles', withPositionStyles);
|
|
346
354
|
addFilter('editor.BlockEdit', 'core/editor/position/with-inspector-controls', withInspectorControls);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/position.js"],"names":["classnames","__","_x","sprintf","getBlockSupport","hasBlockSupport","BaseControl","privateApis","componentsPrivateApis","createHigherOrderComponent","useInstanceId","useSelect","useContext","useMemo","createPortal","Platform","addFilter","BlockList","useSetting","InspectorControls","cleanEmptyObject","unlock","store","blockEditorStore","CustomSelectControl","POSITION_SUPPORT_KEY","OPTION_CLASSNAME","DEFAULT_OPTION","key","value","name","className","STICKY_OPTION","__experimentalHint","FIXED_OPTION","POSITION_SIDES","VALID_POSITION_TYPES","getPositionCSS","selector","style","output","type","positionType","position","includes","forEach","side","undefined","hasStickyPositionSupport","blockType","support","sticky","hasFixedPositionSupport","fixed","hasPositionSupport","hasPositionValue","props","attributes","hasStickyOrFixedPositionValue","resetPosition","setAttributes","top","right","bottom","left","useIsPositionDisabled","blockName","allowFixed","allowSticky","isDisabled","PositionPanel","clientId","hasParents","select","getBlockParents","parents","length","options","availableOptions","push","onChangeType","next","placementValue","newStyle","selectedOption","find","option","web","selectedItem","native","withInspectorControls","BlockEdit","positionSupport","showPositionControls","withPositionStyles","BlockListBlock","hasPositionBlockSupport","allowPositionStyles","id","element","__unstableElementContext","positionSelector","css"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SACCC,WADD,EAECC,WAAW,IAAIC,qBAFhB,QAGO,uBAHP;AAIA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,UADD,EAECC,OAFD,EAGCC,YAHD,EAICC,QAJD,QAKO,oBALP;AAMA,SAASC,SAAT,QAA0B,kBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,0BAAtB;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,SAASC,gBAAT,QAAiC,SAAjC;AACA,S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names from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport {\n\tBaseControl,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tuseContext,\n\tuseMemo,\n\tcreatePortal,\n\tPlatform,\n} from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../components/block-list';\nimport useSetting from '../components/use-setting';\nimport InspectorControls from '../components/inspector-controls';\nimport { cleanEmptyObject } from './utils';\nimport { unlock } from '../lock-unlock';\nimport { store as blockEditorStore } from '../store';\n\nconst { CustomSelectControl } = unlock( componentsPrivateApis );\n\nconst POSITION_SUPPORT_KEY = 'position';\n\nconst OPTION_CLASSNAME =\n\t'block-editor-hooks__position-selection__select-control__option';\n\nconst DEFAULT_OPTION = {\n\tkey: 'default',\n\tvalue: '',\n\tname: __( 'Default' ),\n\tclassName: OPTION_CLASSNAME,\n};\n\nconst STICKY_OPTION = {\n\tkey: 'sticky',\n\tvalue: 'sticky',\n\tname: _x( 'Sticky', 'Name for the value of the CSS position property' ),\n\tclassName: OPTION_CLASSNAME,\n\t__experimentalHint: __(\n\t\t'The block will stick to the top of the window instead of scrolling.'\n\t),\n};\n\nconst FIXED_OPTION = {\n\tkey: 'fixed',\n\tvalue: 'fixed',\n\tname: _x( 'Fixed', 'Name for the value of the CSS position property' ),\n\tclassName: OPTION_CLASSNAME,\n\t__experimentalHint: __(\n\t\t'The block will not move when the page is scrolled.'\n\t),\n};\n\nconst POSITION_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nconst VALID_POSITION_TYPES = [ 'sticky', 'fixed' ];\n\n/**\n * Get calculated position CSS.\n *\n * @param {Object} props Component props.\n * @param {string} props.selector Selector to use.\n * @param {Object} props.style Style object.\n * @return {string} The generated CSS rules.\n */\nexport function getPositionCSS( { selector, style } ) {\n\tlet output = '';\n\n\tconst { type: positionType } = style?.position || {};\n\n\tif ( ! VALID_POSITION_TYPES.includes( positionType ) ) {\n\t\treturn output;\n\t}\n\n\toutput += `${ selector } {`;\n\toutput += `position: ${ positionType };`;\n\n\tPOSITION_SIDES.forEach( ( side ) => {\n\t\tif ( style?.position?.[ side ] !== undefined ) {\n\t\t\toutput += `${ side }: ${ style.position[ side ] };`;\n\t\t}\n\t} );\n\n\tif ( positionType === 'sticky' || positionType === 'fixed' ) {\n\t\t// TODO: Replace hard-coded z-index value with a z-index preset approach in theme.json.\n\t\toutput += `z-index: 10`;\n\t}\n\toutput += `}`;\n\n\treturn output;\n}\n\n/**\n * Determines if there is sticky position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasStickyPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.sticky );\n}\n\n/**\n * Determines if there is fixed position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasFixedPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.fixed );\n}\n\n/**\n * Determines if there is position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! support;\n}\n\n/**\n * Checks if there is a current value in the position block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a position value set.\n */\nexport function hasPositionValue( props ) {\n\treturn props.attributes.style?.position?.type !== undefined;\n}\n\n/**\n * Checks if the block is currently set to a sticky or fixed position.\n * This check is helpful for determining how to position block toolbars or other elements.\n *\n * @param {Object} attributes Block attributes.\n * @return {boolean} Whether or not the block is set to a sticky or fixed position.\n */\nexport function hasStickyOrFixedPositionValue( attributes ) {\n\tconst positionType = attributes.style?.position?.type;\n\treturn positionType === 'sticky' || positionType === 'fixed';\n}\n\n/**\n * Resets the position block support attributes. This can be used when disabling\n * the position support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetPosition( { attributes = {}, setAttributes } ) {\n\tconst { style = {} } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: undefined,\n\t\t\t\ttop: undefined,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t\tleft: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if position settings have been disabled.\n *\n * @param {string} name The name of the block.\n *\n * @return {boolean} Whether padding setting is disabled.\n */\nexport function useIsPositionDisabled( { name: blockName } = {} ) {\n\tconst allowFixed = useSetting( 'position.fixed' );\n\tconst allowSticky = useSetting( 'position.sticky' );\n\tconst isDisabled = ! allowFixed && ! allowSticky;\n\n\treturn ! hasPositionSupport( blockName ) || isDisabled;\n}\n\n/*\n * Position controls rendered in an inspector control panel.\n *\n * @param {Object} props\n *\n * @return {WPElement} Position panel.\n */\nexport function PositionPanel( props ) {\n\tconst {\n\t\tattributes: { style = {} },\n\t\tclientId,\n\t\tname: blockName,\n\t\tsetAttributes,\n\t} = props;\n\n\tconst allowFixed = hasFixedPositionSupport( blockName );\n\tconst allowSticky = hasStickyPositionSupport( blockName );\n\tconst value = style?.position?.type;\n\n\tconst { hasParents } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParents } = select( blockEditorStore );\n\t\t\tconst parents = getBlockParents( clientId );\n\t\t\treturn {\n\t\t\t\thasParents: parents.length,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst options = useMemo( () => {\n\t\tconst availableOptions = [ DEFAULT_OPTION ];\n\t\t// Only display sticky option if the block has no parents (is at the root of the document),\n\t\t// or if the block already has a sticky position value set.\n\t\tif (\n\t\t\t( allowSticky && ! hasParents ) ||\n\t\t\tvalue === STICKY_OPTION.value\n\t\t) {\n\t\t\tavailableOptions.push( STICKY_OPTION );\n\t\t}\n\t\tif ( allowFixed || value === FIXED_OPTION.value ) {\n\t\t\tavailableOptions.push( FIXED_OPTION );\n\t\t}\n\t\treturn availableOptions;\n\t}, [ allowFixed, allowSticky, hasParents, value ] );\n\n\tconst onChangeType = ( next ) => {\n\t\t// For now, use a hard-coded `0px` value for the position.\n\t\t// `0px` is preferred over `0` as it can be used in `calc()` functions.\n\t\t// In the future, it could be useful to allow for an offset value.\n\t\tconst placementValue = '0px';\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: next,\n\t\t\t\ttop:\n\t\t\t\t\tnext === 'sticky' || next === 'fixed'\n\t\t\t\t\t\t? placementValue\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tconst selectedOption = value\n\t\t? options.find( ( option ) => option.value === value ) || DEFAULT_OPTION\n\t\t: DEFAULT_OPTION;\n\n\t// Only display position controls if there is at least one option to choose from.\n\treturn Platform.select( {\n\t\tweb:\n\t\t\toptions.length > 1 ? (\n\t\t\t\t<InspectorControls group=\"position\">\n\t\t\t\t\t<BaseControl className=\"block-editor-hooks__position-selection\">\n\t\t\t\t\t\t<CustomSelectControl\n\t\t\t\t\t\t\t__nextUnconstrainedWidth\n\t\t\t\t\t\t\t__next36pxDefaultSize\n\t\t\t\t\t\t\tclassName=\"block-editor-hooks__position-selection__select-control\"\n\t\t\t\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tdescribedBy={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Currently selected position.\n\t\t\t\t\t\t\t\t__( 'Currently selected position: %s' ),\n\t\t\t\t\t\t\t\tselectedOption.name\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\tvalue={ selectedOption }\n\t\t\t\t\t\t\t__experimentalShowSelectedHint\n\t\t\t\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\t\t\t\tonChangeType( selectedItem.value );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</InspectorControls>\n\t\t\t) : null,\n\t\tnative: null,\n\t} );\n}\n\n/**\n * Override the default edit UI to include position controls.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withInspectorControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { name: blockName } = props;\n\t\tconst positionSupport = hasBlockSupport(\n\t\t\tblockName,\n\t\t\tPOSITION_SUPPORT_KEY\n\t\t);\n\t\tconst showPositionControls =\n\t\t\tpositionSupport && ! useIsPositionDisabled( props );\n\n\t\treturn [\n\t\t\tshowPositionControls && (\n\t\t\t\t<PositionPanel key=\"position\" { ...props } />\n\t\t\t),\n\t\t\t<BlockEdit key=\"edit\" { ...props } />,\n\t\t];\n\t},\n\t'withInspectorControls'\n);\n\n/**\n * Override the default block element to add the position styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withPositionStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst hasPositionBlockSupport = hasBlockSupport(\n\t\t\tname,\n\t\t\tPOSITION_SUPPORT_KEY\n\t\t);\n\t\tconst allowPositionStyles =\n\t\t\thasPositionBlockSupport && ! useIsPositionDisabled( props );\n\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\t// Higher specificity to override defaults in editor UI.\n\t\tconst positionSelector = `.wp-container-${ id }.wp-container-${ id }`;\n\n\t\t// Get CSS string for the current position values.\n\t\tlet css;\n\t\tif ( allowPositionStyles ) {\n\t\t\tcss =\n\t\t\t\tgetPositionCSS( {\n\t\t\t\t\tselector: positionSelector,\n\t\t\t\t\tstyle: attributes?.style,\n\t\t\t\t} ) || '';\n\t\t}\n\n\t\t// Attach a `wp-container-` id-based class name.\n\t\tconst className = classnames( props?.className, {\n\t\t\t[ `wp-container-${ id }` ]: allowPositionStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t\t[ `is-position-${ attributes?.style?.position?.type }` ]:\n\t\t\t\tallowPositionStyles &&\n\t\t\t\t!! css &&\n\t\t\t\t!! attributes?.style?.position?.type,\n\t\t} );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ allowPositionStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal( <style>{ css }</style>, element ) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withPositionStyles'\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/position/with-position-styles',\n\twithPositionStyles\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/position/with-inspector-controls',\n\twithInspectorControls\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/position.js"],"names":["classnames","__","_x","sprintf","getBlockSupport","hasBlockSupport","BaseControl","privateApis","componentsPrivateApis","createHigherOrderComponent","useInstanceId","useSelect","useContext","useMemo","createPortal","Platform","addFilter","BlockList","useSetting","InspectorControls","useBlockDisplayInformation","cleanEmptyObject","unlock","store","blockEditorStore","CustomSelectControl","POSITION_SUPPORT_KEY","OPTION_CLASSNAME","DEFAULT_OPTION","key","value","name","className","STICKY_OPTION","__experimentalHint","FIXED_OPTION","POSITION_SIDES","VALID_POSITION_TYPES","getPositionCSS","selector","style","output","type","positionType","position","includes","forEach","side","undefined","hasStickyPositionSupport","blockType","support","sticky","hasFixedPositionSupport","fixed","hasPositionSupport","hasPositionValue","props","attributes","hasStickyOrFixedPositionValue","resetPosition","setAttributes","top","right","bottom","left","useIsPositionDisabled","blockName","allowFixed","allowSticky","isDisabled","PositionPanel","clientId","firstParentClientId","select","getBlockParents","parents","length","blockInformation","stickyHelpText","title","options","availableOptions","push","onChangeType","next","placementValue","newStyle","selectedOption","find","option","web","selectedItem","native","withInspectorControls","BlockEdit","positionSupport","showPositionControls","withPositionStyles","BlockListBlock","hasPositionBlockSupport","allowPositionStyles","id","element","__unstableElementContext","positionSelector","css"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SACCC,WADD,EAECC,WAAW,IAAIC,qBAFhB,QAGO,uBAHP;AAIA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,UADD,EAECC,OAFD,EAGCC,YAHD,EAICC,QAJD,QAKO,oBALP;AAMA,SAASC,SAAT,QAA0B,kBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,0BAAtB;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,OAAOC,0BAAP,MAAuC,6CAAvC;AACA,SAASC,gBAAT,QAAiC,SAAjC;AACA,SAASC,MAAT,QAAuB,gBAAvB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAA0BH,MAAM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D,CADD;AASA,CA5C0D,EA6C3D,oBA7C2D,CAArD;AAgDPhB,SAAS,CACR,uBADQ,EAER,2CAFQ,EAGRkF,kBAHQ,CAAT;AAKAlF,SAAS,CACR,kBADQ,EAER,8CAFQ,EAGR8E,qBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport {\n\tBaseControl,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tuseContext,\n\tuseMemo,\n\tcreatePortal,\n\tPlatform,\n} from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../components/block-list';\nimport useSetting from '../components/use-setting';\nimport InspectorControls from '../components/inspector-controls';\nimport useBlockDisplayInformation from '../components/use-block-display-information';\nimport { cleanEmptyObject } from './utils';\nimport { unlock } from '../lock-unlock';\nimport { store as blockEditorStore } from '../store';\n\nconst { CustomSelectControl } = unlock( componentsPrivateApis );\n\nconst POSITION_SUPPORT_KEY = 'position';\n\nconst OPTION_CLASSNAME =\n\t'block-editor-hooks__position-selection__select-control__option';\n\nconst DEFAULT_OPTION = {\n\tkey: 'default',\n\tvalue: '',\n\tname: __( 'Default' ),\n\tclassName: OPTION_CLASSNAME,\n};\n\nconst STICKY_OPTION = {\n\tkey: 'sticky',\n\tvalue: 'sticky',\n\tname: _x( 'Sticky', 'Name for the value of the CSS position property' ),\n\tclassName: OPTION_CLASSNAME,\n\t__experimentalHint: __(\n\t\t'The block will stick to the top of the window instead of scrolling.'\n\t),\n};\n\nconst FIXED_OPTION = {\n\tkey: 'fixed',\n\tvalue: 'fixed',\n\tname: _x( 'Fixed', 'Name for the value of the CSS position property' ),\n\tclassName: OPTION_CLASSNAME,\n\t__experimentalHint: __(\n\t\t'The block will not move when the page is scrolled.'\n\t),\n};\n\nconst POSITION_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nconst VALID_POSITION_TYPES = [ 'sticky', 'fixed' ];\n\n/**\n * Get calculated position CSS.\n *\n * @param {Object} props Component props.\n * @param {string} props.selector Selector to use.\n * @param {Object} props.style Style object.\n * @return {string} The generated CSS rules.\n */\nexport function getPositionCSS( { selector, style } ) {\n\tlet output = '';\n\n\tconst { type: positionType } = style?.position || {};\n\n\tif ( ! VALID_POSITION_TYPES.includes( positionType ) ) {\n\t\treturn output;\n\t}\n\n\toutput += `${ selector } {`;\n\toutput += `position: ${ positionType };`;\n\n\tPOSITION_SIDES.forEach( ( side ) => {\n\t\tif ( style?.position?.[ side ] !== undefined ) {\n\t\t\toutput += `${ side }: ${ style.position[ side ] };`;\n\t\t}\n\t} );\n\n\tif ( positionType === 'sticky' || positionType === 'fixed' ) {\n\t\t// TODO: Replace hard-coded z-index value with a z-index preset approach in theme.json.\n\t\toutput += `z-index: 10`;\n\t}\n\toutput += `}`;\n\n\treturn output;\n}\n\n/**\n * Determines if there is sticky position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasStickyPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.sticky );\n}\n\n/**\n * Determines if there is fixed position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasFixedPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.fixed );\n}\n\n/**\n * Determines if there is position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! support;\n}\n\n/**\n * Checks if there is a current value in the position block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a position value set.\n */\nexport function hasPositionValue( props ) {\n\treturn props.attributes.style?.position?.type !== undefined;\n}\n\n/**\n * Checks if the block is currently set to a sticky or fixed position.\n * This check is helpful for determining how to position block toolbars or other elements.\n *\n * @param {Object} attributes Block attributes.\n * @return {boolean} Whether or not the block is set to a sticky or fixed position.\n */\nexport function hasStickyOrFixedPositionValue( attributes ) {\n\tconst positionType = attributes.style?.position?.type;\n\treturn positionType === 'sticky' || positionType === 'fixed';\n}\n\n/**\n * Resets the position block support attributes. This can be used when disabling\n * the position support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetPosition( { attributes = {}, setAttributes } ) {\n\tconst { style = {} } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: undefined,\n\t\t\t\ttop: undefined,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t\tleft: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if position settings have been disabled.\n *\n * @param {string} name The name of the block.\n *\n * @return {boolean} Whether padding setting is disabled.\n */\nexport function useIsPositionDisabled( { name: blockName } = {} ) {\n\tconst allowFixed = useSetting( 'position.fixed' );\n\tconst allowSticky = useSetting( 'position.sticky' );\n\tconst isDisabled = ! allowFixed && ! allowSticky;\n\n\treturn ! hasPositionSupport( blockName ) || isDisabled;\n}\n\n/*\n * Position controls rendered in an inspector control panel.\n *\n * @param {Object} props\n *\n * @return {WPElement} Position panel.\n */\nexport function PositionPanel( props ) {\n\tconst {\n\t\tattributes: { style = {} },\n\t\tclientId,\n\t\tname: blockName,\n\t\tsetAttributes,\n\t} = props;\n\n\tconst allowFixed = hasFixedPositionSupport( blockName );\n\tconst allowSticky = hasStickyPositionSupport( blockName );\n\tconst value = style?.position?.type;\n\n\tconst { firstParentClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParents } = select( blockEditorStore );\n\t\t\tconst parents = getBlockParents( clientId );\n\t\t\treturn { firstParentClientId: parents[ parents.length - 1 ] };\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst blockInformation = useBlockDisplayInformation( firstParentClientId );\n\tconst stickyHelpText =\n\t\tallowSticky && value === STICKY_OPTION.value && blockInformation\n\t\t\t? sprintf(\n\t\t\t\t\t/* translators: %s: the name of the parent block. */\n\t\t\t\t\t__(\n\t\t\t\t\t\t'The block will stick to the scrollable area of the parent %s block.'\n\t\t\t\t\t),\n\t\t\t\t\tblockInformation.title\n\t\t\t )\n\t\t\t: null;\n\n\tconst options = useMemo( () => {\n\t\tconst availableOptions = [ DEFAULT_OPTION ];\n\t\t// Display options if they are allowed, or if a block already has a valid value set.\n\t\t// This allows for a block to be switched off from a position type that is not allowed.\n\t\tif ( allowSticky || value === STICKY_OPTION.value ) {\n\t\t\tavailableOptions.push( STICKY_OPTION );\n\t\t}\n\t\tif ( allowFixed || value === FIXED_OPTION.value ) {\n\t\t\tavailableOptions.push( FIXED_OPTION );\n\t\t}\n\t\treturn availableOptions;\n\t}, [ allowFixed, allowSticky, value ] );\n\n\tconst onChangeType = ( next ) => {\n\t\t// For now, use a hard-coded `0px` value for the position.\n\t\t// `0px` is preferred over `0` as it can be used in `calc()` functions.\n\t\t// In the future, it could be useful to allow for an offset value.\n\t\tconst placementValue = '0px';\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: next,\n\t\t\t\ttop:\n\t\t\t\t\tnext === 'sticky' || next === 'fixed'\n\t\t\t\t\t\t? placementValue\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tconst selectedOption = value\n\t\t? options.find( ( option ) => option.value === value ) || DEFAULT_OPTION\n\t\t: DEFAULT_OPTION;\n\n\t// Only display position controls if there is at least one option to choose from.\n\treturn Platform.select( {\n\t\tweb:\n\t\t\toptions.length > 1 ? (\n\t\t\t\t<InspectorControls group=\"position\">\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\tclassName=\"block-editor-hooks__position-selection\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\thelp={ stickyHelpText }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CustomSelectControl\n\t\t\t\t\t\t\t__nextUnconstrainedWidth\n\t\t\t\t\t\t\t__next36pxDefaultSize\n\t\t\t\t\t\t\tclassName=\"block-editor-hooks__position-selection__select-control\"\n\t\t\t\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tdescribedBy={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Currently selected position.\n\t\t\t\t\t\t\t\t__( 'Currently selected position: %s' ),\n\t\t\t\t\t\t\t\tselectedOption.name\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\tvalue={ selectedOption }\n\t\t\t\t\t\t\t__experimentalShowSelectedHint\n\t\t\t\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\t\t\t\tonChangeType( selectedItem.value );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</InspectorControls>\n\t\t\t) : null,\n\t\tnative: null,\n\t} );\n}\n\n/**\n * Override the default edit UI to include position controls.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withInspectorControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { name: blockName } = props;\n\t\tconst positionSupport = hasBlockSupport(\n\t\t\tblockName,\n\t\t\tPOSITION_SUPPORT_KEY\n\t\t);\n\t\tconst showPositionControls =\n\t\t\tpositionSupport && ! useIsPositionDisabled( props );\n\n\t\treturn [\n\t\t\tshowPositionControls && (\n\t\t\t\t<PositionPanel key=\"position\" { ...props } />\n\t\t\t),\n\t\t\t<BlockEdit key=\"edit\" { ...props } />,\n\t\t];\n\t},\n\t'withInspectorControls'\n);\n\n/**\n * Override the default block element to add the position styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withPositionStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst hasPositionBlockSupport = hasBlockSupport(\n\t\t\tname,\n\t\t\tPOSITION_SUPPORT_KEY\n\t\t);\n\t\tconst allowPositionStyles =\n\t\t\thasPositionBlockSupport && ! useIsPositionDisabled( props );\n\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\t// Higher specificity to override defaults in editor UI.\n\t\tconst positionSelector = `.wp-container-${ id }.wp-container-${ id }`;\n\n\t\t// Get CSS string for the current position values.\n\t\tlet css;\n\t\tif ( allowPositionStyles ) {\n\t\t\tcss =\n\t\t\t\tgetPositionCSS( {\n\t\t\t\t\tselector: positionSelector,\n\t\t\t\t\tstyle: attributes?.style,\n\t\t\t\t} ) || '';\n\t\t}\n\n\t\t// Attach a `wp-container-` id-based class name.\n\t\tconst className = classnames( props?.className, {\n\t\t\t[ `wp-container-${ id }` ]: allowPositionStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t\t[ `is-position-${ attributes?.style?.position?.type }` ]:\n\t\t\t\tallowPositionStyles &&\n\t\t\t\t!! css &&\n\t\t\t\t!! attributes?.style?.position?.type,\n\t\t} );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ allowPositionStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal( <style>{ css }</style>, element ) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withPositionStyles'\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/position/with-position-styles',\n\twithPositionStyles\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/position/with-inspector-controls',\n\twithInspectorControls\n);\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -316,7 +315,12 @@ export function addEditProps(settings) {
|
|
|
316
315
|
export const withBlockControls = createHigherOrderComponent(BlockEdit => props => {
|
|
317
316
|
const shouldDisplayControls = useDisplayBlockControls();
|
|
318
317
|
const blockEditingMode = useBlockEditingMode();
|
|
319
|
-
return createElement(Fragment, null, shouldDisplayControls && blockEditingMode === 'default' && createElement(Fragment, null, createElement(ColorEdit,
|
|
318
|
+
return createElement(Fragment, null, shouldDisplayControls && blockEditingMode === 'default' && createElement(Fragment, null, createElement(ColorEdit, { ...props
|
|
319
|
+
}), createElement(TypographyPanel, { ...props
|
|
320
|
+
}), createElement(BorderPanel, { ...props
|
|
321
|
+
}), createElement(DimensionsPanel, { ...props
|
|
322
|
+
})), createElement(BlockEdit, { ...props
|
|
323
|
+
}));
|
|
320
324
|
}, 'withToolbarControls');
|
|
321
325
|
/**
|
|
322
326
|
* Override the default block element to include elements styles.
|
|
@@ -360,9 +364,9 @@ const withElementsStyles = createHigherOrderComponent(BlockListBlock => props =>
|
|
|
360
364
|
dangerouslySetInnerHTML: {
|
|
361
365
|
__html: styles
|
|
362
366
|
}
|
|
363
|
-
}), element), createElement(BlockListBlock,
|
|
367
|
+
}), element), createElement(BlockListBlock, { ...props,
|
|
364
368
|
className: props.attributes.style?.elements ? classnames(props.className, blockElementsContainerIdentifier) : props.className
|
|
365
|
-
}))
|
|
369
|
+
}));
|
|
366
370
|
}, 'withElementsStyles');
|
|
367
371
|
addFilter('blocks.registerBlockType', 'core/style/addAttribute', addAttribute);
|
|
368
372
|
addFilter('blocks.getSaveContent.extraProps', 'core/style/addSaveProps', addSaveProps);
|