@wordpress/block-editor 12.14.0 → 12.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +10 -5
- package/build/components/block-canvas/index.js +22 -6
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-card/index.js +1 -1
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-controls/hook.js +3 -23
- package/build/components/block-controls/hook.js.map +1 -1
- package/build/components/block-edit/context.js +5 -1
- package/build/components/block-edit/context.js.map +1 -1
- package/build/components/block-edit/index.js +18 -9
- package/build/components/block-edit/index.js.map +1 -1
- package/build/components/block-info-slot-fill/index.js +3 -4
- package/build/components/block-info-slot-fill/index.js.map +1 -1
- package/build/components/block-list/block.js +28 -9
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +16 -5
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +61 -18
- 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 -29
- 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-is-hovered.js +4 -14
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.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 +25 -16
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +4 -2
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-patterns-list/index.js +37 -20
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +2 -9
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-rename/index.js +28 -0
- package/build/components/block-rename/index.js.map +1 -0
- package/build/components/block-rename/is-empty-string.js +10 -0
- package/build/components/block-rename/is-empty-string.js.map +1 -0
- package/build/components/block-rename/modal.js +90 -0
- package/build/components/block-rename/modal.js.map +1 -0
- package/build/components/block-rename/rename-control.js +74 -0
- package/build/components/block-rename/rename-control.js.map +1 -0
- package/build/components/block-rename/use-block-rename.js +17 -0
- package/build/components/block-rename/use-block-rename.js.map +1 -0
- package/build/components/block-settings/container.native.js +6 -4
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +33 -20
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +7 -0
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/index.js +1 -1
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/index.native.js +3 -2
- package/build/components/block-styles/index.native.js.map +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build/components/block-toolbar/index.js +89 -27
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-toolbar-breadcrumb.js +49 -0
- package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
- package/build/components/block-tools/block-toolbar-popover.js +86 -0
- package/build/components/block-tools/block-toolbar-popover.js.map +1 -0
- package/build/components/block-tools/index.js +27 -24
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-types-list/index.js +6 -2
- package/build/components/block-types-list/index.js.map +1 -1
- package/build/components/block-types-list/index.native.js +4 -3
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/block-variation-picker/index.native.js +2 -1
- package/build/components/block-variation-picker/index.native.js.map +1 -1
- package/build/components/colors-gradients/control.js +28 -17
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/date-format-picker/index.js +8 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/duotone-control/index.js +1 -4
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/global-styles/advanced-panel.js +1 -1
- package/build/components/global-styles/advanced-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +22 -20
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +9 -3
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +20 -31
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/image-link-destinations/index.native.js +118 -0
- package/build/components/image-link-destinations/index.native.js.map +1 -0
- package/build/components/image-size-control/index.js +0 -5
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.native.js +8 -0
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/index.js +3 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/warning-max-depth-exceeded.native.js +29 -31
- package/build/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.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-patterns-tab/utils.js +3 -4
- package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +2 -1
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/media-tab/media-panel.js +2 -2
- package/build/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build/components/inserter/menu.js +14 -7
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/preview-panel.js +2 -2
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter-button/index.native.js +98 -0
- package/build/components/inserter-button/index.native.js.map +1 -0
- package/build/components/inserter-button/sparkles.js +23 -0
- package/build/components/inserter-button/sparkles.js.map +1 -0
- package/build/components/inserter-draggable-blocks/index.js +8 -4
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inserter-listbox/index.js +11 -6
- package/build/components/inserter-listbox/index.js.map +1 -1
- package/build/components/inserter-listbox/item.js +24 -23
- package/build/components/inserter-listbox/item.js.map +1 -1
- package/build/components/inserter-listbox/row.js +5 -5
- package/build/components/inserter-listbox/row.js.map +1 -1
- package/build/components/inspector-controls/fill.js +3 -3
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +3 -3
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/list-view/use-list-view-expand-selected-item.js +2 -3
- package/build/components/list-view/use-list-view-expand-selected-item.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +2 -2
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/preview-options/index.js +6 -60
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/rich-text/content.js +26 -23
- package/build/components/rich-text/content.js.map +1 -1
- package/build/components/rich-text/get-rich-text-values.js +2 -1
- package/build/components/rich-text/get-rich-text-values.js.map +1 -1
- package/build/components/rich-text/index.js +2 -30
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +10 -17
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/get-format-colors.native.js +22 -24
- package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +41 -37
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +35 -2
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/rich-text/with-deprecations.js +50 -0
- package/build/components/rich-text/with-deprecations.js.map +1 -0
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +74 -9
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +2 -1
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +1 -1
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +4 -1
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/use-settings/index.js +16 -2
- package/build/components/use-settings/index.js.map +1 -1
- package/build/hooks/align.js +20 -68
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/align.native.js +11 -1
- package/build/hooks/align.native.js.map +1 -1
- package/build/hooks/anchor.js +13 -29
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/background.js +28 -31
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +24 -32
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-renaming.js +38 -0
- package/build/hooks/block-renaming.js.map +1 -1
- package/build/hooks/border.js +58 -80
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +76 -89
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +29 -29
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/custom-class-name.js +12 -29
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/custom-fields.js +64 -73
- package/build/hooks/custom-fields.js.map +1 -1
- package/build/hooks/dimensions.js +21 -17
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +31 -61
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-family.js +16 -25
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +51 -119
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +25 -15
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +10 -3
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout-child.js +68 -0
- package/build/hooks/layout-child.js.map +1 -0
- package/build/hooks/layout.js +29 -108
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/padding.js +2 -2
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/position.js +40 -62
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +51 -88
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +34 -14
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +154 -7
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/constrained.js +4 -3
- package/build/layouts/constrained.js.map +1 -1
- package/build/private-apis.js +0 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/private-actions.js +8 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +34 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +8 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +10 -58
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +66 -0
- package/build/store/utils.js.map +1 -0
- package/build/utils/object.js +21 -61
- package/build/utils/object.js.map +1 -1
- package/build/utils/selection.js +9 -1
- package/build/utils/selection.js.map +1 -1
- package/build/utils/transform-styles/index.js +26 -6
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/components/block-canvas/index.js +23 -7
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-card/index.js +1 -1
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-controls/hook.js +4 -24
- package/build-module/components/block-controls/hook.js.map +1 -1
- package/build-module/components/block-edit/context.js +2 -0
- package/build-module/components/block-edit/context.js.map +1 -1
- package/build-module/components/block-edit/index.js +19 -10
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-info-slot-fill/index.js +3 -3
- package/build-module/components/block-info-slot-fill/index.js.map +1 -1
- package/build-module/components/block-list/block.js +29 -10
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +16 -5
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +62 -19
- 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 -29
- 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-is-hovered.js +4 -14
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.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 +24 -15
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +4 -2
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +37 -20
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +3 -10
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-rename/index.js +4 -0
- package/build-module/components/block-rename/index.js.map +1 -0
- package/build-module/components/block-rename/is-empty-string.js +4 -0
- package/build-module/components/block-rename/is-empty-string.js.map +1 -0
- package/build-module/components/block-rename/modal.js +82 -0
- package/build-module/components/block-rename/modal.js.map +1 -0
- package/build-module/components/block-rename/rename-control.js +66 -0
- package/build-module/components/block-rename/rename-control.js.map +1 -0
- package/build-module/components/block-rename/use-block-rename.js +10 -0
- package/build-module/components/block-rename/use-block-rename.js.map +1 -0
- package/build-module/components/block-settings/container.native.js +4 -2
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +34 -21
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +7 -0
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +1 -1
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/index.native.js +3 -2
- package/build-module/components/block-styles/index.native.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +88 -25
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js +41 -0
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
- package/build-module/components/block-tools/block-toolbar-popover.js +76 -0
- package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -0
- package/build-module/components/block-tools/index.js +27 -24
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-types-list/index.js +6 -2
- package/build-module/components/block-types-list/index.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +2 -1
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/block-variation-picker/index.native.js +2 -1
- package/build-module/components/block-variation-picker/index.native.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +29 -18
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +8 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/duotone-control/index.js +1 -4
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +1 -1
- package/build-module/components/global-styles/advanced-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +23 -21
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +10 -4
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +20 -31
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/image-link-destinations/index.native.js +109 -0
- package/build-module/components/image-link-destinations/index.native.js.map +1 -0
- package/build-module/components/image-size-control/index.js +0 -5
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -0
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +3 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js +30 -32
- package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +2 -2
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/utils.js +3 -4
- package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +2 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build-module/components/inserter/menu.js +14 -7
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +2 -2
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter-button/index.native.js +89 -0
- package/build-module/components/inserter-button/index.native.js.map +1 -0
- package/build-module/components/inserter-button/sparkles.js +15 -0
- package/build-module/components/inserter-button/sparkles.js.map +1 -0
- package/build-module/components/inserter-draggable-blocks/index.js +9 -5
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inserter-listbox/index.js +13 -8
- package/build-module/components/inserter-listbox/index.js.map +1 -1
- package/build-module/components/inserter-listbox/item.js +25 -23
- package/build-module/components/inserter-listbox/item.js.map +1 -1
- package/build-module/components/inserter-listbox/row.js +6 -5
- package/build-module/components/inserter-listbox/row.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +3 -3
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +3 -3
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/list-view/use-list-view-expand-selected-item.js +2 -3
- package/build-module/components/list-view/use-list-view-expand-selected-item.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +2 -2
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/preview-options/index.js +6 -60
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/rich-text/content.js +25 -21
- package/build-module/components/rich-text/content.js.map +1 -1
- package/build-module/components/rich-text/get-rich-text-values.js +2 -1
- package/build-module/components/rich-text/get-rich-text-values.js.map +1 -1
- package/build-module/components/rich-text/index.js +4 -32
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +11 -19
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/get-format-colors.native.js +22 -24
- package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +41 -37
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +36 -3
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/rich-text/with-deprecations.js +42 -0
- package/build-module/components/rich-text/with-deprecations.js.map +1 -0
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +73 -9
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +2 -1
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +1 -1
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +4 -1
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +15 -3
- package/build-module/components/use-settings/index.js.map +1 -1
- package/build-module/hooks/align.js +19 -66
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/align.native.js +1 -0
- package/build-module/hooks/align.native.js.map +1 -1
- package/build-module/hooks/anchor.js +11 -26
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/background.js +26 -28
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +22 -30
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-renaming.js +36 -0
- package/build-module/hooks/block-renaming.js.map +1 -1
- package/build-module/hooks/border.js +57 -78
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +74 -86
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +27 -27
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +11 -27
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/custom-fields.js +60 -74
- package/build-module/hooks/custom-fields.js.map +1 -1
- package/build-module/hooks/dimensions.js +21 -16
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +30 -61
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-family.js +14 -23
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +49 -119
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +18 -15
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +5 -3
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout-child.js +60 -0
- package/build-module/hooks/layout-child.js.map +1 -0
- package/build-module/hooks/layout.js +26 -105
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/padding.js +2 -2
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/position.js +38 -59
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +51 -84
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/typography.js +33 -12
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +149 -6
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/constrained.js +4 -3
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/private-apis.js +0 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/private-actions.js +7 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +33 -1
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +8 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +3 -51
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +56 -0
- package/build-module/store/utils.js.map +1 -0
- package/build-module/utils/object.js +21 -60
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/selection.js +9 -1
- package/build-module/utils/selection.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +24 -7
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +6 -6
- package/build-style/content.css +6 -6
- package/build-style/style-rtl.css +123 -298
- package/build-style/style.css +123 -298
- package/package.json +31 -31
- package/src/components/block-canvas/index.js +31 -17
- package/src/components/block-caption/README.md +2 -2
- package/src/components/block-card/index.js +5 -3
- package/src/components/block-card/style.scss +7 -3
- package/src/components/block-controls/hook.js +8 -30
- package/src/components/block-controls/test/index.js +3 -3
- package/src/components/block-edit/context.js +3 -0
- package/src/components/block-edit/index.js +36 -10
- package/src/components/block-info-slot-fill/index.js +6 -3
- package/src/components/block-inspector/style.scss +0 -4
- package/src/components/block-list/block.js +39 -5
- package/src/components/block-list/block.native.js +20 -4
- package/src/components/block-list/use-block-props/index.js +74 -21
- package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -34
- package/src/components/block-list/use-block-props/use-is-hovered.js +2 -13
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +1 -5
- package/src/components/block-parent-selector/index.js +1 -1
- package/src/components/block-pattern-setup/index.js +38 -22
- package/src/components/block-pattern-setup/setup-toolbar.js +2 -0
- package/src/components/block-pattern-setup/style.scss +4 -1
- package/src/components/block-patterns-list/README.md +4 -4
- package/src/components/block-patterns-list/index.js +61 -35
- package/src/components/block-patterns-list/style.scss +7 -0
- package/src/components/block-removal-warning-modal/index.js +7 -14
- package/src/components/block-rename/index.js +3 -0
- package/src/components/block-rename/is-empty-string.js +3 -0
- package/src/components/block-rename/modal.js +121 -0
- package/src/components/block-rename/rename-control.js +80 -0
- package/src/components/block-rename/use-block-rename.js +10 -0
- package/src/components/block-settings/container.native.js +3 -5
- package/src/components/block-settings-menu/block-settings-dropdown.js +38 -34
- package/src/components/block-settings-menu-controls/index.js +9 -0
- package/src/components/block-styles/index.js +1 -1
- package/src/components/block-styles/index.native.js +4 -2
- package/src/components/block-styles/style.scss +0 -11
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +3 -1
- package/src/components/block-toolbar/block-toolbar-menu.native.js +1 -4
- package/src/components/block-toolbar/index.js +180 -95
- package/src/components/block-toolbar/style.scss +50 -66
- package/src/components/block-tools/block-toolbar-breadcrumb.js +46 -0
- package/src/components/block-tools/block-toolbar-popover.js +90 -0
- package/src/components/block-tools/index.js +42 -29
- package/src/components/block-tools/style.scss +60 -172
- package/src/components/block-types-list/index.js +5 -4
- package/src/components/block-types-list/index.native.js +2 -1
- package/src/components/block-variation-picker/index.native.js +1 -1
- package/src/components/button-block-appender/content.scss +2 -2
- package/src/components/colors-gradients/control.js +49 -30
- package/src/components/colors-gradients/style.scss +0 -7
- package/src/components/date-format-picker/index.js +7 -0
- package/src/components/duotone-control/index.js +2 -5
- package/src/components/duotone-control/style.scss +1 -6
- package/src/components/editable-text/README.md +0 -36
- package/src/components/global-styles/advanced-panel.js +1 -1
- package/src/components/global-styles/color-panel.js +34 -25
- package/src/components/global-styles/filters-panel.js +8 -4
- package/src/components/global-styles/typography-panel.js +23 -43
- package/src/components/image-link-destinations/index.native.js +152 -0
- package/src/components/image-link-destinations/style.native.scss +16 -0
- package/src/components/image-size-control/index.js +0 -6
- package/src/components/index.native.js +1 -0
- package/src/components/inner-blocks/README.md +13 -2
- package/src/components/inner-blocks/index.js +6 -2
- package/src/components/inner-blocks/warning-max-depth-exceeded.native.js +57 -33
- package/src/components/inserter/block-patterns-explorer/pattern-list.js +5 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +7 -3
- package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +6 -1
- package/src/components/inserter/block-patterns-tab/utils.js +6 -4
- package/src/components/inserter/hooks/use-patterns-state.js +3 -1
- package/src/components/inserter/media-tab/media-panel.js +1 -1
- package/src/components/inserter/menu.js +16 -8
- package/src/components/inserter/preview-panel.js +2 -2
- package/src/components/inserter/style.scss +15 -17
- package/src/components/inserter-button/README.md +62 -0
- package/src/components/inserter-button/index.native.js +116 -0
- package/src/components/inserter-button/sparkles.js +15 -0
- package/src/components/inserter-button/style.native.scss +72 -0
- package/src/components/inserter-draggable-blocks/index.js +18 -5
- package/src/components/inserter-listbox/index.js +11 -7
- package/src/components/inserter-listbox/item.js +11 -12
- package/src/components/inserter-listbox/row.js +6 -12
- package/src/components/inspector-controls/fill.js +6 -3
- package/src/components/inspector-controls/fill.native.js +6 -3
- package/src/components/link-control/style.scss +1 -1
- package/src/components/link-control/test/index.js +1 -1
- package/src/components/list-view/use-list-view-expand-selected-item.js +7 -8
- package/src/components/navigable-toolbar/README.md +2 -0
- package/src/components/navigable-toolbar/index.js +2 -2
- package/src/components/plain-text/README.md +0 -28
- package/src/components/preview-options/index.js +6 -84
- package/src/components/rich-text/README.md +0 -58
- package/src/components/rich-text/content.js +27 -20
- package/src/components/rich-text/get-rich-text-values.js +6 -1
- package/src/components/rich-text/index.js +5 -46
- package/src/components/rich-text/index.native.js +9 -26
- package/src/components/rich-text/native/get-format-colors.native.js +33 -40
- package/src/components/rich-text/native/index.native.js +52 -50
- package/src/components/rich-text/use-input-rules.js +36 -3
- package/src/components/rich-text/with-deprecations.js +51 -0
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/src/components/url-input/README.md +1 -74
- package/src/components/use-block-drop-zone/index.js +118 -15
- package/src/components/use-moving-animation/index.js +1 -1
- package/src/components/use-on-block-drop/index.js +2 -1
- package/src/components/use-resize-canvas/README.md +3 -3
- package/src/components/use-resize-canvas/index.js +4 -1
- package/src/components/use-settings/index.js +17 -3
- package/src/components/use-settings/test/index.js +1 -1
- package/src/hooks/align.js +15 -76
- package/src/hooks/align.native.js +1 -0
- package/src/hooks/anchor.js +13 -33
- package/src/hooks/background.js +28 -23
- package/src/hooks/block-hooks.js +22 -51
- package/src/hooks/block-renaming.js +33 -0
- package/src/hooks/border.js +67 -118
- package/src/hooks/color.js +100 -132
- package/src/hooks/content-lock-ui.js +110 -122
- package/src/hooks/custom-class-name.js +8 -40
- package/src/hooks/custom-fields.js +70 -94
- package/src/hooks/dimensions.js +20 -16
- package/src/hooks/duotone.js +70 -127
- package/src/hooks/font-family.js +10 -29
- package/src/hooks/font-size.js +66 -162
- package/src/hooks/index.js +42 -15
- package/src/hooks/index.native.js +6 -3
- package/src/hooks/layout-child.js +53 -0
- package/src/hooks/layout.js +25 -110
- package/src/hooks/padding.js +2 -2
- package/src/hooks/position.js +50 -90
- package/src/hooks/style.js +117 -187
- package/src/hooks/test/__snapshots__/align.native.js.snap +5 -5
- package/src/hooks/test/align.js +1 -178
- package/src/hooks/typography.js +20 -16
- package/src/hooks/utils.js +187 -6
- package/src/layouts/constrained.js +57 -50
- package/src/private-apis.js +0 -2
- package/src/store/private-actions.js +8 -0
- package/src/store/private-selectors.js +45 -0
- package/src/store/reducer.js +8 -0
- package/src/store/selectors.js +5 -67
- package/src/store/utils.js +74 -0
- package/src/style.scss +1 -3
- package/src/utils/object.js +18 -69
- package/src/utils/selection.js +9 -2
- package/src/utils/test/transform-styles.js +49 -0
- package/src/utils/transform-styles/index.js +39 -13
- package/build/components/block-list/use-block-props/use-block-class-names.js +0 -67
- package/build/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js +0 -46
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
- package/build/components/block-list/use-block-props/use-block-default-class-name.js +0 -37
- package/build/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
- package/build/components/block-tools/back-compat.js +0 -45
- package/build/components/block-tools/back-compat.js.map +0 -1
- package/build/components/block-tools/block-contextual-toolbar.js +0 -91
- package/build/components/block-tools/block-contextual-toolbar.js.map +0 -1
- package/build/components/block-tools/selected-block-tools.js +0 -113
- package/build/components/block-tools/selected-block-tools.js.map +0 -1
- package/build/components/inserter/hooks/use-debounced-input.js +0 -22
- package/build/components/inserter/hooks/use-debounced-input.js.map +0 -1
- package/build/components/use-display-block-controls/index.js +0 -39
- package/build/components/use-display-block-controls/index.js.map +0 -1
- package/build/components/use-display-block-controls/index.native.js +0 -39
- package/build/components/use-display-block-controls/index.native.js.map +0 -1
- package/build/hooks/block-rename-ui.js +0 -167
- package/build/hooks/block-rename-ui.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-class-names.js +0 -60
- package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js +0 -40
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js +0 -31
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
- package/build-module/components/block-tools/back-compat.js +0 -35
- package/build-module/components/block-tools/back-compat.js.map +0 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +0 -83
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +0 -1
- package/build-module/components/block-tools/selected-block-tools.js +0 -105
- package/build-module/components/block-tools/selected-block-tools.js.map +0 -1
- package/build-module/components/inserter/hooks/use-debounced-input.js +0 -15
- package/build-module/components/inserter/hooks/use-debounced-input.js.map +0 -1
- package/build-module/components/use-display-block-controls/index.js +0 -32
- package/build-module/components/use-display-block-controls/index.js.map +0 -1
- package/build-module/components/use-display-block-controls/index.native.js +0 -32
- package/build-module/components/use-display-block-controls/index.native.js.map +0 -1
- package/build-module/hooks/block-rename-ui.js +0 -159
- package/build-module/hooks/block-rename-ui.js.map +0 -1
- package/src/components/block-list/use-block-props/use-block-class-names.js +0 -66
- package/src/components/block-list/use-block-props/use-block-custom-class-name.js +0 -44
- package/src/components/block-list/use-block-props/use-block-default-class-name.js +0 -35
- package/src/components/block-parent-selector/style.scss +0 -11
- package/src/components/block-tools/back-compat.js +0 -35
- package/src/components/block-tools/block-contextual-toolbar.js +0 -100
- package/src/components/block-tools/selected-block-tools.js +0 -127
- package/src/components/inserter/hooks/use-debounced-input.js +0 -18
- package/src/components/preview-options/README.md +0 -94
- package/src/components/preview-options/style.scss +0 -64
- package/src/components/use-display-block-controls/index.js +0 -36
- package/src/components/use-display-block-controls/index.native.js +0 -37
- package/src/hooks/block-rename-ui.js +0 -228
- package/src/hooks/test/color.js +0 -112
- /package/src/{hooks/block-rename-ui.scss → components/block-rename/style.scss} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Draggable","serialize","store","blocksStore","useSelect","BlockDraggableChip","InserterDraggableBlocks","isEnabled","blocks","icon","children","
|
|
1
|
+
{"version":3,"names":["Draggable","createBlock","serialize","store","blocksStore","useSelect","BlockDraggableChip","PATTERN_TYPES","InserterDraggableBlocks","isEnabled","blocks","icon","children","pattern","transferData","type","blockTypeIcon","select","getBlockType","length","name","createElement","__experimentalTransferDataType","onDragStart","event","parsedBlocks","user","syncStatus","ref","id","dataTransfer","setData","__experimentalDragComponent","count","isPattern","onDraggableStart","onDraggableEnd","draggable","undefined","onDragEnd"],"sources":["@wordpress/block-editor/src/components/inserter-draggable-blocks/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Draggable } from '@wordpress/components';\nimport {\n\tcreateBlock,\n\tserialize,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n/**\n * Internal dependencies\n */\nimport BlockDraggableChip from '../block-draggable/draggable-chip';\nimport { PATTERN_TYPES } from '../inserter/block-patterns-tab/utils';\n\nconst InserterDraggableBlocks = ( {\n\tisEnabled,\n\tblocks,\n\ticon,\n\tchildren,\n\tpattern,\n} ) => {\n\tconst transferData = {\n\t\ttype: 'inserter',\n\t\tblocks,\n\t};\n\n\tconst blockTypeIcon = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockType } = select( blocksStore );\n\t\t\treturn (\n\t\t\t\tblocks.length === 1 && getBlockType( blocks[ 0 ].name )?.icon\n\t\t\t);\n\t\t},\n\t\t[ blocks ]\n\t);\n\n\treturn (\n\t\t<Draggable\n\t\t\t__experimentalTransferDataType=\"wp-blocks\"\n\t\t\ttransferData={ transferData }\n\t\t\tonDragStart={ ( event ) => {\n\t\t\t\tconst parsedBlocks =\n\t\t\t\t\tpattern?.type === PATTERN_TYPES.user &&\n\t\t\t\t\tpattern?.syncStatus !== 'unsynced'\n\t\t\t\t\t\t? [ createBlock( 'core/block', { ref: pattern.id } ) ]\n\t\t\t\t\t\t: blocks;\n\t\t\t\tevent.dataTransfer.setData(\n\t\t\t\t\t'text/html',\n\t\t\t\t\tserialize( parsedBlocks )\n\t\t\t\t);\n\t\t\t} }\n\t\t\t__experimentalDragComponent={\n\t\t\t\t<BlockDraggableChip\n\t\t\t\t\tcount={ blocks.length }\n\t\t\t\t\ticon={ icon || ( ! pattern && blockTypeIcon ) }\n\t\t\t\t\tisPattern={ !! pattern }\n\t\t\t\t/>\n\t\t\t}\n\t\t>\n\t\t\t{ ( { onDraggableStart, onDraggableEnd } ) => {\n\t\t\t\treturn children( {\n\t\t\t\t\tdraggable: isEnabled,\n\t\t\t\t\tonDragStart: isEnabled ? onDraggableStart : undefined,\n\t\t\t\t\tonDragEnd: isEnabled ? onDraggableEnd : undefined,\n\t\t\t\t} );\n\t\t\t} }\n\t\t</Draggable>\n\t);\n};\n\nexport default InserterDraggableBlocks;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,uBAAuB;AACjD,SACCC,WAAW,EACXC,SAAS,EACTC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,mCAAmC;AAClE,SAASC,aAAa,QAAQ,sCAAsC;AAEpE,MAAMC,uBAAuB,GAAGA,CAAE;EACjCC,SAAS;EACTC,MAAM;EACNC,IAAI;EACJC,QAAQ;EACRC;AACD,CAAC,KAAM;EACN,MAAMC,YAAY,GAAG;IACpBC,IAAI,EAAE,UAAU;IAChBL;EACD,CAAC;EAED,MAAMM,aAAa,GAAGX,SAAS,CAC5BY,MAAM,IAAM;IACb,MAAM;MAAEC;IAAa,CAAC,GAAGD,MAAM,CAAEb,WAAY,CAAC;IAC9C,OACCM,MAAM,CAACS,MAAM,KAAK,CAAC,IAAID,YAAY,CAAER,MAAM,CAAE,CAAC,CAAE,CAACU,IAAK,CAAC,EAAET,IAAI;EAE/D,CAAC,EACD,CAAED,MAAM,CACT,CAAC;EAED,OACCW,aAAA,CAACrB,SAAS;IACTsB,8BAA8B,EAAC,WAAW;IAC1CR,YAAY,EAAGA,YAAc;IAC7BS,WAAW,EAAKC,KAAK,IAAM;MAC1B,MAAMC,YAAY,GACjBZ,OAAO,EAAEE,IAAI,KAAKR,aAAa,CAACmB,IAAI,IACpCb,OAAO,EAAEc,UAAU,KAAK,UAAU,GAC/B,CAAE1B,WAAW,CAAE,YAAY,EAAE;QAAE2B,GAAG,EAAEf,OAAO,CAACgB;MAAG,CAAE,CAAC,CAAE,GACpDnB,MAAM;MACVc,KAAK,CAACM,YAAY,CAACC,OAAO,CACzB,WAAW,EACX7B,SAAS,CAAEuB,YAAa,CACzB,CAAC;IACF,CAAG;IACHO,2BAA2B,EAC1BX,aAAA,CAACf,kBAAkB;MAClB2B,KAAK,EAAGvB,MAAM,CAACS,MAAQ;MACvBR,IAAI,EAAGA,IAAI,IAAM,CAAEE,OAAO,IAAIG,aAAiB;MAC/CkB,SAAS,EAAG,CAAC,CAAErB;IAAS,CACxB;EACD,GAEC,CAAE;IAAEsB,gBAAgB;IAAEC;EAAe,CAAC,KAAM;IAC7C,OAAOxB,QAAQ,CAAE;MAChByB,SAAS,EAAE5B,SAAS;MACpBc,WAAW,EAAEd,SAAS,GAAG0B,gBAAgB,GAAGG,SAAS;MACrDC,SAAS,EAAE9B,SAAS,GAAG2B,cAAc,GAAGE;IACzC,CAAE,CAAC;EACJ,CACU,CAAC;AAEd,CAAC;AAED,eAAe9B,uBAAuB"}
|
|
@@ -1,25 +1,30 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
1
|
+
import { createElement, Fragment } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
|
-
import
|
|
10
|
+
import { unlock } from '../../lock-unlock';
|
|
11
11
|
export { default as InserterListboxGroup } from './group';
|
|
12
12
|
export { default as InserterListboxRow } from './row';
|
|
13
13
|
export { default as InserterListboxItem } from './item';
|
|
14
|
+
const {
|
|
15
|
+
CompositeV2: Composite,
|
|
16
|
+
useCompositeStoreV2: useCompositeStore
|
|
17
|
+
} = unlock(componentsPrivateApis);
|
|
14
18
|
function InserterListbox({
|
|
15
19
|
children
|
|
16
20
|
}) {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
const store = useCompositeStore({
|
|
22
|
+
focusShift: true,
|
|
23
|
+
focusWrap: 'horizontal'
|
|
20
24
|
});
|
|
21
|
-
return createElement(
|
|
22
|
-
|
|
25
|
+
return createElement(Composite, {
|
|
26
|
+
store: store,
|
|
27
|
+
render: createElement(Fragment, null)
|
|
23
28
|
}, children);
|
|
24
29
|
}
|
|
25
30
|
export default InserterListbox;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["privateApis","componentsPrivateApis","unlock","default","InserterListboxGroup","InserterListboxRow","InserterListboxItem","CompositeV2","Composite","useCompositeStoreV2","useCompositeStore","InserterListbox","children","store","focusShift","focusWrap","createElement","render","Fragment"],"sources":["@wordpress/block-editor/src/components/inserter-listbox/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nexport { default as InserterListboxGroup } from './group';\nexport { default as InserterListboxRow } from './row';\nexport { default as InserterListboxItem } from './item';\n\nconst { CompositeV2: Composite, useCompositeStoreV2: useCompositeStore } =\n\tunlock( componentsPrivateApis );\n\nfunction InserterListbox( { children } ) {\n\tconst store = useCompositeStore( {\n\t\tfocusShift: true,\n\t\tfocusWrap: 'horizontal',\n\t} );\n\n\treturn (\n\t\t<Composite store={ store } render={ <></> }>\n\t\t\t{ children }\n\t\t</Composite>\n\t);\n}\n\nexport default InserterListbox;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,qBAAqB,QAAQ,uBAAuB;;AAE5E;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,SAASC,OAAO,IAAIC,oBAAoB,QAAQ,SAAS;AACzD,SAASD,OAAO,IAAIE,kBAAkB,QAAQ,OAAO;AACrD,SAASF,OAAO,IAAIG,mBAAmB,QAAQ,QAAQ;AAEvD,MAAM;EAAEC,WAAW,EAAEC,SAAS;EAAEC,mBAAmB,EAAEC;AAAkB,CAAC,GACvER,MAAM,CAAED,qBAAsB,CAAC;AAEhC,SAASU,eAAeA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACxC,MAAMC,KAAK,GAAGH,iBAAiB,CAAE;IAChCI,UAAU,EAAE,IAAI;IAChBC,SAAS,EAAE;EACZ,CAAE,CAAC;EAEH,OACCC,aAAA,CAACR,SAAS;IAACK,KAAK,EAAGA,KAAO;IAACI,MAAM,EAAGD,aAAA,CAAAE,QAAA,MAAI;EAAG,GACxCN,QACQ,CAAC;AAEd;AAEA,eAAeD,eAAe"}
|
|
@@ -2,46 +2,48 @@ import { createElement } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
|
-
import { Button,
|
|
6
|
-
import { forwardRef
|
|
5
|
+
import { Button, privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
6
|
+
import { forwardRef } from '@wordpress/element';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
|
-
import
|
|
11
|
+
import { unlock } from '../../lock-unlock';
|
|
12
|
+
const {
|
|
13
|
+
CompositeItemV2: CompositeItem
|
|
14
|
+
} = unlock(componentsPrivateApis);
|
|
12
15
|
function InserterListboxItem({
|
|
13
16
|
isFirst,
|
|
14
17
|
as: Component,
|
|
15
18
|
children,
|
|
16
19
|
...props
|
|
17
20
|
}, ref) {
|
|
18
|
-
const state = useContext(InserterListboxContext);
|
|
19
21
|
return createElement(CompositeItem, {
|
|
20
22
|
ref: ref,
|
|
21
|
-
state: state,
|
|
22
23
|
role: "option"
|
|
23
|
-
// Use the CompositeItem `
|
|
24
|
-
// isFocusable
|
|
25
|
-
// with tab order in the inserter list.
|
|
24
|
+
// Use the CompositeItem `accessibleWhenDisabled` prop
|
|
25
|
+
// over Button's `isFocusable`. The latter was shown to
|
|
26
|
+
// cause an issue with tab order in the inserter list.
|
|
26
27
|
,
|
|
27
|
-
|
|
28
|
-
...props
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
accessibleWhenDisabled: true,
|
|
29
|
+
...props,
|
|
30
|
+
render: htmlProps => {
|
|
31
|
+
const propsWithTabIndex = {
|
|
32
|
+
...htmlProps,
|
|
33
|
+
tabIndex: isFirst ? 0 : htmlProps.tabIndex
|
|
34
|
+
};
|
|
35
|
+
if (Component) {
|
|
36
|
+
return createElement(Component, {
|
|
37
|
+
...propsWithTabIndex
|
|
38
|
+
}, children);
|
|
39
|
+
}
|
|
40
|
+
if (typeof children === 'function') {
|
|
41
|
+
return children(propsWithTabIndex);
|
|
42
|
+
}
|
|
43
|
+
return createElement(Button, {
|
|
36
44
|
...propsWithTabIndex
|
|
37
45
|
}, children);
|
|
38
46
|
}
|
|
39
|
-
if (typeof children === 'function') {
|
|
40
|
-
return children(propsWithTabIndex);
|
|
41
|
-
}
|
|
42
|
-
return createElement(Button, {
|
|
43
|
-
...propsWithTabIndex
|
|
44
|
-
}, children);
|
|
45
47
|
});
|
|
46
48
|
}
|
|
47
49
|
export default forwardRef(InserterListboxItem);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Button","
|
|
1
|
+
{"version":3,"names":["Button","privateApis","componentsPrivateApis","forwardRef","unlock","CompositeItemV2","CompositeItem","InserterListboxItem","isFirst","as","Component","children","props","ref","createElement","role","accessibleWhenDisabled","render","htmlProps","propsWithTabIndex","tabIndex"],"sources":["@wordpress/block-editor/src/components/inserter-listbox/item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { CompositeItemV2: CompositeItem } = unlock( componentsPrivateApis );\n\nfunction InserterListboxItem(\n\t{ isFirst, as: Component, children, ...props },\n\tref\n) {\n\treturn (\n\t\t<CompositeItem\n\t\t\tref={ ref }\n\t\t\trole=\"option\"\n\t\t\t// Use the CompositeItem `accessibleWhenDisabled` prop\n\t\t\t// over Button's `isFocusable`. The latter was shown to\n\t\t\t// cause an issue with tab order in the inserter list.\n\t\t\taccessibleWhenDisabled\n\t\t\t{ ...props }\n\t\t\trender={ ( htmlProps ) => {\n\t\t\t\tconst propsWithTabIndex = {\n\t\t\t\t\t...htmlProps,\n\t\t\t\t\ttabIndex: isFirst ? 0 : htmlProps.tabIndex,\n\t\t\t\t};\n\t\t\t\tif ( Component ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Component { ...propsWithTabIndex }>\n\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t</Component>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif ( typeof children === 'function' ) {\n\t\t\t\t\treturn children( propsWithTabIndex );\n\t\t\t\t}\n\t\t\t\treturn <Button { ...propsWithTabIndex }>{ children }</Button>;\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( InserterListboxItem );\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,MAAM,EACNC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC,eAAe,EAAEC;AAAc,CAAC,GAAGF,MAAM,CAAEF,qBAAsB,CAAC;AAE1E,SAASK,mBAAmBA,CAC3B;EAAEC,OAAO;EAAEC,EAAE,EAAEC,SAAS;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAC9CC,GAAG,EACF;EACD,OACCC,aAAA,CAACR,aAAa;IACbO,GAAG,EAAGA,GAAK;IACXE,IAAI,EAAC;IACL;IACA;IACA;IAAA;IACAC,sBAAsB;IAAA,GACjBJ,KAAK;IACVK,MAAM,EAAKC,SAAS,IAAM;MACzB,MAAMC,iBAAiB,GAAG;QACzB,GAAGD,SAAS;QACZE,QAAQ,EAAEZ,OAAO,GAAG,CAAC,GAAGU,SAAS,CAACE;MACnC,CAAC;MACD,IAAKV,SAAS,EAAG;QAChB,OACCI,aAAA,CAACJ,SAAS;UAAA,GAAMS;QAAiB,GAC9BR,QACQ,CAAC;MAEd;MACA,IAAK,OAAOA,QAAQ,KAAK,UAAU,EAAG;QACrC,OAAOA,QAAQ,CAAEQ,iBAAkB,CAAC;MACrC;MACA,OAAOL,aAAA,CAACd,MAAM;QAAA,GAAMmB;MAAiB,GAAKR,QAAkB,CAAC;IAC9D;EAAG,CACH,CAAC;AAEJ;AAEA,eAAeR,UAAU,CAAEI,mBAAoB,CAAC"}
|
|
@@ -2,17 +2,18 @@ import { createElement } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
|
-
import { forwardRef
|
|
6
|
-
import {
|
|
5
|
+
import { forwardRef } from '@wordpress/element';
|
|
6
|
+
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
|
-
import
|
|
11
|
+
import { unlock } from '../../lock-unlock';
|
|
12
|
+
const {
|
|
13
|
+
CompositeGroupV2: CompositeGroup
|
|
14
|
+
} = unlock(componentsPrivateApis);
|
|
12
15
|
function InserterListboxRow(props, ref) {
|
|
13
|
-
const state = useContext(InserterListboxContext);
|
|
14
16
|
return createElement(CompositeGroup, {
|
|
15
|
-
state: state,
|
|
16
17
|
role: "presentation",
|
|
17
18
|
ref: ref,
|
|
18
19
|
...props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","
|
|
1
|
+
{"version":3,"names":["forwardRef","privateApis","componentsPrivateApis","unlock","CompositeGroupV2","CompositeGroup","InserterListboxRow","props","ref","createElement","role"],"sources":["@wordpress/block-editor/src/components/inserter-listbox/row.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { CompositeGroupV2: CompositeGroup } = unlock( componentsPrivateApis );\n\nfunction InserterListboxRow( props, ref ) {\n\treturn <CompositeGroup role=\"presentation\" ref={ ref } { ...props } />;\n}\n\nexport default forwardRef( InserterListboxRow );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,WAAW,IAAIC,qBAAqB,QAAQ,uBAAuB;;AAE5E;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC,gBAAgB,EAAEC;AAAe,CAAC,GAAGF,MAAM,CAAED,qBAAsB,CAAC;AAE5E,SAASI,kBAAkBA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACzC,OAAOC,aAAA,CAACJ,cAAc;IAACK,IAAI,EAAC,cAAc;IAACF,GAAG,EAAGA,GAAK;IAAA,GAAMD;EAAK,CAAI,CAAC;AACvE;AAEA,eAAeP,UAAU,CAAEM,kBAAmB,CAAC"}
|
|
@@ -10,7 +10,7 @@ import { useEffect, useContext } from '@wordpress/element';
|
|
|
10
10
|
/**
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
|
-
import
|
|
13
|
+
import { useBlockEditContext, mayDisplayControlsKey } from '../block-edit/context';
|
|
14
14
|
import groups from './groups';
|
|
15
15
|
export default function InspectorControlsFill({
|
|
16
16
|
children,
|
|
@@ -26,13 +26,13 @@ export default function InspectorControlsFill({
|
|
|
26
26
|
});
|
|
27
27
|
group = __experimentalGroup;
|
|
28
28
|
}
|
|
29
|
-
const
|
|
29
|
+
const context = useBlockEditContext();
|
|
30
30
|
const Fill = groups[group]?.Fill;
|
|
31
31
|
if (!Fill) {
|
|
32
32
|
typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? warning(`Unknown InspectorControls group "${group}" provided.`) : void 0;
|
|
33
33
|
return null;
|
|
34
34
|
}
|
|
35
|
-
if (!
|
|
35
|
+
if (!context[mayDisplayControlsKey]) {
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
38
|
return createElement(StyleProvider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalStyleProvider","StyleProvider","__experimentalToolsPanelContext","ToolsPanelContext","warning","deprecated","useEffect","useContext","
|
|
1
|
+
{"version":3,"names":["__experimentalStyleProvider","StyleProvider","__experimentalToolsPanelContext","ToolsPanelContext","warning","deprecated","useEffect","useContext","useBlockEditContext","mayDisplayControlsKey","groups","InspectorControlsFill","children","group","__experimentalGroup","resetAllFilter","since","version","alternative","context","Fill","SCRIPT_DEBUG","createElement","document","fillProps","ToolsPanelInspectorControl","RegisterResetAll","registerResetAllFilter","deregisterResetAllFilter","forwardedContext","innerMarkup","reduce","inner","Provider","props"],"sources":["@wordpress/block-editor/src/components/inspector-controls/fill.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalStyleProvider as StyleProvider,\n\t__experimentalToolsPanelContext as ToolsPanelContext,\n} from '@wordpress/components';\nimport warning from '@wordpress/warning';\nimport deprecated from '@wordpress/deprecated';\nimport { useEffect, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseBlockEditContext,\n\tmayDisplayControlsKey,\n} from '../block-edit/context';\nimport groups from './groups';\n\nexport default function InspectorControlsFill( {\n\tchildren,\n\tgroup = 'default',\n\t__experimentalGroup,\n\tresetAllFilter,\n} ) {\n\tif ( __experimentalGroup ) {\n\t\tdeprecated(\n\t\t\t'`__experimentalGroup` property in `InspectorControlsFill`',\n\t\t\t{\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.4',\n\t\t\t\talternative: '`group`',\n\t\t\t}\n\t\t);\n\t\tgroup = __experimentalGroup;\n\t}\n\n\tconst context = useBlockEditContext();\n\tconst Fill = groups[ group ]?.Fill;\n\tif ( ! Fill ) {\n\t\twarning( `Unknown InspectorControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\tif ( ! context[ mayDisplayControlsKey ] ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StyleProvider document={ document }>\n\t\t\t<Fill>\n\t\t\t\t{ ( fillProps ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ToolsPanelInspectorControl\n\t\t\t\t\t\t\tfillProps={ fillProps }\n\t\t\t\t\t\t\tchildren={ children }\n\t\t\t\t\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</Fill>\n\t\t</StyleProvider>\n\t);\n}\n\nfunction RegisterResetAll( { resetAllFilter, children } ) {\n\tconst { registerResetAllFilter, deregisterResetAllFilter } =\n\t\tuseContext( ToolsPanelContext );\n\tuseEffect( () => {\n\t\tif (\n\t\t\tresetAllFilter &&\n\t\t\tregisterResetAllFilter &&\n\t\t\tderegisterResetAllFilter\n\t\t) {\n\t\t\tregisterResetAllFilter( resetAllFilter );\n\t\t\treturn () => {\n\t\t\t\tderegisterResetAllFilter( resetAllFilter );\n\t\t\t};\n\t\t}\n\t}, [ resetAllFilter, registerResetAllFilter, deregisterResetAllFilter ] );\n\treturn children;\n}\n\nfunction ToolsPanelInspectorControl( { children, resetAllFilter, fillProps } ) {\n\t// `fillProps.forwardedContext` is an array of context provider entries, provided by slot,\n\t// that should wrap the fill markup.\n\tconst { forwardedContext = [] } = fillProps;\n\n\t// Children passed to InspectorControlsFill will not have\n\t// access to any React Context whose Provider is part of\n\t// the InspectorControlsSlot tree. So we re-create the\n\t// Provider in this subtree.\n\tconst innerMarkup = (\n\t\t<RegisterResetAll resetAllFilter={ resetAllFilter }>\n\t\t\t{ children }\n\t\t</RegisterResetAll>\n\t);\n\treturn forwardedContext.reduce(\n\t\t( inner, [ Provider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gB,CACjC,CAAC;EAEJ,CACK,CACQ,CAAC;AAElB;AAEA,SAASW,gBAAgBA,CAAE;EAAEX,cAAc;EAAEH;AAAS,CAAC,EAAG;EACzD,MAAM;IAAEe,sBAAsB;IAAEC;EAAyB,CAAC,GACzDrB,UAAU,CAAEJ,iBAAkB,CAAC;EAChCG,SAAS,CAAE,MAAM;IAChB,IACCS,cAAc,IACdY,sBAAsB,IACtBC,wBAAwB,EACvB;MACDD,sBAAsB,CAAEZ,cAAe,CAAC;MACxC,OAAO,MAAM;QACZa,wBAAwB,CAAEb,cAAe,CAAC;MAC3C,CAAC;IACF;EACD,CAAC,EAAE,CAAEA,cAAc,EAAEY,sBAAsB,EAAEC,wBAAwB,CAAG,CAAC;EACzE,OAAOhB,QAAQ;AAChB;AAEA,SAASa,0BAA0BA,CAAE;EAAEb,QAAQ;EAAEG,cAAc;EAAES;AAAU,CAAC,EAAG;EAC9E;EACA;EACA,MAAM;IAAEK,gBAAgB,GAAG;EAAG,CAAC,GAAGL,SAAS;;EAE3C;EACA;EACA;EACA;EACA,MAAMM,WAAW,GAChBR,aAAA,CAACI,gBAAgB;IAACX,cAAc,EAAGA;EAAgB,GAChDH,QACe,CAClB;EACD,OAAOiB,gBAAgB,CAACE,MAAM,CAC7B,CAAEC,KAAK,EAAE,CAAEC,QAAQ,EAAEC,KAAK,CAAE,KAC3BZ,aAAA,CAACW,QAAQ;IAAA,GAAMC;EAAK,GAAKF,KAAiB,CAC1C,EACDF,WACD,CAAC;AACF"}
|
|
@@ -16,7 +16,7 @@ import deprecated from '@wordpress/deprecated';
|
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
18
|
import groups from './groups';
|
|
19
|
-
import
|
|
19
|
+
import { useBlockEditContext, mayDisplayControlsKey } from '../block-edit/context';
|
|
20
20
|
import { BlockSettingsButton } from '../block-settings';
|
|
21
21
|
export default function InspectorControlsFill({
|
|
22
22
|
children,
|
|
@@ -32,13 +32,13 @@ export default function InspectorControlsFill({
|
|
|
32
32
|
});
|
|
33
33
|
group = __experimentalGroup;
|
|
34
34
|
}
|
|
35
|
-
const
|
|
35
|
+
const context = useBlockEditContext();
|
|
36
36
|
const Fill = groups[group]?.Fill;
|
|
37
37
|
if (!Fill) {
|
|
38
38
|
typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? warning(`Unknown InspectorControls group "${group}" provided.`) : void 0;
|
|
39
39
|
return null;
|
|
40
40
|
}
|
|
41
|
-
if (!
|
|
41
|
+
if (!context[mayDisplayControlsKey]) {
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
44
|
return createElement(Fragment, null, createElement(Fill, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["View","Children","BottomSheetConsumer","warning","deprecated","groups","
|
|
1
|
+
{"version":3,"names":["View","Children","BottomSheetConsumer","warning","deprecated","groups","useBlockEditContext","mayDisplayControlsKey","BlockSettingsButton","InspectorControlsFill","children","group","__experimentalGroup","props","since","version","alternative","context","Fill","SCRIPT_DEBUG","createElement","Fragment","count"],"sources":["@wordpress/block-editor/src/components/inspector-controls/fill.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Children } from '@wordpress/element';\nimport { BottomSheetConsumer } from '@wordpress/components';\nimport warning from '@wordpress/warning';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport groups from './groups';\nimport {\n\tuseBlockEditContext,\n\tmayDisplayControlsKey,\n} from '../block-edit/context';\nimport { BlockSettingsButton } from '../block-settings';\n\nexport default function InspectorControlsFill( {\n\tchildren,\n\tgroup = 'default',\n\t__experimentalGroup,\n\t...props\n} ) {\n\tif ( __experimentalGroup ) {\n\t\tdeprecated(\n\t\t\t'`__experimentalGroup` property in `InspectorControlsFill`',\n\t\t\t{\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.4',\n\t\t\t\talternative: '`group`',\n\t\t\t}\n\t\t);\n\t\tgroup = __experimentalGroup;\n\t}\n\tconst context = useBlockEditContext();\n\n\tconst Fill = groups[ group ]?.Fill;\n\tif ( ! Fill ) {\n\t\twarning( `Unknown InspectorControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\tif ( ! context[ mayDisplayControlsKey ] ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Fill { ...props }>\n\t\t\t\t{\n\t\t\t\t\t<BottomSheetConsumer>\n\t\t\t\t\t\t{ () => <View>{ children }</View> }\n\t\t\t\t\t</BottomSheetConsumer>\n\t\t\t\t}\n\t\t\t</Fill>\n\t\t\t{ Children.count( children ) > 0 && <BlockSettingsButton /> }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,IAAI,QAAQ,cAAc;;AAEnC;AACA;AACA;AACA,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,OAAOC,OAAO,MAAM,oBAAoB;AACxC,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,OAAOC,MAAM,MAAM,UAAU;AAC7B,SACCC,mBAAmB,EACnBC,qBAAqB,QACf,uBAAuB;AAC9B,SAASC,mBAAmB,QAAQ,mBAAmB;AAEvD,eAAe,SAASC,qBAAqBA,CAAE;EAC9CC,QAAQ;EACRC,KAAK,GAAG,SAAS;EACjBC,mBAAmB;EACnB,GAAGC;AACJ,CAAC,EAAG;EACH,IAAKD,mBAAmB,EAAG;IAC1BR,UAAU,CACT,2DAA2D,EAC3D;MACCU,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAAK;MACdC,WAAW,EAAE;IACd,CACD,CAAC;IACDL,KAAK,GAAGC,mBAAmB;EAC5B;EACA,MAAMK,OAAO,GAAGX,mBAAmB,CAAC,CAAC;EAErC,MAAMY,IAAI,GAAGb,MAAM,CAAEM,KAAK,CAAE,EAAEO,IAAI;EAClC,IAAK,CAAEA,IAAI,EAAG;IACb,OAAAC,YAAA,oBAAAA,YAAA,YAAAhB,OAAO,CAAG,oCAAoCQ,KAAO,aAAa,CAAC;IACnE,OAAO,IAAI;EACZ;EACA,IAAK,CAAEM,OAAO,CAAEV,qBAAqB,CAAE,EAAG;IACzC,OAAO,IAAI;EACZ;EAEA,OACCa,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACF,IAAI;IAAA,GAAML;EAAK,GAEdO,aAAA,CAAClB,mBAAmB,QACjB,MAAMkB,aAAA,CAACpB,IAAI,QAAGU,QAAgB,CACZ,CAEjB,CAAC,EACLT,QAAQ,CAACqB,KAAK,CAAEZ,QAAS,CAAC,GAAG,CAAC,IAAIU,aAAA,CAACZ,mBAAmB,MAAE,CACzD,CAAC;AAEL"}
|
|
@@ -23,7 +23,6 @@ export default function useListViewExpandSelectedItem({
|
|
|
23
23
|
selectedBlockParentClientIds: getBlockParents(firstSelectedBlockClientId, false)
|
|
24
24
|
};
|
|
25
25
|
}, [firstSelectedBlockClientId]);
|
|
26
|
-
const parentClientIds = Array.isArray(selectedBlockParentClientIds) && selectedBlockParentClientIds.length ? selectedBlockParentClientIds : null;
|
|
27
26
|
|
|
28
27
|
// Expand tree when a block is selected.
|
|
29
28
|
useEffect(() => {
|
|
@@ -34,7 +33,7 @@ export default function useListViewExpandSelectedItem({
|
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
// If the selected block has parents, get the top-level parent.
|
|
37
|
-
if (
|
|
36
|
+
if (selectedBlockParentClientIds?.length) {
|
|
38
37
|
// If the selected block has parents,
|
|
39
38
|
// expand the tree branch.
|
|
40
39
|
setExpandedState({
|
|
@@ -42,7 +41,7 @@ export default function useListViewExpandSelectedItem({
|
|
|
42
41
|
clientIds: selectedBlockParentClientIds
|
|
43
42
|
});
|
|
44
43
|
}
|
|
45
|
-
}, [firstSelectedBlockClientId]);
|
|
44
|
+
}, [firstSelectedBlockClientId, selectedBlockParentClientIds, selectedTreeId, setExpandedState]);
|
|
46
45
|
return {
|
|
47
46
|
setSelectedTreeId
|
|
48
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useState","useSelect","store","blockEditorStore","useListViewExpandSelectedItem","firstSelectedBlockClientId","setExpandedState","selectedTreeId","setSelectedTreeId","selectedBlockParentClientIds","select","getBlockParents","
|
|
1
|
+
{"version":3,"names":["useEffect","useState","useSelect","store","blockEditorStore","useListViewExpandSelectedItem","firstSelectedBlockClientId","setExpandedState","selectedTreeId","setSelectedTreeId","selectedBlockParentClientIds","select","getBlockParents","length","type","clientIds"],"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-expand-selected-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nexport default function useListViewExpandSelectedItem( {\n\tfirstSelectedBlockClientId,\n\tsetExpandedState,\n} ) {\n\tconst [ selectedTreeId, setSelectedTreeId ] = useState( null );\n\tconst { selectedBlockParentClientIds } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParents } = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tselectedBlockParentClientIds: getBlockParents(\n\t\t\t\t\tfirstSelectedBlockClientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ firstSelectedBlockClientId ]\n\t);\n\n\t// Expand tree when a block is selected.\n\tuseEffect( () => {\n\t\t// If the selectedTreeId is the same as the selected block,\n\t\t// it means that the block was selected using the block list tree.\n\t\tif ( selectedTreeId === firstSelectedBlockClientId ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If the selected block has parents, get the top-level parent.\n\t\tif ( selectedBlockParentClientIds?.length ) {\n\t\t\t// If the selected block has parents,\n\t\t\t// expand the tree branch.\n\t\t\tsetExpandedState( {\n\t\t\t\ttype: 'expand',\n\t\t\t\tclientIds: selectedBlockParentClientIds,\n\t\t\t} );\n\t\t}\n\t}, [\n\t\tfirstSelectedBlockClientId,\n\t\tselectedBlockParentClientIds,\n\t\tselectedTreeId,\n\t\tsetExpandedState,\n\t] );\n\n\treturn {\n\t\tsetSelectedTreeId,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AACxD,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAEvD,eAAe,SAASC,6BAA6BA,CAAE;EACtDC,0BAA0B;EAC1BC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,cAAc,EAAEC,iBAAiB,CAAE,GAAGR,QAAQ,CAAE,IAAK,CAAC;EAC9D,MAAM;IAAES;EAA6B,CAAC,GAAGR,SAAS,CAC/CS,MAAM,IAAM;IACb,MAAM;MAAEC;IAAgB,CAAC,GAAGD,MAAM,CAAEP,gBAAiB,CAAC;IACtD,OAAO;MACNM,4BAA4B,EAAEE,eAAe,CAC5CN,0BAA0B,EAC1B,KACD;IACD,CAAC;EACF,CAAC,EACD,CAAEA,0BAA0B,CAC7B,CAAC;;EAED;EACAN,SAAS,CAAE,MAAM;IAChB;IACA;IACA,IAAKQ,cAAc,KAAKF,0BAA0B,EAAG;MACpD;IACD;;IAEA;IACA,IAAKI,4BAA4B,EAAEG,MAAM,EAAG;MAC3C;MACA;MACAN,gBAAgB,CAAE;QACjBO,IAAI,EAAE,QAAQ;QACdC,SAAS,EAAEL;MACZ,CAAE,CAAC;IACJ;EACD,CAAC,EAAE,CACFJ,0BAA0B,EAC1BI,4BAA4B,EAC5BF,cAAc,EACdD,gBAAgB,CACf,CAAC;EAEH,OAAO;IACNE;EACD,CAAC;AACF"}
|
|
@@ -138,7 +138,7 @@ function useToolbarFocus({
|
|
|
138
138
|
const index = items.findIndex(item => item.tabIndex === 0);
|
|
139
139
|
onIndexChange(index);
|
|
140
140
|
};
|
|
141
|
-
}, [initialIndex, initialFocusOnMount, toolbarRef]);
|
|
141
|
+
}, [initialIndex, initialFocusOnMount, onIndexChange, toolbarRef]);
|
|
142
142
|
const {
|
|
143
143
|
lastFocus
|
|
144
144
|
} = useSelect(select => {
|
|
@@ -183,9 +183,9 @@ export default function NavigableToolbar({
|
|
|
183
183
|
useToolbarFocus({
|
|
184
184
|
toolbarRef,
|
|
185
185
|
focusOnMount,
|
|
186
|
-
isAccessibleToolbar,
|
|
187
186
|
defaultIndex: initialIndex,
|
|
188
187
|
onIndexChange,
|
|
188
|
+
isAccessibleToolbar,
|
|
189
189
|
shouldUseKeyboardFocusShortcut,
|
|
190
190
|
focusEditorOnEscape
|
|
191
191
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NavigableMenu","Toolbar","useState","useRef","useLayoutEffect","useEffect","useCallback","useSelect","deprecated","focus","useShortcut","ESCAPE","store","blockEditorStore","hasOnlyToolbarItem","elements","dataProp","some","element","dataset","getAllToolbarItemsIn","container","Array","from","querySelectorAll","hasFocusWithin","contains","ownerDocument","activeElement","focusFirstTabbableIn","firstTabbable","tabbable","find","preventScroll","useIsAccessibleToolbar","toolbarRef","initialAccessibleToolbarState","isAccessibleToolbar","setIsAccessibleToolbar","determineIsAccessibleToolbar","tabbables","current","onlyToolbarItem","since","alternative","link","observer","window","MutationObserver","observe","childList","subtree","disconnect","useToolbarFocus","focusOnMount","defaultIndex","onIndexChange","shouldUseKeyboardFocusShortcut","focusEditorOnEscape","initialFocusOnMount","initialIndex","focusToolbar","focusToolbarViaShortcut","navigableToolbarRef","raf","requestAnimationFrame","items","index","cancelAnimationFrame","findIndex","item","tabIndex","lastFocus","select","getLastFocus","handleKeyDown","event","keyCode","preventDefault","addEventListener","removeEventListener","NavigableToolbar","children","__experimentalInitialIndex","__experimentalOnIndexChange","props","createElement","label","ref","orientation","role"],"sources":["@wordpress/block-editor/src/components/navigable-toolbar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { NavigableMenu, Toolbar } from '@wordpress/components';\nimport {\n\tuseState,\n\tuseRef,\n\tuseLayoutEffect,\n\tuseEffect,\n\tuseCallback,\n} from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { focus } from '@wordpress/dom';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nfunction hasOnlyToolbarItem( elements ) {\n\tconst dataProp = 'toolbarItem';\n\treturn ! elements.some( ( element ) => ! ( dataProp in element.dataset ) );\n}\n\nfunction getAllToolbarItemsIn( container ) {\n\treturn Array.from( container.querySelectorAll( '[data-toolbar-item]' ) );\n}\n\nfunction hasFocusWithin( container ) {\n\treturn container.contains( container.ownerDocument.activeElement );\n}\n\nfunction focusFirstTabbableIn( container ) {\n\tconst [ firstTabbable ] = focus.tabbable.find( container );\n\n\tif ( firstTabbable ) {\n\t\tfirstTabbable.focus( {\n\t\t\t// When focusing newly mounted toolbars,\n\t\t\t// the position of the popover is often not right on the first render\n\t\t\t// This prevents the layout shifts when focusing the dialogs.\n\t\t\tpreventScroll: true,\n\t\t} );\n\t}\n}\n\nfunction useIsAccessibleToolbar( toolbarRef ) {\n\t/*\n\t * By default, we'll assume the starting accessible state of the Toolbar\n\t * is true, as it seems to be the most common case.\n\t *\n\t * Transitioning from an (initial) false to true state causes the\n\t * <Toolbar /> component to mount twice, which is causing undesired\n\t * side-effects. These side-effects appear to only affect certain\n\t * E2E tests.\n\t *\n\t * This was initial discovered in this pull-request:\n\t * https://github.com/WordPress/gutenberg/pull/23425\n\t */\n\tconst initialAccessibleToolbarState = true;\n\n\t// By default, it's gonna render NavigableMenu. If all the tabbable elements\n\t// inside the toolbar are ToolbarItem components (or derived components like\n\t// ToolbarButton), then we can wrap them with the accessible Toolbar\n\t// component.\n\tconst [ isAccessibleToolbar, setIsAccessibleToolbar ] = useState(\n\t\tinitialAccessibleToolbarState\n\t);\n\n\tconst determineIsAccessibleToolbar = useCallback( () => {\n\t\tconst tabbables = focus.tabbable.find( toolbarRef.current );\n\t\tconst onlyToolbarItem = hasOnlyToolbarItem( tabbables );\n\t\tif ( ! onlyToolbarItem ) {\n\t\t\tdeprecated( 'Using custom components as toolbar controls', {\n\t\t\t\tsince: '5.6',\n\t\t\t\talternative:\n\t\t\t\t\t'ToolbarItem, ToolbarButton or ToolbarDropdownMenu components',\n\t\t\t\tlink: 'https://developer.wordpress.org/block-editor/components/toolbar-button/#inside-blockcontrols',\n\t\t\t} );\n\t\t}\n\t\tsetIsAccessibleToolbar( onlyToolbarItem );\n\t}, [ toolbarRef ] );\n\n\tuseLayoutEffect( () => {\n\t\t// Toolbar buttons may be rendered asynchronously, so we use\n\t\t// MutationObserver to check if the toolbar subtree has been modified.\n\t\tconst observer = new window.MutationObserver(\n\t\t\tdetermineIsAccessibleToolbar\n\t\t);\n\t\tobserver.observe( toolbarRef.current, {\n\t\t\tchildList: true,\n\t\t\tsubtree: true,\n\t\t} );\n\t\treturn () => observer.disconnect();\n\t}, [ determineIsAccessibleToolbar, isAccessibleToolbar, toolbarRef ] );\n\n\treturn isAccessibleToolbar;\n}\n\nfunction useToolbarFocus( {\n\ttoolbarRef,\n\tfocusOnMount,\n\tisAccessibleToolbar,\n\tdefaultIndex,\n\tonIndexChange,\n\tshouldUseKeyboardFocusShortcut,\n\tfocusEditorOnEscape,\n} ) {\n\t// Make sure we don't use modified versions of this prop.\n\tconst [ initialFocusOnMount ] = useState( focusOnMount );\n\tconst [ initialIndex ] = useState( defaultIndex );\n\n\tconst focusToolbar = useCallback( () => {\n\t\tfocusFirstTabbableIn( toolbarRef.current );\n\t}, [ toolbarRef ] );\n\n\tconst focusToolbarViaShortcut = () => {\n\t\tif ( shouldUseKeyboardFocusShortcut ) {\n\t\t\tfocusToolbar();\n\t\t}\n\t};\n\n\t// Focus on toolbar when pressing alt+F10 when the toolbar is visible.\n\tuseShortcut( 'core/block-editor/focus-toolbar', focusToolbarViaShortcut );\n\n\tuseEffect( () => {\n\t\tif ( initialFocusOnMount ) {\n\t\t\tfocusToolbar();\n\t\t}\n\t}, [ isAccessibleToolbar, initialFocusOnMount, focusToolbar ] );\n\n\tuseEffect( () => {\n\t\t// Store ref so we have access on useEffect cleanup: https://legacy.reactjs.org/blog/2020/08/10/react-v17-rc.html#effect-cleanup-timing\n\t\tconst navigableToolbarRef = toolbarRef.current;\n\t\t// If initialIndex is passed, we focus on that toolbar item when the\n\t\t// toolbar gets mounted and initial focus is not forced.\n\t\t// We have to wait for the next browser paint because block controls aren't\n\t\t// rendered right away when the toolbar gets mounted.\n\t\tlet raf = 0;\n\t\tif ( ! initialFocusOnMount ) {\n\t\t\traf = window.requestAnimationFrame( () => {\n\t\t\t\tconst items = getAllToolbarItemsIn( navigableToolbarRef );\n\t\t\t\tconst index = initialIndex || 0;\n\t\t\t\tif ( items[ index ] && hasFocusWithin( navigableToolbarRef ) ) {\n\t\t\t\t\titems[ index ].focus( {\n\t\t\t\t\t\t// When focusing newly mounted toolbars,\n\t\t\t\t\t\t// the position of the popover is often not right on the first render\n\t\t\t\t\t\t// This prevents the layout shifts when focusing the dialogs.\n\t\t\t\t\t\tpreventScroll: true,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t\treturn () => {\n\t\t\twindow.cancelAnimationFrame( raf );\n\t\t\tif ( ! onIndexChange || ! navigableToolbarRef ) return;\n\t\t\t// When the toolbar element is unmounted and onIndexChange is passed, we\n\t\t\t// pass the focused toolbar item index so it can be hydrated later.\n\t\t\tconst items = getAllToolbarItemsIn( navigableToolbarRef );\n\t\t\tconst index = items.findIndex( ( item ) => item.tabIndex === 0 );\n\t\t\tonIndexChange( index );\n\t\t};\n\t}, [ initialIndex, initialFocusOnMount, toolbarRef ] );\n\n\tconst { lastFocus } = useSelect( ( select ) => {\n\t\tconst { getLastFocus } = select( blockEditorStore );\n\t\treturn {\n\t\t\tlastFocus: getLastFocus(),\n\t\t};\n\t}, [] );\n\t/**\n\t * Handles returning focus to the block editor canvas when pressing escape.\n\t */\n\tuseEffect( () => {\n\t\tconst navigableToolbarRef = toolbarRef.current;\n\n\t\tif ( focusEditorOnEscape ) {\n\t\t\tconst handleKeyDown = ( event ) => {\n\t\t\t\tif ( event.keyCode === ESCAPE && lastFocus?.current ) {\n\t\t\t\t\t// Focus the last focused element when pressing escape.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tlastFocus.current.focus();\n\t\t\t\t}\n\t\t\t};\n\t\t\tnavigableToolbarRef.addEventListener( 'keydown', handleKeyDown );\n\t\t\treturn () => {\n\t\t\t\tnavigableToolbarRef.removeEventListener(\n\t\t\t\t\t'keydown',\n\t\t\t\t\thandleKeyDown\n\t\t\t\t);\n\t\t\t};\n\t\t}\n\t}, [ focusEditorOnEscape, lastFocus, toolbarRef ] );\n}\n\nexport default function NavigableToolbar( {\n\tchildren,\n\tfocusOnMount,\n\tfocusEditorOnEscape = false,\n\tshouldUseKeyboardFocusShortcut = true,\n\t__experimentalInitialIndex: initialIndex,\n\t__experimentalOnIndexChange: onIndexChange,\n\t...props\n} ) {\n\tconst toolbarRef = useRef();\n\tconst isAccessibleToolbar = useIsAccessibleToolbar( toolbarRef );\n\n\tuseToolbarFocus( {\n\t\ttoolbarRef,\n\t\tfocusOnMount,\n\t\tisAccessibleToolbar,\n\t\tdefaultIndex: initialIndex,\n\t\tonIndexChange,\n\t\tshouldUseKeyboardFocusShortcut,\n\t\tfocusEditorOnEscape,\n\t} );\n\n\tif ( isAccessibleToolbar ) {\n\t\treturn (\n\t\t\t<Toolbar\n\t\t\t\tlabel={ props[ 'aria-label' ] }\n\t\t\t\tref={ toolbarRef }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</Toolbar>\n\t\t);\n\t}\n\n\treturn (\n\t\t<NavigableMenu\n\t\t\torientation=\"horizontal\"\n\t\t\trole=\"toolb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EAAE5B,aAAa;EAC1C,GAAG6B;AACJ,CAAC,EAAG;EACH,MAAMlD,UAAU,GAAGhC,MAAM,CAAC,CAAC;EAC3B,MAAMkC,mBAAmB,GAAGH,sBAAsB,CAAEC,UAAW,CAAC;EAEhEkB,eAAe,CAAE;IAChBlB,UAAU;IACVmB,YAAY;IACZjB,mBAAmB;IACnBkB,YAAY,EAAEK,YAAY;IAC1BJ,aAAa;IACbC,8BAA8B;IAC9BC;EACD,CAAE,CAAC;EAEH,IAAKrB,mBAAmB,EAAG;IAC1B,OACCiD,aAAA,CAACrF,OAAO;MACPsF,KAAK,EAAGF,KAAK,CAAE,YAAY,CAAI;MAC/BG,GAAG,EAAGrD,UAAY;MAAA,GACbkD;IAAK,GAERH,QACM,CAAC;EAEZ;EAEA,OACCI,aAAA,CAACtF,aAAa;IACbyF,WAAW,EAAC,YAAY;IACxBC,IAAI,EAAC,SAAS;IACdF,GAAG,EAAGrD,UAAY;IAAA,GACbkD;EAAK,GAERH,QACY,CAAC;AAElB"}
|
|
1
|
+
{"version":3,"names":["NavigableMenu","Toolbar","useState","useRef","useLayoutEffect","useEffect","useCallback","useSelect","deprecated","focus","useShortcut","ESCAPE","store","blockEditorStore","hasOnlyToolbarItem","elements","dataProp","some","element","dataset","getAllToolbarItemsIn","container","Array","from","querySelectorAll","hasFocusWithin","contains","ownerDocument","activeElement","focusFirstTabbableIn","firstTabbable","tabbable","find","preventScroll","useIsAccessibleToolbar","toolbarRef","initialAccessibleToolbarState","isAccessibleToolbar","setIsAccessibleToolbar","determineIsAccessibleToolbar","tabbables","current","onlyToolbarItem","since","alternative","link","observer","window","MutationObserver","observe","childList","subtree","disconnect","useToolbarFocus","focusOnMount","defaultIndex","onIndexChange","shouldUseKeyboardFocusShortcut","focusEditorOnEscape","initialFocusOnMount","initialIndex","focusToolbar","focusToolbarViaShortcut","navigableToolbarRef","raf","requestAnimationFrame","items","index","cancelAnimationFrame","findIndex","item","tabIndex","lastFocus","select","getLastFocus","handleKeyDown","event","keyCode","preventDefault","addEventListener","removeEventListener","NavigableToolbar","children","__experimentalInitialIndex","__experimentalOnIndexChange","props","createElement","label","ref","orientation","role"],"sources":["@wordpress/block-editor/src/components/navigable-toolbar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { NavigableMenu, Toolbar } from '@wordpress/components';\nimport {\n\tuseState,\n\tuseRef,\n\tuseLayoutEffect,\n\tuseEffect,\n\tuseCallback,\n} from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { focus } from '@wordpress/dom';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nfunction hasOnlyToolbarItem( elements ) {\n\tconst dataProp = 'toolbarItem';\n\treturn ! elements.some( ( element ) => ! ( dataProp in element.dataset ) );\n}\n\nfunction getAllToolbarItemsIn( container ) {\n\treturn Array.from( container.querySelectorAll( '[data-toolbar-item]' ) );\n}\n\nfunction hasFocusWithin( container ) {\n\treturn container.contains( container.ownerDocument.activeElement );\n}\n\nfunction focusFirstTabbableIn( container ) {\n\tconst [ firstTabbable ] = focus.tabbable.find( container );\n\n\tif ( firstTabbable ) {\n\t\tfirstTabbable.focus( {\n\t\t\t// When focusing newly mounted toolbars,\n\t\t\t// the position of the popover is often not right on the first render\n\t\t\t// This prevents the layout shifts when focusing the dialogs.\n\t\t\tpreventScroll: true,\n\t\t} );\n\t}\n}\n\nfunction useIsAccessibleToolbar( toolbarRef ) {\n\t/*\n\t * By default, we'll assume the starting accessible state of the Toolbar\n\t * is true, as it seems to be the most common case.\n\t *\n\t * Transitioning from an (initial) false to true state causes the\n\t * <Toolbar /> component to mount twice, which is causing undesired\n\t * side-effects. These side-effects appear to only affect certain\n\t * E2E tests.\n\t *\n\t * This was initial discovered in this pull-request:\n\t * https://github.com/WordPress/gutenberg/pull/23425\n\t */\n\tconst initialAccessibleToolbarState = true;\n\n\t// By default, it's gonna render NavigableMenu. If all the tabbable elements\n\t// inside the toolbar are ToolbarItem components (or derived components like\n\t// ToolbarButton), then we can wrap them with the accessible Toolbar\n\t// component.\n\tconst [ isAccessibleToolbar, setIsAccessibleToolbar ] = useState(\n\t\tinitialAccessibleToolbarState\n\t);\n\n\tconst determineIsAccessibleToolbar = useCallback( () => {\n\t\tconst tabbables = focus.tabbable.find( toolbarRef.current );\n\t\tconst onlyToolbarItem = hasOnlyToolbarItem( tabbables );\n\t\tif ( ! onlyToolbarItem ) {\n\t\t\tdeprecated( 'Using custom components as toolbar controls', {\n\t\t\t\tsince: '5.6',\n\t\t\t\talternative:\n\t\t\t\t\t'ToolbarItem, ToolbarButton or ToolbarDropdownMenu components',\n\t\t\t\tlink: 'https://developer.wordpress.org/block-editor/components/toolbar-button/#inside-blockcontrols',\n\t\t\t} );\n\t\t}\n\t\tsetIsAccessibleToolbar( onlyToolbarItem );\n\t}, [ toolbarRef ] );\n\n\tuseLayoutEffect( () => {\n\t\t// Toolbar buttons may be rendered asynchronously, so we use\n\t\t// MutationObserver to check if the toolbar subtree has been modified.\n\t\tconst observer = new window.MutationObserver(\n\t\t\tdetermineIsAccessibleToolbar\n\t\t);\n\t\tobserver.observe( toolbarRef.current, {\n\t\t\tchildList: true,\n\t\t\tsubtree: true,\n\t\t} );\n\t\treturn () => observer.disconnect();\n\t}, [ determineIsAccessibleToolbar, isAccessibleToolbar, toolbarRef ] );\n\n\treturn isAccessibleToolbar;\n}\n\nfunction useToolbarFocus( {\n\ttoolbarRef,\n\tfocusOnMount,\n\tisAccessibleToolbar,\n\tdefaultIndex,\n\tonIndexChange,\n\tshouldUseKeyboardFocusShortcut,\n\tfocusEditorOnEscape,\n} ) {\n\t// Make sure we don't use modified versions of this prop.\n\tconst [ initialFocusOnMount ] = useState( focusOnMount );\n\tconst [ initialIndex ] = useState( defaultIndex );\n\n\tconst focusToolbar = useCallback( () => {\n\t\tfocusFirstTabbableIn( toolbarRef.current );\n\t}, [ toolbarRef ] );\n\n\tconst focusToolbarViaShortcut = () => {\n\t\tif ( shouldUseKeyboardFocusShortcut ) {\n\t\t\tfocusToolbar();\n\t\t}\n\t};\n\n\t// Focus on toolbar when pressing alt+F10 when the toolbar is visible.\n\tuseShortcut( 'core/block-editor/focus-toolbar', focusToolbarViaShortcut );\n\n\tuseEffect( () => {\n\t\tif ( initialFocusOnMount ) {\n\t\t\tfocusToolbar();\n\t\t}\n\t}, [ isAccessibleToolbar, initialFocusOnMount, focusToolbar ] );\n\n\tuseEffect( () => {\n\t\t// Store ref so we have access on useEffect cleanup: https://legacy.reactjs.org/blog/2020/08/10/react-v17-rc.html#effect-cleanup-timing\n\t\tconst navigableToolbarRef = toolbarRef.current;\n\t\t// If initialIndex is passed, we focus on that toolbar item when the\n\t\t// toolbar gets mounted and initial focus is not forced.\n\t\t// We have to wait for the next browser paint because block controls aren't\n\t\t// rendered right away when the toolbar gets mounted.\n\t\tlet raf = 0;\n\t\tif ( ! initialFocusOnMount ) {\n\t\t\traf = window.requestAnimationFrame( () => {\n\t\t\t\tconst items = getAllToolbarItemsIn( navigableToolbarRef );\n\t\t\t\tconst index = initialIndex || 0;\n\t\t\t\tif ( items[ index ] && hasFocusWithin( navigableToolbarRef ) ) {\n\t\t\t\t\titems[ index ].focus( {\n\t\t\t\t\t\t// When focusing newly mounted toolbars,\n\t\t\t\t\t\t// the position of the popover is often not right on the first render\n\t\t\t\t\t\t// This prevents the layout shifts when focusing the dialogs.\n\t\t\t\t\t\tpreventScroll: true,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t\treturn () => {\n\t\t\twindow.cancelAnimationFrame( raf );\n\t\t\tif ( ! onIndexChange || ! navigableToolbarRef ) return;\n\t\t\t// When the toolbar element is unmounted and onIndexChange is passed, we\n\t\t\t// pass the focused toolbar item index so it can be hydrated later.\n\t\t\tconst items = getAllToolbarItemsIn( navigableToolbarRef );\n\t\t\tconst index = items.findIndex( ( item ) => item.tabIndex === 0 );\n\t\t\tonIndexChange( index );\n\t\t};\n\t}, [ initialIndex, initialFocusOnMount, onIndexChange, toolbarRef ] );\n\n\tconst { lastFocus } = useSelect( ( select ) => {\n\t\tconst { getLastFocus } = select( blockEditorStore );\n\t\treturn {\n\t\t\tlastFocus: getLastFocus(),\n\t\t};\n\t}, [] );\n\t/**\n\t * Handles returning focus to the block editor canvas when pressing escape.\n\t */\n\tuseEffect( () => {\n\t\tconst navigableToolbarRef = toolbarRef.current;\n\n\t\tif ( focusEditorOnEscape ) {\n\t\t\tconst handleKeyDown = ( event ) => {\n\t\t\t\tif ( event.keyCode === ESCAPE && lastFocus?.current ) {\n\t\t\t\t\t// Focus the last focused element when pressing escape.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tlastFocus.current.focus();\n\t\t\t\t}\n\t\t\t};\n\t\t\tnavigableToolbarRef.addEventListener( 'keydown', handleKeyDown );\n\t\t\treturn () => {\n\t\t\t\tnavigableToolbarRef.removeEventListener(\n\t\t\t\t\t'keydown',\n\t\t\t\t\thandleKeyDown\n\t\t\t\t);\n\t\t\t};\n\t\t}\n\t}, [ focusEditorOnEscape, lastFocus, toolbarRef ] );\n}\n\nexport default function NavigableToolbar( {\n\tchildren,\n\tfocusOnMount,\n\tfocusEditorOnEscape = false,\n\tshouldUseKeyboardFocusShortcut = true,\n\t__experimentalInitialIndex: initialIndex,\n\t__experimentalOnIndexChange: onIndexChange,\n\t...props\n} ) {\n\tconst toolbarRef = useRef();\n\tconst isAccessibleToolbar = useIsAccessibleToolbar( toolbarRef );\n\n\tuseToolbarFocus( {\n\t\ttoolbarRef,\n\t\tfocusOnMount,\n\t\tdefaultIndex: initialIndex,\n\t\tonIndexChange,\n\t\tisAccessibleToolbar,\n\t\tshouldUseKeyboardFocusShortcut,\n\t\tfocusEditorOnEscape,\n\t} );\n\n\tif ( isAccessibleToolbar ) {\n\t\treturn (\n\t\t\t<Toolbar\n\t\t\t\tlabel={ props[ 'aria-label' ] }\n\t\t\t\tref={ toolbarRef }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</Toolbar>\n\t\t);\n\t}\n\n\treturn (\n\t\t<NavigableMenu\n\t\t\torientation=\"horizontal\"\n\t\t\trole=\"toolbar\"\n\t\t\tref={ toolbarRef }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ children }\n\t\t</NavigableMenu>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,OAAO,QAAQ,uBAAuB;AAC9D,SACCC,QAAQ,EACRC,MAAM,EACNC,eAAe,EACfC,SAAS,EACTC,WAAW,QACL,oBAAoB;AAC3B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SAASC,WAAW,QAAQ,+BAA+B;AAC3D,SAASC,MAAM,QAAQ,qBAAqB;;AAE5C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAEvD,SAASC,kBAAkBA,CAAEC,QAAQ,EAAG;EACvC,MAAMC,QAAQ,GAAG,aAAa;EAC9B,OAAO,CAAED,QAAQ,CAACE,IAAI,CAAIC,OAAO,IAAM,EAAIF,QAAQ,IAAIE,OAAO,CAACC,OAAO,CAAG,CAAC;AAC3E;AAEA,SAASC,oBAAoBA,CAAEC,SAAS,EAAG;EAC1C,OAAOC,KAAK,CAACC,IAAI,CAAEF,SAAS,CAACG,gBAAgB,CAAE,qBAAsB,CAAE,CAAC;AACzE;AAEA,SAASC,cAAcA,CAAEJ,SAAS,EAAG;EACpC,OAAOA,SAAS,CAACK,QAAQ,CAAEL,SAAS,CAACM,aAAa,CAACC,aAAc,CAAC;AACnE;AAEA,SAASC,oBAAoBA,CAAER,SAAS,EAAG;EAC1C,MAAM,CAAES,aAAa,CAAE,GAAGrB,KAAK,CAACsB,QAAQ,CAACC,IAAI,CAAEX,S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UAAU,CAAG,CAAC;AACpD;AAEA,eAAe,SAAS8C,gBAAgBA,CAAE;EACzCC,QAAQ;EACR5B,YAAY;EACZI,mBAAmB,GAAG,KAAK;EAC3BD,8BAA8B,GAAG,IAAI;EACrC0B,0BAA0B,EAAEvB,YAAY;EACxCwB,2BAA2B,EAAE5B,aAAa;EAC1C,GAAG6B;AACJ,CAAC,EAAG;EACH,MAAMlD,UAAU,GAAGhC,MAAM,CAAC,CAAC;EAC3B,MAAMkC,mBAAmB,GAAGH,sBAAsB,CAAEC,UAAW,CAAC;EAEhEkB,eAAe,CAAE;IAChBlB,UAAU;IACVmB,YAAY;IACZC,YAAY,EAAEK,YAAY;IAC1BJ,aAAa;IACbnB,mBAAmB;IACnBoB,8BAA8B;IAC9BC;EACD,CAAE,CAAC;EAEH,IAAKrB,mBAAmB,EAAG;IAC1B,OACCiD,aAAA,CAACrF,OAAO;MACPsF,KAAK,EAAGF,KAAK,CAAE,YAAY,CAAI;MAC/BG,GAAG,EAAGrD,UAAY;MAAA,GACbkD;IAAK,GAERH,QACM,CAAC;EAEZ;EAEA,OACCI,aAAA,CAACtF,aAAa;IACbyF,WAAW,EAAC,YAAY;IACxBC,IAAI,EAAC,SAAS;IACdF,GAAG,EAAGrD,UAAY;IAAA,GACbkD;EAAK,GAERH,QACY,CAAC;AAElB"}
|
|
@@ -1,65 +1,11 @@
|
|
|
1
|
-
import { createElement, Fragment } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* External dependencies
|
|
4
|
-
*/
|
|
5
|
-
import classnames from 'classnames';
|
|
6
|
-
|
|
7
1
|
/**
|
|
8
2
|
* WordPress dependencies
|
|
9
3
|
*/
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
viewLabel,
|
|
17
|
-
className,
|
|
18
|
-
isEnabled = true,
|
|
19
|
-
deviceType,
|
|
20
|
-
setDeviceType,
|
|
21
|
-
label
|
|
22
|
-
}) {
|
|
23
|
-
const isMobile = useViewportMatch('small', '<');
|
|
24
|
-
if (isMobile) return null;
|
|
25
|
-
const popoverProps = {
|
|
26
|
-
className: classnames(className, 'block-editor-post-preview__dropdown-content'),
|
|
27
|
-
placement: 'bottom-end'
|
|
28
|
-
};
|
|
29
|
-
const toggleProps = {
|
|
30
|
-
className: 'block-editor-post-preview__button-toggle',
|
|
31
|
-
disabled: !isEnabled,
|
|
32
|
-
__experimentalIsFocusable: !isEnabled,
|
|
33
|
-
children: viewLabel
|
|
34
|
-
};
|
|
35
|
-
const menuProps = {
|
|
36
|
-
'aria-label': __('View options')
|
|
37
|
-
};
|
|
38
|
-
const deviceIcons = {
|
|
39
|
-
mobile,
|
|
40
|
-
tablet,
|
|
41
|
-
desktop
|
|
42
|
-
};
|
|
43
|
-
return createElement(DropdownMenu, {
|
|
44
|
-
className: "block-editor-post-preview__dropdown",
|
|
45
|
-
popoverProps: popoverProps,
|
|
46
|
-
toggleProps: toggleProps,
|
|
47
|
-
menuProps: menuProps,
|
|
48
|
-
icon: deviceIcons[deviceType.toLowerCase()],
|
|
49
|
-
label: label || __('Preview'),
|
|
50
|
-
disableOpenOnArrowDown: !isEnabled
|
|
51
|
-
}, renderProps => createElement(Fragment, null, createElement(MenuGroup, null, createElement(MenuItem, {
|
|
52
|
-
className: "block-editor-post-preview__button-resize",
|
|
53
|
-
onClick: () => setDeviceType('Desktop'),
|
|
54
|
-
icon: deviceType === 'Desktop' && check
|
|
55
|
-
}, __('Desktop')), createElement(MenuItem, {
|
|
56
|
-
className: "block-editor-post-preview__button-resize",
|
|
57
|
-
onClick: () => setDeviceType('Tablet'),
|
|
58
|
-
icon: deviceType === 'Tablet' && check
|
|
59
|
-
}, __('Tablet')), createElement(MenuItem, {
|
|
60
|
-
className: "block-editor-post-preview__button-resize",
|
|
61
|
-
onClick: () => setDeviceType('Mobile'),
|
|
62
|
-
icon: deviceType === 'Mobile' && check
|
|
63
|
-
}, __('Mobile'))), children?.(renderProps)));
|
|
4
|
+
import deprecated from '@wordpress/deprecated';
|
|
5
|
+
export default function PreviewOptions() {
|
|
6
|
+
deprecated('wp.blockEditor.PreviewOptions', {
|
|
7
|
+
version: '6.5'
|
|
8
|
+
});
|
|
9
|
+
return null;
|
|
64
10
|
}
|
|
65
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["deprecated","PreviewOptions","version"],"sources":["@wordpress/block-editor/src/components/preview-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\nexport default function PreviewOptions() {\n\tdeprecated( 'wp.blockEditor.PreviewOptions', {\n\t\tversion: '6.5',\n\t} );\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,uBAAuB;AAE9C,eAAe,SAASC,cAAcA,CAAA,EAAG;EACxCD,UAAU,CAAE,+BAA+B,EAAE;IAC5CE,OAAO,EAAE;EACV,CAAE,CAAC;EACH,OAAO,IAAI;AACZ"}
|
|
@@ -6,40 +6,44 @@ import { RawHTML } from '@wordpress/element';
|
|
|
6
6
|
import { children as childrenSource } from '@wordpress/blocks';
|
|
7
7
|
import deprecated from '@wordpress/deprecated';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import RichText from './';
|
|
13
|
+
|
|
9
14
|
/**
|
|
10
15
|
* Internal dependencies
|
|
11
16
|
*/
|
|
12
17
|
import { getMultilineTag } from './utils';
|
|
13
|
-
export
|
|
18
|
+
export function Content({
|
|
14
19
|
value,
|
|
15
20
|
tagName: Tag,
|
|
16
21
|
multiline,
|
|
22
|
+
format,
|
|
17
23
|
...props
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
}) {
|
|
25
|
+
if (RichText.isEmpty(value)) {
|
|
26
|
+
const MultilineTag = getMultilineTag(multiline);
|
|
27
|
+
value = MultilineTag ? createElement(MultilineTag, null) : null;
|
|
28
|
+
} else if (Array.isArray(value)) {
|
|
21
29
|
deprecated('wp.blockEditor.RichText value prop as children type', {
|
|
22
30
|
since: '6.1',
|
|
23
31
|
version: '6.3',
|
|
24
32
|
alternative: 'value prop as string',
|
|
25
33
|
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
|
|
26
34
|
});
|
|
27
|
-
value = childrenSource.toHTML(value);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
format,
|
|
37
|
-
...restProps
|
|
38
|
-
} = props;
|
|
39
|
-
return createElement(Tag, {
|
|
40
|
-
...restProps
|
|
41
|
-
}, content);
|
|
35
|
+
value = createElement(RawHTML, null, childrenSource.toHTML(value));
|
|
36
|
+
} else if (typeof value === 'string') {
|
|
37
|
+
// To do: deprecate.
|
|
38
|
+
value = createElement(RawHTML, null, value);
|
|
39
|
+
} else {
|
|
40
|
+
// To do: create a toReactComponent method on RichTextData, which we
|
|
41
|
+
// might in the future also use for the editable tree. See
|
|
42
|
+
// https://github.com/WordPress/gutenberg/pull/41655.
|
|
43
|
+
value = createElement(RawHTML, null, value.toHTMLString());
|
|
42
44
|
}
|
|
43
|
-
return
|
|
44
|
-
|
|
45
|
+
return Tag ? createElement(Tag, {
|
|
46
|
+
...props
|
|
47
|
+
}, value) : value;
|
|
48
|
+
}
|
|
45
49
|
//# sourceMappingURL=content.js.map
|