@wordpress/block-editor 7.0.2 → 8.0.1
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 +11 -0
- package/README.md +45 -1
- package/build/components/autocomplete/index.js +1 -1
- package/build/components/autocomplete/index.js.map +1 -1
- package/build/components/block-actions/index.js +8 -4
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/ui.js +61 -14
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js +25 -3
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-controls/fill.js +2 -2
- package/build/components/block-controls/fill.js.map +1 -1
- package/build/components/block-controls/hook.js +3 -3
- package/build/components/block-controls/hook.js.map +1 -1
- package/build/components/block-icon/index.js +5 -1
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-icon/index.native.js +9 -11
- package/build/components/block-icon/index.native.js.map +1 -1
- package/build/components/block-inspector/index.js +8 -0
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-html.js +5 -0
- package/build/components/block-list/block-html.js.map +1 -1
- package/build/components/block-list/block.js +12 -5
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +4 -3
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +1 -1
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/use-multi-selection.js +21 -8
- package/build/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
- package/build/components/block-list-appender/index.js +9 -1
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-mover/index.js +4 -4
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-mover/index.native.js +4 -4
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +0 -1
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-patterns-list/index.js +1 -8
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-preview/auto.js +1 -1
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings/container.native.js +5 -2
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +26 -5
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +10 -3
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/preview.native.js +2 -2
- package/build/components/block-styles/preview.native.js.map +1 -1
- package/build/components/block-switcher/block-styles-menu.js +1 -1
- package/build/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build/components/block-switcher/index.js +10 -3
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-title/index.js +3 -2
- package/build/components/block-title/index.js.map +1 -1
- package/build/components/block-tools/block-popover.js +2 -4
- package/build/components/block-tools/block-popover.js.map +1 -1
- package/build/components/block-tools/index.js +4 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +96 -7
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/border-radius-control/utils.js +17 -8
- package/build/components/border-radius-control/utils.js.map +1 -1
- package/build/components/colors/utils.js +11 -3
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors-gradients/control.js +22 -57
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +83 -7
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/contrast-checker/index.js +18 -12
- package/build/components/contrast-checker/index.js.map +1 -1
- package/build/components/copy-handler/index.js +9 -3
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/default-block-appender/index.js +2 -2
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/duotone-control/index.js +41 -39
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/editor-styles/index.js +9 -3
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +32 -21
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/iframe/index.js +6 -4
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js +126 -0
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
- package/build/components/image-editor/constants.js +16 -0
- package/build/components/image-editor/constants.js.map +1 -0
- package/build/components/image-editor/context.js +59 -0
- package/build/components/image-editor/context.js.map +1 -0
- package/build/components/image-editor/cropper.js +83 -0
- package/build/components/image-editor/cropper.js.map +1 -0
- package/build/components/image-editor/form-controls.js +36 -0
- package/build/components/image-editor/form-controls.js.map +1 -0
- package/build/components/image-editor/index.js +60 -0
- package/build/components/image-editor/index.js.map +1 -0
- package/build/components/image-editor/rotation-button.js +37 -0
- package/build/components/image-editor/rotation-button.js.map +1 -0
- package/build/components/image-editor/use-save-image.js +84 -0
- package/build/components/image-editor/use-save-image.js.map +1 -0
- package/build/components/image-editor/use-transform-image.js +135 -0
- package/build/components/image-editor/use-transform-image.js.map +1 -0
- package/build/components/image-editor/zoom-dropdown.js +55 -0
- package/build/components/image-editor/zoom-dropdown.js.map +1 -0
- package/build/components/image-size-control/use-dimension-handler.js +14 -3
- package/build/components/image-size-control/use-dimension-handler.js.map +1 -1
- package/build/components/index.js +36 -20
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +2 -2
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/button-block-appender.js +11 -1
- package/build/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build/components/inner-blocks/index.js +8 -5
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +4 -3
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +24 -13
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/explorer.js +62 -0
- package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/patterns-list.js +111 -0
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/sidebar.js +78 -0
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
- package/build/components/inserter/block-patterns-tab.js +74 -35
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js +3 -11
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
- package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build/components/inserter/hooks/use-clipboard-block.native.js +5 -4
- package/build/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
- package/build/components/inserter/index.js +12 -4
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +1 -7
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/library.js +2 -0
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js +2 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/menu.native.js +11 -15
- package/build/components/inserter/menu.native.js.map +1 -1
- package/build/components/inserter/pattern-panel.js +19 -10
- package/build/components/inserter/pattern-panel.js.map +1 -1
- package/build/components/inserter/preview-panel.js +1 -1
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +5 -6
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inserter/search-results.native.js +6 -11
- package/build/components/inserter/search-results.native.js.map +1 -1
- package/build/components/inserter/utils.native.js +44 -0
- package/build/components/inserter/utils.native.js.map +1 -0
- package/build/components/inspector-controls/block-support-slot-container.js +28 -0
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -0
- package/build/components/inspector-controls/block-support-tools-panel.js +78 -0
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -0
- package/build/components/inspector-controls/fill.js +16 -1
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/groups.js +5 -1
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls/slot.js +15 -0
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +9 -6
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/link-control/index.js +93 -34
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/link-preview.js +45 -15
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-input.js +25 -7
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block-contents.js +1 -20
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block.js +54 -69
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +102 -76
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +45 -20
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/leaf.js +2 -2
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/list-view/list-item.js +3 -2
- package/build/components/list-view/list-item.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +13 -54
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/media-placeholder/index.js +29 -20
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +5 -3
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +1 -4
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/observe-typing/index.js +1 -1
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +30 -1
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/rich-text/embed-handler-picker.native.js +66 -0
- package/build/components/rich-text/embed-handler-picker.native.js.map +1 -0
- package/build/components/rich-text/format-edit.js +28 -2
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js +32 -11
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +5 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +41 -2
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +28 -9
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/rich-text/utils.js +22 -0
- package/build/components/rich-text/utils.js.map +1 -1
- package/build/components/typewriter/index.js +1 -1
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/url-input/index.js +25 -11
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +13 -10
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +2 -1
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-setting/index.js +48 -9
- package/build/components/use-setting/index.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js +6 -0
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +10 -1
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js +13 -10
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/anchor.js +1 -1
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border.js +5 -5
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +5 -2
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color.js +1 -1
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/dimensions.js +23 -27
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +60 -16
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-appearance.js +49 -6
- package/build/hooks/font-appearance.js.map +1 -1
- package/build/hooks/font-family.js +123 -32
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +51 -9
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/gap.js +2 -1
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/index.js +10 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +8 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/letter-spacing.js +44 -7
- package/build/hooks/letter-spacing.js.map +1 -1
- package/build/hooks/line-height.js +45 -8
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/lock.js +43 -0
- package/build/hooks/lock.js.map +1 -0
- package/build/hooks/margin.js +1 -1
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +1 -1
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/style.js +7 -4
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/text-decoration.js +42 -6
- package/build/hooks/text-decoration.js.map +1 -1
- package/build/hooks/text-transform.js +42 -6
- package/build/hooks/text-transform.js.map +1 -1
- package/build/hooks/typography.js +108 -8
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/use-cached-truthy.js +29 -0
- package/build/hooks/use-cached-truthy.js.map +1 -0
- package/build/index.js +7 -0
- package/build/index.js.map +1 -1
- package/build/layouts/flex.js +160 -34
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +75 -8
- package/build/layouts/flow.js.map +1 -1
- package/build/store/actions.js +323 -265
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.native.js +13 -1
- package/build/store/defaults.native.js.map +1 -1
- package/build/store/index.js +1 -3
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +33 -22
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +172 -38
- package/build/store/selectors.js.map +1 -1
- package/build/utils/index.js +10 -1
- package/build/utils/index.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +51 -1
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build/utils/transform-styles/transforms/wrap.js +16 -0
- package/build/utils/transform-styles/transforms/wrap.js.map +1 -1
- package/build-module/components/autocomplete/index.js +2 -2
- package/build-module/components/autocomplete/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +8 -4
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +64 -17
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +25 -3
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-controls/fill.js +2 -2
- package/build-module/components/block-controls/fill.js.map +1 -1
- package/build-module/components/block-controls/hook.js +3 -3
- package/build-module/components/block-controls/hook.js.map +1 -1
- package/build-module/components/block-icon/index.js +5 -1
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-icon/index.native.js +10 -11
- package/build-module/components/block-icon/index.native.js.map +1 -1
- package/build-module/components/block-inspector/index.js +8 -0
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-html.js +5 -0
- package/build-module/components/block-list/block-html.js.map +1 -1
- package/build-module/components/block-list/block.js +12 -5
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +4 -3
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +1 -1
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-multi-selection.js +21 -8
- package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +9 -1
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-mover/index.js +4 -4
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +4 -4
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +0 -1
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +1 -6
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +1 -1
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +6 -3
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -7
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +10 -3
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/preview.native.js +2 -2
- package/build-module/components/block-styles/preview.native.js.map +1 -1
- package/build-module/components/block-switcher/block-styles-menu.js +1 -1
- package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build-module/components/block-switcher/index.js +10 -3
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-title/index.js +3 -2
- package/build-module/components/block-title/index.js.map +1 -1
- package/build-module/components/block-tools/block-popover.js +3 -5
- package/build-module/components/block-tools/block-popover.js.map +1 -1
- package/build-module/components/block-tools/index.js +4 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +96 -8
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/utils.js +16 -9
- package/build-module/components/border-radius-control/utils.js.map +1 -1
- package/build-module/components/colors/utils.js +9 -3
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +26 -63
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +84 -7
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/contrast-checker/index.js +13 -10
- package/build-module/components/contrast-checker/index.js.map +1 -1
- package/build-module/components/copy-handler/index.js +9 -3
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +2 -2
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/duotone-control/index.js +43 -39
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/editor-styles/index.js +7 -3
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +28 -21
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/iframe/index.js +6 -4
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +115 -0
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
- package/build-module/components/image-editor/constants.js +7 -0
- package/build-module/components/image-editor/constants.js.map +1 -0
- package/build-module/components/image-editor/context.js +44 -0
- package/build-module/components/image-editor/context.js.map +1 -0
- package/build-module/components/image-editor/cropper.js +69 -0
- package/build-module/components/image-editor/cropper.js.map +1 -0
- package/build-module/components/image-editor/form-controls.js +26 -0
- package/build-module/components/image-editor/form-controls.js.map +1 -0
- package/build-module/components/image-editor/index.js +37 -0
- package/build-module/components/image-editor/index.js.map +1 -0
- package/build-module/components/image-editor/rotation-button.js +26 -0
- package/build-module/components/image-editor/rotation-button.js.map +1 -0
- package/build-module/components/image-editor/use-save-image.js +70 -0
- package/build-module/components/image-editor/use-save-image.js.map +1 -0
- package/build-module/components/image-editor/use-transform-image.js +127 -0
- package/build-module/components/image-editor/use-transform-image.js.map +1 -0
- package/build-module/components/image-editor/zoom-dropdown.js +43 -0
- package/build-module/components/image-editor/zoom-dropdown.js.map +1 -0
- package/build-module/components/image-size-control/use-dimension-handler.js +13 -2
- package/build-module/components/image-size-control/use-dimension-handler.js.map +1 -1
- package/build-module/components/index.js +4 -3
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/button-block-appender.js +10 -1
- package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +9 -6
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +5 -4
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +24 -13
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/explorer.js +50 -0
- package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +92 -0
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js +69 -0
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab.js +75 -36
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js +2 -10
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build-module/components/inserter/hooks/use-clipboard-block.native.js +5 -4
- package/build-module/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
- package/build-module/components/inserter/index.js +12 -4
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +1 -7
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/library.js +2 -0
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js +2 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js +10 -15
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/pattern-panel.js +21 -13
- package/build-module/components/inserter/pattern-panel.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +1 -1
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +4 -5
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inserter/search-results.native.js +5 -10
- package/build-module/components/inserter/search-results.native.js.map +1 -1
- package/build-module/components/inserter/utils.native.js +35 -0
- package/build-module/components/inserter/utils.native.js.map +1 -0
- package/build-module/components/inspector-controls/block-support-slot-container.js +18 -0
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -0
- package/build-module/components/inspector-controls/block-support-tools-panel.js +67 -0
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -0
- package/build-module/components/inspector-controls/fill.js +16 -2
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +5 -1
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +13 -0
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +9 -6
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +93 -35
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +46 -17
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-input.js +24 -7
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +1 -18
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block.js +56 -71
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +102 -78
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +48 -23
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/leaf.js +2 -2
- package/build-module/components/list-view/leaf.js.map +1 -1
- package/build-module/components/list-view/list-item.js +3 -2
- package/build-module/components/list-view/list-item.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +13 -54
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +29 -20
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +5 -3
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +1 -4
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/observe-typing/index.js +1 -1
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +29 -2
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/embed-handler-picker.native.js +54 -0
- package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -0
- package/build-module/components/rich-text/format-edit.js +28 -3
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +29 -11
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +4 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +41 -3
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +28 -9
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/rich-text/utils.js +20 -0
- package/build-module/components/rich-text/utils.js.map +1 -1
- package/build-module/components/typewriter/index.js +1 -1
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/url-input/index.js +25 -11
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +13 -10
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +3 -2
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +48 -9
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js +6 -0
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +10 -1
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js +13 -10
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/anchor.js +1 -1
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border.js +5 -5
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +6 -3
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color.js +1 -1
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/dimensions.js +24 -27
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +59 -16
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-appearance.js +45 -6
- package/build-module/hooks/font-appearance.js.map +1 -1
- package/build-module/hooks/font-family.js +117 -33
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +47 -9
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/gap.js +2 -1
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/index.js +2 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +1 -0
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/letter-spacing.js +40 -7
- package/build-module/hooks/letter-spacing.js.map +1 -1
- package/build-module/hooks/line-height.js +41 -8
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/lock.js +33 -0
- package/build-module/hooks/lock.js.map +1 -0
- package/build-module/hooks/margin.js +1 -1
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +1 -1
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/style.js +7 -4
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/text-decoration.js +38 -6
- package/build-module/hooks/text-decoration.js.map +1 -1
- package/build-module/hooks/text-transform.js +38 -6
- package/build-module/hooks/text-transform.js.map +1 -1
- package/build-module/hooks/typography.js +117 -17
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/use-cached-truthy.js +21 -0
- package/build-module/hooks/use-cached-truthy.js.map +1 -0
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/flex.js +163 -38
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/flow.js +74 -8
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/store/actions.js +286 -241
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.native.js +12 -1
- package/build-module/store/defaults.native.js.map +1 -1
- package/build-module/store/index.js +1 -2
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +33 -22
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +160 -34
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/index.js +1 -0
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +48 -1
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/utils/transform-styles/transforms/wrap.js +16 -0
- package/build-module/utils/transform-styles/transforms/wrap.js.map +1 -1
- package/build-style/style-rtl.css +267 -144
- package/build-style/style.css +267 -144
- package/package.json +28 -27
- package/src/components/autocomplete/index.js +5 -2
- package/src/components/block-actions/index.js +9 -5
- package/src/components/block-alignment-control/style.scss +5 -0
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +15 -1
- package/src/components/block-alignment-control/test/index.native.js +37 -0
- package/src/components/block-alignment-control/ui.js +98 -27
- package/src/components/block-alignment-control/use-available-alignments.js +31 -10
- package/src/components/block-controls/fill.js +5 -2
- package/src/components/block-controls/hook.js +3 -3
- package/src/components/block-draggable/style.scss +19 -4
- package/src/components/block-icon/index.js +4 -1
- package/src/components/block-icon/index.native.js +10 -16
- package/src/components/block-inspector/index.js +10 -0
- package/src/components/block-list/block-html.js +5 -0
- package/src/components/block-list/block.js +11 -3
- package/src/components/block-list/block.native.js +5 -3
- package/src/components/block-list/index.native.js +1 -1
- package/src/components/block-list/style.scss +15 -0
- package/src/components/block-list/use-block-props/use-multi-selection.js +27 -7
- package/src/components/block-list-appender/index.js +8 -0
- package/src/components/block-mover/index.js +4 -4
- package/src/components/block-mover/index.native.js +4 -4
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +10 -6
- package/src/components/block-mover/test/index.native.js +26 -28
- package/src/components/block-navigation/dropdown.js +0 -1
- package/src/components/block-patterns-list/index.js +1 -8
- package/src/components/block-patterns-list/style.scss +22 -12
- package/src/components/block-preview/README.md +1 -1
- package/src/components/block-preview/auto.js +1 -1
- package/src/components/block-preview/style.scss +0 -17
- package/src/components/block-settings/container.native.js +7 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +26 -13
- package/src/components/block-settings-menu-controls/index.js +9 -6
- package/src/components/block-styles/preview.native.js +2 -2
- package/src/components/block-switcher/block-styles-menu.js +1 -1
- package/src/components/block-switcher/index.js +7 -3
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +1 -1
- package/src/components/block-switcher/test/index.js +3 -0
- package/src/components/block-title/index.js +5 -2
- package/src/components/block-tools/block-popover.js +3 -5
- package/src/components/block-tools/index.js +5 -2
- package/src/components/block-tools/insertion-point.js +97 -9
- package/src/components/block-tools/style.scss +4 -35
- package/src/components/block-types-list/style.scss +0 -3
- package/src/components/border-radius-control/index.js +1 -0
- package/src/components/border-radius-control/test/utils.js +216 -0
- package/src/components/border-radius-control/utils.js +18 -10
- package/src/components/color-palette/test/__snapshots__/control.js.snap +128 -71
- package/src/components/colors/test/utils.js +41 -0
- package/src/components/colors/utils.js +9 -5
- package/src/components/colors-gradients/control.js +70 -110
- package/src/components/colors-gradients/panel-color-gradient-settings.js +79 -7
- package/src/components/colors-gradients/style.scss +10 -18
- package/src/components/colors-gradients/test/control.js +41 -66
- package/src/components/contrast-checker/index.js +14 -10
- package/src/components/copy-handler/index.js +6 -1
- package/src/components/default-block-appender/index.js +2 -2
- package/src/components/default-block-appender/test/__snapshots__/index.js.snap +3 -3
- package/src/components/duotone-control/index.js +49 -41
- package/src/components/duotone-control/style.scss +27 -12
- package/src/components/editor-styles/index.js +7 -4
- package/src/components/font-appearance-control/index.js +41 -33
- package/src/components/font-appearance-control/style.scss +1 -1
- package/src/components/iframe/index.js +4 -4
- package/src/components/image-editor/aspect-ratio-dropdown.js +129 -0
- package/src/components/image-editor/constants.js +6 -0
- package/src/components/image-editor/context.js +56 -0
- package/src/components/image-editor/cropper.js +74 -0
- package/src/components/image-editor/form-controls.js +22 -0
- package/src/components/image-editor/index.js +52 -0
- package/src/components/image-editor/rotation-button.js +24 -0
- package/src/components/image-editor/use-save-image.js +97 -0
- package/src/components/image-editor/use-transform-image.js +162 -0
- package/src/components/image-editor/zoom-dropdown.js +40 -0
- package/src/components/image-size-control/use-dimension-handler.js +18 -1
- package/src/components/index.js +7 -6
- package/src/components/index.native.js +1 -4
- package/src/components/inner-blocks/button-block-appender.js +9 -0
- package/src/components/inner-blocks/index.js +8 -4
- package/src/components/inner-blocks/index.native.js +7 -4
- package/src/components/inner-blocks/use-nested-settings-update.js +26 -11
- package/src/components/inserter/block-patterns-explorer/explorer.js +50 -0
- package/src/components/inserter/block-patterns-explorer/patterns-list.js +122 -0
- package/src/components/inserter/block-patterns-explorer/sidebar.js +73 -0
- package/src/components/inserter/block-patterns-tab.js +107 -73
- package/src/components/inserter/block-types-tab.native.js +3 -15
- package/src/components/inserter/hooks/use-block-type-impressions.native.js +14 -21
- package/src/components/inserter/hooks/use-clipboard-block.native.js +3 -2
- package/src/components/inserter/index.js +15 -3
- package/src/components/inserter/index.native.js +2 -19
- package/src/components/inserter/library.js +2 -0
- package/src/components/inserter/menu.js +4 -1
- package/src/components/inserter/menu.native.js +9 -14
- package/src/components/inserter/pattern-panel.js +33 -16
- package/src/components/inserter/preview-panel.js +1 -1
- package/src/components/inserter/quick-inserter.js +1 -1
- package/src/components/inserter/reusable-blocks-tab.native.js +4 -6
- package/src/components/inserter/search-results.native.js +5 -15
- package/src/components/inserter/style.scss +80 -16
- package/src/components/inserter/test/block-types-tab.native.js +1 -1
- package/src/components/inserter/test/fixtures/index.native.js +12 -0
- package/src/components/inserter/utils.native.js +35 -0
- package/src/components/inserter-list-item/style.scss +4 -2
- package/src/components/inspector-controls/block-support-slot-container.js +10 -0
- package/src/components/inspector-controls/block-support-tools-panel.js +60 -0
- package/src/components/inspector-controls/fill.js +23 -2
- package/src/components/inspector-controls/groups.js +8 -0
- package/src/components/inspector-controls/slot.js +15 -0
- package/src/components/letter-spacing-control/index.js +12 -6
- package/src/components/link-control/README.md +47 -14
- package/src/components/link-control/index.js +102 -31
- package/src/components/link-control/link-preview.js +53 -20
- package/src/components/link-control/search-input.js +21 -7
- package/src/components/link-control/style.scss +66 -19
- package/src/components/link-control/test/index.js +311 -4
- package/src/components/list-view/block-contents.js +17 -38
- package/src/components/list-view/block.js +73 -84
- package/src/components/list-view/branch.js +123 -94
- package/src/components/list-view/index.js +82 -30
- package/src/components/list-view/leaf.js +2 -2
- package/src/components/list-view/list-item.js +5 -4
- package/src/components/list-view/style.scss +70 -33
- package/src/components/list-view/use-list-view-client-ids.js +9 -68
- package/src/components/media-placeholder/index.js +26 -19
- package/src/components/media-replace-flow/README.md +7 -0
- package/src/components/media-replace-flow/index.js +4 -1
- package/src/components/media-upload/README.md +1 -1
- package/src/components/navigable-toolbar/index.js +1 -4
- package/src/components/observe-typing/index.js +3 -2
- package/src/components/plain-text/index.native.js +26 -4
- package/src/components/rich-text/embed-handler-picker.native.js +68 -0
- package/src/components/rich-text/format-edit.js +36 -2
- package/src/components/rich-text/format-toolbar/index.js +25 -6
- package/src/components/rich-text/index.js +12 -8
- package/src/components/rich-text/index.native.js +35 -1
- package/src/components/rich-text/use-paste-handler.js +30 -12
- package/src/components/rich-text/utils.js +16 -0
- package/src/components/skip-to-selected-block/README.md +39 -0
- package/src/components/typewriter/index.js +3 -2
- package/src/components/url-input/index.js +26 -10
- package/src/components/use-moving-animation/index.js +9 -8
- package/src/components/use-on-block-drop/index.js +5 -1
- package/src/components/use-setting/index.js +49 -11
- package/src/components/writing-flow/use-multi-selection.js +6 -0
- package/src/components/writing-flow/use-tab-nav.js +17 -3
- package/src/hooks/align.js +19 -10
- package/src/hooks/anchor.js +2 -2
- package/src/hooks/border.js +8 -11
- package/src/hooks/color-panel.js +4 -1
- package/src/hooks/color.js +7 -4
- package/src/hooks/dimensions.js +48 -59
- package/src/hooks/duotone.js +68 -19
- package/src/hooks/font-appearance.js +38 -7
- package/src/hooks/font-family.js +129 -33
- package/src/hooks/font-size.js +42 -6
- package/src/hooks/gap.js +2 -1
- package/src/hooks/index.js +2 -0
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/layout.scss +8 -0
- package/src/hooks/letter-spacing.js +35 -7
- package/src/hooks/line-height.js +37 -9
- package/src/hooks/lock.js +34 -0
- package/src/hooks/margin.js +1 -1
- package/src/hooks/padding.js +1 -1
- package/src/hooks/style.js +15 -11
- package/src/hooks/text-decoration.js +34 -6
- package/src/hooks/text-transform.js +34 -6
- package/src/hooks/typography.js +165 -15
- package/src/hooks/typography.scss +16 -0
- package/src/hooks/use-cached-truthy.js +20 -0
- package/src/index.js +1 -0
- package/src/layouts/flex.js +179 -50
- package/src/layouts/flow.js +54 -8
- package/src/store/actions.js +239 -377
- package/src/store/defaults.native.js +12 -0
- package/src/store/index.js +1 -2
- package/src/store/reducer.js +54 -18
- package/src/store/selectors.js +173 -47
- package/src/store/test/actions.js +407 -705
- package/src/store/test/reducer.js +22 -54
- package/src/store/test/selectors.js +79 -21
- package/src/style.scss +2 -1
- package/src/utils/index.js +1 -0
- package/src/utils/parse-css-unit-to-px.js +43 -1
- package/src/utils/test/parse-css-unit-to-px.js +148 -165
- package/src/utils/transform-styles/transforms/test/wrap.js +1 -1
- package/src/utils/transform-styles/transforms/wrap.js +16 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/duotone-control/duotone-picker-popover.js +0 -44
- package/build/components/duotone-control/duotone-picker-popover.js.map +0 -1
- package/build/components/list-view/block-slot.js +0 -121
- package/build/components/list-view/block-slot.js.map +0 -1
- package/build/components/list-view/editor.js +0 -35
- package/build/components/list-view/editor.js.map +0 -1
- package/build/components/text-decoration-and-transform/index.js +0 -39
- package/build/components/text-decoration-and-transform/index.js.map +0 -1
- package/build/store/controls.js +0 -44
- package/build/store/controls.js.map +0 -1
- package/build-module/components/duotone-control/duotone-picker-popover.js +0 -35
- package/build-module/components/duotone-control/duotone-picker-popover.js.map +0 -1
- package/build-module/components/list-view/block-slot.js +0 -96
- package/build-module/components/list-view/block-slot.js.map +0 -1
- package/build-module/components/list-view/editor.js +0 -25
- package/build-module/components/list-view/editor.js.map +0 -1
- package/build-module/components/text-decoration-and-transform/index.js +0 -30
- package/build-module/components/text-decoration-and-transform/index.js.map +0 -1
- package/build-module/store/controls.js +0 -32
- package/build-module/store/controls.js.map +0 -1
- package/src/components/duotone-control/duotone-picker-popover.js +0 -36
- package/src/components/list-view/block-slot.js +0 -120
- package/src/components/list-view/editor.js +0 -29
- package/src/components/text-decoration-and-transform/index.js +0 -36
- package/src/components/text-decoration-and-transform/style.scss +0 -3
- package/src/store/controls.js +0 -39
package/src/components/index.js
CHANGED
|
@@ -45,13 +45,16 @@ export { default as __experimentalDuotoneControl } from './duotone-control';
|
|
|
45
45
|
export { default as __experimentalFontAppearanceControl } from './font-appearance-control';
|
|
46
46
|
export { default as __experimentalFontFamilyControl } from './font-family';
|
|
47
47
|
export { default as __experimentalLetterSpacingControl } from './letter-spacing-control';
|
|
48
|
+
export { default as __experimentalTextDecorationControl } from './text-decoration-control';
|
|
49
|
+
export { default as __experimentalTextTransformControl } from './text-transform-control';
|
|
48
50
|
export { default as __experimentalColorGradientControl } from './colors-gradients/control';
|
|
49
51
|
export { default as __experimentalPanelColorGradientSettings } from './colors-gradients/panel-color-gradient-settings';
|
|
50
|
-
export { default as __experimentalImageSizeControl } from './image-size-control';
|
|
51
52
|
export {
|
|
52
|
-
default as
|
|
53
|
-
|
|
54
|
-
} from './
|
|
53
|
+
default as __experimentalImageEditor,
|
|
54
|
+
ImageEditingProvider as __experimentalImageEditingProvider,
|
|
55
|
+
} from './image-editor';
|
|
56
|
+
export { default as __experimentalImageSizeControl } from './image-size-control';
|
|
57
|
+
export { default as InnerBlocks, useInnerBlocksProps } from './inner-blocks';
|
|
55
58
|
export {
|
|
56
59
|
default as InspectorControls,
|
|
57
60
|
InspectorAdvancedControls,
|
|
@@ -66,8 +69,6 @@ export { default as __experimentalLinkControlSearchResults } from './link-contro
|
|
|
66
69
|
export { default as __experimentalLinkControlSearchItem } from './link-control/search-item';
|
|
67
70
|
export { default as LineHeightControl } from './line-height-control';
|
|
68
71
|
export { default as __experimentalListView } from './list-view';
|
|
69
|
-
export { ListViewBlockFill as __experimentalListViewBlockFill } from './list-view/block-slot';
|
|
70
|
-
export { default as __experimentalListViewEditor } from './list-view/editor';
|
|
71
72
|
export { default as MediaReplaceFlow } from './media-replace-flow';
|
|
72
73
|
export { default as MediaPlaceholder } from './media-placeholder';
|
|
73
74
|
export { default as MediaUpload } from './media-upload';
|
|
@@ -18,10 +18,7 @@ export * from './colors';
|
|
|
18
18
|
export * from './gradients';
|
|
19
19
|
export * from './font-sizes';
|
|
20
20
|
export { AlignmentControl, AlignmentToolbar } from './alignment-control';
|
|
21
|
-
export {
|
|
22
|
-
default as InnerBlocks,
|
|
23
|
-
useInnerBlocksProps as __experimentalUseInnerBlocksProps,
|
|
24
|
-
} from './inner-blocks';
|
|
21
|
+
export { default as InnerBlocks, useInnerBlocksProps } from './inner-blocks';
|
|
25
22
|
export {
|
|
26
23
|
default as InspectorControls,
|
|
27
24
|
InspectorAdvancedControls,
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* Internal dependencies
|
|
3
8
|
*/
|
|
@@ -9,9 +14,13 @@ export const ButtonBlockAppender = ( {
|
|
|
9
14
|
showSeparator,
|
|
10
15
|
isFloating,
|
|
11
16
|
onAddBlock,
|
|
17
|
+
isToggle,
|
|
12
18
|
} ) => {
|
|
13
19
|
return (
|
|
14
20
|
<BaseButtonBlockAppender
|
|
21
|
+
className={ classnames( {
|
|
22
|
+
'block-list-appender__toggle': isToggle,
|
|
23
|
+
} ) }
|
|
15
24
|
rootClientId={ clientId }
|
|
16
25
|
showSeparator={ showSeparator }
|
|
17
26
|
isFloating={ isFloating }
|
|
@@ -12,7 +12,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
12
12
|
import {
|
|
13
13
|
getBlockType,
|
|
14
14
|
store as blocksStore,
|
|
15
|
-
|
|
15
|
+
__unstableGetInnerBlocksProps as getInnerBlocksProps,
|
|
16
16
|
} from '@wordpress/blocks';
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -42,6 +42,8 @@ function UncontrolledInnerBlocks( props ) {
|
|
|
42
42
|
const {
|
|
43
43
|
clientId,
|
|
44
44
|
allowedBlocks,
|
|
45
|
+
__experimentalDefaultBlock,
|
|
46
|
+
__experimentalDirectInsert,
|
|
45
47
|
template,
|
|
46
48
|
templateLock,
|
|
47
49
|
wrapperRef,
|
|
@@ -57,6 +59,8 @@ function UncontrolledInnerBlocks( props ) {
|
|
|
57
59
|
useNestedSettingsUpdate(
|
|
58
60
|
clientId,
|
|
59
61
|
allowedBlocks,
|
|
62
|
+
__experimentalDefaultBlock,
|
|
63
|
+
__experimentalDirectInsert,
|
|
60
64
|
templateLock,
|
|
61
65
|
captureToolbars,
|
|
62
66
|
orientation,
|
|
@@ -206,13 +210,13 @@ export function useInnerBlocksProps( props = {}, options = {} ) {
|
|
|
206
210
|
};
|
|
207
211
|
}
|
|
208
212
|
|
|
213
|
+
useInnerBlocksProps.save = getInnerBlocksProps;
|
|
214
|
+
|
|
209
215
|
// Expose default appender placeholders as components.
|
|
210
216
|
ForwardedInnerBlocks.DefaultBlockAppender = DefaultBlockAppender;
|
|
211
217
|
ForwardedInnerBlocks.ButtonBlockAppender = ButtonBlockAppender;
|
|
212
218
|
|
|
213
|
-
ForwardedInnerBlocks.Content =
|
|
214
|
-
( { BlockContent } ) => <BlockContent />
|
|
215
|
-
);
|
|
219
|
+
ForwardedInnerBlocks.Content = () => useInnerBlocksProps.save().children;
|
|
216
220
|
|
|
217
221
|
/**
|
|
218
222
|
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useSelect } from '@wordpress/data';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
getBlockType,
|
|
7
|
+
__unstableGetInnerBlocksProps as getInnerBlocksProps,
|
|
8
|
+
} from '@wordpress/blocks';
|
|
6
9
|
import { useRef } from '@wordpress/element';
|
|
7
10
|
|
|
8
11
|
/**
|
|
@@ -189,9 +192,9 @@ const InnerBlocks = ( props ) => {
|
|
|
189
192
|
InnerBlocks.DefaultBlockAppender = DefaultBlockAppender;
|
|
190
193
|
InnerBlocks.ButtonBlockAppender = ButtonBlockAppender;
|
|
191
194
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
) );
|
|
195
|
+
useInnerBlocksProps.save = getInnerBlocksProps;
|
|
196
|
+
|
|
197
|
+
InnerBlocks.Content = () => useInnerBlocksProps.save().children;
|
|
195
198
|
|
|
196
199
|
/**
|
|
197
200
|
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md
|
|
@@ -18,21 +18,26 @@ import { getLayoutType } from '../../layouts';
|
|
|
18
18
|
* the block-editor store, then the store is updated with the new settings which
|
|
19
19
|
* came from props.
|
|
20
20
|
*
|
|
21
|
-
* @param {string}
|
|
22
|
-
* @param {string[]}
|
|
23
|
-
*
|
|
24
|
-
* @param {
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* @param {
|
|
30
|
-
*
|
|
31
|
-
*
|
|
21
|
+
* @param {string} clientId The client ID of the block to update.
|
|
22
|
+
* @param {string[]} allowedBlocks An array of block names which are permitted
|
|
23
|
+
* in inner blocks.
|
|
24
|
+
* @param {?Array} __experimentalDefaultBlock The default block to insert: [ blockName, { blockAttributes } ].
|
|
25
|
+
* @param {?Function|boolean} __experimentalDirectInsert If a default block should be inserted directly by the
|
|
26
|
+
* appender.
|
|
27
|
+
* @param {string} [templateLock] The template lock specified for the inner
|
|
28
|
+
* blocks component. (e.g. "all")
|
|
29
|
+
* @param {boolean} captureToolbars Whether or children toolbars should be shown
|
|
30
|
+
* in the inner blocks component rather than on
|
|
31
|
+
* the child block.
|
|
32
|
+
* @param {string} orientation The direction in which the block
|
|
33
|
+
* should face.
|
|
34
|
+
* @param {Object} layout The layout object for the block container.
|
|
32
35
|
*/
|
|
33
36
|
export default function useNestedSettingsUpdate(
|
|
34
37
|
clientId,
|
|
35
38
|
allowedBlocks,
|
|
39
|
+
__experimentalDefaultBlock,
|
|
40
|
+
__experimentalDirectInsert,
|
|
36
41
|
templateLock,
|
|
37
42
|
captureToolbars,
|
|
38
43
|
orientation,
|
|
@@ -83,6 +88,14 @@ export default function useNestedSettingsUpdate(
|
|
|
83
88
|
newSettings.orientation = layoutType.getOrientation( layout );
|
|
84
89
|
}
|
|
85
90
|
|
|
91
|
+
if ( __experimentalDefaultBlock !== undefined ) {
|
|
92
|
+
newSettings.__experimentalDefaultBlock = __experimentalDefaultBlock;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if ( __experimentalDirectInsert !== undefined ) {
|
|
96
|
+
newSettings.__experimentalDirectInsert = __experimentalDirectInsert;
|
|
97
|
+
}
|
|
98
|
+
|
|
86
99
|
if ( ! isShallowEqual( blockListSettings, newSettings ) ) {
|
|
87
100
|
updateBlockListSettings( clientId, newSettings );
|
|
88
101
|
}
|
|
@@ -90,6 +103,8 @@ export default function useNestedSettingsUpdate(
|
|
|
90
103
|
clientId,
|
|
91
104
|
blockListSettings,
|
|
92
105
|
_allowedBlocks,
|
|
106
|
+
__experimentalDefaultBlock,
|
|
107
|
+
__experimentalDirectInsert,
|
|
93
108
|
templateLock,
|
|
94
109
|
parentLock,
|
|
95
110
|
captureToolbars,
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Modal } from '@wordpress/components';
|
|
5
|
+
import { useState } from '@wordpress/element';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import PatternExplorerSidebar from './sidebar';
|
|
12
|
+
import PatternList from './patterns-list';
|
|
13
|
+
|
|
14
|
+
function PatternsExplorer( { initialCategory, patternCategories } ) {
|
|
15
|
+
const [ filterValue, setFilterValue ] = useState( '' );
|
|
16
|
+
const [ selectedCategory, setSelectedCategory ] = useState(
|
|
17
|
+
initialCategory?.name
|
|
18
|
+
);
|
|
19
|
+
return (
|
|
20
|
+
<div className="block-editor-block-patterns-explorer">
|
|
21
|
+
<PatternExplorerSidebar
|
|
22
|
+
selectedCategory={ selectedCategory }
|
|
23
|
+
patternCategories={ patternCategories }
|
|
24
|
+
onClickCategory={ setSelectedCategory }
|
|
25
|
+
filterValue={ filterValue }
|
|
26
|
+
setFilterValue={ setFilterValue }
|
|
27
|
+
/>
|
|
28
|
+
<PatternList
|
|
29
|
+
filterValue={ filterValue }
|
|
30
|
+
selectedCategory={ selectedCategory }
|
|
31
|
+
patternCategories={ patternCategories }
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function PatternsExplorerModal( { onModalClose, ...restProps } ) {
|
|
38
|
+
return (
|
|
39
|
+
<Modal
|
|
40
|
+
title={ __( 'Patterns' ) }
|
|
41
|
+
closeLabel={ __( 'Close' ) }
|
|
42
|
+
onRequestClose={ onModalClose }
|
|
43
|
+
isFullScreen
|
|
44
|
+
>
|
|
45
|
+
<PatternsExplorer { ...restProps } />
|
|
46
|
+
</Modal>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default PatternsExplorerModal;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useMemo, useEffect } from '@wordpress/element';
|
|
5
|
+
import { _n, sprintf } from '@wordpress/i18n';
|
|
6
|
+
import { useDebounce, useAsyncList } from '@wordpress/compose';
|
|
7
|
+
import { __experimentalHeading as Heading } from '@wordpress/components';
|
|
8
|
+
import { speak } from '@wordpress/a11y';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import BlockPatternsList from '../../block-patterns-list';
|
|
14
|
+
import InserterNoResults from '../no-results';
|
|
15
|
+
import useInsertionPoint from '../hooks/use-insertion-point';
|
|
16
|
+
import usePatternsState from '../hooks/use-patterns-state';
|
|
17
|
+
import InserterListbox from '../../inserter-listbox';
|
|
18
|
+
import { searchItems } from '../search-items';
|
|
19
|
+
|
|
20
|
+
const INITIAL_INSERTER_RESULTS = 2;
|
|
21
|
+
|
|
22
|
+
function PatternsListHeader( { filterValue, filteredBlockPatternsLength } ) {
|
|
23
|
+
if ( ! filterValue ) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return (
|
|
27
|
+
<Heading
|
|
28
|
+
level={ 2 }
|
|
29
|
+
lineHeight={ '48px' }
|
|
30
|
+
className="block-editor-block-patterns-explorer__search-results-count"
|
|
31
|
+
>
|
|
32
|
+
{ sprintf(
|
|
33
|
+
/* translators: %d: number of patterns. %s: block pattern search query */
|
|
34
|
+
_n(
|
|
35
|
+
'%1$d pattern found for "%2$s"',
|
|
36
|
+
'%1$d patterns found for "%2$s"',
|
|
37
|
+
filteredBlockPatternsLength
|
|
38
|
+
),
|
|
39
|
+
filteredBlockPatternsLength,
|
|
40
|
+
filterValue
|
|
41
|
+
) }
|
|
42
|
+
</Heading>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function PatternList( { filterValue, selectedCategory, patternCategories } ) {
|
|
47
|
+
const debouncedSpeak = useDebounce( speak, 500 );
|
|
48
|
+
const [ destinationRootClientId, onInsertBlocks ] = useInsertionPoint( {
|
|
49
|
+
shouldFocusBlock: true,
|
|
50
|
+
} );
|
|
51
|
+
const [ allPatterns, , onSelectBlockPattern ] = usePatternsState(
|
|
52
|
+
onInsertBlocks,
|
|
53
|
+
destinationRootClientId
|
|
54
|
+
);
|
|
55
|
+
const registeredPatternCategories = useMemo(
|
|
56
|
+
() =>
|
|
57
|
+
patternCategories.map(
|
|
58
|
+
( patternCategory ) => patternCategory.name
|
|
59
|
+
),
|
|
60
|
+
[ patternCategories ]
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const filteredBlockPatterns = useMemo( () => {
|
|
64
|
+
if ( ! filterValue ) {
|
|
65
|
+
return allPatterns.filter( ( pattern ) =>
|
|
66
|
+
selectedCategory === 'uncategorized'
|
|
67
|
+
? ! pattern.categories?.length ||
|
|
68
|
+
pattern.categories.every(
|
|
69
|
+
( category ) =>
|
|
70
|
+
! registeredPatternCategories.includes(
|
|
71
|
+
category
|
|
72
|
+
)
|
|
73
|
+
)
|
|
74
|
+
: pattern.categories?.includes( selectedCategory )
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
return searchItems( allPatterns, filterValue );
|
|
78
|
+
}, [ filterValue, selectedCategory, allPatterns ] );
|
|
79
|
+
|
|
80
|
+
// Announce search results on change.
|
|
81
|
+
useEffect( () => {
|
|
82
|
+
if ( ! filterValue ) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const count = filteredBlockPatterns.length;
|
|
86
|
+
const resultsFoundMessage = sprintf(
|
|
87
|
+
/* translators: %d: number of results. */
|
|
88
|
+
_n( '%d result found.', '%d results found.', count ),
|
|
89
|
+
count
|
|
90
|
+
);
|
|
91
|
+
debouncedSpeak( resultsFoundMessage );
|
|
92
|
+
}, [ filterValue, debouncedSpeak ] );
|
|
93
|
+
|
|
94
|
+
const currentShownPatterns = useAsyncList( filteredBlockPatterns, {
|
|
95
|
+
step: INITIAL_INSERTER_RESULTS,
|
|
96
|
+
} );
|
|
97
|
+
|
|
98
|
+
const hasItems = !! filteredBlockPatterns?.length;
|
|
99
|
+
return (
|
|
100
|
+
<div className="block-editor-block-patterns-explorer__list">
|
|
101
|
+
{ hasItems && (
|
|
102
|
+
<PatternsListHeader
|
|
103
|
+
filterValue={ filterValue }
|
|
104
|
+
filteredBlockPatternsLength={ filteredBlockPatterns.length }
|
|
105
|
+
/>
|
|
106
|
+
) }
|
|
107
|
+
<InserterListbox>
|
|
108
|
+
{ ! hasItems && <InserterNoResults /> }
|
|
109
|
+
{ hasItems && (
|
|
110
|
+
<BlockPatternsList
|
|
111
|
+
shownPatterns={ currentShownPatterns }
|
|
112
|
+
blockPatterns={ filteredBlockPatterns }
|
|
113
|
+
onClickPattern={ onSelectBlockPattern }
|
|
114
|
+
isDraggable={ false }
|
|
115
|
+
/>
|
|
116
|
+
) }
|
|
117
|
+
</InserterListbox>
|
|
118
|
+
</div>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export default PatternList;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Button, SearchControl } from '@wordpress/components';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
|
|
7
|
+
function PatternCategoriesList( {
|
|
8
|
+
selectedCategory,
|
|
9
|
+
patternCategories,
|
|
10
|
+
onClickCategory,
|
|
11
|
+
} ) {
|
|
12
|
+
const baseClassName = 'block-editor-block-patterns-explorer__sidebar';
|
|
13
|
+
return (
|
|
14
|
+
<div className={ `${ baseClassName }__categories-list` }>
|
|
15
|
+
{ patternCategories.map( ( { name, label } ) => {
|
|
16
|
+
return (
|
|
17
|
+
<Button
|
|
18
|
+
key={ name }
|
|
19
|
+
label={ label }
|
|
20
|
+
className={ `${ baseClassName }__categories-list__item` }
|
|
21
|
+
isPressed={ selectedCategory === name }
|
|
22
|
+
onClick={ () => {
|
|
23
|
+
onClickCategory( name );
|
|
24
|
+
} }
|
|
25
|
+
>
|
|
26
|
+
{ label }
|
|
27
|
+
</Button>
|
|
28
|
+
);
|
|
29
|
+
} ) }
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function PatternsExplorerSearch( { filterValue, setFilterValue } ) {
|
|
35
|
+
const baseClassName = 'block-editor-block-patterns-explorer__search';
|
|
36
|
+
return (
|
|
37
|
+
<div className={ baseClassName }>
|
|
38
|
+
<SearchControl
|
|
39
|
+
onChange={ setFilterValue }
|
|
40
|
+
value={ filterValue }
|
|
41
|
+
label={ __( 'Search for patterns' ) }
|
|
42
|
+
placeholder={ __( 'Search' ) }
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function PatternExplorerSidebar( {
|
|
49
|
+
selectedCategory,
|
|
50
|
+
patternCategories,
|
|
51
|
+
onClickCategory,
|
|
52
|
+
filterValue,
|
|
53
|
+
setFilterValue,
|
|
54
|
+
} ) {
|
|
55
|
+
const baseClassName = 'block-editor-block-patterns-explorer__sidebar';
|
|
56
|
+
return (
|
|
57
|
+
<div className={ baseClassName }>
|
|
58
|
+
<PatternsExplorerSearch
|
|
59
|
+
filterValue={ filterValue }
|
|
60
|
+
setFilterValue={ setFilterValue }
|
|
61
|
+
/>
|
|
62
|
+
{ ! filterValue && (
|
|
63
|
+
<PatternCategoriesList
|
|
64
|
+
selectedCategory={ selectedCategory }
|
|
65
|
+
patternCategories={ patternCategories }
|
|
66
|
+
onClickCategory={ onClickCategory }
|
|
67
|
+
/>
|
|
68
|
+
) }
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default PatternExplorerSidebar;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { fromPairs } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
9
|
-
import { useMemo,
|
|
4
|
+
import { useMemo, useState, useCallback } from '@wordpress/element';
|
|
10
5
|
import { _x } from '@wordpress/i18n';
|
|
11
6
|
import { useAsyncList } from '@wordpress/compose';
|
|
12
7
|
|
|
@@ -16,59 +11,30 @@ import { useAsyncList } from '@wordpress/compose';
|
|
|
16
11
|
import PatternInserterPanel from './pattern-panel';
|
|
17
12
|
import usePatternsState from './hooks/use-patterns-state';
|
|
18
13
|
import BlockPatternList from '../block-patterns-list';
|
|
14
|
+
import PatternsExplorerModal from './block-patterns-explorer/explorer';
|
|
19
15
|
|
|
20
16
|
function BlockPatternsCategory( {
|
|
21
17
|
rootClientId,
|
|
22
18
|
onInsert,
|
|
23
19
|
selectedCategory,
|
|
24
|
-
|
|
20
|
+
populatedCategories,
|
|
25
21
|
} ) {
|
|
26
|
-
const [ allPatterns,
|
|
22
|
+
const [ allPatterns, , onClick ] = usePatternsState(
|
|
27
23
|
onInsert,
|
|
28
24
|
rootClientId
|
|
29
25
|
);
|
|
30
26
|
|
|
31
|
-
// Remove any empty categories
|
|
32
|
-
const populatedCategories = useMemo(
|
|
33
|
-
() =>
|
|
34
|
-
allCategories.filter( ( category ) =>
|
|
35
|
-
allPatterns.some( ( pattern ) =>
|
|
36
|
-
pattern.categories?.includes( category.name )
|
|
37
|
-
)
|
|
38
|
-
),
|
|
39
|
-
[ allPatterns, allCategories ]
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
const patternCategory = selectedCategory
|
|
43
|
-
? selectedCategory
|
|
44
|
-
: populatedCategories[ 0 ];
|
|
45
|
-
|
|
46
|
-
useEffect( () => {
|
|
47
|
-
if (
|
|
48
|
-
allPatterns.some(
|
|
49
|
-
( pattern ) => getPatternIndex( pattern ) === Infinity
|
|
50
|
-
) &&
|
|
51
|
-
! populatedCategories.find(
|
|
52
|
-
( category ) => category.name === 'uncategorized'
|
|
53
|
-
)
|
|
54
|
-
) {
|
|
55
|
-
populatedCategories.push( {
|
|
56
|
-
name: 'uncategorized',
|
|
57
|
-
label: _x( 'Uncategorized' ),
|
|
58
|
-
} );
|
|
59
|
-
}
|
|
60
|
-
}, [ populatedCategories, allPatterns ] );
|
|
61
|
-
|
|
62
27
|
const getPatternIndex = useCallback(
|
|
63
28
|
( pattern ) => {
|
|
64
|
-
if ( ! pattern.categories
|
|
29
|
+
if ( ! pattern.categories?.length ) {
|
|
65
30
|
return Infinity;
|
|
66
31
|
}
|
|
67
|
-
const indexedCategories =
|
|
68
|
-
|
|
69
|
-
name
|
|
70
|
-
|
|
71
|
-
|
|
32
|
+
const indexedCategories = populatedCategories.reduce(
|
|
33
|
+
( accumulator, { name }, index ) => {
|
|
34
|
+
accumulator[ name ] = index;
|
|
35
|
+
return accumulator;
|
|
36
|
+
},
|
|
37
|
+
{}
|
|
72
38
|
);
|
|
73
39
|
return Math.min(
|
|
74
40
|
...pattern.categories.map( ( cat ) =>
|
|
@@ -84,12 +50,11 @@ function BlockPatternsCategory( {
|
|
|
84
50
|
const currentCategoryPatterns = useMemo(
|
|
85
51
|
() =>
|
|
86
52
|
allPatterns.filter( ( pattern ) =>
|
|
87
|
-
|
|
53
|
+
selectedCategory.name === 'uncategorized'
|
|
88
54
|
? getPatternIndex( pattern ) === Infinity
|
|
89
|
-
: pattern.categories
|
|
90
|
-
pattern.categories.includes( patternCategory.name )
|
|
55
|
+
: pattern.categories?.includes( selectedCategory.name )
|
|
91
56
|
),
|
|
92
|
-
[ allPatterns,
|
|
57
|
+
[ allPatterns, selectedCategory ]
|
|
93
58
|
);
|
|
94
59
|
|
|
95
60
|
// Ordering the patterns is important for the async rendering.
|
|
@@ -101,25 +66,21 @@ function BlockPatternsCategory( {
|
|
|
101
66
|
|
|
102
67
|
const currentShownPatterns = useAsyncList( orderedPatterns );
|
|
103
68
|
|
|
69
|
+
if ( ! currentCategoryPatterns.length ) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
|
|
104
73
|
return (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
onClickPattern={ onClick }
|
|
116
|
-
label={ patternCategory.label }
|
|
117
|
-
orientation="vertical"
|
|
118
|
-
isDraggable
|
|
119
|
-
/>
|
|
120
|
-
</PatternInserterPanel>
|
|
121
|
-
) }
|
|
122
|
-
</>
|
|
74
|
+
<div className="block-editor-inserter__panel-content">
|
|
75
|
+
<BlockPatternList
|
|
76
|
+
shownPatterns={ currentShownPatterns }
|
|
77
|
+
blockPatterns={ currentCategoryPatterns }
|
|
78
|
+
onClickPattern={ onClick }
|
|
79
|
+
label={ selectedCategory.label }
|
|
80
|
+
orientation="vertical"
|
|
81
|
+
isDraggable
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
123
84
|
);
|
|
124
85
|
}
|
|
125
86
|
|
|
@@ -129,13 +90,86 @@ function BlockPatternsTabs( {
|
|
|
129
90
|
onClickCategory,
|
|
130
91
|
selectedCategory,
|
|
131
92
|
} ) {
|
|
93
|
+
const [ showPatternsExplorer, setShowPatternsExplorer ] = useState( false );
|
|
94
|
+
const [ allPatterns, allCategories ] = usePatternsState();
|
|
95
|
+
|
|
96
|
+
const hasRegisteredCategory = useCallback(
|
|
97
|
+
( pattern ) => {
|
|
98
|
+
if ( ! pattern.categories || ! pattern.categories.length ) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return pattern.categories.some( ( cat ) =>
|
|
103
|
+
allCategories.some( ( category ) => category.name === cat )
|
|
104
|
+
);
|
|
105
|
+
},
|
|
106
|
+
[ allCategories ]
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
// Remove any empty categories
|
|
110
|
+
const populatedCategories = useMemo( () => {
|
|
111
|
+
const categories = allCategories
|
|
112
|
+
.filter( ( category ) =>
|
|
113
|
+
allPatterns.some( ( pattern ) =>
|
|
114
|
+
pattern.categories?.includes( category.name )
|
|
115
|
+
)
|
|
116
|
+
)
|
|
117
|
+
.sort( ( { name: currentName }, { name: nextName } ) => {
|
|
118
|
+
if ( ! [ currentName, nextName ].includes( 'featured' ) ) {
|
|
119
|
+
return 0;
|
|
120
|
+
}
|
|
121
|
+
return currentName === 'featured' ? -1 : 1;
|
|
122
|
+
} );
|
|
123
|
+
|
|
124
|
+
if (
|
|
125
|
+
allPatterns.some(
|
|
126
|
+
( pattern ) => ! hasRegisteredCategory( pattern )
|
|
127
|
+
) &&
|
|
128
|
+
! categories.find(
|
|
129
|
+
( category ) => category.name === 'uncategorized'
|
|
130
|
+
)
|
|
131
|
+
) {
|
|
132
|
+
categories.push( {
|
|
133
|
+
name: 'uncategorized',
|
|
134
|
+
label: _x( 'Uncategorized' ),
|
|
135
|
+
} );
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return categories;
|
|
139
|
+
}, [ allPatterns, allCategories ] );
|
|
140
|
+
|
|
141
|
+
const patternCategory = selectedCategory
|
|
142
|
+
? selectedCategory
|
|
143
|
+
: populatedCategories[ 0 ];
|
|
144
|
+
|
|
132
145
|
return (
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
146
|
+
<>
|
|
147
|
+
{ ! showPatternsExplorer && (
|
|
148
|
+
<>
|
|
149
|
+
<PatternInserterPanel
|
|
150
|
+
selectedCategory={ patternCategory }
|
|
151
|
+
patternCategories={ populatedCategories }
|
|
152
|
+
onClickCategory={ onClickCategory }
|
|
153
|
+
openPatternExplorer={ () =>
|
|
154
|
+
setShowPatternsExplorer( true )
|
|
155
|
+
}
|
|
156
|
+
/>
|
|
157
|
+
<BlockPatternsCategory
|
|
158
|
+
rootClientId={ rootClientId }
|
|
159
|
+
onInsert={ onInsert }
|
|
160
|
+
selectedCategory={ patternCategory }
|
|
161
|
+
populatedCategories={ populatedCategories }
|
|
162
|
+
/>
|
|
163
|
+
</>
|
|
164
|
+
) }
|
|
165
|
+
{ showPatternsExplorer && (
|
|
166
|
+
<PatternsExplorerModal
|
|
167
|
+
initialCategory={ patternCategory }
|
|
168
|
+
patternCategories={ populatedCategories }
|
|
169
|
+
onModalClose={ () => setShowPatternsExplorer( false ) }
|
|
170
|
+
/>
|
|
171
|
+
) }
|
|
172
|
+
</>
|
|
139
173
|
);
|
|
140
174
|
}
|
|
141
175
|
|