@wordpress/block-editor 14.4.0 → 14.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +4 -8
- package/build/autocompleters/block.js +13 -5
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/background-image-control/index.js +1 -1
- package/build/components/background-image-control/index.js.map +1 -1
- package/build/components/block-canvas/index.js +10 -0
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-card/index.js +2 -2
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-controls/slot.js.map +1 -1
- package/build/components/block-controls/slot.native.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.js +1 -1
- package/build/components/block-draggable/draggable-chip.js.map +1 -1
- package/build/components/block-full-height-alignment-control/index.js +1 -1
- package/build/components/block-full-height-alignment-control/index.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.native.js +1 -1
- package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block.js +1 -1
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +1 -7
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +6 -5
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +1 -2
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -3
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +11 -6
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +1 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list/zoom-out-separator.js +10 -7
- package/build/components/block-list/zoom-out-separator.js.map +1 -1
- package/build/components/block-lock/modal.js +1 -1
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-parent-selector/index.js +1 -1
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +1 -1
- package/build/components/block-patterns-paging/index.js.map +1 -1
- package/build/components/block-popover/index.js +1 -1
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/auto.js +1 -4
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +2 -2
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-rename/modal.js +2 -2
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js +1 -1
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +5 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu/index.js +4 -3
- package/build/components/block-settings-menu/index.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build/components/block-switcher/index.js +2 -1
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/use-transformed-patterns.js +1 -0
- package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build/components/block-switcher/utils.js +1 -0
- package/build/components/block-switcher/utils.js.map +1 -1
- package/build/components/block-toolbar/change-design.js +122 -0
- package/build/components/block-toolbar/change-design.js.map +1 -0
- package/build/components/block-toolbar/index.js +19 -7
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/index.js +4 -17
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +4 -3
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +4 -6
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +20 -29
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-types-list/index.js.map +1 -1
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +3 -2
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/block-vertical-alignment-control/ui.js +6 -10
- package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/border-radius-control/linked-button.js +7 -10
- package/build/components/border-radius-control/linked-button.js.map +1 -1
- package/build/components/border-radius-control/utils.js.map +1 -1
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/collab/block-comment-icon-slot.js +18 -0
- package/build/components/collab/block-comment-icon-slot.js.map +1 -0
- package/build/components/collab/block-comment-icon-toolbar-slot.js +18 -0
- package/build/components/collab/block-comment-icon-toolbar-slot.js.map +1 -0
- package/build/components/color-style-selector/index.js.map +1 -1
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.native.js.map +1 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +4 -4
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build/components/date-format-picker/index.js +1 -0
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/duotone/utils.js.map +1 -1
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +1 -4
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +2 -1
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-context.native.js +6 -0
- package/build/components/global-styles/use-global-styles-context.native.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/gradients/use-gradient.js.map +1 -1
- package/build/components/grid/grid-item-movers.js.map +1 -1
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/iframe/index.js +46 -11
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +1 -1
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-size-control/index.js +61 -20
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +9 -5
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +15 -8
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +2 -2
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/category-tabs/index.js +16 -12
- package/build/components/inserter/category-tabs/index.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +1 -1
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build/components/inserter/media-tab/utils.js.map +1 -1
- package/build/components/inserter/menu.js +8 -3
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +1 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-results.js +1 -1
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.native.js.map +1 -1
- package/build/components/inserter-button/index.native.js +1 -1
- package/build/components/inserter-button/index.native.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls/slot.native.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +0 -2
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/utils.js +3 -6
- package/build/components/inspector-controls-tabs/utils.js.map +1 -1
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/is-url-like.js.map +1 -1
- package/build/components/link-control/link-preview.js +12 -9
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-create-button.js +1 -1
- package/build/components/link-control/search-create-button.js.map +1 -1
- package/build/components/link-control/search-input.js +3 -5
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/search-results.js +5 -15
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/link-control/use-rich-url-data.js.map +1 -1
- package/build/components/list-view/appender.js +5 -4
- package/build/components/list-view/appender.js.map +1 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +6 -5
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js +1 -2
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +2 -2
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/list-view/utils.js +1 -1
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +1 -1
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +2 -2
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/observe-typing/index.js +1 -0
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/provider/index.js +1 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/recursion-provider/index.js +1 -0
- package/build/components/recursion-provider/index.js.map +1 -1
- package/build/components/responsive-block-control/index.js +3 -3
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/responsive-block-control/label.js +1 -1
- package/build/components/responsive-block-control/label.js.map +1 -1
- package/build/components/rich-text/content.js.map +1 -1
- package/build/components/rich-text/event-listeners/index.js +3 -1
- package/build/components/rich-text/event-listeners/index.js.map +1 -1
- package/build/components/rich-text/file-paste-handler.native.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.native.js.map +1 -1
- package/build/components/rich-text/index.js +3 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +2 -6
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/multiline.js.map +1 -1
- package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/native/use-format-types.js +1 -0
- package/build/components/rich-text/native/use-format-types.js.map +1 -1
- package/build/components/rich-text/toolbar-button.js.map +1 -1
- package/build/components/rich-text/use-format-types.js +1 -0
- package/build/components/rich-text/use-format-types.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +2 -2
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -3
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/spacing-sizes-control/linked-button.js +1 -5
- package/build/components/spacing-sizes-control/linked-button.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +1 -0
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/tool-selector/index.js +8 -5
- package/build/components/tool-selector/index.js.map +1 -1
- package/build/components/typewriter/index.js +1 -0
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/unsupported-block-details/index.native.js.map +1 -1
- package/build/components/url-input/index.js +1 -1
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-commands/index.js +1 -1
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +5 -5
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.native.js +0 -1
- package/build/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build/components/use-flash-editable-blocks/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +1 -3
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +1 -2
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/use-settings/index.js +1 -3
- package/build/components/use-settings/index.js.map +1 -1
- package/build/components/writing-flow/index.js +5 -3
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +20 -5
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/block-bindings.js +19 -8
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/block-hooks.js +1 -1
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-style-variation.js.map +1 -1
- package/build/hooks/contrast-checker.js +0 -1
- package/build/hooks/contrast-checker.js.map +1 -1
- package/build/hooks/duotone.js +2 -2
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/generated-class-name.js +1 -0
- package/build/hooks/generated-class-name.js.map +1 -1
- package/build/hooks/grid-visualizer.js +13 -11
- package/build/hooks/grid-visualizer.js.map +1 -1
- package/build/hooks/layout-child.js +41 -3
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +1 -1
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/spacing-visualizer.js.map +1 -1
- package/build/hooks/style.js +4 -1
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/text-align.js.map +1 -1
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/hooks/use-zoom-out.js +17 -18
- package/build/hooks/use-zoom-out.js.map +1 -1
- package/build/index.js +0 -7
- package/build/index.js.map +1 -1
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/grid.js.map +1 -1
- package/build/layouts/utils.js.map +1 -1
- package/build/private-apis.js +6 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +6 -38
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +1 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/private-actions.js +57 -8
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +9 -21
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +18 -24
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +66 -22
- package/build/store/selectors.js.map +1 -1
- package/build/utils/block-bindings.js +9 -6
- package/build/utils/block-bindings.js.map +1 -1
- package/build/utils/dom.js +16 -1
- package/build/utils/dom.js.map +1 -1
- package/build/utils/get-font-styles-and-weights.js +2 -2
- package/build/utils/get-font-styles-and-weights.js.map +1 -1
- package/build/utils/object.js +1 -0
- package/build/utils/object.js.map +1 -1
- package/build/utils/pasting.js.map +1 -1
- package/build/utils/transform-styles/index.js +4 -3
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/autocompleters/block.js +15 -9
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/autocompleters/link.js +1 -3
- package/build-module/autocompleters/link.js.map +1 -1
- package/build-module/components/audio-player/index.native.js +1 -2
- package/build-module/components/audio-player/index.native.js.map +1 -1
- package/build-module/components/background-image-control/index.js +2 -3
- package/build-module/components/background-image-control/index.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +1 -2
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +1 -2
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-canvas/index.js +12 -3
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-card/index.js +4 -5
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-compare/block-view.js +1 -2
- package/build-module/components/block-compare/block-view.js.map +1 -1
- package/build-module/components/block-compare/index.js +1 -2
- package/build-module/components/block-compare/index.js.map +1 -1
- package/build-module/components/block-controls/fill.js +1 -3
- package/build-module/components/block-controls/fill.js.map +1 -1
- package/build-module/components/block-controls/slot.js.map +1 -1
- package/build-module/components/block-controls/slot.native.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.js +2 -3
- package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.native.js +1 -2
- package/build-module/components/block-draggable/draggable-chip.native.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +1 -3
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-edit/index.js +1 -2
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-edit/multiple-usage-warning.js +1 -2
- package/build-module/components/block-edit/multiple-usage-warning.js.map +1 -1
- package/build-module/components/block-full-height-alignment-control/index.js +1 -1
- package/build-module/components/block-full-height-alignment-control/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -3
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-crash-warning.js +1 -1
- package/build-module/components/block-list/block-crash-warning.js.map +1 -1
- package/build-module/components/block-list/block-crash-warning.native.js +1 -1
- package/build-module/components/block-list/block-crash-warning.native.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.js +1 -3
- package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.native.js +1 -1
- package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +1 -2
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-selection-button.native.js +1 -2
- package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
- package/build-module/components/block-list/block.js +2 -4
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +2 -9
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +7 -7
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/index.native.js +1 -3
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/insertion-point.native.js +1 -2
- package/build-module/components/block-list/insertion-point.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -2
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -3
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +11 -6
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list/zoom-out-separator.js +10 -7
- package/build-module/components/block-list/zoom-out-separator.js.map +1 -1
- package/build-module/components/block-lock/menu-item.js +1 -3
- package/build-module/components/block-lock/menu-item.js.map +1 -1
- package/build-module/components/block-lock/modal.js +2 -3
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +1 -3
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-media-update-progress/index.native.js +1 -2
- package/build-module/components/block-media-update-progress/index.native.js.map +1 -1
- package/build-module/components/block-mover/button.js +1 -3
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +1 -2
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +1 -2
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +1 -2
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +1 -1
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +1 -3
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +1 -2
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +1 -3
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +2 -3
- package/build-module/components/block-patterns-paging/index.js.map +1 -1
- package/build-module/components/block-popover/index.js +1 -1
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +2 -7
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +3 -4
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-quick-navigation/index.js +1 -2
- package/build-module/components/block-quick-navigation/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +1 -2
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js +3 -4
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-rename/rename-control.js +1 -3
- package/build-module/components/block-rename/rename-control.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +1 -3
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js +1 -1
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +6 -3
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu/index.js +5 -4
- package/build-module/components/block-settings-menu/index.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +1 -2
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +1 -2
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/menu-items.js +1 -2
- package/build-module/components/block-styles/menu-items.js.map +1 -1
- package/build-module/components/block-styles/preview.native.js +1 -2
- package/build-module/components/block-styles/preview.native.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.js +1 -3
- package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build-module/components/block-switcher/block-variation-transformations.js +1 -3
- package/build-module/components/block-switcher/block-variation-transformations.js.map +1 -1
- package/build-module/components/block-switcher/index.js +3 -4
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +1 -2
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/preview-block-popover.js +1 -2
- package/build-module/components/block-switcher/preview-block-popover.js.map +1 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js +1 -0
- package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build-module/components/block-switcher/utils.js +1 -0
- package/build-module/components/block-switcher/utils.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js +1 -2
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-toolbar/change-design.js +114 -0
- package/build-module/components/block-toolbar/change-design.js.map +1 -0
- package/build-module/components/block-toolbar/index.js +20 -10
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js +1 -3
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-tools/index.js +5 -19
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +5 -5
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +4 -6
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +20 -29
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-types-list/index.js +1 -2
- package/build-module/components/block-types-list/index.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +1 -2
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +1 -2
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/block-variation-picker/index.native.js +1 -2
- package/build-module/components/block-variation-picker/index.native.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +4 -4
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/block-vertical-alignment-control/ui.js +6 -10
- package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +1 -3
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/linked-button.js +8 -11
- package/build-module/components/border-radius-control/linked-button.js.map +1 -1
- package/build-module/components/border-radius-control/utils.js.map +1 -1
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/button-block-appender/index.native.js +1 -2
- package/build-module/components/button-block-appender/index.native.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +1 -3
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/collab/block-comment-icon-slot.js +11 -0
- package/build-module/components/collab/block-comment-icon-slot.js.map +1 -0
- package/build-module/components/collab/block-comment-icon-toolbar-slot.js +11 -0
- package/build-module/components/collab/block-comment-icon-toolbar-slot.js.map +1 -0
- package/build-module/components/color-style-selector/index.js.map +1 -1
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +1 -2
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +1 -3
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +1 -3
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.native.js +1 -3
- package/build-module/components/colors-gradients/panel-color-gradient-settings.native.js.map +1 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build-module/components/contrast-checker/index.native.js +1 -2
- package/build-module/components/contrast-checker/index.native.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.js +1 -3
- package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +5 -6
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +2 -2
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +1 -2
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/dimensions-tool/index.js +1 -3
- package/build-module/components/dimensions-tool/index.js.map +1 -1
- package/build-module/components/dimensions-tool/width-height-tool.js +1 -3
- package/build-module/components/dimensions-tool/width-height-tool.js.map +1 -1
- package/build-module/components/duotone/utils.js.map +1 -1
- 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/editor-styles/index.js +1 -3
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/floating-toolbar/index.native.js +1 -2
- package/build-module/components/floating-toolbar/index.native.js.map +1 -1
- package/build-module/components/floating-toolbar/nav-up-icon.js +1 -2
- package/build-module/components/floating-toolbar/nav-up-icon.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +2 -2
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +1 -2
- package/build-module/components/global-styles/advanced-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +1 -2
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +3 -7
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +1 -2
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +1 -2
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +2 -1
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +1 -2
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +1 -2
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +1 -2
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-context.native.js +6 -0
- package/build-module/components/global-styles/use-global-styles-context.native.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/gradients/use-gradient.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +1 -3
- package/build-module/components/grid/grid-item-movers.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/height-control/index.js +1 -2
- package/build-module/components/height-control/index.js.map +1 -1
- package/build-module/components/iframe/index.js +47 -14
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +1 -3
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/image-editor/cropper.js +1 -3
- package/build-module/components/image-editor/cropper.js.map +1 -1
- package/build-module/components/image-editor/form-controls.js +1 -3
- package/build-module/components/image-editor/form-controls.js.map +1 -1
- package/build-module/components/image-editor/index.js +1 -2
- package/build-module/components/image-editor/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +1 -1
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-link-destinations/index.native.js +1 -3
- package/build-module/components/image-link-destinations/index.native.js.map +1 -1
- package/build-module/components/image-size-control/index.js +63 -24
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +9 -5
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +16 -9
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js +1 -2
- package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/index.js +1 -2
- package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +2 -3
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +3 -5
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js +1 -3
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +3 -5
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +2 -4
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +1 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +1 -3
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/category-tabs/index.js +18 -15
- package/build-module/components/inserter/category-tabs/index.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/index.native.js +1 -3
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js +1 -2
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +2 -4
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-tab.js +1 -3
- package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build-module/components/inserter/media-tab/utils.js.map +1 -1
- package/build-module/components/inserter/menu.js +10 -7
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js +1 -3
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +1 -2
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build-module/components/inserter/no-results.js +1 -2
- package/build-module/components/inserter/no-results.js.map +1 -1
- package/build-module/components/inserter/no-results.native.js +1 -2
- package/build-module/components/inserter/no-results.native.js.map +1 -1
- package/build-module/components/inserter/panel.js +1 -3
- package/build-module/components/inserter/panel.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +1 -2
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -3
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-results.js +2 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.native.js.map +1 -1
- package/build-module/components/inserter-button/index.native.js +2 -3
- package/build-module/components/inserter-button/index.native.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +1 -2
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/inserter-listbox/index.js +1 -2
- package/build-module/components/inserter-listbox/index.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +1 -3
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls/slot.native.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +1 -4
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.js +1 -3
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +1 -3
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/utils.js +3 -6
- package/build-module/components/inspector-controls-tabs/utils.js.map +1 -1
- package/build-module/components/inspector-popover-header/index.js +1 -2
- package/build-module/components/inspector-popover-header/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +1 -3
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/is-url-like.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +14 -13
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-create-button.js +1 -1
- package/build-module/components/link-control/search-create-button.js.map +1 -1
- package/build-module/components/link-control/search-input.js +4 -7
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/search-results.js +6 -17
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +1 -3
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/link-control/settings.js +1 -2
- package/build-module/components/link-control/settings.js.map +1 -1
- package/build-module/components/link-control/use-rich-url-data.js.map +1 -1
- package/build-module/components/list-view/appender.js +6 -6
- package/build-module/components/list-view/appender.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +1 -3
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +1 -2
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +1 -3
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +8 -9
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +1 -2
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js +2 -4
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +2 -2
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/list-view/utils.js +1 -1
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +1 -3
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +2 -4
- package/build-module/components/media-placeholder/index.native.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/media-upload/index.native.js +1 -3
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/media-upload-progress/index.native.js +1 -2
- package/build-module/components/media-upload-progress/index.native.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +3 -4
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/observe-typing/index.js +1 -0
- package/build-module/components/observe-typing/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/publish-date-time-picker/index.js +1 -2
- package/build-module/components/publish-date-time-picker/index.js.map +1 -1
- package/build-module/components/recursion-provider/index.js +1 -0
- package/build-module/components/recursion-provider/index.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +4 -5
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/responsive-block-control/label.js +2 -4
- package/build-module/components/responsive-block-control/label.js.map +1 -1
- package/build-module/components/rich-text/content.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/before-input-rules.js +2 -2
- package/build-module/components/rich-text/event-listeners/before-input-rules.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/delete.js +2 -2
- package/build-module/components/rich-text/event-listeners/delete.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/enter.js +2 -2
- package/build-module/components/rich-text/event-listeners/enter.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/firefox-compat.js +2 -2
- package/build-module/components/rich-text/event-listeners/firefox-compat.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/index.js +4 -2
- package/build-module/components/rich-text/event-listeners/index.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/input-events.js +2 -2
- package/build-module/components/rich-text/event-listeners/input-events.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/input-rules.js +2 -2
- package/build-module/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.js +2 -2
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/paste-handler.js +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js +2 -2
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/shortcuts.js +2 -2
- package/build-module/components/rich-text/event-listeners/shortcuts.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.js +2 -2
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.js.map +1 -1
- package/build-module/components/rich-text/file-paste-handler.native.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +1 -3
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.native.js +1 -3
- package/build-module/components/rich-text/format-toolbar/index.native.js.map +1 -1
- package/build-module/components/rich-text/index.js +4 -5
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +3 -9
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/multiline.js.map +1 -1
- package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.js +1 -1
- package/build-module/components/rich-text/native/index.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +1 -3
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/toolbar-button-with-options.native.js +1 -3
- package/build-module/components/rich-text/native/toolbar-button-with-options.native.js.map +1 -1
- package/build-module/components/rich-text/native/use-format-types.js +1 -0
- package/build-module/components/rich-text/native/use-format-types.js.map +1 -1
- package/build-module/components/rich-text/toolbar-button.js.map +1 -1
- package/build-module/components/rich-text/use-format-types.js +1 -0
- package/build-module/components/rich-text/use-format-types.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +4 -5
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/axial.js +1 -2
- package/build-module/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/separated.js +1 -2
- package/build-module/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +5 -7
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/spacing-sizes-control/linked-button.js +2 -6
- package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +1 -0
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/tabbed-sidebar/index.js +1 -2
- package/build-module/components/tabbed-sidebar/index.js.map +1 -1
- package/build-module/components/tool-selector/index.js +9 -8
- package/build-module/components/tool-selector/index.js.map +1 -1
- package/build-module/components/typewriter/index.js +1 -0
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/unsupported-block-details/index.native.js +1 -2
- package/build-module/components/unsupported-block-details/index.native.js.map +1 -1
- package/build-module/components/url-input/button.js +1 -2
- package/build-module/components/url-input/button.js.map +1 -1
- package/build-module/components/url-input/index.js +2 -4
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +1 -3
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/url-popover/index.js +1 -2
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/components/url-popover/link-editor.js +1 -2
- package/build-module/components/url-popover/link-editor.js.map +1 -1
- package/build-module/components/url-popover/link-viewer.js +1 -2
- package/build-module/components/url-popover/link-viewer.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +1 -1
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +5 -5
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.native.js +0 -1
- package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build-module/components/use-flash-editable-blocks/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +1 -3
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +1 -2
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +1 -3
- package/build-module/components/use-settings/index.js.map +1 -1
- package/build-module/components/video-player/index.native.js +1 -2
- package/build-module/components/video-player/index.native.js.map +1 -1
- package/build-module/components/warning/index.js +1 -2
- package/build-module/components/warning/index.js.map +1 -1
- package/build-module/components/warning/index.native.js +1 -2
- package/build-module/components/warning/index.native.js.map +1 -1
- package/build-module/components/writing-flow/index.js +6 -6
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +20 -5
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/anchor.js +1 -3
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/block-bindings.js +21 -12
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/block-hooks.js +2 -3
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-style-variation.js +1 -2
- package/build-module/hooks/block-style-variation.js.map +1 -1
- package/build-module/hooks/contrast-checker.js +0 -1
- package/build-module/hooks/contrast-checker.js.map +1 -1
- package/build-module/hooks/dimensions.js +1 -3
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +3 -5
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/generated-class-name.js +1 -0
- package/build-module/hooks/generated-class-name.js.map +1 -1
- package/build-module/hooks/grid-visualizer.js +14 -14
- package/build-module/hooks/grid-visualizer.js.map +1 -1
- package/build-module/hooks/layout-child.js +42 -6
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/layout.js +1 -3
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +1 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/spacing-visualizer.js.map +1 -1
- package/build-module/hooks/style.js +5 -4
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/text-align.js.map +1 -1
- package/build-module/hooks/typography.native.js +1 -2
- package/build-module/hooks/typography.native.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +1 -2
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +18 -19
- package/build-module/hooks/use-zoom-out.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 +1 -3
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/flex.js +1 -3
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/grid.js +1 -3
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/layouts/utils.js.map +1 -1
- package/build-module/private-apis.js +7 -3
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +6 -38
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +1 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/private-actions.js +54 -7
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +9 -20
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +17 -22
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +66 -20
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/block-bindings.js +9 -6
- package/build-module/utils/block-bindings.js.map +1 -1
- package/build-module/utils/dom.js +16 -1
- package/build-module/utils/dom.js.map +1 -1
- package/build-module/utils/get-font-styles-and-weights.js +3 -3
- package/build-module/utils/get-font-styles-and-weights.js.map +1 -1
- package/build-module/utils/get-px-from-css-unit.js +1 -1
- package/build-module/utils/get-px-from-css-unit.js.map +1 -1
- package/build-module/utils/object.js +1 -0
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/pasting.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +3 -2
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +19 -27
- package/build-style/content.css +19 -27
- package/build-style/style-rtl.css +47 -54
- package/build-style/style.css +47 -54
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +34 -33
- package/src/autocompleters/block.js +16 -7
- package/src/components/block-canvas/index.js +17 -1
- package/src/components/block-canvas/style.scss +1 -0
- package/src/components/block-card/index.js +3 -3
- package/src/components/block-full-height-alignment-control/index.js +1 -1
- package/src/components/block-inspector/style.scss +0 -6
- package/src/components/block-list/block.js +1 -2
- package/src/components/block-list/block.native.js +0 -4
- package/src/components/block-list/content.scss +4 -3
- package/src/components/block-list/index.js +4 -4
- package/src/components/block-list/use-block-props/index.js +0 -2
- package/src/components/block-list/use-block-props/use-focus-first-element.js +5 -3
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +12 -4
- package/src/components/block-list/use-in-between-inserter.js +1 -1
- package/src/components/block-list/zoom-out-separator.js +8 -6
- package/src/components/block-patterns-list/stories/fixtures.js +834 -0
- package/src/components/block-patterns-list/stories/index.story.js +81 -0
- package/src/components/block-patterns-list/style.scss +2 -0
- package/src/components/block-patterns-paging/index.js +1 -1
- package/src/components/block-popover/index.js +2 -2
- package/src/components/block-preview/auto.js +1 -4
- package/src/components/block-preview/index.js +2 -2
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -0
- package/src/components/block-settings-menu/index.js +3 -0
- package/src/components/block-toolbar/change-design.js +133 -0
- package/src/components/block-toolbar/index.js +25 -8
- package/src/components/block-toolbar/style.scss +16 -0
- package/src/components/block-tools/index.js +4 -28
- package/src/components/block-tools/insertion-point.js +4 -3
- package/src/components/block-tools/style.scss +0 -20
- package/src/components/block-tools/use-show-block-tools.js +2 -8
- package/src/components/block-tools/zoom-out-mode-inserters.js +25 -40
- package/src/components/block-variation-transforms/index.js +2 -2
- package/src/components/block-vertical-alignment-control/ui.js +11 -15
- package/src/components/border-radius-control/linked-button.js +9 -11
- package/src/components/collab/block-comment-icon-slot.js +12 -0
- package/src/components/collab/block-comment-icon-toolbar-slot.js +12 -0
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
- package/src/components/convert-to-group-buttons/toolbar.js +4 -4
- package/src/components/global-styles/color-panel.js +2 -10
- package/src/components/global-styles/test/use-global-styles-context.native.js +1 -0
- package/src/components/global-styles/use-global-styles-context.native.js +6 -0
- package/src/components/iframe/content.scss +22 -32
- package/src/components/iframe/index.js +62 -15
- package/src/components/iframe/style.scss +17 -0
- package/src/components/image-size-control/index.js +74 -43
- package/src/components/image-size-control/test/index.js +5 -63
- package/src/components/inner-blocks/index.js +12 -6
- package/src/components/inner-blocks/use-nested-settings-update.js +16 -10
- package/src/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +1 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +2 -3
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
- package/src/components/inserter/category-tabs/index.js +17 -13
- package/src/components/inserter/menu.js +12 -5
- package/src/components/inserter/quick-inserter.js +1 -1
- package/src/components/inserter/style.scss +14 -41
- package/src/components/inserter-button/index.native.js +1 -1
- package/src/components/inspector-controls-tabs/index.js +1 -6
- package/src/components/inspector-controls-tabs/utils.js +0 -3
- package/src/components/link-control/link-preview.js +15 -8
- package/src/components/link-control/search-input.js +4 -5
- package/src/components/link-control/search-results.js +2 -13
- package/src/components/link-control/test/index.js +147 -70
- package/src/components/list-view/appender.js +5 -6
- package/src/components/list-view/branch.js +8 -6
- package/src/components/list-view/index.js +1 -2
- package/src/components/media-replace-flow/test/index.js +1 -1
- package/src/components/provider/index.js +1 -3
- package/src/components/provider/test/experimental-provider.js +43 -1
- package/src/components/responsive-block-control/style.scss +0 -1
- package/src/components/rich-text/event-listeners/index.js +4 -2
- package/src/components/rich-text/index.native.js +0 -2
- package/src/components/rich-text/style.scss +5 -0
- package/src/components/spacing-sizes-control/index.js +3 -3
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
- package/src/components/spacing-sizes-control/linked-button.js +2 -12
- package/src/components/tool-selector/index.js +6 -5
- package/src/components/url-input/index.js +1 -1
- package/src/components/use-block-commands/index.js +1 -1
- package/src/components/use-block-drop-zone/index.js +5 -5
- package/src/components/use-block-drop-zone/index.native.js +0 -1
- package/src/components/use-moving-animation/index.js +0 -1
- package/src/components/use-resize-canvas/index.js +1 -3
- package/src/components/use-settings/index.js +0 -1
- package/src/components/writing-flow/index.js +5 -3
- package/src/components/writing-flow/use-tab-nav.js +27 -4
- package/src/hooks/block-bindings.js +48 -31
- package/src/hooks/contrast-checker.js +0 -1
- package/src/hooks/duotone.js +2 -2
- package/src/hooks/grid-visualizer.js +23 -9
- package/src/hooks/layout-child.js +48 -3
- package/src/hooks/style.js +7 -3
- package/src/hooks/use-zoom-out.js +20 -24
- package/src/index.js +0 -1
- package/src/private-apis.js +6 -1
- package/src/store/actions.js +5 -53
- package/src/store/defaults.js +2 -1
- package/src/store/private-actions.js +71 -8
- package/src/store/private-selectors.js +9 -19
- package/src/store/reducer.js +25 -28
- package/src/store/selectors.js +82 -20
- package/src/store/test/actions.js +41 -0
- package/src/store/test/private-selectors.js +7 -1
- package/src/store/test/reducer.js +23 -0
- package/src/store/test/selectors.js +13 -2
- package/src/style.scss +1 -0
- package/src/utils/block-bindings.js +9 -6
- package/src/utils/dom.js +22 -2
- package/src/utils/get-font-styles-and-weights.js +2 -2
- package/src/utils/test/use-block-bindings-utils.js +174 -0
- package/src/utils/transform-styles/index.js +3 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -57
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +0 -1
- package/build/components/block-toolbar/shuffle.js +0 -110
- package/build/components/block-toolbar/shuffle.js.map +0 -1
- package/build/components/block-tools/zoom-out-popover.js +0 -57
- package/build/components/block-tools/zoom-out-popover.js.map +0 -1
- package/build/components/block-tools/zoom-out-toolbar.js +0 -149
- package/build/components/block-tools/zoom-out-toolbar.js.map +0 -1
- package/build/components/block-vertical-alignment-control/icons.js +0 -48
- package/build/components/block-vertical-alignment-control/icons.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -51
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +0 -1
- package/build-module/components/block-toolbar/shuffle.js +0 -103
- package/build-module/components/block-toolbar/shuffle.js.map +0 -1
- package/build-module/components/block-tools/zoom-out-popover.js +0 -48
- package/build-module/components/block-tools/zoom-out-popover.js.map +0 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +0 -142
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +0 -1
- package/build-module/components/block-vertical-alignment-control/icons.js +0 -41
- package/build-module/components/block-vertical-alignment-control/icons.js.map +0 -1
- package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -65
- package/src/components/block-toolbar/shuffle.js +0 -111
- package/src/components/block-tools/zoom-out-popover.js +0 -46
- package/src/components/block-tools/zoom-out-toolbar.js +0 -156
- package/src/components/block-vertical-alignment-control/icons.js +0 -34
|
@@ -10,8 +10,7 @@ import { Children } from '@wordpress/element';
|
|
|
10
10
|
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
|
|
11
11
|
import { __ } from '@wordpress/i18n';
|
|
12
12
|
import { moreVertical } from '@wordpress/icons';
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
14
|
function Warning({
|
|
16
15
|
className,
|
|
17
16
|
actions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","Children","DropdownMenu","MenuGroup","MenuItem","__","moreVertical","jsx","_jsx","jsxs","_jsxs","Warning","className","actions","children","secondaryActions","style","display","all","count","map","action","i","icon","label","popoverProps","position","noIcons","item","pos","onClick","title"],"sources":["@wordpress/block-editor/src/components/warning/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Children } from '@wordpress/element';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { moreVertical } from '@wordpress/icons';\n\nfunction Warning( { className, actions, children, secondaryActions } ) {\n\treturn (\n\t\t<div style={ { display: 'contents', all: 'initial' } }>\n\t\t\t<div className={ clsx( className, 'block-editor-warning' ) }>\n\t\t\t\t<div className=\"block-editor-warning__contents\">\n\t\t\t\t\t<p className=\"block-editor-warning__message\">\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</p>\n\n\t\t\t\t\t{ ( Children.count( actions ) > 0 || secondaryActions ) && (\n\t\t\t\t\t\t<div className=\"block-editor-warning__actions\">\n\t\t\t\t\t\t\t{ Children.count( actions ) > 0 &&\n\t\t\t\t\t\t\t\tChildren.map( actions, ( action, i ) => (\n\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\tkey={ i }\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-warning__action\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ action }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t{ secondaryActions && (\n\t\t\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-warning__secondary\"\n\t\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'More options' ) }\n\t\t\t\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\t\t\t\tposition: 'bottom left',\n\t\t\t\t\t\t\t\t\t\tclassName:\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-warning__dropdown',\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tnoIcons\n\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\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t\t\t{ secondaryActions.map(\n\t\t\t\t\t\t\t\t\t\t\t\t( item, pos ) => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ item.onClick }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ pos }\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ item.title }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</DropdownMenu>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/warning/README.md\n */\nexport default Warning;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,YAAY,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,uBAAuB;AACzE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,QAAQ,kBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA
|
|
1
|
+
{"version":3,"names":["clsx","Children","DropdownMenu","MenuGroup","MenuItem","__","moreVertical","jsx","_jsx","jsxs","_jsxs","Warning","className","actions","children","secondaryActions","style","display","all","count","map","action","i","icon","label","popoverProps","position","noIcons","item","pos","onClick","title"],"sources":["@wordpress/block-editor/src/components/warning/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Children } from '@wordpress/element';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { moreVertical } from '@wordpress/icons';\n\nfunction Warning( { className, actions, children, secondaryActions } ) {\n\treturn (\n\t\t<div style={ { display: 'contents', all: 'initial' } }>\n\t\t\t<div className={ clsx( className, 'block-editor-warning' ) }>\n\t\t\t\t<div className=\"block-editor-warning__contents\">\n\t\t\t\t\t<p className=\"block-editor-warning__message\">\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</p>\n\n\t\t\t\t\t{ ( Children.count( actions ) > 0 || secondaryActions ) && (\n\t\t\t\t\t\t<div className=\"block-editor-warning__actions\">\n\t\t\t\t\t\t\t{ Children.count( actions ) > 0 &&\n\t\t\t\t\t\t\t\tChildren.map( actions, ( action, i ) => (\n\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\tkey={ i }\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-warning__action\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ action }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t{ secondaryActions && (\n\t\t\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-warning__secondary\"\n\t\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'More options' ) }\n\t\t\t\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\t\t\t\tposition: 'bottom left',\n\t\t\t\t\t\t\t\t\t\tclassName:\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-warning__dropdown',\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tnoIcons\n\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\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t\t\t{ secondaryActions.map(\n\t\t\t\t\t\t\t\t\t\t\t\t( item, pos ) => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ item.onClick }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ pos }\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ item.title }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</DropdownMenu>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/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,YAAc;YACrBkB,KAAK,EAAGnB,EAAE,CAAE,cAAe,CAAG;YAC9BoB,YAAY,EAAG;cACdC,QAAQ,EAAE,aAAa;cACvBd,SAAS,EACR;YACF,CAAG;YACHe,OAAO;YAAAb,QAAA,EAELA,CAAA,kBACDN,IAAA,CAACL,SAAS;cAAAW,QAAA,EACPC,gBAAgB,CAACK,GAAG,CACrB,CAAEQ,IAAI,EAAEC,GAAG,kBACVrB,IAAA,CAACJ,QAAQ;gBACR0B,OAAO,EAAGF,IAAI,CAACE,OAAS;gBAAAhB,QAAA,EAGtBc,IAAI,CAACG;cAAK,GAFNF,GAGG,CAEZ;YAAC,CACS;UACX,CACY,CACd;QAAA,CACG,CACL;MAAA,CACG;IAAC,CACF;EAAC,CACF,CAAC;AAER;;AAEA;AACA;AACA;AACA,eAAelB,OAAO","ignoreList":[]}
|
|
@@ -14,8 +14,7 @@ import { normalizeIconObject } from '@wordpress/blocks';
|
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
16
16
|
import styles from './style.scss';
|
|
17
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
18
|
function Warning({
|
|
20
19
|
actions,
|
|
21
20
|
title,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["View","Text","Icon","withPreferredColorScheme","normalizeIconObject","styles","jsx","_jsx","jsxs","_jsxs","Warning","actions","title","message","icon","iconClass","preferredColorScheme","getStylesFromColorScheme","containerStyle","extraContainerStyle","titleStyle","extraTitleStyle","messageStyle","extraMessageStyle","viewProps","internalIconClass","container","containerDark","titleDark","messageDark","style","children","className","src"],"sources":["@wordpress/block-editor/src/components/warning/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Icon } from '@wordpress/components';\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { normalizeIconObject } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nfunction Warning( {\n\tactions,\n\ttitle,\n\tmessage,\n\ticon,\n\ticonClass,\n\tpreferredColorScheme,\n\tgetStylesFromColorScheme,\n\tcontainerStyle: extraContainerStyle,\n\ttitleStyle: extraTitleStyle,\n\tmessageStyle: extraMessageStyle,\n\t...viewProps\n} ) {\n\ticon = icon && normalizeIconObject( icon );\n\tconst internalIconClass = 'warning-icon' + '-' + preferredColorScheme;\n\n\tconst containerStyle = [\n\t\tgetStylesFromColorScheme( styles.container, styles.containerDark ),\n\t\textraContainerStyle,\n\t];\n\tconst titleStyle = [\n\t\tgetStylesFromColorScheme( styles.title, styles.titleDark ),\n\t\textraTitleStyle,\n\t];\n\tconst messageStyle = [\n\t\tgetStylesFromColorScheme( styles.message, styles.messageDark ),\n\t\textraMessageStyle,\n\t];\n\n\treturn (\n\t\t<View style={ containerStyle } { ...viewProps }>\n\t\t\t{ icon && (\n\t\t\t\t<View style={ styles.icon }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tclassName={ iconClass || internalIconClass }\n\t\t\t\t\t\ticon={ icon && icon.src ? icon.src : icon }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ title && <Text style={ titleStyle }>{ title }</Text> }\n\t\t\t{ message && <Text style={ messageStyle }>{ message }</Text> }\n\t\t\t{ actions }\n\t\t</View>\n\t);\n}\n\nexport default withPreferredColorScheme( Warning );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAI,EAAEC,IAAI,QAAQ,cAAc;;AAEzC;AACA;AACA;AACA,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,mBAAmB,QAAQ,mBAAmB;;AAEvD;AACA;AACA;AACA,OAAOC,MAAM,MAAM,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA
|
|
1
|
+
{"version":3,"names":["View","Text","Icon","withPreferredColorScheme","normalizeIconObject","styles","jsx","_jsx","jsxs","_jsxs","Warning","actions","title","message","icon","iconClass","preferredColorScheme","getStylesFromColorScheme","containerStyle","extraContainerStyle","titleStyle","extraTitleStyle","messageStyle","extraMessageStyle","viewProps","internalIconClass","container","containerDark","titleDark","messageDark","style","children","className","src"],"sources":["@wordpress/block-editor/src/components/warning/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Icon } from '@wordpress/components';\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { normalizeIconObject } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nfunction Warning( {\n\tactions,\n\ttitle,\n\tmessage,\n\ticon,\n\ticonClass,\n\tpreferredColorScheme,\n\tgetStylesFromColorScheme,\n\tcontainerStyle: extraContainerStyle,\n\ttitleStyle: extraTitleStyle,\n\tmessageStyle: extraMessageStyle,\n\t...viewProps\n} ) {\n\ticon = icon && normalizeIconObject( icon );\n\tconst internalIconClass = 'warning-icon' + '-' + preferredColorScheme;\n\n\tconst containerStyle = [\n\t\tgetStylesFromColorScheme( styles.container, styles.containerDark ),\n\t\textraContainerStyle,\n\t];\n\tconst titleStyle = [\n\t\tgetStylesFromColorScheme( styles.title, styles.titleDark ),\n\t\textraTitleStyle,\n\t];\n\tconst messageStyle = [\n\t\tgetStylesFromColorScheme( styles.message, styles.messageDark ),\n\t\textraMessageStyle,\n\t];\n\n\treturn (\n\t\t<View style={ containerStyle } { ...viewProps }>\n\t\t\t{ icon && (\n\t\t\t\t<View style={ styles.icon }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tclassName={ iconClass || internalIconClass }\n\t\t\t\t\t\ticon={ icon && icon.src ? icon.src : icon }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ title && <Text style={ titleStyle }>{ title }</Text> }\n\t\t\t{ message && <Text style={ messageStyle }>{ message }</Text> }\n\t\t\t{ actions }\n\t\t</View>\n\t);\n}\n\nexport default withPreferredColorScheme( Warning );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAI,EAAEC,IAAI,QAAQ,cAAc;;AAEzC;AACA;AACA;AACA,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,mBAAmB,QAAQ,mBAAmB;;AAEvD;AACA;AACA;AACA,OAAOC,MAAM,MAAM,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAElC,SAASC,OAAOA,CAAE;EACjBC,OAAO;EACPC,KAAK;EACLC,OAAO;EACPC,IAAI;EACJC,SAAS;EACTC,oBAAoB;EACpBC,wBAAwB;EACxBC,cAAc,EAAEC,mBAAmB;EACnCC,UAAU,EAAEC,eAAe;EAC3BC,YAAY,EAAEC,iBAAiB;EAC/B,GAAGC;AACJ,CAAC,EAAG;EACHV,IAAI,GAAGA,IAAI,IAAIV,mBAAmB,CAAEU,IAAK,CAAC;EAC1C,MAAMW,iBAAiB,GAAG,cAAc,GAAG,GAAG,GAAGT,oBAAoB;EAErE,MAAME,cAAc,GAAG,CACtBD,wBAAwB,CAAEZ,MAAM,CAACqB,SAAS,EAAErB,MAAM,CAACsB,aAAc,CAAC,EAClER,mBAAmB,CACnB;EACD,MAAMC,UAAU,GAAG,CAClBH,wBAAwB,CAAEZ,MAAM,CAACO,KAAK,EAAEP,MAAM,CAACuB,SAAU,CAAC,EAC1DP,eAAe,CACf;EACD,MAAMC,YAAY,GAAG,CACpBL,wBAAwB,CAAEZ,MAAM,CAACQ,OAAO,EAAER,MAAM,CAACwB,WAAY,CAAC,EAC9DN,iBAAiB,CACjB;EAED,oBACCd,KAAA,CAACT,IAAI;IAAC8B,KAAK,EAAGZ,cAAgB;IAAA,GAAMM,SAAS;IAAAO,QAAA,GAC1CjB,IAAI,iBACLP,IAAA,CAACP,IAAI;MAAC8B,KAAK,EAAGzB,MAAM,CAACS,IAAM;MAAAiB,QAAA,eAC1BxB,IAAA,CAACL,IAAI;QACJ8B,SAAS,EAAGjB,SAAS,IAAIU,iBAAmB;QAC5CX,IAAI,EAAGA,IAAI,IAAIA,IAAI,CAACmB,GAAG,GAAGnB,IAAI,CAACmB,GAAG,GAAGnB;MAAM,CAC3C;IAAC,CACG,CACN,EACCF,KAAK,iBAAIL,IAAA,CAACN,IAAI;MAAC6B,KAAK,EAAGV,UAAY;MAAAW,QAAA,EAAGnB;IAAK,CAAQ,CAAC,EACpDC,OAAO,iBAAIN,IAAA,CAACN,IAAI;MAAC6B,KAAK,EAAGR,YAAc;MAAAS,QAAA,EAAGlB;IAAO,CAAQ,CAAC,EAC1DF,OAAO;EAAA,CACJ,CAAC;AAET;AAEA,eAAeR,wBAAwB,CAAEO,OAAQ,CAAC","ignoreList":[]}
|
|
@@ -24,21 +24,21 @@ import useClickSelection from './use-click-selection';
|
|
|
24
24
|
import useInput from './use-input';
|
|
25
25
|
import useClipboardHandler from './use-clipboard-handler';
|
|
26
26
|
import { store as blockEditorStore } from '../../store';
|
|
27
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
29
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
30
28
|
export function useWritingFlow() {
|
|
31
29
|
const [before, ref, after] = useTabNav();
|
|
32
30
|
const hasMultiSelection = useSelect(select => select(blockEditorStore).hasMultiSelection(), []);
|
|
33
31
|
return [before, useMergeRefs([ref, useClipboardHandler(), useInput(), useDragSelection(), useSelectionObserver(), useClickSelection(), useMultiSelection(), useSelectAll(), useArrowNav(), useRefEffect(node => {
|
|
34
32
|
node.tabIndex = 0;
|
|
33
|
+
node.dataset.hasMultiSelection = hasMultiSelection;
|
|
35
34
|
if (!hasMultiSelection) {
|
|
36
|
-
return
|
|
35
|
+
return () => {
|
|
36
|
+
delete node.dataset.hasMultiSelection;
|
|
37
|
+
};
|
|
37
38
|
}
|
|
38
|
-
node.classList.add('has-multi-selection');
|
|
39
39
|
node.setAttribute('aria-label', __('Multiple selected blocks'));
|
|
40
40
|
return () => {
|
|
41
|
-
node.
|
|
41
|
+
delete node.dataset.hasMultiSelection;
|
|
42
42
|
node.removeAttribute('aria-label');
|
|
43
43
|
};
|
|
44
44
|
}, [hasMultiSelection])]), after];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useSelect","__","useMergeRefs","useRefEffect","forwardRef","useMultiSelection","useTabNav","useArrowNav","useSelectAll","useDragSelection","useSelectionObserver","useClickSelection","useInput","useClipboardHandler","store","blockEditorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useWritingFlow","before","ref","after","hasMultiSelection","select","node","tabIndex","
|
|
1
|
+
{"version":3,"names":["clsx","useSelect","__","useMergeRefs","useRefEffect","forwardRef","useMultiSelection","useTabNav","useArrowNav","useSelectAll","useDragSelection","useSelectionObserver","useClickSelection","useInput","useClipboardHandler","store","blockEditorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useWritingFlow","before","ref","after","hasMultiSelection","select","node","tabIndex","dataset","setAttribute","removeAttribute","WritingFlow","children","props","forwardedRef","className"],"sources":["@wordpress/block-editor/src/components/writing-flow/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { useMergeRefs, useRefEffect } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useMultiSelection from './use-multi-selection';\nimport useTabNav from './use-tab-nav';\nimport useArrowNav from './use-arrow-nav';\nimport useSelectAll from './use-select-all';\nimport useDragSelection from './use-drag-selection';\nimport useSelectionObserver from './use-selection-observer';\nimport useClickSelection from './use-click-selection';\nimport useInput from './use-input';\nimport useClipboardHandler from './use-clipboard-handler';\nimport { store as blockEditorStore } from '../../store';\n\nexport function useWritingFlow() {\n\tconst [ before, ref, after ] = useTabNav();\n\tconst hasMultiSelection = useSelect(\n\t\t( select ) => select( blockEditorStore ).hasMultiSelection(),\n\t\t[]\n\t);\n\n\treturn [\n\t\tbefore,\n\t\tuseMergeRefs( [\n\t\t\tref,\n\t\t\tuseClipboardHandler(),\n\t\t\tuseInput(),\n\t\t\tuseDragSelection(),\n\t\t\tuseSelectionObserver(),\n\t\t\tuseClickSelection(),\n\t\t\tuseMultiSelection(),\n\t\t\tuseSelectAll(),\n\t\t\tuseArrowNav(),\n\t\t\tuseRefEffect(\n\t\t\t\t( node ) => {\n\t\t\t\t\tnode.tabIndex = 0;\n\t\t\t\t\tnode.dataset.hasMultiSelection = hasMultiSelection;\n\n\t\t\t\t\tif ( ! hasMultiSelection ) {\n\t\t\t\t\t\treturn () => {\n\t\t\t\t\t\t\tdelete node.dataset.hasMultiSelection;\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\tnode.setAttribute(\n\t\t\t\t\t\t'aria-label',\n\t\t\t\t\t\t__( 'Multiple selected blocks' )\n\t\t\t\t\t);\n\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\tdelete node.dataset.hasMultiSelection;\n\t\t\t\t\t\tnode.removeAttribute( 'aria-label' );\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\t[ hasMultiSelection ]\n\t\t\t),\n\t\t] ),\n\t\tafter,\n\t];\n}\n\nfunction WritingFlow( { children, ...props }, forwardedRef ) {\n\tconst [ before, ref, after ] = useWritingFlow();\n\treturn (\n\t\t<>\n\t\t\t{ before }\n\t\t\t<div\n\t\t\t\t{ ...props }\n\t\t\t\tref={ useMergeRefs( [ ref, forwardedRef ] ) }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tprops.className,\n\t\t\t\t\t'block-editor-writing-flow'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t\t{ after }\n\t\t</>\n\t);\n}\n\n/**\n * Handles selection and navigation across blocks. This component should be\n * wrapped around BlockList.\n *\n * @param {Object} props Component properties.\n * @param {Element} props.children Children to be rendered.\n */\nexport default forwardRef( WritingFlow );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,EAAEC,YAAY,QAAQ,oBAAoB;AAC/D,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,OAAOC,iBAAiB,MAAM,uBAAuB;AACrD,OAAOC,SAAS,MAAM,eAAe;AACrC,OAAOC,WAAW,MAAM,iBAAiB;AACzC,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,OAAOC,oBAAoB,MAAM,0BAA0B;AAC3D,OAAOC,iBAAiB,MAAM,uBAAuB;AACrD,OAAOC,QAAQ,MAAM,aAAa;AAClC,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAExD,OAAO,SAASC,cAAcA,CAAA,EAAG;EAChC,MAAM,CAAEC,MAAM,EAAEC,GAAG,EAAEC,KAAK,CAAE,GAAGnB,SAAS,CAAC,CAAC;EAC1C,MAAMoB,iBAAiB,GAAG1B,SAAS,CAChC2B,MAAM,IAAMA,MAAM,CAAEZ,gBAAiB,CAAC,CAACW,iBAAiB,CAAC,CAAC,EAC5D,EACD,CAAC;EAED,OAAO,CACNH,MAAM,EACNrB,YAAY,CAAE,CACbsB,GAA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A;AACA;AACA;AACA,eAAerB,UAAU,CAAE6B,WAAY,CAAC","ignoreList":[]}
|
|
@@ -21,14 +21,15 @@ export default function useTabNav() {
|
|
|
21
21
|
const {
|
|
22
22
|
hasMultiSelection,
|
|
23
23
|
getSelectedBlockClientId,
|
|
24
|
-
getBlockCount
|
|
25
|
-
|
|
24
|
+
getBlockCount,
|
|
25
|
+
getBlockOrder,
|
|
26
|
+
getLastFocus,
|
|
27
|
+
getSectionRootClientId,
|
|
28
|
+
isZoomOut
|
|
29
|
+
} = unlock(useSelect(blockEditorStore));
|
|
26
30
|
const {
|
|
27
31
|
setLastFocus
|
|
28
32
|
} = unlock(useDispatch(blockEditorStore));
|
|
29
|
-
const {
|
|
30
|
-
getLastFocus
|
|
31
|
-
} = unlock(useSelect(blockEditorStore));
|
|
32
33
|
|
|
33
34
|
// Reference that holds the a flag for enabling or disabling
|
|
34
35
|
// capturing on the focus capture elements.
|
|
@@ -46,6 +47,20 @@ export default function useTabNav() {
|
|
|
46
47
|
// Handles when the last focus has not been set yet, or has been cleared by new blocks being added via the inserter.
|
|
47
48
|
container.current.querySelector(`[data-block="${getSelectedBlockClientId()}"]`).focus();
|
|
48
49
|
}
|
|
50
|
+
}
|
|
51
|
+
// In "compose" mode without a selected ID, we want to place focus on the section root when tabbing to the canvas.
|
|
52
|
+
else if (isZoomOut()) {
|
|
53
|
+
const sectionRootClientId = getSectionRootClientId();
|
|
54
|
+
const sectionBlocks = getBlockOrder(sectionRootClientId);
|
|
55
|
+
|
|
56
|
+
// If we have section within the section root, focus the first one.
|
|
57
|
+
if (sectionBlocks.length) {
|
|
58
|
+
container.current.querySelector(`[data-block="${sectionBlocks[0]}"]`).focus();
|
|
59
|
+
}
|
|
60
|
+
// If we don't have any section blocks, focus the section root.
|
|
61
|
+
else {
|
|
62
|
+
container.current.querySelector(`[data-block="${sectionRootClientId}"]`).focus();
|
|
63
|
+
}
|
|
49
64
|
} else {
|
|
50
65
|
const canvasElement = container.current.ownerDocument === event.target.ownerDocument ? container.current : container.current.ownerDocument.defaultView.frameElement;
|
|
51
66
|
const isBefore =
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["focus","isFormElement","TAB","useSelect","useDispatch","useRefEffect","useMergeRefs","useRef","store","blockEditorStore","isInSameBlock","isInsideRootBlock","unlock","jsx","_jsx","useTabNav","container","focusCaptureBeforeRef","focusCaptureAfterRef","hasMultiSelection","getSelectedBlockClientId","getBlockCount","setLastFocus","getLastFocus","noCaptureRef","onFocusCapture","event","current","querySelector","canvasElement","ownerDocument","target","defaultView","frameElement","isBefore","compareDocumentPosition","DOCUMENT_POSITION_FOLLOWING","tabbables","tabbable","find","length","next","before","ref","tabIndex","onFocus","after","node","onKeyDown","defaultPrevented","keyCode","isShift","shiftKey","direction","nextTabbable","currentBlock","closest","isElementPartOfSelectedBlock","preventScroll","onFocusOut","relatedTarget","activeElement","body","preventScrollOnTab","getAttribute","preventDefault","addEventListener","removeEventListener","mergedRefs"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-tab-nav.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { focus, isFormElement } from '@wordpress/dom';\nimport { TAB } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect, useMergeRefs } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { isInSameBlock, isInsideRootBlock } from '../../utils/dom';\nimport { unlock } from '../../lock-unlock';\n\nexport default function useTabNav() {\n\tconst container = useRef();\n\tconst focusCaptureBeforeRef = useRef();\n\tconst focusCaptureAfterRef = useRef();\n\n\tconst { hasMultiSelection, getSelectedBlockClientId, getBlockCount } =\n\t\tuseSelect( blockEditorStore );\n\tconst { setLastFocus } = unlock( useDispatch( blockEditorStore ) );\n\tconst { getLastFocus } = unlock( useSelect( blockEditorStore ) );\n\n\t// Reference that holds the a flag for enabling or disabling\n\t// capturing on the focus capture elements.\n\tconst noCaptureRef = useRef();\n\n\tfunction onFocusCapture( event ) {\n\t\t// Do not capture incoming focus if set by us in WritingFlow.\n\t\tif ( noCaptureRef.current ) {\n\t\t\tnoCaptureRef.current = null;\n\t\t} else if ( hasMultiSelection() ) {\n\t\t\tcontainer.current.focus();\n\t\t} else if ( getSelectedBlockClientId() ) {\n\t\t\tif ( getLastFocus()?.current ) {\n\t\t\t\tgetLastFocus().current.focus();\n\t\t\t} else {\n\t\t\t\t// Handles when the last focus has not been set yet, or has been cleared by new blocks being added via the inserter.\n\t\t\t\tcontainer.current\n\t\t\t\t\t.querySelector(\n\t\t\t\t\t\t`[data-block=\"${ getSelectedBlockClientId() }\"]`\n\t\t\t\t\t)\n\t\t\t\t\t.focus();\n\t\t\t}\n\t\t} else {\n\t\t\tconst canvasElement =\n\t\t\t\tcontainer.current.ownerDocument === event.target.ownerDocument\n\t\t\t\t\t? container.current\n\t\t\t\t\t: container.current.ownerDocument.defaultView.frameElement;\n\n\t\t\tconst isBefore =\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tevent.target.compareDocumentPosition( canvasElement ) &\n\t\t\t\tevent.target.DOCUMENT_POSITION_FOLLOWING;\n\t\t\tconst tabbables = focus.tabbable.find( container.current );\n\n\t\t\tif ( tabbables.length ) {\n\t\t\t\tconst next = isBefore\n\t\t\t\t\t? tabbables[ 0 ]\n\t\t\t\t\t: tabbables[ tabbables.length - 1 ];\n\n\t\t\t\tnext.focus();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst before = (\n\t\t<div\n\t\t\tref={ focusCaptureBeforeRef }\n\t\t\ttabIndex=\"0\"\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst after = (\n\t\t<div\n\t\t\tref={ focusCaptureAfterRef }\n\t\t\ttabIndex=\"0\"\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst ref = useRefEffect( ( node ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// In Edit mode, Tab should focus the first tabbable element after\n\t\t\t// the content, which is normally the sidebar (with block controls)\n\t\t\t// and Shift+Tab should focus the first tabbable element before the\n\t\t\t// content, which is normally the block toolbar.\n\t\t\t// Arrow keys can be used, and Tab and arrow keys can be used in\n\t\t\t// Navigation mode (press Esc), to navigate through blocks.\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\t\t\tconst nextTabbable = focus.tabbable[ direction ]( event.target );\n\n\t\t\t// We want to constrain the tabbing to the block and its child blocks.\n\t\t\t// If the preceding form element is within a different block,\n\t\t\t// such as two sibling image blocks in the placeholder state,\n\t\t\t// we want shift + tab from the first form element to move to the image\n\t\t\t// block toolbar and not the previous image block's form element.\n\t\t\tconst currentBlock = event.target.closest( '[data-block]' );\n\t\t\tconst isElementPartOfSelectedBlock =\n\t\t\t\tcurrentBlock &&\n\t\t\t\tnextTabbable &&\n\t\t\t\t( isInSameBlock( currentBlock, nextTabbable ) ||\n\t\t\t\t\tisInsideRootBlock( currentBlock, nextTabbable ) );\n\n\t\t\t// Allow tabbing from the block wrapper to a form element,\n\t\t\t// and between form elements rendered in a block and its child blocks,\n\t\t\t// such as inside a placeholder. Form elements are generally\n\t\t\t// meant to be UI rather than part of the content. Ideally\n\t\t\t// these are not rendered in the content and perhaps in the\n\t\t\t// future they can be rendered in an iframe or shadow DOM.\n\t\t\tif (\n\t\t\t\tisFormElement( nextTabbable ) &&\n\t\t\t\tisElementPartOfSelectedBlock\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef;\n\n\t\t\t// Disable focus capturing on the focus capture element, so it\n\t\t\t// doesn't refocus this block and so it allows default behaviour\n\t\t\t// (moving focus to the next tabbable element).\n\t\t\tnoCaptureRef.current = true;\n\n\t\t\t// Focusing the focus capture element, which is located above and\n\t\t\t// below the editor, should not scroll the page all the way up or\n\t\t\t// down.\n\t\t\tnext.current.focus( { preventScroll: true } );\n\t\t}\n\n\t\tfunction onFocusOut( event ) {\n\t\t\tsetLastFocus( { ...getLastFocus(), current: event.target } );\n\n\t\t\tconst { ownerDocument } = node;\n\n\t\t\t// If focus disappears due to there being no blocks, move focus to\n\t\t\t// the writing flow wrapper.\n\t\t\tif (\n\t\t\t\t! event.relatedTarget &&\n\t\t\t\townerDocument.activeElement === ownerDocument.body &&\n\t\t\t\tgetBlockCount() === 0\n\t\t\t) {\n\t\t\t\tnode.focus();\n\t\t\t}\n\t\t}\n\n\t\t// When tabbing back to an element in block list, this event handler prevents scrolling if the\n\t\t// focus capture divs (before/after) are outside of the viewport. (For example shift+tab back to a paragraph\n\t\t// when focus is on a sidebar element. This prevents the scrollable writing area from jumping either to the\n\t\t// top or bottom of the document.\n\t\t//\n\t\t// Note that it isn't possible to disable scrolling in the onFocus event. We need to intercept this\n\t\t// earlier in the keypress handler, and call focus( { preventScroll: true } ) instead.\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus#parameters\n\t\tfunction preventScrollOnTab( event ) {\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.target?.getAttribute( 'role' ) === 'region' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( container.current === event.target ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\t\t\tconst target = focus.tabbable[ direction ]( event.target );\n\t\t\t// Only do something when the next tabbable is a focus capture div (before/after)\n\t\t\tif (\n\t\t\t\ttarget === focusCaptureBeforeRef.current ||\n\t\t\t\ttarget === focusCaptureAfterRef.current\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttarget.focus( { preventScroll: true } );\n\t\t\t}\n\t\t}\n\n\t\tconst { ownerDocument } = node;\n\t\tconst { defaultView } = ownerDocument;\n\t\tdefaultView.addEventListener( 'keydown', preventScrollOnTab );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\tnode.addEventListener( 'focusout', onFocusOut );\n\t\treturn () => {\n\t\t\tdefaultView.removeEventListener( 'keydown', preventScrollOnTab );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\tnode.removeEventListener( 'focusout', onFocusOut );\n\t\t};\n\t}, [] );\n\n\tconst mergedRefs = useMergeRefs( [ container, ref ] );\n\n\treturn [ before, mergedRefs, after ];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,EAAEC,aAAa,QAAQ,gBAAgB;AACrD,SAASC,GAAG,QAAQ,qBAAqB;AACzC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,EAAEC,YAAY,QAAQ,oBAAoB;AAC/D,SAASC,MAAM,QAAQ,oBAAoB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,iBAAiB;AAClE,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3C,eAAe,SAASC,SAASA,CAAA,EAAG;EACnC,MAAMC,SAAS,GAAGT,MAAM,CAAC,CAAC;EAC1B,MAAMU,qBAAqB,GAAGV,MAAM,CAAC,CAAC;EACtC,MAAMW,oBAAoB,GAAGX,MAAM,CAAC,CAAC;EAErC,MAAM;IAAEY,iBAAiB;IAAEC,wBAAwB;IAAEC;EAAc,CAAC,GACnElB,SAAS,CAAEM,gBAAiB,CAAC;EAC9B,MAAM;IAAEa;EAAa,CAAC,GAAGV,MAAM,CAAER,WAAW,CAAEK,gBAAiB,CAAE,CAAC;EAClE,MAAM;IAAEc;EAAa,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QAAK,CAAE,CAAC;MACxC;IACD;IAEA,MAAM;MAAE5B;IAAc,CAAC,GAAGiB,IAAI;IAC9B,MAAM;MAAEf;IAAY,CAAC,GAAGF,aAAa;IACrCE,WAAW,CAACkC,gBAAgB,CAAE,SAAS,EAAEH,kBAAmB,CAAC;IAC7DhB,IAAI,CAACmB,gBAAgB,CAAE,SAAS,EAAElB,SAAU,CAAC;IAC7CD,IAAI,CAACmB,gBAAgB,CAAE,UAAU,EAAEP,UAAW,CAAC;IAC/C,OAAO,MAAM;MACZ3B,WAAW,CAACmC,mBAAmB,CAAE,SAAS,EAAEJ,kBAAmB,CAAC;MAChEhB,IAAI,CAACoB,mBAAmB,CAAE,SAAS,EAAEnB,SAAU,CAAC;MAChDD,IAAI,CAACoB,mBAAmB,CAAE,UAAU,EAAER,UAAW,CAAC;IACnD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMS,UAAU,GAAG9D,YAAY,CAAE,CAAEU,SAAS,EAAE2B,GAAG,CAAG,CAAC;EAErD,OAAO,CAAED,MAAM,EAAE0B,UAAU,EAAEtB,KAAK,CAAE;AACrC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["focus","isFormElement","TAB","useSelect","useDispatch","useRefEffect","useMergeRefs","useRef","store","blockEditorStore","isInSameBlock","isInsideRootBlock","unlock","jsx","_jsx","useTabNav","container","focusCaptureBeforeRef","focusCaptureAfterRef","hasMultiSelection","getSelectedBlockClientId","getBlockCount","getBlockOrder","getLastFocus","getSectionRootClientId","isZoomOut","setLastFocus","noCaptureRef","onFocusCapture","event","current","querySelector","sectionRootClientId","sectionBlocks","length","canvasElement","ownerDocument","target","defaultView","frameElement","isBefore","compareDocumentPosition","DOCUMENT_POSITION_FOLLOWING","tabbables","tabbable","find","next","before","ref","tabIndex","onFocus","after","node","onKeyDown","defaultPrevented","keyCode","isShift","shiftKey","direction","nextTabbable","currentBlock","closest","isElementPartOfSelectedBlock","preventScroll","onFocusOut","relatedTarget","activeElement","body","preventScrollOnTab","getAttribute","preventDefault","addEventListener","removeEventListener","mergedRefs"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-tab-nav.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { focus, isFormElement } from '@wordpress/dom';\nimport { TAB } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect, useMergeRefs } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { isInSameBlock, isInsideRootBlock } from '../../utils/dom';\nimport { unlock } from '../../lock-unlock';\n\nexport default function useTabNav() {\n\tconst container = useRef();\n\tconst focusCaptureBeforeRef = useRef();\n\tconst focusCaptureAfterRef = useRef();\n\n\tconst {\n\t\thasMultiSelection,\n\t\tgetSelectedBlockClientId,\n\t\tgetBlockCount,\n\t\tgetBlockOrder,\n\t\tgetLastFocus,\n\t\tgetSectionRootClientId,\n\t\tisZoomOut,\n\t} = unlock( useSelect( blockEditorStore ) );\n\tconst { setLastFocus } = unlock( useDispatch( blockEditorStore ) );\n\n\t// Reference that holds the a flag for enabling or disabling\n\t// capturing on the focus capture elements.\n\tconst noCaptureRef = useRef();\n\n\tfunction onFocusCapture( event ) {\n\t\t// Do not capture incoming focus if set by us in WritingFlow.\n\t\tif ( noCaptureRef.current ) {\n\t\t\tnoCaptureRef.current = null;\n\t\t} else if ( hasMultiSelection() ) {\n\t\t\tcontainer.current.focus();\n\t\t} else if ( getSelectedBlockClientId() ) {\n\t\t\tif ( getLastFocus()?.current ) {\n\t\t\t\tgetLastFocus().current.focus();\n\t\t\t} else {\n\t\t\t\t// Handles when the last focus has not been set yet, or has been cleared by new blocks being added via the inserter.\n\t\t\t\tcontainer.current\n\t\t\t\t\t.querySelector(\n\t\t\t\t\t\t`[data-block=\"${ getSelectedBlockClientId() }\"]`\n\t\t\t\t\t)\n\t\t\t\t\t.focus();\n\t\t\t}\n\t\t}\n\t\t// In \"compose\" mode without a selected ID, we want to place focus on the section root when tabbing to the canvas.\n\t\telse if ( isZoomOut() ) {\n\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\t\t\tconst sectionBlocks = getBlockOrder( sectionRootClientId );\n\n\t\t\t// If we have section within the section root, focus the first one.\n\t\t\tif ( sectionBlocks.length ) {\n\t\t\t\tcontainer.current\n\t\t\t\t\t.querySelector( `[data-block=\"${ sectionBlocks[ 0 ] }\"]` )\n\t\t\t\t\t.focus();\n\t\t\t}\n\t\t\t// If we don't have any section blocks, focus the section root.\n\t\t\telse {\n\t\t\t\tcontainer.current\n\t\t\t\t\t.querySelector( `[data-block=\"${ sectionRootClientId }\"]` )\n\t\t\t\t\t.focus();\n\t\t\t}\n\t\t} else {\n\t\t\tconst canvasElement =\n\t\t\t\tcontainer.current.ownerDocument === event.target.ownerDocument\n\t\t\t\t\t? container.current\n\t\t\t\t\t: container.current.ownerDocument.defaultView.frameElement;\n\n\t\t\tconst isBefore =\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tevent.target.compareDocumentPosition( canvasElement ) &\n\t\t\t\tevent.target.DOCUMENT_POSITION_FOLLOWING;\n\t\t\tconst tabbables = focus.tabbable.find( container.current );\n\n\t\t\tif ( tabbables.length ) {\n\t\t\t\tconst next = isBefore\n\t\t\t\t\t? tabbables[ 0 ]\n\t\t\t\t\t: tabbables[ tabbables.length - 1 ];\n\t\t\t\tnext.focus();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst before = (\n\t\t<div\n\t\t\tref={ focusCaptureBeforeRef }\n\t\t\ttabIndex=\"0\"\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst after = (\n\t\t<div\n\t\t\tref={ focusCaptureAfterRef }\n\t\t\ttabIndex=\"0\"\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst ref = useRefEffect( ( node ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// In Edit mode, Tab should focus the first tabbable element after\n\t\t\t// the content, which is normally the sidebar (with block controls)\n\t\t\t// and Shift+Tab should focus the first tabbable element before the\n\t\t\t// content, which is normally the block toolbar.\n\t\t\t// Arrow keys can be used, and Tab and arrow keys can be used in\n\t\t\t// Navigation mode (press Esc), to navigate through blocks.\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\t\t\tconst nextTabbable = focus.tabbable[ direction ]( event.target );\n\n\t\t\t// We want to constrain the tabbing to the block and its child blocks.\n\t\t\t// If the preceding form element is within a different block,\n\t\t\t// such as two sibling image blocks in the placeholder state,\n\t\t\t// we want shift + tab from the first form element to move to the image\n\t\t\t// block toolbar and not the previous image block's form element.\n\t\t\tconst currentBlock = event.target.closest( '[data-block]' );\n\t\t\tconst isElementPartOfSelectedBlock =\n\t\t\t\tcurrentBlock &&\n\t\t\t\tnextTabbable &&\n\t\t\t\t( isInSameBlock( currentBlock, nextTabbable ) ||\n\t\t\t\t\tisInsideRootBlock( currentBlock, nextTabbable ) );\n\n\t\t\t// Allow tabbing from the block wrapper to a form element,\n\t\t\t// and between form elements rendered in a block and its child blocks,\n\t\t\t// such as inside a placeholder. Form elements are generally\n\t\t\t// meant to be UI rather than part of the content. Ideally\n\t\t\t// these are not rendered in the content and perhaps in the\n\t\t\t// future they can be rendered in an iframe or shadow DOM.\n\t\t\tif (\n\t\t\t\tisFormElement( nextTabbable ) &&\n\t\t\t\tisElementPartOfSelectedBlock\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef;\n\n\t\t\t// Disable focus capturing on the focus capture element, so it\n\t\t\t// doesn't refocus this block and so it allows default behaviour\n\t\t\t// (moving focus to the next tabbable element).\n\t\t\tnoCaptureRef.current = true;\n\n\t\t\t// Focusing the focus capture element, which is located above and\n\t\t\t// below the editor, should not scroll the page all the way up or\n\t\t\t// down.\n\t\t\tnext.current.focus( { preventScroll: true } );\n\t\t}\n\n\t\tfunction onFocusOut( event ) {\n\t\t\tsetLastFocus( { ...getLastFocus(), current: event.target } );\n\n\t\t\tconst { ownerDocument } = node;\n\n\t\t\t// If focus disappears due to there being no blocks, move focus to\n\t\t\t// the writing flow wrapper.\n\t\t\tif (\n\t\t\t\t! event.relatedTarget &&\n\t\t\t\townerDocument.activeElement === ownerDocument.body &&\n\t\t\t\tgetBlockCount() === 0\n\t\t\t) {\n\t\t\t\tnode.focus();\n\t\t\t}\n\t\t}\n\n\t\t// When tabbing back to an element in block list, this event handler prevents scrolling if the\n\t\t// focus capture divs (before/after) are outside of the viewport. (For example shift+tab back to a paragraph\n\t\t// when focus is on a sidebar element. This prevents the scrollable writing area from jumping either to the\n\t\t// top or bottom of the document.\n\t\t//\n\t\t// Note that it isn't possible to disable scrolling in the onFocus event. We need to intercept this\n\t\t// earlier in the keypress handler, and call focus( { preventScroll: true } ) instead.\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus#parameters\n\t\tfunction preventScrollOnTab( event ) {\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.target?.getAttribute( 'role' ) === 'region' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( container.current === event.target ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\t\t\tconst target = focus.tabbable[ direction ]( event.target );\n\t\t\t// Only do something when the next tabbable is a focus capture div (before/after)\n\t\t\tif (\n\t\t\t\ttarget === focusCaptureBeforeRef.current ||\n\t\t\t\ttarget === focusCaptureAfterRef.current\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttarget.focus( { preventScroll: true } );\n\t\t\t}\n\t\t}\n\n\t\tconst { ownerDocument } = node;\n\t\tconst { defaultView } = ownerDocument;\n\t\tdefaultView.addEventListener( 'keydown', preventScrollOnTab );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\tnode.addEventListener( 'focusout', onFocusOut );\n\t\treturn () => {\n\t\t\tdefaultView.removeEventListener( 'keydown', preventScrollOnTab );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\tnode.removeEventListener( 'focusout', onFocusOut );\n\t\t};\n\t}, [] );\n\n\tconst mergedRefs = useMergeRefs( [ container, ref ] );\n\n\treturn [ before, mergedRefs, after ];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,EAAEC,aAAa,QAAQ,gBAAgB;AACrD,SAASC,GAAG,QAAQ,qBAAqB;AACzC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,EAAEC,YAAY,QAAQ,oBAAoB;AAC/D,SAASC,MAAM,QAAQ,oBAAoB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,iBAAiB;AAClE,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3C,eAAe,SAASC,SAASA,CAAA,EAAG;EACnC,MAAMC,SAAS,GAAGT,MAAM,CAAC,CAAC;EAC1B,MAAMU,qBAAqB,GAAGV,MAAM,CAAC,CAAC;EACtC,MAAMW,oBAAoB,GAAGX,MAAM,CAAC,CAAC;EAErC,MAAM;IACLY,iBAAiB;IACjBC,wBAAwB;IACxBC,aAAa;IACbC,aAAa;IACbC,YAAY;IACZC,sBAAsB;IACtBC;EACD,CAAC,GAAGb,MAAM,CAAET,SAAS,CAAEM,gBAAiB,CAAE,CAAC;EAC3C,MAAM;IAAEiB;EAAa,CAAC,GAAGd,MAAM,CAAER,WAAW,CAAEK,gBAA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AG;QACzC;MACD;MAEA,MAAMmB,OAAO,GAAG3B,KAAK,CAAC4B,QAAQ;MAC9B,MAAMC,SAAS,GAAGF,OAAO,GAAG,cAAc,GAAG,UAAU;MACvD,MAAMnB,MAAM,GAAGrC,KAAK,CAAC4C,QAAQ,CAAEc,SAAS,CAAE,CAAE7B,KAAK,CAACQ,MAAO,CAAC;MAC1D;MACA,IACCA,MAAM,KAAKpB,qBAAqB,CAACa,OAAO,IACxCO,MAAM,KAAKnB,oBAAoB,CAACY,OAAO,EACtC;QACDD,KAAK,CAACyC,cAAc,CAAC,CAAC;QACtBjC,MAAM,CAACrC,KAAK,CAAE;UAAE+D,aAAa,EAAE;QAAK,CAAE,CAAC;MACxC;IACD;IAEA,MAAM;MAAE3B;IAAc,CAAC,GAAGgB,IAAI;IAC9B,MAAM;MAAEd;IAAY,CAAC,GAAGF,aAAa;IACrCE,WAAW,CAACiC,gBAAgB,CAAE,SAAS,EAAEH,kBAAmB,CAAC;IAC7DhB,IAAI,CAACmB,gBAAgB,CAAE,SAAS,EAAElB,SAAU,CAAC;IAC7CD,IAAI,CAACmB,gBAAgB,CAAE,UAAU,EAAEP,UAAW,CAAC;IAC/C,OAAO,MAAM;MACZ1B,WAAW,CAACkC,mBAAmB,CAAE,SAAS,EAAEJ,kBAAmB,CAAC;MAChEhB,IAAI,CAACoB,mBAAmB,CAAE,SAAS,EAAEnB,SAAU,CAAC;MAChDD,IAAI,CAACoB,mBAAmB,CAAE,UAAU,EAAER,UAAW,CAAC;IACnD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMS,UAAU,GAAGnE,YAAY,CAAE,CAAEU,SAAS,EAAEgC,GAAG,CAAG,CAAC;EAErD,OAAO,CAAED,MAAM,EAAE0B,UAAU,EAAEtB,KAAK,CAAE;AACrC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","addFilter","getBlockSupport","getBlockType","hasBlockSupport","BlockControls","BlockAlignmentControl","useAvailableAlignments","useBlockEditingMode","jsx","_jsx","ALL_ALIGNMENTS","WIDE_ALIGNMENTS","getValidAlignments","blockAlign","hasWideBlockSupport","hasWideEnabled","validAlignments","Array","isArray","filter","value","includes","alignment","addAttribute","settings","_settings$attributes$","attributes","align","type","enum","BlockEditAlignmentToolbarControlsPure","name","blockName","setAttributes","blockAllowedAlignments","map","blockEditingMode","length","updateAlignment","nextAlign","blockType","blockDefaultAlign","default","group","__experimentalShareWithChildBlocks","children","onChange","controls","shareWithChildBlocks","edit","useBlockProps","addSaveProps","addAssignedAlign","attributeKeys","hasSupport","some","props","isAlignValid","className"],"sources":["@wordpress/block-editor/src/hooks/align.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { BlockControls, BlockAlignmentControl } from '../components';\nimport useAvailableAlignments from '../components/block-alignment-control/use-available-alignments';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * An array which includes all possible valid alignments,\n * used to validate if an alignment is valid or not.\n *\n * @constant\n * @type {string[]}\n */\nconst ALL_ALIGNMENTS = [ 'left', 'center', 'right', 'wide', 'full' ];\n\n/**\n * An array which includes all wide alignments.\n * In order for this alignments to be valid they need to be supported by the block,\n * and by the theme.\n *\n * @constant\n * @type {string[]}\n */\nconst WIDE_ALIGNMENTS = [ 'wide', 'full' ];\n\n/**\n * Returns the valid alignments.\n * Takes into consideration the aligns supported by a block, if the block supports wide controls or not and if theme supports wide controls or not.\n * Exported just for testing purposes, not exported outside the module.\n *\n * @param {?boolean|string[]} blockAlign Aligns supported by the block.\n * @param {?boolean} hasWideBlockSupport True if block supports wide alignments. And False otherwise.\n * @param {?boolean} hasWideEnabled True if theme supports wide alignments. And False otherwise.\n *\n * @return {string[]} Valid alignments.\n */\nexport function getValidAlignments(\n\tblockAlign,\n\thasWideBlockSupport = true,\n\thasWideEnabled = true\n) {\n\tlet validAlignments;\n\tif ( Array.isArray( blockAlign ) ) {\n\t\tvalidAlignments = ALL_ALIGNMENTS.filter( ( value ) =>\n\t\t\tblockAlign.includes( value )\n\t\t);\n\t} else if ( blockAlign === true ) {\n\t\t// `true` includes all alignments...\n\t\tvalidAlignments = [ ...ALL_ALIGNMENTS ];\n\t} else {\n\t\tvalidAlignments = [];\n\t}\n\n\tif (\n\t\t! hasWideEnabled ||\n\t\t( blockAlign === true && ! hasWideBlockSupport )\n\t) {\n\t\treturn validAlignments.filter(\n\t\t\t( alignment ) => ! WIDE_ALIGNMENTS.includes( alignment )\n\t\t);\n\t}\n\n\treturn validAlignments;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `align`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( 'type' in ( settings.attributes?.align ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'align' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\talign: {\n\t\t\t\ttype: 'string',\n\t\t\t\t// Allow for '' since it is used by the `updateAlignment` function\n\t\t\t\t// in toolbar controls for special cases with defined default values.\n\t\t\t\tenum: [ ...ALL_ALIGNMENTS, '' ],\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockEditAlignmentToolbarControlsPure( {\n\tname: blockName,\n\talign,\n\tsetAttributes,\n} ) {\n\t// Compute the block valid alignments by taking into account,\n\t// if the theme supports wide alignments or not and the layout's\n\t// available alignments. We do that for conditionally rendering\n\t// Slot.\n\tconst blockAllowedAlignments = getValidAlignments(\n\t\tgetBlockSupport( blockName, 'align' ),\n\t\thasBlockSupport( blockName, 'alignWide', true )\n\t);\n\n\tconst validAlignments = useAvailableAlignments(\n\t\tblockAllowedAlignments\n\t).map( ( { name } ) => name );\n\tconst blockEditingMode = useBlockEditingMode();\n\tif ( ! validAlignments.length || blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst updateAlignment = ( nextAlign ) => {\n\t\tif ( ! nextAlign ) {\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tconst blockDefaultAlign = blockType?.attributes?.align?.default;\n\t\t\tif ( blockDefaultAlign ) {\n\t\t\t\tnextAlign = '';\n\t\t\t}\n\t\t}\n\t\tsetAttributes( { align: nextAlign } );\n\t};\n\n\treturn (\n\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t<BlockAlignmentControl\n\t\t\t\tvalue={ align }\n\t\t\t\tonChange={ updateAlignment }\n\t\t\t\tcontrols={ validAlignments }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: BlockEditAlignmentToolbarControlsPure,\n\tuseBlockProps,\n\taddSaveProps: addAssignedAlign,\n\tattributeKeys: [ 'align' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'align', false );\n\t},\n};\n\nfunction useBlockProps( { name, align } ) {\n\tconst blockAllowedAlignments = getValidAlignments(\n\t\tgetBlockSupport( name, 'align' ),\n\t\thasBlockSupport( name, 'alignWide', true )\n\t);\n\tconst validAlignments = useAvailableAlignments( blockAllowedAlignments );\n\n\tif ( validAlignments.some( ( alignment ) => alignment.name === align ) ) {\n\t\treturn { 'data-align': align };\n\t}\n\n\treturn {};\n}\n\n/**\n * Override props assigned to save component to inject alignment class name if\n * block supports it.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addAssignedAlign( props, blockType, attributes ) {\n\tconst { align } = attributes;\n\tconst blockAlign = getBlockSupport( blockType, 'align' );\n\tconst hasWideBlockSupport = hasBlockSupport( blockType, 'alignWide', true );\n\n\t// Compute valid alignments without taking into account if\n\t// the theme supports wide alignments or not.\n\t// This way changing themes does not impact the block save.\n\tconst isAlignValid = getValidAlignments(\n\t\tblockAlign,\n\t\thasWideBlockSupport\n\t).includes( align );\n\tif ( isAlignValid ) {\n\t\tprops.className = clsx( `align${ align }`, props.className );\n\t}\n\n\treturn props;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/align/addAttribute',\n\taddAttribute\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SACCC,eAAe,EACfC,YAAY,EACZC,eAAe,QACT,mBAAmB;;AAE1B;AACA;AACA;AACA,SAASC,aAAa,EAAEC,qBAAqB,QAAQ,eAAe;AACpE,OAAOC,sBAAsB,MAAM,gEAAgE;AACnG,SAASC,mBAAmB,QAAQ,kCAAkC;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;AANA,SAAAC,GAAA,IAAAC,IAAA;AAOA,MAAMC,cAAc,GAAG,CAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAE;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAe,GAAG,CAAE,MAAM,EAAE,MAAM,CAAE;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CACjCC,UAAU,EACVC,mBAAmB,GAAG,IAAI,EAC1BC,cAAc,GAAG,IAAI,EACpB;EACD,IAAIC,eAAe;EACnB,IAAKC,KAAK,CAACC,OAAO,CAAEL,UAAW,CAAC,EAAG;IAClCG,eAAe,GAAGN,cAAc,CAACS,MAAM,CAAIC,KAAK,IAC/CP,UAAU,CAACQ,QAAQ,CAAED,KAAM,CAC5B,CAAC;EACF,CAAC,MAAM,IAAKP,UA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f,eAAe,GAAGV,sBAAsB,CAAE4B,sBAAuB,CAAC;EAExE,IAAKlB,eAAe,CAACuC,IAAI,CAAIjC,SAAS,IAAMA,SAAS,CAACS,IAAI,KAAKJ,KAAM,CAAC,EAAG;IACxE,OAAO;MAAE,YAAY,EAAEA;IAAM,CAAC;EAC/B;EAEA,OAAO,CAAC,CAAC;AACV;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASyB,gBAAgBA,CAAEI,KAAK,EAAEhB,SAAS,EAAEd,UAAU,EAAG;EAChE,MAAM;IAAEC;EAAM,CAAC,GAAGD,UAAU;EAC5B,MAAMb,UAAU,GAAGZ,eAAe,CAAEuC,SAAS,EAAE,OAAQ,CAAC;EACxD,MAAM1B,mBAAmB,GAAGX,eAAe,CAAEqC,SAAS,EAAE,WAAW,EAAE,IAAK,CAAC;;EAE3E;EACA;EACA;EACA,MAAMiB,YAAY,GAAG7C,kBAAkB,CACtCC,UAAU,EACVC,mBACD,CAAC,CAACO,QAAQ,CAAEM,KAAM,CAAC;EACnB,IAAK8B,YAAY,EAAG;IACnBD,KAAK,CAACE,SAAS,GAAG3D,IAAI,CAAG,QAAQ4B,KAAO,EAAC,EAAE6B,KAAK,CAACE,SAAU,CAAC;EAC7D;EAEA,OAAOF,KAAK;AACb;AAEAxD,SAAS,CACR,0BAA0B,EAC1B,gCAAgC,EAChCuB,YACD,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","addFilter","getBlockSupport","getBlockType","hasBlockSupport","BlockControls","BlockAlignmentControl","useAvailableAlignments","useBlockEditingMode","jsx","_jsx","ALL_ALIGNMENTS","WIDE_ALIGNMENTS","getValidAlignments","blockAlign","hasWideBlockSupport","hasWideEnabled","validAlignments","Array","isArray","filter","value","includes","alignment","addAttribute","settings","_settings$attributes$","attributes","align","type","enum","BlockEditAlignmentToolbarControlsPure","name","blockName","setAttributes","blockAllowedAlignments","map","blockEditingMode","length","updateAlignment","nextAlign","blockType","blockDefaultAlign","default","group","__experimentalShareWithChildBlocks","children","onChange","controls","shareWithChildBlocks","edit","useBlockProps","addSaveProps","addAssignedAlign","attributeKeys","hasSupport","some","props","isAlignValid","className"],"sources":["@wordpress/block-editor/src/hooks/align.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { BlockControls, BlockAlignmentControl } from '../components';\nimport useAvailableAlignments from '../components/block-alignment-control/use-available-alignments';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * An array which includes all possible valid alignments,\n * used to validate if an alignment is valid or not.\n *\n * @constant\n * @type {string[]}\n */\nconst ALL_ALIGNMENTS = [ 'left', 'center', 'right', 'wide', 'full' ];\n\n/**\n * An array which includes all wide alignments.\n * In order for this alignments to be valid they need to be supported by the block,\n * and by the theme.\n *\n * @constant\n * @type {string[]}\n */\nconst WIDE_ALIGNMENTS = [ 'wide', 'full' ];\n\n/**\n * Returns the valid alignments.\n * Takes into consideration the aligns supported by a block, if the block supports wide controls or not and if theme supports wide controls or not.\n * Exported just for testing purposes, not exported outside the module.\n *\n * @param {?boolean|string[]} blockAlign Aligns supported by the block.\n * @param {?boolean} hasWideBlockSupport True if block supports wide alignments. And False otherwise.\n * @param {?boolean} hasWideEnabled True if theme supports wide alignments. And False otherwise.\n *\n * @return {string[]} Valid alignments.\n */\nexport function getValidAlignments(\n\tblockAlign,\n\thasWideBlockSupport = true,\n\thasWideEnabled = true\n) {\n\tlet validAlignments;\n\tif ( Array.isArray( blockAlign ) ) {\n\t\tvalidAlignments = ALL_ALIGNMENTS.filter( ( value ) =>\n\t\t\tblockAlign.includes( value )\n\t\t);\n\t} else if ( blockAlign === true ) {\n\t\t// `true` includes all alignments...\n\t\tvalidAlignments = [ ...ALL_ALIGNMENTS ];\n\t} else {\n\t\tvalidAlignments = [];\n\t}\n\n\tif (\n\t\t! hasWideEnabled ||\n\t\t( blockAlign === true && ! hasWideBlockSupport )\n\t) {\n\t\treturn validAlignments.filter(\n\t\t\t( alignment ) => ! WIDE_ALIGNMENTS.includes( alignment )\n\t\t);\n\t}\n\n\treturn validAlignments;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `align`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( 'type' in ( settings.attributes?.align ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'align' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\talign: {\n\t\t\t\ttype: 'string',\n\t\t\t\t// Allow for '' since it is used by the `updateAlignment` function\n\t\t\t\t// in toolbar controls for special cases with defined default values.\n\t\t\t\tenum: [ ...ALL_ALIGNMENTS, '' ],\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockEditAlignmentToolbarControlsPure( {\n\tname: blockName,\n\talign,\n\tsetAttributes,\n} ) {\n\t// Compute the block valid alignments by taking into account,\n\t// if the theme supports wide alignments or not and the layout's\n\t// available alignments. We do that for conditionally rendering\n\t// Slot.\n\tconst blockAllowedAlignments = getValidAlignments(\n\t\tgetBlockSupport( blockName, 'align' ),\n\t\thasBlockSupport( blockName, 'alignWide', true )\n\t);\n\n\tconst validAlignments = useAvailableAlignments(\n\t\tblockAllowedAlignments\n\t).map( ( { name } ) => name );\n\tconst blockEditingMode = useBlockEditingMode();\n\tif ( ! validAlignments.length || blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst updateAlignment = ( nextAlign ) => {\n\t\tif ( ! nextAlign ) {\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tconst blockDefaultAlign = blockType?.attributes?.align?.default;\n\t\t\tif ( blockDefaultAlign ) {\n\t\t\t\tnextAlign = '';\n\t\t\t}\n\t\t}\n\t\tsetAttributes( { align: nextAlign } );\n\t};\n\n\treturn (\n\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t<BlockAlignmentControl\n\t\t\t\tvalue={ align }\n\t\t\t\tonChange={ updateAlignment }\n\t\t\t\tcontrols={ validAlignments }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: BlockEditAlignmentToolbarControlsPure,\n\tuseBlockProps,\n\taddSaveProps: addAssignedAlign,\n\tattributeKeys: [ 'align' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'align', false );\n\t},\n};\n\nfunction useBlockProps( { name, align } ) {\n\tconst blockAllowedAlignments = getValidAlignments(\n\t\tgetBlockSupport( name, 'align' ),\n\t\thasBlockSupport( name, 'alignWide', true )\n\t);\n\tconst validAlignments = useAvailableAlignments( blockAllowedAlignments );\n\n\tif ( validAlignments.some( ( alignment ) => alignment.name === align ) ) {\n\t\treturn { 'data-align': align };\n\t}\n\n\treturn {};\n}\n\n/**\n * Override props assigned to save component to inject alignment class name if\n * block supports it.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addAssignedAlign( props, blockType, attributes ) {\n\tconst { align } = attributes;\n\tconst blockAlign = getBlockSupport( blockType, 'align' );\n\tconst hasWideBlockSupport = hasBlockSupport( blockType, 'alignWide', true );\n\n\t// Compute valid alignments without taking into account if\n\t// the theme supports wide alignments or not.\n\t// This way changing themes does not impact the block save.\n\tconst isAlignValid = getValidAlignments(\n\t\tblockAlign,\n\t\thasWideBlockSupport\n\t).includes( align );\n\tif ( isAlignValid ) {\n\t\tprops.className = clsx( `align${ align }`, props.className );\n\t}\n\n\treturn props;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/align/addAttribute',\n\taddAttribute\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SACCC,eAAe,EACfC,YAAY,EACZC,eAAe,QACT,mBAAmB;;AAE1B;AACA;AACA;AACA,SAASC,aAAa,EAAEC,qBAAqB,QAAQ,eAAe;AACpE,OAAOC,sBAAsB,MAAM,gEAAgE;AACnG,SAASC,mBAAmB,QAAQ,kCAAkC;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;AANA,SAAAC,GAAA,IAAAC,IAAA;AAOA,MAAMC,cAAc,GAAG,CAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAE;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAe,GAAG,CAAE,MAAM,EAAE,MAAM,CAAE;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CACjCC,UAAU,EACVC,mBAAmB,GAAG,IAAI,EAC1BC,cAAc,GAAG,IAAI,EACpB;EACD,IAAIC,eAAe;EACnB,IAAKC,KAAK,CAACC,OAAO,CAAEL,UAAW,CAAC,EAAG;IAClCG,eAAe,GAAGN,cAAc,CAACS,MAAM,CAAIC,KAAK,IAC/CP,UAAU,CAACQ,QAAQ,CAAED,KAAM,CAC5B,CAAC;EACF,CAAC,MAAM,IAAKP,UAAU,KAAK,IAAI,EAAG;IACjC;IACAG,eAAe,GAAG,CAAE,GAAGN,cAAc,CAAE;EACxC,CAAC,MAAM;IACNM,eAAe,GAAG,EAAE;EACrB;EAEA,IACC,CAAED,cAAc,IACdF,UAAU,KAAK,IAAI,IAAI,CAAEC,mBAAqB,EAC/C;IACD,OAAOE,eAAe,CAACG,MAAM,CAC1BG,SAAS,IAAM,CAAEX,eAA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;AACA;AACA;AACA;AACA;AACA,OAAO,SAASyB,gBAAgBA,CAAEI,KAAK,EAAEhB,SAAS,EAAEd,UAAU,EAAG;EAChE,MAAM;IAAEC;EAAM,CAAC,GAAGD,UAAU;EAC5B,MAAMb,UAAU,GAAGZ,eAAe,CAAEuC,SAAS,EAAE,OAAQ,CAAC;EACxD,MAAM1B,mBAAmB,GAAGX,eAAe,CAAEqC,SAAS,EAAE,WAAW,EAAE,IAAK,CAAC;;EAE3E;EACA;EACA;EACA,MAAMiB,YAAY,GAAG7C,kBAAkB,CACtCC,UAAU,EACVC,mBACD,CAAC,CAACO,QAAQ,CAAEM,KAAM,CAAC;EACnB,IAAK8B,YAAY,EAAG;IACnBD,KAAK,CAACE,SAAS,GAAG3D,IAAI,CAAE,QAAS4B,KAAK,EAAG,EAAE6B,KAAK,CAACE,SAAU,CAAC;EAC7D;EAEA,OAAOF,KAAK;AACb;AAEAxD,SAAS,CACR,0BAA0B,EAC1B,gCAAgC,EAChCuB,YACD,CAAC","ignoreList":[]}
|
|
@@ -18,9 +18,7 @@ import { useBlockEditingMode } from '../components/block-editing-mode';
|
|
|
18
18
|
*
|
|
19
19
|
* @type {RegExp}
|
|
20
20
|
*/
|
|
21
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
23
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
22
|
const ANCHOR_REGEX = /[\s#]/g;
|
|
25
23
|
const ANCHOR_SCHEMA = {
|
|
26
24
|
type: 'string',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["addFilter","TextControl","ExternalLink","__","hasBlockSupport","Platform","InspectorControls","useBlockEditingMode","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ANCHOR_REGEX","ANCHOR_SCHEMA","type","source","attribute","selector","addAttribute","settings","_settings$attributes$","attributes","anchor","BlockEditAnchorControlPure","setAttributes","blockEditingMode","isWeb","OS","group","children","__nextHasNoMarginBottom","__next40pxDefaultSize","className","label","help","href","value","placeholder","onChange","nextValue","replace","autoCapitalize","autoComplete","addSaveProps","edit","attributeKeys","hasSupport","name","extraProps","blockType","id"],"sources":["@wordpress/block-editor/src/hooks/anchor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { TextControl, ExternalLink } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { InspectorControls } from '../components';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * Regular expression matching invalid anchor characters for replacement.\n *\n * @type {RegExp}\n */\nconst ANCHOR_REGEX = /[\\s#]/g;\n\nconst ANCHOR_SCHEMA = {\n\ttype: 'string',\n\tsource: 'attribute',\n\tattribute: 'id',\n\tselector: '*',\n};\n\n/**\n * Filters registered block settings, extending attributes with anchor using ID\n * of the first node.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( 'type' in ( settings.attributes?.anchor ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'anchor' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tanchor: ANCHOR_SCHEMA,\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockEditAnchorControlPure( { anchor, setAttributes } ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst isWeb = Platform.OS === 'web';\n\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tclassName=\"html-anchor-control\"\n\t\t\t\tlabel={ __( 'HTML anchor' ) }\n\t\t\t\thelp={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor”. Then, you’ll be able to link directly to this section of your page.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isWeb && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{ ' ' }\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-jumps/'\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\t\t{ __( 'Learn more about anchors' ) }\n\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tvalue={ anchor || '' }\n\t\t\t\tplaceholder={ ! isWeb ? __( 'Add an anchor' ) : null }\n\t\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\t\tnextValue = nextValue.replace( ANCHOR_REGEX, '-' );\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tanchor: nextValue,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tautoCapitalize=\"none\"\n\t\t\t\tautoComplete=\"off\"\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nexport default {\n\taddSaveProps,\n\tedit: BlockEditAnchorControlPure,\n\tattributeKeys: [ 'anchor' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'anchor' );\n\t},\n};\n\n/**\n * Override props assigned to save component to inject anchor ID, if block\n * supports anchor. This is only applied if the block's save result is an\n * element and not a markup string.\n *\n * @param {Object} extraProps Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Current block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( extraProps, blockType, attributes ) {\n\tif ( hasBlockSupport( blockType, 'anchor' ) ) {\n\t\textraProps.id = attributes.anchor === '' ? null : attributes.anchor;\n\t}\n\n\treturn extraProps;\n}\n\naddFilter( 'blocks.registerBlockType', 'core/anchor/attribute', addAttribute );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,WAAW,EAAEC,YAAY,QAAQ,uBAAuB;AACjE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,SAASC,iBAAiB,QAAQ,eAAe;AACjD,SAASC,mBAAmB,QAAQ,kCAAkC;;AAEtE;AACA;AACA;AACA;AACA;AAJA,SAAAC,GAAA,IAAAC,IAAA
|
|
1
|
+
{"version":3,"names":["addFilter","TextControl","ExternalLink","__","hasBlockSupport","Platform","InspectorControls","useBlockEditingMode","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ANCHOR_REGEX","ANCHOR_SCHEMA","type","source","attribute","selector","addAttribute","settings","_settings$attributes$","attributes","anchor","BlockEditAnchorControlPure","setAttributes","blockEditingMode","isWeb","OS","group","children","__nextHasNoMarginBottom","__next40pxDefaultSize","className","label","help","href","value","placeholder","onChange","nextValue","replace","autoCapitalize","autoComplete","addSaveProps","edit","attributeKeys","hasSupport","name","extraProps","blockType","id"],"sources":["@wordpress/block-editor/src/hooks/anchor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { TextControl, ExternalLink } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { InspectorControls } from '../components';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * Regular expression matching invalid anchor characters for replacement.\n *\n * @type {RegExp}\n */\nconst ANCHOR_REGEX = /[\\s#]/g;\n\nconst ANCHOR_SCHEMA = {\n\ttype: 'string',\n\tsource: 'attribute',\n\tattribute: 'id',\n\tselector: '*',\n};\n\n/**\n * Filters registered block settings, extending attributes with anchor using ID\n * of the first node.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( 'type' in ( settings.attributes?.anchor ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'anchor' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tanchor: ANCHOR_SCHEMA,\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockEditAnchorControlPure( { anchor, setAttributes } ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst isWeb = Platform.OS === 'web';\n\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tclassName=\"html-anchor-control\"\n\t\t\t\tlabel={ __( 'HTML anchor' ) }\n\t\t\t\thelp={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor”. Then, you’ll be able to link directly to this section of your page.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isWeb && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{ ' ' }\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-jumps/'\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\t\t{ __( 'Learn more about anchors' ) }\n\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tvalue={ anchor || '' }\n\t\t\t\tplaceholder={ ! isWeb ? __( 'Add an anchor' ) : null }\n\t\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\t\tnextValue = nextValue.replace( ANCHOR_REGEX, '-' );\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tanchor: nextValue,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tautoCapitalize=\"none\"\n\t\t\t\tautoComplete=\"off\"\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nexport default {\n\taddSaveProps,\n\tedit: BlockEditAnchorControlPure,\n\tattributeKeys: [ 'anchor' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'anchor' );\n\t},\n};\n\n/**\n * Override props assigned to save component to inject anchor ID, if block\n * supports anchor. This is only applied if the block's save result is an\n * element and not a markup string.\n *\n * @param {Object} extraProps Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Current block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( extraProps, blockType, attributes ) {\n\tif ( hasBlockSupport( blockType, 'anchor' ) ) {\n\t\textraProps.id = attributes.anchor === '' ? null : attributes.anchor;\n\t}\n\n\treturn extraProps;\n}\n\naddFilter( 'blocks.registerBlockType', 'core/anchor/attribute', addAttribute );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,WAAW,EAAEC,YAAY,QAAQ,uBAAuB;AACjE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,QAAQ,QAA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,OAAO0B,UAAU;AAClB;AAEAlD,SAAS,CAAE,0BAA0B,EAAE,uBAAuB,EAAEoB,YAAa,CAAC","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { getBlockBindingsSource, getBlockBindingsSources } from '@wordpress/blocks';
|
|
5
|
+
import { getBlockBindingsSource, getBlockBindingsSources, getBlockType } from '@wordpress/blocks';
|
|
6
6
|
import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item, __experimentalText as Text, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, __experimentalVStack as VStack, privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
7
7
|
import { useSelect } from '@wordpress/data';
|
|
8
8
|
import { useContext, Fragment } from '@wordpress/element';
|
|
@@ -15,13 +15,12 @@ import { canBindAttribute, getBindableAttributes } from '../hooks/use-bindings-a
|
|
|
15
15
|
import { unlock } from '../lock-unlock';
|
|
16
16
|
import InspectorControls from '../components/inspector-controls';
|
|
17
17
|
import BlockContext from '../components/block-context';
|
|
18
|
+
import { useBlockEditContext } from '../components/block-edit';
|
|
18
19
|
import { useBlockBindingsUtils } from '../utils/block-bindings';
|
|
19
20
|
import { store as blockEditorStore } from '../store';
|
|
20
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
21
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
23
22
|
const {
|
|
24
|
-
|
|
23
|
+
Menu
|
|
25
24
|
} = unlock(componentsPrivateApis);
|
|
26
25
|
const EMPTY_OBJECT = {};
|
|
27
26
|
const useToolsPanelDropdownMenuProps = () => {
|
|
@@ -39,17 +38,27 @@ function BlockBindingsPanelDropdown({
|
|
|
39
38
|
attribute,
|
|
40
39
|
binding
|
|
41
40
|
}) {
|
|
41
|
+
const {
|
|
42
|
+
clientId
|
|
43
|
+
} = useBlockEditContext();
|
|
42
44
|
const registeredSources = getBlockBindingsSources();
|
|
43
45
|
const {
|
|
44
46
|
updateBlockBindings
|
|
45
47
|
} = useBlockBindingsUtils();
|
|
46
48
|
const currentKey = binding?.args?.key;
|
|
49
|
+
const attributeType = useSelect(select => {
|
|
50
|
+
const {
|
|
51
|
+
name: blockName
|
|
52
|
+
} = select(blockEditorStore).getBlock(clientId);
|
|
53
|
+
const _attributeType = getBlockType(blockName).attributes?.[attribute]?.type;
|
|
54
|
+
return _attributeType === 'rich-text' ? 'string' : _attributeType;
|
|
55
|
+
}, [clientId, attribute]);
|
|
47
56
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
48
57
|
children: Object.entries(fieldsList).map(([name, fields], i) => /*#__PURE__*/_jsxs(Fragment, {
|
|
49
|
-
children: [/*#__PURE__*/_jsxs(
|
|
50
|
-
children: [Object.keys(fieldsList).length > 1 && /*#__PURE__*/_jsx(
|
|
58
|
+
children: [/*#__PURE__*/_jsxs(Menu.Group, {
|
|
59
|
+
children: [Object.keys(fieldsList).length > 1 && /*#__PURE__*/_jsx(Menu.GroupLabel, {
|
|
51
60
|
children: registeredSources[name].label
|
|
52
|
-
}), Object.entries(fields).map(([key, args]) => /*#__PURE__*/_jsxs(
|
|
61
|
+
}), Object.entries(fields).filter(([, args]) => args?.type === attributeType).map(([key, args]) => /*#__PURE__*/_jsxs(Menu.RadioItem, {
|
|
53
62
|
onChange: () => updateBlockBindings({
|
|
54
63
|
[attribute]: {
|
|
55
64
|
source: name,
|
|
@@ -61,13 +70,13 @@ function BlockBindingsPanelDropdown({
|
|
|
61
70
|
name: attribute + '-binding',
|
|
62
71
|
value: key,
|
|
63
72
|
checked: key === currentKey,
|
|
64
|
-
children: [/*#__PURE__*/_jsx(
|
|
73
|
+
children: [/*#__PURE__*/_jsx(Menu.ItemLabel, {
|
|
65
74
|
children: args?.label
|
|
66
|
-
}), /*#__PURE__*/_jsx(
|
|
75
|
+
}), /*#__PURE__*/_jsx(Menu.ItemHelpText, {
|
|
67
76
|
children: args?.value
|
|
68
77
|
})]
|
|
69
78
|
}, key))]
|
|
70
|
-
}), i !== Object.keys(fieldsList).length - 1 && /*#__PURE__*/_jsx(
|
|
79
|
+
}), i !== Object.keys(fieldsList).length - 1 && /*#__PURE__*/_jsx(Menu.Separator, {})]
|
|
71
80
|
}, name))
|
|
72
81
|
});
|
|
73
82
|
}
|
|
@@ -130,7 +139,7 @@ function EditableBlockBindingsPanelItems({
|
|
|
130
139
|
[attribute]: undefined
|
|
131
140
|
});
|
|
132
141
|
},
|
|
133
|
-
children: /*#__PURE__*/_jsx(
|
|
142
|
+
children: /*#__PURE__*/_jsx(Menu, {
|
|
134
143
|
placement: isMobile ? 'bottom-start' : 'left-start',
|
|
135
144
|
gutter: isMobile ? 8 : 36,
|
|
136
145
|
trigger: /*#__PURE__*/_jsx(Item, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","getBlockBindingsSource","getBlockBindingsSources","__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__experimentalText","Text","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalVStack","VStack","privateApis","componentsPrivateApis","useSelect","useContext","Fragment","useViewportMatch","canBindAttribute","getBindableAttributes","unlock","InspectorControls","BlockContext","useBlockBindingsUtils","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","_Fragment","DropdownMenuV2","EMPTY_OBJECT","useToolsPanelDropdownMenuProps","isMobile","popoverProps","placement","offset","BlockBindingsPanelDropdown","fieldsList","attribute","binding","registeredSources","updateBlockBindings","currentKey","args","key","children","Object","entries","map","name","fields","i","Group","keys","length","GroupLabel","label","RadioItem","onChange","source","value","checked","ItemLabel","ItemHelpText","Separator","BlockBindingsAttribute","sourceName","sourceProps","isSourceInvalid","className","spacing","truncate","variant","isDestructive","ReadOnlyBlockBindingsPanelItems","bindings","EditableBlockBindingsPanelItems","attributes","hasValue","onDeselect","undefined","gutter","trigger","BlockBindingsPanel","blockName","metadata","blockContext","removeAllBlockBindings","bindableAttributes","dropdownMenuProps","_fieldsList","canUpdateBlockBindings","select","forEach","getFieldsList","usesContext","context","sourceList","values","getSettings","filteredBindings","readOnly","group","resetAll","isBordered","isSeparated","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/block-bindings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tgetBlockBindingsSource,\n\tgetBlockBindingsSources,\n} from '@wordpress/blocks';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalText as Text,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalVStack as VStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, Fragment } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcanBindAttribute,\n\tgetBindableAttributes,\n} from '../hooks/use-bindings-attributes';\nimport { unlock } from '../lock-unlock';\nimport InspectorControls from '../components/inspector-controls';\nimport BlockContext from '../components/block-context';\nimport { useBlockBindingsUtils } from '../utils/block-bindings';\nimport { store as blockEditorStore } from '../store';\n\nconst { DropdownMenuV2 } = unlock( componentsPrivateApis );\n\nconst EMPTY_OBJECT = {};\n\nconst useToolsPanelDropdownMenuProps = () => {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn ! isMobile\n\t\t? {\n\t\t\t\tpopoverProps: {\n\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t\t\t\t\toffset: 259,\n\t\t\t\t},\n\t\t }\n\t\t: {};\n};\n\nfunction BlockBindingsPanelDropdown( { fieldsList, attribute, binding } ) {\n\tconst registeredSources = getBlockBindingsSources();\n\tconst { updateBlockBindings } = useBlockBindingsUtils();\n\tconst currentKey = binding?.args?.key;\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( fieldsList ).map( ( [ name, fields ], i ) => (\n\t\t\t\t<Fragment key={ name }>\n\t\t\t\t\t<DropdownMenuV2.Group>\n\t\t\t\t\t\t{ Object.keys( fieldsList ).length > 1 && (\n\t\t\t\t\t\t\t<DropdownMenuV2.GroupLabel>\n\t\t\t\t\t\t\t\t{ registeredSources[ name ].label }\n\t\t\t\t\t\t\t</DropdownMenuV2.GroupLabel>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ Object.entries( fields ).map( ( [ key, args ] ) => (\n\t\t\t\t\t\t\t<DropdownMenuV2.RadioItem\n\t\t\t\t\t\t\t\tkey={ key }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tupdateBlockBindings( {\n\t\t\t\t\t\t\t\t\t\t[ attribute ]: {\n\t\t\t\t\t\t\t\t\t\t\tsource: name,\n\t\t\t\t\t\t\t\t\t\t\targs: { key },\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\tname={ attribute + '-binding' }\n\t\t\t\t\t\t\t\tvalue={ key }\n\t\t\t\t\t\t\t\tchecked={ key === currentKey }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t\t\t{ args?.label }\n\t\t\t\t\t\t\t\t</DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t\t<DropdownMenuV2.ItemHelpText>\n\t\t\t\t\t\t\t\t\t{ args?.value }\n\t\t\t\t\t\t\t\t</DropdownMenuV2.ItemHelpText>\n\t\t\t\t\t\t\t</DropdownMenuV2.RadioItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</DropdownMenuV2.Group>\n\t\t\t\t\t{ i !== Object.keys( fieldsList ).length - 1 && (\n\t\t\t\t\t\t<DropdownMenuV2.Separator />\n\t\t\t\t\t) }\n\t\t\t\t</Fragment>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction BlockBindingsAttribute( { attribute, binding, fieldsList } ) {\n\tconst { source: sourceName, args } = binding || {};\n\tconst sourceProps = getBlockBindingsSource( sourceName );\n\tconst isSourceInvalid = ! sourceProps;\n\treturn (\n\t\t<VStack className=\"block-editor-bindings__item\" spacing={ 0 }>\n\t\t\t<Text truncate>{ attribute }</Text>\n\t\t\t{ !! binding && (\n\t\t\t\t<Text\n\t\t\t\t\ttruncate\n\t\t\t\t\tvariant={ ! isSourceInvalid && 'muted' }\n\t\t\t\t\tisDestructive={ isSourceInvalid }\n\t\t\t\t>\n\t\t\t\t\t{ isSourceInvalid\n\t\t\t\t\t\t? __( 'Invalid source' )\n\t\t\t\t\t\t: fieldsList?.[ sourceName ]?.[ args?.key ]?.label ||\n\t\t\t\t\t\t sourceProps?.label ||\n\t\t\t\t\t\t sourceName }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nfunction ReadOnlyBlockBindingsPanelItems( { bindings, fieldsList } ) {\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( bindings ).map( ( [ attribute, binding ] ) => (\n\t\t\t\t<Item key={ attribute }>\n\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t/>\n\t\t\t\t</Item>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction EditableBlockBindingsPanelItems( {\n\tattributes,\n\tbindings,\n\tfieldsList,\n} ) {\n\tconst { updateBlockBindings } = useBlockBindingsUtils();\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn (\n\t\t<>\n\t\t\t{ attributes.map( ( attribute ) => {\n\t\t\t\tconst binding = bindings[ attribute ];\n\t\t\t\treturn (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tkey={ attribute }\n\t\t\t\t\t\thasValue={ () => !! binding }\n\t\t\t\t\t\tlabel={ attribute }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tupdateBlockBindings( {\n\t\t\t\t\t\t\t\t[ attribute ]: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<DropdownMenuV2\n\t\t\t\t\t\t\tplacement={\n\t\t\t\t\t\t\t\tisMobile ? 'bottom-start' : 'left-start'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgutter={ isMobile ? 8 : 36 }\n\t\t\t\t\t\t\ttrigger={\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockBindingsPanelDropdown\n\t\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</DropdownMenuV2>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nexport const BlockBindingsPanel = ( { name: blockName, metadata } ) => {\n\tconst blockContext = useContext( BlockContext );\n\tconst { removeAllBlockBindings } = useBlockBindingsUtils();\n\tconst bindableAttributes = getBindableAttributes( blockName );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// `useSelect` is used purposely here to ensure `getFieldsList`\n\t// is updated whenever there are updates in block context.\n\t// `source.getFieldsList` may also call a selector via `select`.\n\tconst _fieldsList = {};\n\tconst { fieldsList, canUpdateBlockBindings } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! bindableAttributes || bindableAttributes.length === 0 ) {\n\t\t\t\treturn EMPTY_OBJECT;\n\t\t\t}\n\t\t\tconst registeredSources = getBlockBindingsSources();\n\t\t\tObject.entries( registeredSources ).forEach(\n\t\t\t\t( [ sourceName, { getFieldsList, usesContext } ] ) => {\n\t\t\t\t\tif ( getFieldsList ) {\n\t\t\t\t\t\t// Populate context.\n\t\t\t\t\t\tconst context = {};\n\t\t\t\t\t\tif ( usesContext?.length ) {\n\t\t\t\t\t\t\tfor ( const key of usesContext ) {\n\t\t\t\t\t\t\t\tcontext[ key ] = blockContext[ key ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst sourceList = getFieldsList( {\n\t\t\t\t\t\t\tselect,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\t// Only add source if the list is not empty.\n\t\t\t\t\t\tif ( Object.keys( sourceList || {} ).length ) {\n\t\t\t\t\t\t\t_fieldsList[ sourceName ] = { ...sourceList };\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tfieldsList:\n\t\t\t\t\tObject.values( _fieldsList ).length > 0\n\t\t\t\t\t\t? _fieldsList\n\t\t\t\t\t\t: EMPTY_OBJECT,\n\t\t\t\tcanUpdateBlockBindings:\n\t\t\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t\t\t.canUpdateBlockBindings,\n\t\t\t};\n\t\t},\n\t\t[ blockContext, bindableAttributes ]\n\t);\n\t// Return early if there are no bindable attributes.\n\tif ( ! bindableAttributes || bindableAttributes.length === 0 ) {\n\t\treturn null;\n\t}\n\t// Filter bindings to only show bindable attributes and remove pattern overrides.\n\tconst { bindings } = metadata || {};\n\tconst filteredBindings = { ...bindings };\n\tObject.keys( filteredBindings ).forEach( ( key ) => {\n\t\tif (\n\t\t\t! canBindAttribute( blockName, key ) ||\n\t\t\tfilteredBindings[ key ].source === 'core/pattern-overrides'\n\t\t) {\n\t\t\tdelete filteredBindings[ key ];\n\t\t}\n\t} );\n\n\t// Lock the UI when the user can't update bindings or there are no fields to connect to.\n\tconst readOnly =\n\t\t! canUpdateBlockBindings || ! Object.keys( fieldsList ).length;\n\n\tif ( readOnly && Object.keys( filteredBindings ).length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorControls group=\"bindings\">\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Attributes' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tremoveAllBlockBindings();\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\tclassName=\"block-editor-bindings__panel\"\n\t\t\t>\n\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t{ readOnly ? (\n\t\t\t\t\t\t<ReadOnlyBlockBindingsPanelItems\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<EditableBlockBindingsPanelItems\n\t\t\t\t\t\t\tattributes={ bindableAttributes }\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ItemGroup>\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Attributes connected to custom fields or other dynamic data.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t</ItemGroup>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n};\n\nexport default {\n\tedit: BlockBindingsPanel,\n\tattributeKeys: [ 'metadata' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SACCC,sBAAsB,EACtBC,uBAAuB,QACjB,mBAAmB;AAC1B,SACCC,uBAAuB,IAAIC,SAAS,EACpCC,kBAAkB,IAAIC,IAAI,EAC1BC,kBAAkB,IAAIC,IAAI,EAC1BC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,EAC9CC,oBAAoB,IAAIC,MAAM,EAC9BC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,UAAU,EAAEC,QAAQ,QAAQ,oBAAoB;AACzD,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA,SACCC,gBAAgB,EAChBC,qBAAqB,QACf,kCAAkC;AACzC,SAASC,MAAM,QAAQ,gBAAgB;AACvC,OAAOC,iBAAiB,MAAM,kCAAkC;AAChE,OAAOC,YAAY,MAAM,6BAA6B;AACtD,SAASC,qBAAqB,QAAQ,yBAAyB;AAC/D,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAb,QAAA,IAAAc,SAAA;AAErD,MAAM;EAAEC;AAAe,CAAC,GAAGX,MAAM,CAAEP,qBAAsB,CAAC;AAE1D,MAAMmB,YAAY,GAAG,CAAC,CAAC;AAEvB,MAAMC,8BAA8B,GAAGA,CAAA,KAAM;EAC5C,MAAMC,QAAQ,GAAGjB,gBAAgB,CAAE,QAAQ,EAAE,GAAI,CAAC;EAClD,OAAO,CAAEiB,QAAQ,GACd;IACAC,YAAY,EAAE;MACbC,SAAS,EAAE,YAAY;MACvB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AE+C,gBAAiB,CAAC,CAAC9C,MAAM,KAAK,CAAC,EAAG;IAC/D,OAAO,IAAI;EACZ;EAEA,oBACC7B,IAAA,CAACN,iBAAiB;IAACmF,KAAK,EAAC,UAAU;IAAAzD,QAAA,eAClClB,KAAA,CAACtB,UAAU;MACVmD,KAAK,EAAG7D,EAAE,CAAE,YAAa,CAAG;MAC5B4G,QAAQ,EAAGA,CAAA,KAAM;QAChBhB,sBAAsB,CAAC,CAAC;MACzB,CAAG;MACHE,iBAAiB,EAAGA,iBAAmB;MACvCpB,SAAS,EAAC,8BAA8B;MAAAxB,QAAA,gBAExCpB,IAAA,CAAC1B,SAAS;QAACyG,UAAU;QAACC,WAAW;QAAA5D,QAAA,EAC9BwD,QAAQ,gBACT5E,IAAA,CAACiD,+BAA+B;UAC/BC,QAAQ,EAAGyB,gBAAkB;UAC7B/D,UAAU,EAAGA;QAAY,CACzB,CAAC,gBAEFZ,IAAA,CAACmD,+BAA+B;UAC/BC,UAAU,EAAGW,kBAAoB;UACjCb,QAAQ,EAAGyB,gBAAkB;UAC7B/D,UAAU,EAAGA;QAAY,CACzB;MACD,CACS,CAAC,eACZZ,IAAA,CAAC1B,SAAS;QAAA8C,QAAA,eACTpB,IAAA,CAACtB,IAAI;UAACqE,OAAO,EAAC,OAAO;UAAA3B,QAAA,EAClBlD,EAAE,CACH,8DACD;QAAC,CACI;MAAC,CACG,CAAC;IAAA,CACD;EAAC,CACK,CAAC;AAEtB,CAAC;AAED,eAAe;EACd+G,IAAI,EAAEvB,kBAAkB;EACxBwB,aAAa,EAAE,CAAE,UAAU,CAAE;EAC7BC,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__","getBlockBindingsSource","getBlockBindingsSources","getBlockType","__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__experimentalText","Text","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalVStack","VStack","privateApis","componentsPrivateApis","useSelect","useContext","Fragment","useViewportMatch","canBindAttribute","getBindableAttributes","unlock","InspectorControls","BlockContext","useBlockEditContext","useBlockBindingsUtils","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","_Fragment","Menu","EMPTY_OBJECT","useToolsPanelDropdownMenuProps","isMobile","popoverProps","placement","offset","BlockBindingsPanelDropdown","fieldsList","attribute","binding","clientId","registeredSources","updateBlockBindings","currentKey","args","key","attributeType","select","name","blockName","getBlock","_attributeType","attributes","type","children","Object","entries","map","fields","i","Group","keys","length","GroupLabel","label","filter","RadioItem","onChange","source","value","checked","ItemLabel","ItemHelpText","Separator","BlockBindingsAttribute","sourceName","sourceProps","isSourceInvalid","className","spacing","truncate","variant","isDestructive","ReadOnlyBlockBindingsPanelItems","bindings","EditableBlockBindingsPanelItems","hasValue","onDeselect","undefined","gutter","trigger","BlockBindingsPanel","metadata","blockContext","removeAllBlockBindings","bindableAttributes","dropdownMenuProps","_fieldsList","canUpdateBlockBindings","forEach","getFieldsList","usesContext","context","sourceList","values","getSettings","filteredBindings","readOnly","group","resetAll","isBordered","isSeparated","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/block-bindings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tgetBlockBindingsSource,\n\tgetBlockBindingsSources,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalText as Text,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalVStack as VStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, Fragment } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcanBindAttribute,\n\tgetBindableAttributes,\n} from '../hooks/use-bindings-attributes';\nimport { unlock } from '../lock-unlock';\nimport InspectorControls from '../components/inspector-controls';\nimport BlockContext from '../components/block-context';\nimport { useBlockEditContext } from '../components/block-edit';\nimport { useBlockBindingsUtils } from '../utils/block-bindings';\nimport { store as blockEditorStore } from '../store';\n\nconst { Menu } = unlock( componentsPrivateApis );\n\nconst EMPTY_OBJECT = {};\n\nconst useToolsPanelDropdownMenuProps = () => {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn ! isMobile\n\t\t? {\n\t\t\t\tpopoverProps: {\n\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t\t\t\t\toffset: 259,\n\t\t\t\t},\n\t\t }\n\t\t: {};\n};\n\nfunction BlockBindingsPanelDropdown( { fieldsList, attribute, binding } ) {\n\tconst { clientId } = useBlockEditContext();\n\tconst registeredSources = getBlockBindingsSources();\n\tconst { updateBlockBindings } = useBlockBindingsUtils();\n\tconst currentKey = binding?.args?.key;\n\tconst attributeType = useSelect(\n\t\t( select ) => {\n\t\t\tconst { name: blockName } =\n\t\t\t\tselect( blockEditorStore ).getBlock( clientId );\n\t\t\tconst _attributeType =\n\t\t\t\tgetBlockType( blockName ).attributes?.[ attribute ]?.type;\n\t\t\treturn _attributeType === 'rich-text' ? 'string' : _attributeType;\n\t\t},\n\t\t[ clientId, attribute ]\n\t);\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( fieldsList ).map( ( [ name, fields ], i ) => (\n\t\t\t\t<Fragment key={ name }>\n\t\t\t\t\t<Menu.Group>\n\t\t\t\t\t\t{ Object.keys( fieldsList ).length > 1 && (\n\t\t\t\t\t\t\t<Menu.GroupLabel>\n\t\t\t\t\t\t\t\t{ registeredSources[ name ].label }\n\t\t\t\t\t\t\t</Menu.GroupLabel>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ Object.entries( fields )\n\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t( [ , args ] ) => args?.type === attributeType\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.map( ( [ key, args ] ) => (\n\t\t\t\t\t\t\t\t<Menu.RadioItem\n\t\t\t\t\t\t\t\t\tkey={ key }\n\t\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\t\tupdateBlockBindings( {\n\t\t\t\t\t\t\t\t\t\t\t[ attribute ]: {\n\t\t\t\t\t\t\t\t\t\t\t\tsource: name,\n\t\t\t\t\t\t\t\t\t\t\t\targs: { key },\n\t\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}\n\t\t\t\t\t\t\t\t\tname={ attribute + '-binding' }\n\t\t\t\t\t\t\t\t\tvalue={ key }\n\t\t\t\t\t\t\t\t\tchecked={ key === currentKey }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t{ args?.label }\n\t\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t<Menu.ItemHelpText>\n\t\t\t\t\t\t\t\t\t\t{ args?.value }\n\t\t\t\t\t\t\t\t\t</Menu.ItemHelpText>\n\t\t\t\t\t\t\t\t</Menu.RadioItem>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Menu.Group>\n\t\t\t\t\t{ i !== Object.keys( fieldsList ).length - 1 && (\n\t\t\t\t\t\t<Menu.Separator />\n\t\t\t\t\t) }\n\t\t\t\t</Fragment>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction BlockBindingsAttribute( { attribute, binding, fieldsList } ) {\n\tconst { source: sourceName, args } = binding || {};\n\tconst sourceProps = getBlockBindingsSource( sourceName );\n\tconst isSourceInvalid = ! sourceProps;\n\treturn (\n\t\t<VStack className=\"block-editor-bindings__item\" spacing={ 0 }>\n\t\t\t<Text truncate>{ attribute }</Text>\n\t\t\t{ !! binding && (\n\t\t\t\t<Text\n\t\t\t\t\ttruncate\n\t\t\t\t\tvariant={ ! isSourceInvalid && 'muted' }\n\t\t\t\t\tisDestructive={ isSourceInvalid }\n\t\t\t\t>\n\t\t\t\t\t{ isSourceInvalid\n\t\t\t\t\t\t? __( 'Invalid source' )\n\t\t\t\t\t\t: fieldsList?.[ sourceName ]?.[ args?.key ]?.label ||\n\t\t\t\t\t\t sourceProps?.label ||\n\t\t\t\t\t\t sourceName }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nfunction ReadOnlyBlockBindingsPanelItems( { bindings, fieldsList } ) {\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( bindings ).map( ( [ attribute, binding ] ) => (\n\t\t\t\t<Item key={ attribute }>\n\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t/>\n\t\t\t\t</Item>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction EditableBlockBindingsPanelItems( {\n\tattributes,\n\tbindings,\n\tfieldsList,\n} ) {\n\tconst { updateBlockBindings } = useBlockBindingsUtils();\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn (\n\t\t<>\n\t\t\t{ attributes.map( ( attribute ) => {\n\t\t\t\tconst binding = bindings[ attribute ];\n\t\t\t\treturn (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tkey={ attribute }\n\t\t\t\t\t\thasValue={ () => !! binding }\n\t\t\t\t\t\tlabel={ attribute }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tupdateBlockBindings( {\n\t\t\t\t\t\t\t\t[ attribute ]: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Menu\n\t\t\t\t\t\t\tplacement={\n\t\t\t\t\t\t\t\tisMobile ? 'bottom-start' : 'left-start'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgutter={ isMobile ? 8 : 36 }\n\t\t\t\t\t\t\ttrigger={\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockBindingsPanelDropdown\n\t\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Menu>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nexport const BlockBindingsPanel = ( { name: blockName, metadata } ) => {\n\tconst blockContext = useContext( BlockContext );\n\tconst { removeAllBlockBindings } = useBlockBindingsUtils();\n\tconst bindableAttributes = getBindableAttributes( blockName );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// `useSelect` is used purposely here to ensure `getFieldsList`\n\t// is updated whenever there are updates in block context.\n\t// `source.getFieldsList` may also call a selector via `select`.\n\tconst _fieldsList = {};\n\tconst { fieldsList, canUpdateBlockBindings } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! bindableAttributes || bindableAttributes.length === 0 ) {\n\t\t\t\treturn EMPTY_OBJECT;\n\t\t\t}\n\t\t\tconst registeredSources = getBlockBindingsSources();\n\t\t\tObject.entries( registeredSources ).forEach(\n\t\t\t\t( [ sourceName, { getFieldsList, usesContext } ] ) => {\n\t\t\t\t\tif ( getFieldsList ) {\n\t\t\t\t\t\t// Populate context.\n\t\t\t\t\t\tconst context = {};\n\t\t\t\t\t\tif ( usesContext?.length ) {\n\t\t\t\t\t\t\tfor ( const key of usesContext ) {\n\t\t\t\t\t\t\t\tcontext[ key ] = blockContext[ key ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst sourceList = getFieldsList( {\n\t\t\t\t\t\t\tselect,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\t// Only add source if the list is not empty.\n\t\t\t\t\t\tif ( Object.keys( sourceList || {} ).length ) {\n\t\t\t\t\t\t\t_fieldsList[ sourceName ] = { ...sourceList };\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tfieldsList:\n\t\t\t\t\tObject.values( _fieldsList ).length > 0\n\t\t\t\t\t\t? _fieldsList\n\t\t\t\t\t\t: EMPTY_OBJECT,\n\t\t\t\tcanUpdateBlockBindings:\n\t\t\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t\t\t.canUpdateBlockBindings,\n\t\t\t};\n\t\t},\n\t\t[ blockContext, bindableAttributes ]\n\t);\n\t// Return early if there are no bindable attributes.\n\tif ( ! bindableAttributes || bindableAttributes.length === 0 ) {\n\t\treturn null;\n\t}\n\t// Filter bindings to only show bindable attributes and remove pattern overrides.\n\tconst { bindings } = metadata || {};\n\tconst filteredBindings = { ...bindings };\n\tObject.keys( filteredBindings ).forEach( ( key ) => {\n\t\tif (\n\t\t\t! canBindAttribute( blockName, key ) ||\n\t\t\tfilteredBindings[ key ].source === 'core/pattern-overrides'\n\t\t) {\n\t\t\tdelete filteredBindings[ key ];\n\t\t}\n\t} );\n\n\t// Lock the UI when the user can't update bindings or there are no fields to connect to.\n\tconst readOnly =\n\t\t! canUpdateBlockBindings || ! Object.keys( fieldsList ).length;\n\n\tif ( readOnly && Object.keys( filteredBindings ).length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorControls group=\"bindings\">\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Attributes' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tremoveAllBlockBindings();\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\tclassName=\"block-editor-bindings__panel\"\n\t\t\t>\n\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t{ readOnly ? (\n\t\t\t\t\t\t<ReadOnlyBlockBindingsPanelItems\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<EditableBlockBindingsPanelItems\n\t\t\t\t\t\t\tattributes={ bindableAttributes }\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ItemGroup>\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Attributes connected to custom fields or other dynamic data.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t</ItemGroup>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n};\n\nexport default {\n\tedit: BlockBindingsPanel,\n\tattributeKeys: [ 'metadata' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SACCC,sBAAsB,EACtBC,uBAAuB,EACvBC,YAAY,QACN,mBAAmB;AAC1B,SACCC,uBAAuB,IAAIC,SAAS,EACpCC,kBAAkB,IAAIC,IAAI,EAC1BC,kBAAkB,IAAIC,IAAI,EAC1BC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,EAC9CC,oBA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","ignoreList":[]}
|
|
@@ -12,8 +12,7 @@ import { useDispatch, useSelect } from '@wordpress/data';
|
|
|
12
12
|
*/
|
|
13
13
|
import { InspectorControls } from '../components';
|
|
14
14
|
import { store as blockEditorStore } from '../store';
|
|
15
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
16
|
const EMPTY_OBJECT = {};
|
|
18
17
|
function BlockHooksControlPure({
|
|
19
18
|
name,
|
|
@@ -153,7 +152,7 @@ function BlockHooksControlPure({
|
|
|
153
152
|
children: [/*#__PURE__*/_jsx("h3", {
|
|
154
153
|
children: vendor
|
|
155
154
|
}), groupedHookedBlocks[vendor].map(block => {
|
|
156
|
-
const checked =
|
|
155
|
+
const checked = block.name in hookedBlockClientIds;
|
|
157
156
|
return /*#__PURE__*/_jsx(ToggleControl, {
|
|
158
157
|
__nextHasNoMarginBottom: true,
|
|
159
158
|
checked: checked,
|