@wordpress/block-editor 15.21.1 → 15.22.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 +6 -0
- package/README.md +2 -2
- package/build/components/block-card/index.cjs +4 -5
- package/build/components/block-card/index.cjs.map +2 -2
- package/build/components/block-editing-mode/index.cjs +13 -7
- package/build/components/block-editing-mode/index.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +35 -20
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-mover/mover-description.cjs +6 -6
- package/build/components/block-mover/mover-description.cjs.map +1 -1
- package/build/components/block-patterns-list/index.cjs.map +2 -2
- package/build/components/block-patterns-paging/index.cjs +4 -4
- package/build/components/block-patterns-paging/index.cjs.map +2 -2
- package/build/components/block-popover/use-popover-scroll.cjs.map +1 -1
- package/build/components/block-quick-navigation/index.cjs +7 -5
- package/build/components/block-quick-navigation/index.cjs.map +2 -2
- package/build/components/block-rename/modal.cjs +0 -1
- package/build/components/block-rename/modal.cjs.map +2 -2
- package/build/components/block-toolbar/block-toolbar-icon.cjs +14 -6
- package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
- package/build/components/block-toolbar/edit-section-button.cjs.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.cjs +10 -4
- package/build/components/block-tools/use-block-toolbar-popover-props.cjs.map +2 -2
- package/build/components/child-layout-control/index.cjs +51 -19
- package/build/components/child-layout-control/index.cjs.map +2 -2
- package/build/components/colors-gradients/control.cjs +25 -14
- package/build/components/colors-gradients/control.cjs.map +2 -2
- package/build/components/colors-gradients/dropdown.cjs +4 -1
- package/build/components/colors-gradients/dropdown.cjs.map +3 -3
- package/build/components/contrast-checker/index.cjs +22 -4
- package/build/components/contrast-checker/index.cjs.map +2 -2
- package/build/components/date-format-picker/index.cjs +0 -1
- package/build/components/date-format-picker/index.cjs.map +2 -2
- package/build/components/dimensions-tool/index.cjs +4 -5
- package/build/components/dimensions-tool/index.cjs.map +2 -2
- package/build/components/dimensions-tool/scale-tool.cjs +1 -1
- package/build/components/dimensions-tool/scale-tool.cjs.map +2 -2
- package/build/components/global-styles/background-panel.cjs +153 -25
- package/build/components/global-styles/background-panel.cjs.map +3 -3
- package/build/components/global-styles/color-gradient-dropdown-item.cjs +227 -0
- package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +7 -0
- package/build/components/global-styles/color-panel.cjs +98 -375
- package/build/components/global-styles/color-panel.cjs.map +3 -3
- package/build/components/global-styles/dimensions-panel.cjs +1 -4
- package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
- package/build/components/global-styles/hooks.cjs +34 -0
- package/build/components/global-styles/hooks.cjs.map +2 -2
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/global-styles/typography-panel.cjs +82 -10
- package/build/components/global-styles/typography-panel.cjs.map +3 -3
- package/build/components/grid/grid-item-resizer.cjs.map +1 -1
- package/build/components/grid/grid-visualizer.cjs.map +1 -1
- package/build/components/iframe/index.cjs +6 -3
- package/build/components/iframe/index.cjs.map +3 -3
- package/build/components/image-editor/use-transform-image.cjs.map +1 -1
- package/build/components/inserter/get-appender-label.cjs.map +1 -1
- package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
- package/build/components/inserter/search-items.cjs.map +1 -1
- package/build/components/inspector-controls/fill.cjs +1 -3
- package/build/components/inspector-controls/fill.cjs.map +2 -2
- package/build/components/inspector-controls/groups.cjs +2 -0
- package/build/components/inspector-controls/groups.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/index.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/styles-tab.cjs +76 -32
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/keyboard-shortcuts/index.cjs.map +1 -1
- package/build/components/line-height-control/index.cjs.map +1 -1
- package/build/components/link-control/index.cjs +2 -3
- package/build/components/link-control/index.cjs.map +2 -2
- package/build/components/link-control/normalize-url.cjs.map +1 -1
- package/build/components/list-view/block-select-button.cjs +1 -10
- package/build/components/list-view/block-select-button.cjs.map +3 -3
- package/build/components/list-view/utils.cjs.map +1 -1
- package/build/components/preset-input-control/custom-value-controls.cjs.map +2 -2
- package/build/components/provider/index.cjs.map +1 -1
- package/build/components/provider/use-block-sync.cjs +3 -1
- package/build/components/provider/use-block-sync.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/before-input-rules.cjs +1 -1
- package/build/components/rich-text/event-listeners/before-input-rules.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/paste-handler.cjs.map +1 -1
- package/build/components/rich-text/prevent-event-discovery.cjs +1 -1
- package/build/components/rich-text/prevent-event-discovery.cjs.map +1 -1
- package/build/components/url-popover/image-url-input-ui.cjs +0 -2
- package/build/components/url-popover/image-url-input-ui.cjs.map +2 -2
- package/build/components/use-block-display-information/index.cjs +10 -3
- package/build/components/use-block-display-information/index.cjs.map +2 -2
- package/build/components/writing-flow/use-tab-nav.cjs.map +1 -1
- package/build/hooks/anchor.cjs +1 -2
- package/build/hooks/anchor.cjs.map +2 -2
- package/build/hooks/background.cjs +124 -75
- package/build/hooks/background.cjs.map +3 -3
- package/build/hooks/block-fields/index.cjs +13 -2
- package/build/hooks/block-fields/index.cjs.map +2 -2
- package/build/hooks/color.cjs +0 -162
- package/build/hooks/color.cjs.map +3 -3
- package/build/hooks/contrast-checker.cjs +31 -28
- package/build/hooks/contrast-checker.cjs.map +3 -3
- package/build/hooks/custom-class-name.cjs +0 -1
- package/build/hooks/custom-class-name.cjs.map +2 -2
- package/build/hooks/dimensions.cjs +13 -2
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/elements.cjs +142 -0
- package/build/hooks/elements.cjs.map +7 -0
- package/build/hooks/grid-visualizer.cjs +21 -11
- package/build/hooks/grid-visualizer.cjs.map +2 -2
- package/build/hooks/layout-child.cjs +65 -10
- package/build/hooks/layout-child.cjs.map +2 -2
- package/build/hooks/layout.cjs +6 -3
- package/build/hooks/layout.cjs.map +2 -2
- package/build/hooks/list-view.cjs +10 -7
- package/build/hooks/list-view.cjs.map +2 -2
- package/build/hooks/spacing-visualizer.cjs.map +1 -1
- package/build/hooks/state-utils.cjs.map +1 -1
- package/build/hooks/states.cjs +2 -2
- package/build/hooks/states.cjs.map +2 -2
- package/build/hooks/style.cjs +50 -6
- package/build/hooks/style.cjs.map +2 -2
- package/build/hooks/typography.cjs +62 -10
- package/build/hooks/typography.cjs.map +3 -3
- package/build/layouts/flex.cjs +99 -6
- package/build/layouts/flex.cjs.map +2 -2
- package/build/private-apis.cjs +4 -0
- package/build/private-apis.cjs.map +2 -2
- package/build/store/actions.cjs.map +1 -1
- package/build/store/private-selectors.cjs +19 -2
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs.map +1 -1
- package/build/store/selectors.cjs.map +1 -1
- package/build/utils/block-bindings.cjs +9 -9
- package/build/utils/block-bindings.cjs.map +3 -3
- package/build/utils/color-values.cjs +10 -1
- package/build/utils/color-values.cjs.map +3 -3
- package/build/utils/dom.cjs +2 -5
- package/build/utils/dom.cjs.map +3 -3
- package/build/utils/fit-text-frontend.cjs +6 -2
- package/build/utils/fit-text-frontend.cjs.map +3 -3
- package/build/utils/fit-text-utils.cjs +1 -1
- package/build/utils/fit-text-utils.cjs.map +3 -3
- package/build/utils/format-font-style.cjs +1 -1
- package/build/utils/format-font-style.cjs.map +3 -3
- package/build/utils/format-font-weight.cjs +1 -1
- package/build/utils/format-font-weight.cjs.map +3 -3
- package/build/utils/get-editor-region.cjs +4 -2
- package/build/utils/get-editor-region.cjs.map +3 -3
- package/build/utils/get-font-styles-and-weights.cjs +8 -12
- package/build/utils/get-font-styles-and-weights.cjs.map +3 -3
- package/build/utils/get-px-from-css-unit.cjs +1 -1
- package/build/utils/get-px-from-css-unit.cjs.map +1 -1
- package/build/utils/index.cjs +1 -1
- package/build/utils/index.cjs.map +1 -1
- package/build/utils/math.cjs +1 -1
- package/build/utils/math.cjs.map +3 -3
- package/build/utils/object.cjs +8 -8
- package/build/utils/object.cjs.map +3 -3
- package/build/utils/order-inserter-block-items.cjs +1 -1
- package/build/utils/order-inserter-block-items.cjs.map +3 -3
- package/build/utils/pasting.cjs +4 -2
- package/build/utils/pasting.cjs.map +3 -3
- package/build/utils/selection.cjs +3 -2
- package/build/utils/selection.cjs.map +3 -3
- package/build/utils/sorting.cjs +9 -3
- package/build/utils/sorting.cjs.map +3 -3
- package/build/utils/transform-styles/index.cjs +3 -2
- package/build/utils/transform-styles/index.cjs.map +3 -3
- package/build/utils/transform-styles/postcss-urlrebase.d.cjs +2 -0
- package/build/utils/transform-styles/postcss-urlrebase.d.cjs.map +7 -0
- package/build/utils/transform-styles/types.cjs +19 -0
- package/build/utils/transform-styles/types.cjs.map +7 -0
- package/build/utils/types.cjs +19 -0
- package/build/utils/types.cjs.map +7 -0
- package/build-module/components/block-card/index.mjs +5 -6
- package/build-module/components/block-card/index.mjs.map +2 -2
- package/build-module/components/block-editing-mode/index.mjs +14 -8
- package/build-module/components/block-editing-mode/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +35 -21
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-mover/mover-description.mjs +6 -6
- package/build-module/components/block-mover/mover-description.mjs.map +1 -1
- package/build-module/components/block-patterns-list/index.mjs.map +2 -2
- package/build-module/components/block-patterns-paging/index.mjs +4 -4
- package/build-module/components/block-patterns-paging/index.mjs.map +2 -2
- package/build-module/components/block-popover/use-popover-scroll.mjs.map +1 -1
- package/build-module/components/block-quick-navigation/index.mjs +8 -6
- package/build-module/components/block-quick-navigation/index.mjs.map +2 -2
- package/build-module/components/block-rename/modal.mjs +0 -1
- package/build-module/components/block-rename/modal.mjs.map +2 -2
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs +14 -6
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
- package/build-module/components/block-toolbar/edit-section-button.mjs.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs +10 -4
- package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs.map +2 -2
- package/build-module/components/child-layout-control/index.mjs +51 -19
- package/build-module/components/child-layout-control/index.mjs.map +2 -2
- package/build-module/components/colors-gradients/control.mjs +27 -15
- package/build-module/components/colors-gradients/control.mjs.map +2 -2
- package/build-module/components/colors-gradients/dropdown.mjs +4 -1
- package/build-module/components/colors-gradients/dropdown.mjs.map +2 -2
- package/build-module/components/contrast-checker/index.mjs +18 -4
- package/build-module/components/contrast-checker/index.mjs.map +2 -2
- package/build-module/components/date-format-picker/index.mjs +0 -1
- package/build-module/components/date-format-picker/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/index.mjs +4 -5
- package/build-module/components/dimensions-tool/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/scale-tool.mjs +1 -1
- package/build-module/components/dimensions-tool/scale-tool.mjs.map +2 -2
- package/build-module/components/global-styles/background-panel.mjs +155 -27
- package/build-module/components/global-styles/background-panel.mjs.map +2 -2
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +207 -0
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +7 -0
- package/build-module/components/global-styles/color-panel.mjs +106 -387
- package/build-module/components/global-styles/color-panel.mjs.map +3 -3
- package/build-module/components/global-styles/dimensions-panel.mjs +1 -5
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/hooks.mjs +33 -0
- package/build-module/components/global-styles/hooks.mjs.map +2 -2
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/global-styles/typography-panel.mjs +84 -10
- package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
- package/build-module/components/grid/grid-item-resizer.mjs.map +1 -1
- package/build-module/components/grid/grid-visualizer.mjs.map +1 -1
- package/build-module/components/iframe/index.mjs +6 -3
- package/build-module/components/iframe/index.mjs.map +2 -2
- package/build-module/components/image-editor/use-transform-image.mjs.map +1 -1
- package/build-module/components/inserter/get-appender-label.mjs.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
- package/build-module/components/inserter/search-items.mjs.map +1 -1
- package/build-module/components/inspector-controls/fill.mjs +1 -3
- package/build-module/components/inspector-controls/fill.mjs.map +2 -2
- package/build-module/components/inspector-controls/groups.mjs +2 -0
- package/build-module/components/inspector-controls/groups.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +76 -32
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/keyboard-shortcuts/index.mjs.map +1 -1
- package/build-module/components/line-height-control/index.mjs.map +1 -1
- package/build-module/components/link-control/index.mjs +2 -3
- package/build-module/components/link-control/index.mjs.map +2 -2
- package/build-module/components/link-control/normalize-url.mjs.map +1 -1
- package/build-module/components/list-view/block-select-button.mjs +2 -17
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/utils.mjs.map +1 -1
- package/build-module/components/preset-input-control/custom-value-controls.mjs.map +2 -2
- package/build-module/components/provider/index.mjs.map +1 -1
- package/build-module/components/provider/use-block-sync.mjs +3 -1
- package/build-module/components/provider/use-block-sync.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs +1 -1
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +1 -1
- package/build-module/components/rich-text/prevent-event-discovery.mjs +1 -1
- package/build-module/components/rich-text/prevent-event-discovery.mjs.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.mjs +0 -2
- package/build-module/components/url-popover/image-url-input-ui.mjs.map +2 -2
- package/build-module/components/use-block-display-information/index.mjs +10 -3
- package/build-module/components/use-block-display-information/index.mjs.map +2 -2
- package/build-module/components/writing-flow/use-tab-nav.mjs.map +1 -1
- package/build-module/hooks/anchor.mjs +1 -2
- package/build-module/hooks/anchor.mjs.map +2 -2
- package/build-module/hooks/background.mjs +123 -75
- package/build-module/hooks/background.mjs.map +2 -2
- package/build-module/hooks/block-fields/index.mjs +13 -2
- package/build-module/hooks/block-fields/index.mjs.map +2 -2
- package/build-module/hooks/color.mjs +2 -175
- package/build-module/hooks/color.mjs.map +2 -2
- package/build-module/hooks/contrast-checker.mjs +32 -19
- package/build-module/hooks/contrast-checker.mjs.map +2 -2
- package/build-module/hooks/custom-class-name.mjs +0 -1
- package/build-module/hooks/custom-class-name.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs +12 -2
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/elements.mjs +115 -0
- package/build-module/hooks/elements.mjs.map +7 -0
- package/build-module/hooks/grid-visualizer.mjs +21 -11
- package/build-module/hooks/grid-visualizer.mjs.map +2 -2
- package/build-module/hooks/layout-child.mjs +68 -10
- package/build-module/hooks/layout-child.mjs.map +2 -2
- package/build-module/hooks/layout.mjs +6 -3
- package/build-module/hooks/layout.mjs.map +2 -2
- package/build-module/hooks/list-view.mjs +10 -7
- package/build-module/hooks/list-view.mjs.map +2 -2
- package/build-module/hooks/spacing-visualizer.mjs.map +1 -1
- package/build-module/hooks/state-utils.mjs.map +1 -1
- package/build-module/hooks/states.mjs +2 -2
- package/build-module/hooks/states.mjs.map +2 -2
- package/build-module/hooks/style.mjs +53 -8
- package/build-module/hooks/style.mjs.map +2 -2
- package/build-module/hooks/typography.mjs +62 -10
- package/build-module/hooks/typography.mjs.map +2 -2
- package/build-module/layouts/flex.mjs +105 -7
- package/build-module/layouts/flex.mjs.map +2 -2
- package/build-module/private-apis.mjs +8 -0
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs.map +1 -1
- package/build-module/store/private-selectors.mjs +18 -1
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs.map +1 -1
- package/build-module/store/selectors.mjs.map +1 -1
- package/build-module/utils/block-bindings.mjs +9 -9
- package/build-module/utils/block-bindings.mjs.map +3 -3
- package/build-module/utils/color-values.mjs +9 -1
- package/build-module/utils/color-values.mjs.map +3 -3
- package/build-module/utils/dom.mjs +2 -5
- package/build-module/utils/dom.mjs.map +3 -3
- package/build-module/utils/fit-text-frontend.mjs +6 -2
- package/build-module/utils/fit-text-frontend.mjs.map +3 -3
- package/build-module/utils/fit-text-utils.mjs +1 -1
- package/build-module/utils/fit-text-utils.mjs.map +3 -3
- package/build-module/utils/format-font-style.mjs +1 -1
- package/build-module/utils/format-font-style.mjs.map +3 -3
- package/build-module/utils/format-font-weight.mjs +1 -1
- package/build-module/utils/format-font-weight.mjs.map +3 -3
- package/build-module/utils/get-editor-region.mjs +4 -2
- package/build-module/utils/get-editor-region.mjs.map +3 -3
- package/build-module/utils/get-font-styles-and-weights.mjs +8 -12
- package/build-module/utils/get-font-styles-and-weights.mjs.map +3 -3
- package/build-module/utils/get-px-from-css-unit.mjs +1 -1
- package/build-module/utils/get-px-from-css-unit.mjs.map +1 -1
- package/build-module/utils/index.mjs +1 -1
- package/build-module/utils/index.mjs.map +1 -1
- package/build-module/utils/math.mjs +1 -1
- package/build-module/utils/math.mjs.map +3 -3
- package/build-module/utils/object.mjs +8 -8
- package/build-module/utils/object.mjs.map +3 -3
- package/build-module/utils/order-inserter-block-items.mjs +1 -1
- package/build-module/utils/order-inserter-block-items.mjs.map +3 -3
- package/build-module/utils/pasting.mjs +4 -2
- package/build-module/utils/pasting.mjs.map +3 -3
- package/build-module/utils/selection.mjs +3 -2
- package/build-module/utils/selection.mjs.map +3 -3
- package/build-module/utils/sorting.mjs +9 -3
- package/build-module/utils/sorting.mjs.map +3 -3
- package/build-module/utils/transform-styles/index.mjs +3 -2
- package/build-module/utils/transform-styles/index.mjs.map +3 -3
- package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs +1 -0
- package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs.map +7 -0
- package/build-module/utils/transform-styles/types.mjs +1 -0
- package/build-module/utils/transform-styles/types.mjs.map +7 -0
- package/build-module/utils/types.mjs +1 -0
- package/build-module/utils/types.mjs.map +7 -0
- package/build-style/content-rtl.css +2 -0
- package/build-style/content.css +2 -0
- package/build-style/style-rtl.css +34 -41
- package/build-style/style.css +34 -41
- package/build-types/utils/block-bindings.d.ts +27 -0
- package/build-types/utils/block-bindings.d.ts.map +1 -0
- package/build-types/utils/color-values.d.ts +40 -0
- package/build-types/utils/color-values.d.ts.map +1 -0
- package/build-types/utils/dom.d.ts +19 -19
- package/build-types/utils/dom.d.ts.map +1 -1
- package/build-types/utils/fit-text-frontend.d.ts +7 -0
- package/build-types/utils/fit-text-frontend.d.ts.map +1 -0
- package/build-types/utils/fit-text-utils.d.ts +15 -0
- package/build-types/utils/fit-text-utils.d.ts.map +1 -0
- package/build-types/utils/format-font-style.d.ts +12 -0
- package/build-types/utils/format-font-style.d.ts.map +1 -0
- package/build-types/utils/format-font-weight.d.ts +12 -0
- package/build-types/utils/format-font-weight.d.ts.map +1 -0
- package/build-types/utils/get-editor-region.d.ts +9 -0
- package/build-types/utils/get-editor-region.d.ts.map +1 -0
- package/build-types/utils/get-font-styles-and-weights.d.ts +16 -0
- package/build-types/utils/get-font-styles-and-weights.d.ts.map +1 -0
- package/build-types/utils/get-px-from-css-unit.d.ts +10 -0
- package/build-types/utils/get-px-from-css-unit.d.ts.map +1 -0
- package/build-types/utils/index.d.ts +3 -0
- package/build-types/utils/index.d.ts.map +1 -0
- package/build-types/utils/math.d.ts +61 -0
- package/build-types/utils/math.d.ts.map +1 -0
- package/build-types/utils/object.d.ts +39 -0
- package/build-types/utils/object.d.ts.map +1 -0
- package/build-types/utils/order-inserter-block-items.d.ts +13 -0
- package/build-types/utils/order-inserter-block-items.d.ts.map +1 -0
- package/build-types/utils/pasting.d.ts +28 -0
- package/build-types/utils/pasting.d.ts.map +1 -0
- package/build-types/utils/selection.d.ts +21 -0
- package/build-types/utils/selection.d.ts.map +1 -0
- package/build-types/utils/sorting.d.ts +17 -0
- package/build-types/utils/sorting.d.ts.map +1 -0
- package/build-types/utils/transform-styles/index.d.ts +15 -0
- package/build-types/utils/transform-styles/index.d.ts.map +1 -0
- package/build-types/utils/transform-styles/types.d.ts +13 -0
- package/build-types/utils/transform-styles/types.d.ts.map +1 -0
- package/build-types/utils/types.d.ts +28 -0
- package/build-types/utils/types.d.ts.map +1 -0
- package/package.json +46 -40
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -0
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -0
- package/src/components/block-card/index.js +7 -13
- package/src/components/block-editing-mode/index.js +17 -9
- package/src/components/block-icon/test/__snapshots__/index.js.snap +1 -0
- package/src/components/block-inspector/index.js +22 -20
- package/src/components/block-patterns-list/index.js +0 -1
- package/src/components/block-quick-navigation/index.js +7 -7
- package/src/components/block-rename/modal.js +0 -1
- package/src/components/block-toolbar/block-toolbar-icon.js +22 -6
- package/src/components/block-toolbar/test/block-toolbar-icon.js +99 -0
- package/src/components/block-tools/use-block-toolbar-popover-props.js +10 -4
- package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +4 -0
- package/src/components/child-layout-control/index.js +65 -20
- package/src/components/child-layout-control/test/index.js +64 -0
- package/src/components/colors-gradients/control.js +29 -12
- package/src/components/colors-gradients/dropdown.js +4 -1
- package/src/components/colors-gradients/style.scss +39 -2
- package/src/components/contrast-checker/README.md +9 -0
- package/src/components/contrast-checker/index.js +42 -3
- package/src/components/date-format-picker/index.js +0 -1
- package/src/components/default-block-appender/content.scss +3 -0
- package/src/components/dimensions-tool/index.js +4 -9
- package/src/components/dimensions-tool/scale-tool.js +1 -2
- package/src/components/dimensions-tool/test/index.js +89 -11
- package/src/components/global-styles/background-panel.js +201 -34
- package/src/components/global-styles/color-gradient-dropdown-item.js +258 -0
- package/src/components/global-styles/color-panel.js +125 -487
- package/src/components/global-styles/dimensions-panel.js +1 -5
- package/src/components/global-styles/hooks.js +45 -0
- package/src/components/global-styles/shadow-panel-components.js +0 -1
- package/src/components/global-styles/test/background-panel.js +56 -0
- package/src/components/global-styles/test/color-panel.js +172 -118
- package/src/components/global-styles/test/typography-panel.js +167 -0
- package/src/components/global-styles/typography-panel.js +100 -11
- package/src/components/iframe/index.js +8 -3
- package/src/components/inserter/media-tab/media-preview.js +0 -1
- package/src/components/inspector-controls/README.md +0 -2
- package/src/components/inspector-controls/fill.js +6 -8
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/index.js +0 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +78 -28
- package/src/components/link-control/index.js +0 -1
- package/src/components/link-control/test/index.js +2 -3
- package/src/components/list-view/block-select-button.js +2 -18
- package/src/components/preset-input-control/custom-value-controls.js +0 -1
- package/src/components/provider/use-block-sync.js +3 -1
- package/src/components/rich-text/content.scss +2 -0
- package/src/components/url-popover/image-url-input-ui.js +0 -2
- package/src/components/use-block-display-information/index.js +15 -2
- package/src/components/use-block-display-information/test/index.js +140 -0
- package/src/hooks/anchor.js +0 -1
- package/src/hooks/background.js +210 -133
- package/src/hooks/background.scss +0 -35
- package/src/hooks/block-fields/index.js +27 -2
- package/src/hooks/color.js +2 -205
- package/src/hooks/color.scss +3 -9
- package/src/hooks/contrast-checker.js +60 -17
- package/src/hooks/custom-class-name.js +0 -1
- package/src/hooks/dimensions.js +14 -3
- package/src/hooks/elements.js +140 -0
- package/src/hooks/elements.scss +8 -0
- package/src/hooks/grid-visualizer.js +59 -45
- package/src/hooks/layout-child.js +92 -14
- package/src/hooks/layout.js +6 -3
- package/src/hooks/list-view.js +10 -11
- package/src/hooks/states.js +2 -2
- package/src/hooks/style.js +91 -9
- package/src/hooks/test/background.js +59 -0
- package/src/hooks/test/block-style-state.js +14 -14
- package/src/hooks/test/dimensions.js +71 -0
- package/src/hooks/test/layout-child.js +165 -0
- package/src/hooks/test/layout.js +6 -6
- package/src/hooks/test/style.js +133 -11
- package/src/hooks/typography.js +70 -6
- package/src/layouts/flex.js +118 -15
- package/src/private-apis.js +8 -0
- package/src/store/private-selectors.js +47 -0
- package/src/store/test/private-selectors.js +166 -7
- package/src/store/test/reducer.js +61 -10
- package/src/style.scss +1 -0
- package/src/utils/block-bindings.ts +51 -0
- package/src/utils/color-values.ts +63 -0
- package/src/utils/{dom.js → dom.ts} +27 -27
- package/src/utils/{fit-text-frontend.js → fit-text-frontend.ts} +12 -4
- package/src/utils/{fit-text-utils.js → fit-text-utils.ts} +15 -7
- package/src/utils/{format-font-style.js → format-font-style.ts} +10 -3
- package/src/utils/{format-font-weight.js → format-font-weight.ts} +10 -3
- package/src/utils/{get-editor-region.js → get-editor-region.ts} +10 -6
- package/src/utils/{get-font-styles-and-weights.js → get-font-styles-and-weights.ts} +21 -17
- package/src/utils/{math.js → math.ts} +37 -30
- package/src/utils/object.ts +89 -0
- package/src/utils/{order-inserter-block-items.js → order-inserter-block-items.ts} +8 -5
- package/src/utils/{pasting.js → pasting.ts} +18 -11
- package/src/utils/{selection.js → selection.ts} +11 -4
- package/src/utils/sorting.ts +81 -0
- package/src/utils/test/color-values.js +44 -1
- package/src/utils/transform-styles/{index.js → index.ts} +25 -25
- package/src/utils/transform-styles/postcss-urlrebase.d.ts +15 -0
- package/src/utils/transform-styles/types.ts +13 -0
- package/src/utils/types.ts +29 -0
- package/src/utils/block-bindings.js +0 -46
- package/src/utils/color-values.js +0 -28
- package/src/utils/object.js +0 -67
- package/src/utils/sorting.js +0 -54
- /package/src/utils/{get-px-from-css-unit.js → get-px-from-css-unit.ts} +0 -0
- /package/src/utils/{index.js → index.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-patterns-list/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { cloneBlock } from '@wordpress/blocks';\nimport { useEffect, useState, forwardRef, useMemo } from '@wordpress/element';\nimport {\n\tComposite,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,oBAA2B;AAC3B,qBAAyD;AACzD,wBAGO;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { cloneBlock } from '@wordpress/blocks';\nimport { useEffect, useState, forwardRef, useMemo } from '@wordpress/element';\nimport {\n\tComposite,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { VisuallyHidden, Text, Tooltip } from '@wordpress/ui';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, symbol } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockPreview from '../block-preview';\nimport InserterDraggableBlocks from '../inserter-draggable-blocks';\nimport BlockPatternsPaging from '../block-patterns-paging';\nimport { INSERTER_PATTERN_TYPES } from '../inserter/block-patterns-tab/utils';\n\nconst WithToolTip = ( { showTooltip, title, children } ) => {\n\tif ( showTooltip ) {\n\t\treturn (\n\t\t\t<Tooltip.Root>\n\t\t\t\t<Tooltip.Trigger render={ children } />\n\t\t\t\t<Tooltip.Popup>{ title }</Tooltip.Popup>\n\t\t\t</Tooltip.Root>\n\t\t);\n\t}\n\treturn <>{ children }</>;\n};\n\nfunction BlockPattern( {\n\tid,\n\tisDraggable,\n\tpattern,\n\tonClick,\n\tonHover,\n\tshowTitlesAsTooltip,\n\tcategory,\n\tisSelected,\n} ) {\n\tconst [ isDragging, setIsDragging ] = useState( false );\n\tconst { blocks, viewportWidth } = pattern;\n\tconst instanceId = useInstanceId( BlockPattern );\n\tconst descriptionId = `block-editor-block-patterns-list__item-description-${ instanceId }`;\n\tconst isUserPattern = pattern.type === INSERTER_PATTERN_TYPES.user;\n\n\t// When we have a selected category and the pattern is draggable, we need to update the\n\t// pattern's categories in metadata to only contain the selected category, and pass this to\n\t// InserterDraggableBlocks component. We do that because we use this information for pattern\n\t// shuffling and it makes more sense to show only the ones from the initially selected category during insertion.\n\tconst patternBlocks = useMemo( () => {\n\t\tif ( ! category || ! isDraggable ) {\n\t\t\treturn blocks;\n\t\t}\n\t\treturn ( blocks ?? [] ).map( ( block ) => {\n\t\t\tconst clonedBlock = cloneBlock( block );\n\t\t\tif (\n\t\t\t\tclonedBlock.attributes.metadata?.categories?.includes(\n\t\t\t\t\tcategory\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tclonedBlock.attributes.metadata.categories = [ category ];\n\t\t\t}\n\t\t\treturn clonedBlock;\n\t\t} );\n\t}, [ blocks, isDraggable, category ] );\n\n\treturn (\n\t\t<InserterDraggableBlocks\n\t\t\tisEnabled={ isDraggable }\n\t\t\tblocks={ patternBlocks }\n\t\t\tpattern={ pattern }\n\t\t>\n\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) => (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"block-editor-block-patterns-list__list-item\"\n\t\t\t\t\tdraggable={ draggable }\n\t\t\t\t\tonDragStart={ ( event ) => {\n\t\t\t\t\t\tsetIsDragging( true );\n\t\t\t\t\t\tif ( onDragStart ) {\n\t\t\t\t\t\t\tonHover?.( null );\n\t\t\t\t\t\t\tonDragStart( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tonDragEnd={ ( event ) => {\n\t\t\t\t\t\tsetIsDragging( false );\n\t\t\t\t\t\tif ( onDragEnd ) {\n\t\t\t\t\t\t\tonDragEnd( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<WithToolTip\n\t\t\t\t\t\tshowTooltip={ showTitlesAsTooltip && ! isUserPattern }\n\t\t\t\t\t\ttitle={ pattern.title }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Composite.Item\n\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\t\t\t\taria-label={ pattern.title }\n\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\tpattern.description\n\t\t\t\t\t\t\t\t\t\t\t? descriptionId\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t'block-editor-block-patterns-list__item',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-block-patterns-list__list-item-synced':\n\t\t\t\t\t\t\t\t\t\t\t\tpattern.type ===\n\t\t\t\t\t\t\t\t\t\t\t\t\tINSERTER_PATTERN_TYPES.user &&\n\t\t\t\t\t\t\t\t\t\t\t\t! pattern.syncStatus,\n\t\t\t\t\t\t\t\t\t\t\t'is-selected': isSelected,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tid={ id }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonClick( pattern, blocks );\n\t\t\t\t\t\t\t\tonHover?.( null );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonMouseEnter={ () => {\n\t\t\t\t\t\t\t\tif ( isDragging ) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonHover?.( pattern );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonMouseLeave={ () => onHover?.( null ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockPreview.Async\n\t\t\t\t\t\t\t\tplaceholder={ <BlockPatternPlaceholder /> }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<BlockPreview\n\t\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</BlockPreview.Async>\n\t\t\t\t\t\t\t{ ( ! showTitlesAsTooltip || isUserPattern ) && (\n\t\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-patterns__pattern-details\"\n\t\t\t\t\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ isUserPattern && ! pattern.syncStatus && (\n\t\t\t\t\t\t\t\t\t\t<div className=\"block-editor-patterns__pattern-icon-wrapper\">\n\t\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-patterns__pattern-icon\"\n\t\t\t\t\t\t\t\t\t\t\t\ticon={ symbol }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\t\trender={ <div /> }\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-patterns-list__item-title\"\n\t\t\t\t\t\t\t\t\t\tvariant=\"body-sm\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ pattern.title }\n\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t{ !! pattern.description && (\n\t\t\t\t\t\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t\t\t\t\t\t{ pattern.description }\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Composite.Item>\n\t\t\t\t\t</WithToolTip>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</InserterDraggableBlocks>\n\t);\n}\n\nfunction BlockPatternPlaceholder() {\n\treturn (\n\t\t<div className=\"block-editor-block-patterns-list__item is-placeholder\" />\n\t);\n}\n\nfunction BlockPatternsList(\n\t{\n\t\tisDraggable,\n\t\tblockPatterns,\n\t\tonHover,\n\t\tonClickPattern,\n\t\torientation,\n\t\tcategory,\n\t\tlabel = __( 'Patterns' ),\n\t\tshowTitlesAsTooltip,\n\t\tpagingProps,\n\t},\n\tref\n) {\n\tconst [ activeCompositeId, setActiveCompositeId ] = useState( undefined );\n\tconst [ activePattern, setActivePattern ] = useState( null ); // State to track active pattern\n\n\tuseEffect( () => {\n\t\t// Reset the active composite item whenever the available patterns change,\n\t\t// to make sure that Composite widget can receive focus correctly when its\n\t\t// composite items change. The first composite item will receive focus.\n\t\tconst firstCompositeItemId = blockPatterns[ 0 ]?.name;\n\t\tsetActiveCompositeId( firstCompositeItemId );\n\t}, [ blockPatterns ] );\n\n\tconst handleClickPattern = ( pattern, blocks ) => {\n\t\tsetActivePattern( pattern.name );\n\t\tonClickPattern( pattern, blocks );\n\t};\n\n\treturn (\n\t\t<Composite\n\t\t\torientation={ orientation }\n\t\t\tactiveId={ activeCompositeId }\n\t\t\tsetActiveId={ setActiveCompositeId }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-editor-block-patterns-list\"\n\t\t\taria-label={ label }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t{ blockPatterns.map( ( pattern ) => (\n\t\t\t\t<BlockPattern\n\t\t\t\t\tkey={ pattern.name }\n\t\t\t\t\tid={ pattern.name }\n\t\t\t\t\tpattern={ pattern }\n\t\t\t\t\tonClick={ handleClickPattern }\n\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\tisDraggable={ isDraggable }\n\t\t\t\t\tshowTitlesAsTooltip={ showTitlesAsTooltip }\n\t\t\t\t\tcategory={ category }\n\t\t\t\t\tisSelected={\n\t\t\t\t\t\t!! activePattern && activePattern === pattern.name\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ pagingProps && <BlockPatternsPaging { ...pagingProps } /> }\n\t\t</Composite>\n\t);\n}\n\nexport default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ACX,aAAc;AAAA,MACd,MAAK;AAAA,MACL,WAAU;AAAA,MACV,cAAa;AAAA,MACb;AAAA,MAEE;AAAA,sBAAc,IAAK,CAAE,YACtB;AAAA,UAAC;AAAA;AAAA,YAEA,IAAK,QAAQ;AAAA,YACb;AAAA,YACA,SAAU;AAAA,YACV;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,YACC,CAAC,CAAE,iBAAiB,kBAAkB,QAAQ;AAAA;AAAA,UATzC,QAAQ;AAAA,QAWf,CACC;AAAA,QACA,eAAe,4CAAC,6BAAAC,SAAA,EAAsB,GAAG,aAAc;AAAA;AAAA;AAAA,EAC1D;AAEF;AAEA,IAAO,kCAAQ,2BAAY,iBAAkB;",
|
|
6
6
|
"names": ["InserterDraggableBlocks", "clsx", "BlockPreview", "HStack", "BlockPatternsPaging"]
|
|
7
7
|
}
|
|
@@ -63,7 +63,7 @@ function Pagination({
|
|
|
63
63
|
size: "compact",
|
|
64
64
|
accessibleWhenDisabled: true,
|
|
65
65
|
className: "block-editor-patterns__grid-pagination-button",
|
|
66
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "
|
|
66
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "«" })
|
|
67
67
|
}
|
|
68
68
|
),
|
|
69
69
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -76,7 +76,7 @@ function Pagination({
|
|
|
76
76
|
size: "compact",
|
|
77
77
|
accessibleWhenDisabled: true,
|
|
78
78
|
className: "block-editor-patterns__grid-pagination-button",
|
|
79
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "
|
|
79
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "‹" })
|
|
80
80
|
}
|
|
81
81
|
)
|
|
82
82
|
]
|
|
@@ -105,7 +105,7 @@ function Pagination({
|
|
|
105
105
|
size: "compact",
|
|
106
106
|
accessibleWhenDisabled: true,
|
|
107
107
|
className: "block-editor-patterns__grid-pagination-button",
|
|
108
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "
|
|
108
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "›" })
|
|
109
109
|
}
|
|
110
110
|
),
|
|
111
111
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -118,7 +118,7 @@ function Pagination({
|
|
|
118
118
|
size: "compact",
|
|
119
119
|
accessibleWhenDisabled: true,
|
|
120
120
|
className: "block-editor-patterns__grid-pagination-button",
|
|
121
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "
|
|
121
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "»" })
|
|
122
122
|
}
|
|
123
123
|
)
|
|
124
124
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-patterns-paging/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\t__experimentalText as WCText,\n\tButton,\n} from '@wordpress/components';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\n\nexport default function Pagination( {\n\tcurrentPage,\n\tnumPages,\n\tchangePage,\n\ttotalItems,\n} ) {\n\treturn (\n\t\t<VStack className=\"block-editor-patterns__grid-pagination-wrapper\">\n\t\t\t<WCText variant=\"muted\">\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: %s: Total number of patterns.\n\t\t\t\t\t_n( '%s item', '%s items', totalItems ),\n\t\t\t\t\ttotalItems\n\t\t\t\t) }\n\t\t\t</WCText>\n\t\t\t{ numPages > 1 && (\n\t\t\t\t<HStack\n\t\t\t\t\texpanded={ false }\n\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination\"\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-previous\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'First page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAKO;AACP,kBAAoC;AAUjC;AARY,SAAR,WAA6B;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,SACC,6CAAC,kBAAAA,sBAAA,EAAO,WAAU,kDACjB;AAAA,gDAAC,kBAAAC,oBAAA,EAAO,SAAQ,SACb;AAAA;AAAA,UAED,gBAAI,WAAW,YAAY,UAAW;AAAA,MACtC;AAAA,IACD,GACD;AAAA,IACE,WAAW,KACZ;AAAA,MAAC,kBAAAC;AAAA,MAAA;AAAA,QACA,UAAW;AAAA,QACX,SAAU;AAAA,QACV,SAAQ;AAAA,QACR,WAAU;AAAA,QAEV;AAAA;AAAA,YAAC,kBAAAA;AAAA,YAAA;AAAA,cACA,UAAW;AAAA,cACX,SAAU;AAAA,cACV,WAAU;AAAA,cAEV;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACA,SAAQ;AAAA,oBACR,SAAU,MAAM,WAAY,CAAE;AAAA,oBAC9B,UAAW,gBAAgB;AAAA,oBAC3B,kBAAa,gBAAI,YAAa;AAAA,oBAC9B,MAAK;AAAA,oBACL,wBAAsB;AAAA,oBACtB,WAAU;AAAA,oBAEV,sDAAC,UAAK,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\t__experimentalText as WCText,\n\tButton,\n} from '@wordpress/components';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\n\nexport default function Pagination( {\n\tcurrentPage,\n\tnumPages,\n\tchangePage,\n\ttotalItems,\n} ) {\n\treturn (\n\t\t<VStack className=\"block-editor-patterns__grid-pagination-wrapper\">\n\t\t\t<WCText variant=\"muted\">\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: %s: Total number of patterns.\n\t\t\t\t\t_n( '%s item', '%s items', totalItems ),\n\t\t\t\t\ttotalItems\n\t\t\t\t) }\n\t\t\t</WCText>\n\t\t\t{ numPages > 1 && (\n\t\t\t\t<HStack\n\t\t\t\t\texpanded={ false }\n\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination\"\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-previous\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'First page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>«</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( currentPage - 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'Previous page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>‹</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<WCText variant=\"muted\">\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: 1: Current page number. 2: Total number of pages.\n\t\t\t\t\t\t\t_x( '%1$s of %2$s', 'paging' ),\n\t\t\t\t\t\t\tcurrentPage,\n\t\t\t\t\t\t\tnumPages\n\t\t\t\t\t\t) }\n\t\t\t\t\t</WCText>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-next\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( currentPage + 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\t\t\taria-label={ __( 'Next page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>›</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( numPages ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\t\t\taria-label={ __( 'Last page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>»</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAKO;AACP,kBAAoC;AAUjC;AARY,SAAR,WAA6B;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,SACC,6CAAC,kBAAAA,sBAAA,EAAO,WAAU,kDACjB;AAAA,gDAAC,kBAAAC,oBAAA,EAAO,SAAQ,SACb;AAAA;AAAA,UAED,gBAAI,WAAW,YAAY,UAAW;AAAA,MACtC;AAAA,IACD,GACD;AAAA,IACE,WAAW,KACZ;AAAA,MAAC,kBAAAC;AAAA,MAAA;AAAA,QACA,UAAW;AAAA,QACX,SAAU;AAAA,QACV,SAAQ;AAAA,QACR,WAAU;AAAA,QAEV;AAAA;AAAA,YAAC,kBAAAA;AAAA,YAAA;AAAA,cACA,UAAW;AAAA,cACX,SAAU;AAAA,cACV,WAAU;AAAA,cAEV;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACA,SAAQ;AAAA,oBACR,SAAU,MAAM,WAAY,CAAE;AAAA,oBAC9B,UAAW,gBAAgB;AAAA,oBAC3B,kBAAa,gBAAI,YAAa;AAAA,oBAC9B,MAAK;AAAA,oBACL,wBAAsB;AAAA,oBACtB,WAAU;AAAA,oBAEV,sDAAC,UAAK,eAAC;AAAA;AAAA,gBACR;AAAA,gBACA;AAAA,kBAAC;AAAA;AAAA,oBACA,SAAQ;AAAA,oBACR,SAAU,MAAM,WAAY,cAAc,CAAE;AAAA,oBAC5C,UAAW,gBAAgB;AAAA,oBAC3B,kBAAa,gBAAI,eAAgB;AAAA,oBACjC,MAAK;AAAA,oBACL,wBAAsB;AAAA,oBACtB,WAAU;AAAA,oBAEV,sDAAC,UAAK,eAAC;AAAA;AAAA,gBACR;AAAA;AAAA;AAAA,UACD;AAAA,UACA,4CAAC,kBAAAD,oBAAA,EAAO,SAAQ,SACb;AAAA;AAAA,gBAED,gBAAI,gBAAgB,QAAS;AAAA,YAC7B;AAAA,YACA;AAAA,UACD,GACD;AAAA,UACA;AAAA,YAAC,kBAAAC;AAAA,YAAA;AAAA,cACA,UAAW;AAAA,cACX,SAAU;AAAA,cACV,WAAU;AAAA,cAEV;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACA,SAAQ;AAAA,oBACR,SAAU,MAAM,WAAY,cAAc,CAAE;AAAA,oBAC5C,UAAW,gBAAgB;AAAA,oBAC3B,kBAAa,gBAAI,WAAY;AAAA,oBAC7B,MAAK;AAAA,oBACL,wBAAsB;AAAA,oBACtB,WAAU;AAAA,oBAEV,sDAAC,UAAK,eAAC;AAAA;AAAA,gBACR;AAAA,gBACA;AAAA,kBAAC;AAAA;AAAA,oBACA,SAAQ;AAAA,oBACR,SAAU,MAAM,WAAY,QAAS;AAAA,oBACrC,UAAW,gBAAgB;AAAA,oBAC3B,kBAAa,gBAAI,WAAY;AAAA,oBAC7B,MAAK;AAAA,oBACL,wBAAsB;AAAA,oBACtB,WAAU;AAAA,oBAEV,sDAAC,UAAK,eAAC;AAAA;AAAA,gBACR;AAAA;AAAA;AAAA,UACD;AAAA;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;",
|
|
6
6
|
"names": ["VStack", "WCText", "HStack"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-popover/use-popover-scroll.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { getScrollContainer } from '@wordpress/dom';\n\nconst scrollContainerCache = new WeakMap();\n\n/**\n * Allow scrolling \"through\" popovers over the canvas. This is only called for\n * as long as the pointer is over a popover. Do not use React events because it\n * will bubble through portals.\n *\n * @param {Object} contentRef\n */\nfunction usePopoverScroll( contentRef ) {\n\tconst effect = useRefEffect(\n\t\t( node ) => {\n\t\t\tfunction onWheel( event ) {\n\t\t\t\tconst { deltaX, deltaY, target } = event;\n\t\t\t\tconst contentEl = contentRef.current;\n\t\t\t\tlet scrollContainer = scrollContainerCache.get( contentEl );\n\t\t\t\tif ( ! scrollContainer ) {\n\t\t\t\t\tscrollContainer = getScrollContainer( contentEl );\n\t\t\t\t\tscrollContainerCache.set( contentEl, scrollContainer );\n\t\t\t\t}\n\t\t\t\t// Finds a scrollable ancestor of the event
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { getScrollContainer } from '@wordpress/dom';\n\nconst scrollContainerCache = new WeakMap();\n\n/**\n * Allow scrolling \"through\" popovers over the canvas. This is only called for\n * as long as the pointer is over a popover. Do not use React events because it\n * will bubble through portals.\n *\n * @param {Object} contentRef\n */\nfunction usePopoverScroll( contentRef ) {\n\tconst effect = useRefEffect(\n\t\t( node ) => {\n\t\t\tfunction onWheel( event ) {\n\t\t\t\tconst { deltaX, deltaY, target } = event;\n\t\t\t\tconst contentEl = contentRef.current;\n\t\t\t\tlet scrollContainer = scrollContainerCache.get( contentEl );\n\t\t\t\tif ( ! scrollContainer ) {\n\t\t\t\t\tscrollContainer = getScrollContainer( contentEl );\n\t\t\t\t\tscrollContainerCache.set( contentEl, scrollContainer );\n\t\t\t\t}\n\t\t\t\t// Finds a scrollable ancestor of the event’s target. It's not cached because the\n\t\t\t\t// it may not remain scrollable due to popover position changes. The cache is also\n\t\t\t\t// less likely to be utilized because the target may be different every event.\n\t\t\t\tconst eventScrollContainer = getScrollContainer( target );\n\t\t\t\t// Scrolls “through” the popover only if another contained scrollable area isn’t\n\t\t\t\t// in front of it. This is to avoid scrolling both containers simultaneously.\n\t\t\t\tif ( ! node.contains( eventScrollContainer ) ) {\n\t\t\t\t\tscrollContainer.scrollBy( deltaX, deltaY );\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Tell the browser that we do not call event.preventDefault\n\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners\n\t\t\tconst options = { passive: true };\n\t\t\tnode.addEventListener( 'wheel', onWheel, options );\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'wheel', onWheel, options );\n\t\t\t};\n\t\t},\n\t\t[ contentRef ]\n\t);\n\treturn contentRef ? effect : null;\n}\n\nexport default usePopoverScroll;\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA6B;AAC7B,iBAAmC;AAEnC,IAAM,uBAAuB,oBAAI,QAAQ;AASzC,SAAS,iBAAkB,YAAa;AACvC,QAAM,aAAS;AAAA,IACd,CAAE,SAAU;AACX,eAAS,QAAS,OAAQ;AACzB,cAAM,EAAE,QAAQ,QAAQ,OAAO,IAAI;AACnC,cAAM,YAAY,WAAW;AAC7B,YAAI,kBAAkB,qBAAqB,IAAK,SAAU;AAC1D,YAAK,CAAE,iBAAkB;AACxB,gCAAkB,+BAAoB,SAAU;AAChD,+BAAqB,IAAK,WAAW,eAAgB;AAAA,QACtD;AAIA,cAAM,2BAAuB,+BAAoB,MAAO;AAGxD,YAAK,CAAE,KAAK,SAAU,oBAAqB,GAAI;AAC9C,0BAAgB,SAAU,QAAQ,MAAO;AAAA,QAC1C;AAAA,MACD;AAGA,YAAM,UAAU,EAAE,SAAS,KAAK;AAChC,WAAK,iBAAkB,SAAS,SAAS,OAAQ;AACjD,aAAO,MAAM;AACZ,aAAK,oBAAqB,SAAS,SAAS,OAAQ;AAAA,MACrD;AAAA,IACD;AAAA,IACA,CAAE,UAAW;AAAA,EACd;AACA,SAAO,aAAa,SAAS;AAC9B;AAEA,IAAO,6BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -41,6 +41,7 @@ var import_store = require("../../store/index.cjs");
|
|
|
41
41
|
var import_block_icon = __toESM(require("../block-icon/index.cjs"));
|
|
42
42
|
var import_use_block_display_information = __toESM(require("../use-block-display-information/index.cjs"));
|
|
43
43
|
var import_use_block_display_title = __toESM(require("../block-title/use-block-display-title.cjs"));
|
|
44
|
+
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
44
45
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
46
|
function BlockQuickNavigation({
|
|
46
47
|
clientIds,
|
|
@@ -69,14 +70,15 @@ function BlockQuickNavigationItem({
|
|
|
69
70
|
hasListViewTab
|
|
70
71
|
}) {
|
|
71
72
|
const blockInformation = (0, import_use_block_display_information.default)(clientId);
|
|
72
|
-
const { isSelected, childBlocks,
|
|
73
|
+
const { isSelected, childBlocks, shouldRenderListView, blockName } = (0, import_data.useSelect)(
|
|
73
74
|
(select) => {
|
|
74
75
|
const {
|
|
75
76
|
isBlockSelected,
|
|
76
77
|
hasSelectedInnerBlock,
|
|
77
78
|
getBlockOrder,
|
|
78
|
-
getBlockName
|
|
79
|
-
|
|
79
|
+
getBlockName,
|
|
80
|
+
shouldRenderBlockListView
|
|
81
|
+
} = (0, import_lock_unlock.unlock)(select(import_store.store));
|
|
80
82
|
const _blockName = getBlockName(clientId);
|
|
81
83
|
return {
|
|
82
84
|
isSelected: isBlockSelected(clientId) || hasSelectedInnerBlock(
|
|
@@ -85,7 +87,7 @@ function BlockQuickNavigationItem({
|
|
|
85
87
|
true
|
|
86
88
|
),
|
|
87
89
|
childBlocks: getBlockOrder(clientId),
|
|
88
|
-
|
|
90
|
+
shouldRenderListView: shouldRenderBlockListView(clientId),
|
|
89
91
|
blockName: _blockName
|
|
90
92
|
};
|
|
91
93
|
},
|
|
@@ -99,7 +101,7 @@ function BlockQuickNavigationItem({
|
|
|
99
101
|
const blockTitle = displayTitle || blockType?.title || blockName;
|
|
100
102
|
const { selectBlock } = (0, import_data.useDispatch)(import_store.store);
|
|
101
103
|
const hasChildren = childBlocks && childBlocks.length > 0;
|
|
102
|
-
const canNavigateToListView = hasChildren && hasListViewTab &&
|
|
104
|
+
const canNavigateToListView = hasChildren && hasListViewTab && shouldRenderListView;
|
|
103
105
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
104
106
|
import_components.Button,
|
|
105
107
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-quick-navigation/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalVStack as VStack,\n\t__experimentalTruncate as Truncate,\n\tFlex,\n\tFlexBlock,\n\tFlexItem,\n} from '@wordpress/components';\nimport { Icon, chevronRight } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport BlockIcon from '../block-icon';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport { unlock } from '../../lock-unlock';\n\nexport default function BlockQuickNavigation( {\n\tclientIds,\n\tonSelect,\n\tonSwitchToListView,\n\thasListViewTab,\n} ) {\n\tif ( ! clientIds.length ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<VStack spacing={ 1 }>\n\t\t\t{ clientIds.map( ( clientId ) => (\n\t\t\t\t<BlockQuickNavigationItem\n\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\tonSwitchToListView={ onSwitchToListView }\n\t\t\t\t\thasListViewTab={ hasListViewTab }\n\t\t\t\t\tkey={ clientId }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</VStack>\n\t);\n}\n\nfunction BlockQuickNavigationItem( {\n\tclientId,\n\tonSelect,\n\tonSwitchToListView,\n\thasListViewTab,\n} ) {\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst { isSelected, childBlocks, shouldRenderListView, blockName } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tisBlockSelected,\n\t\t\t\t\thasSelectedInnerBlock,\n\t\t\t\t\tgetBlockOrder,\n\t\t\t\t\tgetBlockName,\n\t\t\t\t\tshouldRenderBlockListView,\n\t\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\t\tconst _blockName = getBlockName( clientId );\n\n\t\t\t\treturn {\n\t\t\t\t\tisSelected:\n\t\t\t\t\t\tisBlockSelected( clientId ) ||\n\t\t\t\t\t\thasSelectedInnerBlock( clientId, /* deep: */ true ),\n\t\t\t\t\tchildBlocks: getBlockOrder( clientId ),\n\t\t\t\t\tshouldRenderListView: shouldRenderBlockListView( clientId ),\n\t\t\t\t\tblockName: _blockName,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\n\tconst blockType = getBlockType( blockName );\n\tconst displayTitle = useBlockDisplayTitle( {\n\t\tclientId,\n\t\tcontext: 'list-view',\n\t} );\n\tconst blockTitle = displayTitle || blockType?.title || blockName;\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\tconst hasChildren = childBlocks && childBlocks.length > 0;\n\tconst canNavigateToListView =\n\t\thasChildren && hasListViewTab && shouldRenderListView;\n\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName=\"block-editor-block-quick-navigation__item\"\n\t\t\tisPressed={ isSelected }\n\t\t\tonClick={ async () => {\n\t\t\t\tawait selectBlock( clientId );\n\n\t\t\t\t// If the block has children and List View is available,\n\t\t\t\t// switch to List View to show the expanded container.\n\t\t\t\tif ( canNavigateToListView && onSwitchToListView ) {\n\t\t\t\t\tonSwitchToListView( clientId );\n\t\t\t\t}\n\n\t\t\t\tif ( onSelect ) {\n\t\t\t\t\tonSelect( clientId );\n\t\t\t\t}\n\t\t\t} }\n\t\t>\n\t\t\t<Flex>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<BlockIcon icon={ blockInformation?.icon } />\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexBlock style={ { textAlign: 'left' } }>\n\t\t\t\t\t<Truncate>{ blockTitle }</Truncate>\n\t\t\t\t</FlexBlock>\n\t\t\t\t{ canNavigateToListView && (\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Icon icon={ chevronRight } size={ 24 } />\n\t\t\t\t\t</FlexItem>\n\t\t\t\t) }\n\t\t\t</Flex>\n\t\t</Button>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAA6B;AAC7B,kBAAuC;AACvC,wBAOO;AACP,mBAAmC;AAKnC,mBAA0C;AAC1C,wBAAsB;AACtB,2CAAuC;AACvC,qCAAiC;AACjC,yBAAuB;AAcnB;AAZW,SAAR,qBAAuC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,MAAK,CAAE,UAAU,QAAS;AACzB,WAAO;AAAA,EACR;AACA,SACC,4CAAC,kBAAAA,sBAAA,EAAO,SAAU,GACf,oBAAU,IAAK,CAAE,aAClB;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEA;AAAA;AAAA,IADM;AAAA,EAEP,CACC,GACH;AAEF;AAEA,SAAS,yBAA0B;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,uBAAmB,qCAAAC,SAA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,qBAAK,MAAO,2BAAe,MAAO,IAAK,GACzC;AAAA,SAEF;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": ["VStack", "useBlockDisplayInformation", "blockEditorStore", "useBlockDisplayTitle", "BlockIcon", "Truncate"]
|
|
7
7
|
}
|
|
@@ -108,7 +108,6 @@ function BlockRenameModal({ clientId, onClose }) {
|
|
|
108
108
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
109
109
|
import_components.TextControl,
|
|
110
110
|
{
|
|
111
|
-
__next40pxDefaultSize: true,
|
|
112
111
|
value: editedBlockName ?? blockName,
|
|
113
112
|
label: (0, import_i18n.__)("Name"),
|
|
114
113
|
help: hasOverridesWarning ? (0, import_i18n.__)(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-rename/modal.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\tTextControl,\n\tModal,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockDisplayInformation } from '..';\nimport isEmptyString from './is-empty-string';\nimport { cleanEmptyObject } from '../../hooks/utils';\n\nexport default function BlockRenameModal( { clientId, onClose } ) {\n\tconst [ editedBlockName, setEditedBlockName ] = useState();\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst { metadata } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes } = select( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tmetadata: getBlockAttributes( clientId )?.metadata,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst blockName = metadata?.name || '';\n\tconst originalBlockName = blockInformation?.title;\n\t// Pattern Overrides is a WordPress-only feature but it also uses the Block Binding API.\n\t// Ideally this should not be inside the block editor package, but we keep it here for simplicity.\n\tconst hasOverridesWarning =\n\t\t!! blockName &&\n\t\t!! metadata?.bindings &&\n\t\tObject.values( metadata.bindings ).some(\n\t\t\t( binding ) => binding.source === 'core/pattern-overrides'\n\t\t);\n\n\tconst nameHasChanged =\n\t\teditedBlockName !== undefined && editedBlockName !== blockName;\n\tconst nameIsOriginal = editedBlockName === originalBlockName;\n\tconst nameIsEmpty = isEmptyString( editedBlockName );\n\n\tconst isNameValid = nameHasChanged || nameIsOriginal;\n\n\tconst autoSelectInputText = ( event ) => event.target.select();\n\n\tconst handleSubmit = () => {\n\t\tconst newName =\n\t\t\tnameIsOriginal || nameIsEmpty ? undefined : editedBlockName;\n\t\tconst message =\n\t\t\tnameIsOriginal || nameIsEmpty\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %s: new name/label for the block */\n\t\t\t\t\t\t__( 'Block name reset to: \"%s\".' ),\n\t\t\t\t\t\teditedBlockName\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: new name/label for the block */\n\t\t\t\t\t\t__( 'Block name changed to: \"%s\".' ),\n\t\t\t\t\t\teditedBlockName\n\t\t\t\t );\n\n\t\t// Must be assertive to immediately announce change.\n\t\tspeak( message, 'assertive' );\n\t\tupdateBlockAttributes( [ clientId ], {\n\t\t\tmetadata: cleanEmptyObject( {\n\t\t\t\t...metadata,\n\t\t\t\tname: newName,\n\t\t\t} ),\n\t\t} );\n\n\t\t// Immediate close avoids ability to hit save multiple times.\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Rename' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\toverlayClassName=\"block-editor-block-rename-modal\"\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\t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AEtC,QAAM,sBAAsB,CAAE,UAAW,MAAM,OAAO,OAAO;AAE7D,QAAM,eAAe,MAAM;AAC1B,UAAM,UACL,kBAAkB,cAAc,SAAY;AAC7C,UAAM,UACL,kBAAkB,kBACf;AAAA;AAAA,UAEA,gBAAI,4BAA6B;AAAA,MACjC;AAAA,IACA,QACA;AAAA;AAAA,UAEA,gBAAI,8BAA+B;AAAA,MACnC;AAAA,IACA;AAGJ,2BAAO,SAAS,WAAY;AAC5B,0BAAuB,CAAE,QAAS,GAAG;AAAA,MACpC,cAAU,+BAAkB;AAAA,QAC3B,GAAG;AAAA,QACH,MAAM;AAAA,MACP,CAAE;AAAA,IACH,CAAE;AAGF,YAAQ;AAAA,EACT;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAQ,gBAAI,QAAS;AAAA,MACrB,gBAAiB;AAAA,MACjB,kBAAiB;AAAA,MACjB,cAAa;AAAA,MACb,MAAK;AAAA,MAEL;AAAA,QAAC;AAAA;AAAA,UACA,UAAW,CAAE,MAAO;AACnB,cAAE,eAAe;AAEjB,gBAAK,CAAE,aAAc;AACpB;AAAA,YACD;AAEA,yBAAa;AAAA,UACd;AAAA,UAEA,uDAAC,kBAAAC,sBAAA,EAAO,SAAQ,KACf;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\tTextControl,\n\tModal,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockDisplayInformation } from '..';\nimport isEmptyString from './is-empty-string';\nimport { cleanEmptyObject } from '../../hooks/utils';\n\nexport default function BlockRenameModal( { clientId, onClose } ) {\n\tconst [ editedBlockName, setEditedBlockName ] = useState();\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst { metadata } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes } = select( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tmetadata: getBlockAttributes( clientId )?.metadata,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst blockName = metadata?.name || '';\n\tconst originalBlockName = blockInformation?.title;\n\t// Pattern Overrides is a WordPress-only feature but it also uses the Block Binding API.\n\t// Ideally this should not be inside the block editor package, but we keep it here for simplicity.\n\tconst hasOverridesWarning =\n\t\t!! blockName &&\n\t\t!! metadata?.bindings &&\n\t\tObject.values( metadata.bindings ).some(\n\t\t\t( binding ) => binding.source === 'core/pattern-overrides'\n\t\t);\n\n\tconst nameHasChanged =\n\t\teditedBlockName !== undefined && editedBlockName !== blockName;\n\tconst nameIsOriginal = editedBlockName === originalBlockName;\n\tconst nameIsEmpty = isEmptyString( editedBlockName );\n\n\tconst isNameValid = nameHasChanged || nameIsOriginal;\n\n\tconst autoSelectInputText = ( event ) => event.target.select();\n\n\tconst handleSubmit = () => {\n\t\tconst newName =\n\t\t\tnameIsOriginal || nameIsEmpty ? undefined : editedBlockName;\n\t\tconst message =\n\t\t\tnameIsOriginal || nameIsEmpty\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %s: new name/label for the block */\n\t\t\t\t\t\t__( 'Block name reset to: \"%s\".' ),\n\t\t\t\t\t\teditedBlockName\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: new name/label for the block */\n\t\t\t\t\t\t__( 'Block name changed to: \"%s\".' ),\n\t\t\t\t\t\teditedBlockName\n\t\t\t\t );\n\n\t\t// Must be assertive to immediately announce change.\n\t\tspeak( message, 'assertive' );\n\t\tupdateBlockAttributes( [ clientId ], {\n\t\t\tmetadata: cleanEmptyObject( {\n\t\t\t\t...metadata,\n\t\t\t\tname: newName,\n\t\t\t} ),\n\t\t} );\n\n\t\t// Immediate close avoids ability to hit save multiple times.\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Rename' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\toverlayClassName=\"block-editor-block-rename-modal\"\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( e ) => {\n\t\t\t\t\te.preventDefault();\n\n\t\t\t\t\tif ( ! isNameValid ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\thandleSubmit();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ editedBlockName ?? blockName }\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\thasOverridesWarning\n\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t'This block allows overrides. Changing the name can cause problems with content entered into instances of this pattern.'\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\tplaceholder={ originalBlockName }\n\t\t\t\t\t\tonChange={ setEditedBlockName }\n\t\t\t\t\t\tonFocus={ autoSelectInputText }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\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,CAAE;AAAA,kBACb,SAAQ;AAAA,kBACR,MAAK;AAAA,kBAEH,8BAAI,MAAO;AAAA;AAAA,cACd;AAAA,eACD;AAAA,aACD;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": ["blockEditorStore", "isEmptyString", "VStack", "HStack"]
|
|
7
7
|
}
|
|
@@ -47,6 +47,7 @@ var import_use_block_display_title = __toESM(require("../block-title/use-block-d
|
|
|
47
47
|
var import_store = require("../../store/index.cjs");
|
|
48
48
|
var import_block_bindings = require("../../utils/block-bindings.cjs");
|
|
49
49
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
50
|
+
var import_private_keys = require("../../store/private-keys.cjs");
|
|
50
51
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
51
52
|
function getBlockIconVariant({ select, clientIds }) {
|
|
52
53
|
const {
|
|
@@ -56,9 +57,12 @@ function getBlockIconVariant({ select, clientIds }) {
|
|
|
56
57
|
canRemoveBlocks,
|
|
57
58
|
getTemplateLock,
|
|
58
59
|
getBlockEditingMode,
|
|
59
|
-
canEditBlock
|
|
60
|
+
canEditBlock,
|
|
61
|
+
isWithinEditedContentOnlySection,
|
|
62
|
+
getSettings
|
|
60
63
|
} = (0, import_lock_unlock.unlock)(select(import_store.store));
|
|
61
64
|
const { getBlockStyles } = select(import_blocks.store);
|
|
65
|
+
const isIsolatedEditor = !!getSettings()?.[import_private_keys.isIsolatedEditorKey];
|
|
62
66
|
const hasTemplateLock = clientIds.some(
|
|
63
67
|
(id) => getTemplateLock(id) === "contentOnly"
|
|
64
68
|
);
|
|
@@ -66,7 +70,7 @@ function getBlockIconVariant({ select, clientIds }) {
|
|
|
66
70
|
const blockName = isSingleBlock && getBlockName(clientIds[0]);
|
|
67
71
|
const hasBlockStyles = isSingleBlock && !!getBlockStyles(blockName)?.length;
|
|
68
72
|
const hasPatternNameInSelection = clientIds.some(
|
|
69
|
-
(id) => !!getBlockAttributes(id)?.metadata?.patternName
|
|
73
|
+
(id) => !!getBlockAttributes(id)?.metadata?.patternName && !isWithinEditedContentOnlySection(id) && !isIsolatedEditor
|
|
70
74
|
);
|
|
71
75
|
const hasPatternOverrides = clientIds.every(
|
|
72
76
|
(clientId) => (0, import_block_bindings.hasPatternOverridesDefaultBinding)(
|
|
@@ -94,13 +98,17 @@ function getBlockIconVariant({ select, clientIds }) {
|
|
|
94
98
|
return "default";
|
|
95
99
|
}
|
|
96
100
|
function getBlockIcon({ select, clientIds }) {
|
|
97
|
-
const {
|
|
98
|
-
|
|
99
|
-
|
|
101
|
+
const {
|
|
102
|
+
getBlockName,
|
|
103
|
+
getBlockAttributes,
|
|
104
|
+
isWithinEditedContentOnlySection,
|
|
105
|
+
getSettings
|
|
106
|
+
} = (0, import_lock_unlock.unlock)(select(import_store.store));
|
|
107
|
+
const isIsolatedEditor = !!getSettings()?.[import_private_keys.isIsolatedEditorKey];
|
|
100
108
|
const _isSingleBlock = clientIds.length === 1;
|
|
101
109
|
const firstClientId = clientIds[0];
|
|
102
110
|
const blockAttributes = getBlockAttributes(firstClientId);
|
|
103
|
-
if (_isSingleBlock && blockAttributes?.metadata?.patternName) {
|
|
111
|
+
if (_isSingleBlock && blockAttributes?.metadata?.patternName && !isWithinEditedContentOnlySection(firstClientId) && !isIsolatedEditor) {
|
|
104
112
|
return import_icons.symbol;
|
|
105
113
|
}
|
|
106
114
|
const blockName = getBlockName(firstClientId);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-toolbar/block-toolbar-icon.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { copy, symbol } from '@wordpress/icons';\nimport { getBlockType, store as blocksStore } from '@wordpress/blocks';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport BlockSwitcher from '../block-switcher';\nimport BlockIcon from '../block-icon';\nimport BlockStylesDropdown from './block-styles-dropdown';\nimport PatternOverridesDropdown from './pattern-overrides-dropdown';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport { store as blockEditorStore } from '../../store';\nimport { hasPatternOverridesDefaultBinding } from '../../utils/block-bindings';\nimport { unlock } from '../../lock-unlock';\n\nfunction getBlockIconVariant( { select, clientIds } ) {\n\tconst {\n\t\tgetBlockName,\n\t\tgetBlockAttributes,\n\t\tgetBlockParentsByBlockName,\n\t\tcanRemoveBlocks,\n\t\tgetTemplateLock,\n\t\tgetBlockEditingMode,\n\t\tcanEditBlock,\n\t} = unlock( select( blockEditorStore ) );\n\tconst { getBlockStyles } = select( blocksStore );\n\n\tconst hasTemplateLock = clientIds.some(\n\t\t( id ) => getTemplateLock( id ) === 'contentOnly'\n\t);\n\n\t// Calculate props only used in this function\n\tconst isSingleBlock = clientIds.length === 1;\n\tconst blockName = isSingleBlock && getBlockName( clientIds[ 0 ] );\n\tconst hasBlockStyles =\n\t\tisSingleBlock && !! getBlockStyles( blockName )?.length;\n\tconst hasPatternNameInSelection = clientIds.some(\n\t\t( id )
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA8B;AAC9B,kBAAmB;AACnB,kBAA0B;AAC1B,mBAA6B;AAC7B,oBAAmD;AACnD,yBAA0C;AAK1C,4BAA0B;AAC1B,wBAAsB;AACtB,mCAAgC;AAChC,wCAAqC;AACrC,qCAAiC;AACjC,mBAA0C;AAC1C,4BAAkD;AAClD,yBAAuB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { copy, symbol } from '@wordpress/icons';\nimport { getBlockType, store as blocksStore } from '@wordpress/blocks';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport BlockSwitcher from '../block-switcher';\nimport BlockIcon from '../block-icon';\nimport BlockStylesDropdown from './block-styles-dropdown';\nimport PatternOverridesDropdown from './pattern-overrides-dropdown';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport { store as blockEditorStore } from '../../store';\nimport { hasPatternOverridesDefaultBinding } from '../../utils/block-bindings';\nimport { unlock } from '../../lock-unlock';\nimport { isIsolatedEditorKey } from '../../store/private-keys';\n\nfunction getBlockIconVariant( { select, clientIds } ) {\n\tconst {\n\t\tgetBlockName,\n\t\tgetBlockAttributes,\n\t\tgetBlockParentsByBlockName,\n\t\tcanRemoveBlocks,\n\t\tgetTemplateLock,\n\t\tgetBlockEditingMode,\n\t\tcanEditBlock,\n\t\tisWithinEditedContentOnlySection,\n\t\tgetSettings,\n\t} = unlock( select( blockEditorStore ) );\n\tconst { getBlockStyles } = select( blocksStore );\n\tconst isIsolatedEditor = !! getSettings()?.[ isIsolatedEditorKey ];\n\n\tconst hasTemplateLock = clientIds.some(\n\t\t( id ) => getTemplateLock( id ) === 'contentOnly'\n\t);\n\n\t// Calculate props only used in this function\n\tconst isSingleBlock = clientIds.length === 1;\n\tconst blockName = isSingleBlock && getBlockName( clientIds[ 0 ] );\n\tconst hasBlockStyles =\n\t\tisSingleBlock && !! getBlockStyles( blockName )?.length;\n\tconst hasPatternNameInSelection = clientIds.some(\n\t\t( id ) =>\n\t\t\t!! getBlockAttributes( id )?.metadata?.patternName &&\n\t\t\t! isWithinEditedContentOnlySection( id ) &&\n\t\t\t! isIsolatedEditor\n\t);\n\tconst hasPatternOverrides = clientIds.every( ( clientId ) =>\n\t\thasPatternOverridesDefaultBinding(\n\t\t\tgetBlockAttributes( clientId )?.metadata?.bindings\n\t\t)\n\t);\n\tconst hasParentPattern = clientIds.every(\n\t\t( clientId ) =>\n\t\t\tgetBlockParentsByBlockName( clientId, 'core/block', true ).length >\n\t\t\t0\n\t);\n\tconst canRemove = canRemoveBlocks( clientIds );\n\tconst canEdit = clientIds.every( ( clientId ) => canEditBlock( clientId ) );\n\tconst editingMode = getBlockEditingMode( clientIds[ 0 ] );\n\tconst isDefaultEditingMode = editingMode === 'default';\n\tconst isContentOnlyMode = editingMode === 'contentOnly';\n\tconst _hideTransformsForSections = hasPatternNameInSelection;\n\tconst _showBlockSwitcher =\n\t\t! _hideTransformsForSections &&\n\t\tisDefaultEditingMode &&\n\t\t( hasBlockStyles || canRemove ) &&\n\t\t! hasTemplateLock &&\n\t\tcanEdit;\n\n\tconst _showPatternOverrides = hasPatternOverrides && hasParentPattern;\n\n\tif ( _showBlockSwitcher ) {\n\t\treturn 'switcher';\n\t} else if (\n\t\tisContentOnlyMode &&\n\t\thasBlockStyles &&\n\t\t! hasPatternOverrides &&\n\t\tcanEdit\n\t) {\n\t\treturn 'styles-only';\n\t} else if ( _showPatternOverrides ) {\n\t\treturn 'pattern-overrides';\n\t}\n\n\treturn 'default';\n}\n\nfunction getBlockIcon( { select, clientIds } ) {\n\tconst {\n\t\tgetBlockName,\n\t\tgetBlockAttributes,\n\t\tisWithinEditedContentOnlySection,\n\t\tgetSettings,\n\t} = unlock( select( blockEditorStore ) );\n\tconst isIsolatedEditor = !! getSettings()?.[ isIsolatedEditorKey ];\n\n\tconst _isSingleBlock = clientIds.length === 1;\n\tconst firstClientId = clientIds[ 0 ];\n\n\tconst blockAttributes = getBlockAttributes( firstClientId );\n\tif (\n\t\t_isSingleBlock &&\n\t\tblockAttributes?.metadata?.patternName &&\n\t\t! isWithinEditedContentOnlySection( firstClientId ) &&\n\t\t! isIsolatedEditor\n\t) {\n\t\treturn symbol;\n\t}\n\n\tconst blockName = getBlockName( firstClientId );\n\tconst blockType = getBlockType( blockName );\n\tif ( _isSingleBlock ) {\n\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\t\tconst match = getActiveBlockVariation( blockName, blockAttributes );\n\t\treturn match?.icon || blockType?.icon;\n\t}\n\n\tconst blockNames = clientIds.map( ( id ) => getBlockName( id ) );\n\tconst isSelectionOfSameType = new Set( blockNames ).size === 1;\n\treturn isSelectionOfSameType ? blockType?.icon : copy;\n}\n\nexport default function BlockToolbarIcon( { clientIds, isSynced } ) {\n\tconst { icon, showIconLabels, variant } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\ticon: getBlockIcon( { select, clientIds } ),\n\t\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t\t'core',\n\t\t\t\t\t'showIconLabels'\n\t\t\t\t),\n\t\t\t\tvariant: getBlockIconVariant( {\n\t\t\t\t\tselect,\n\t\t\t\t\tclientIds,\n\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId: clientIds?.[ 0 ],\n\t\tmaximumLength: 35,\n\t} );\n\n\tconst isSingleBlock = clientIds.length === 1;\n\tconst showBlockTitle = isSingleBlock && isSynced && ! showIconLabels;\n\tconst label = isSingleBlock ? blockTitle : __( 'Multiple blocks selected' );\n\t// Used to hide the block icon when the showIconLabels preference is enabled, or to display the template title when it's a template.\n\tconst text = showBlockTitle && blockTitle ? blockTitle : undefined;\n\n\tconst BlockIconElement = (\n\t\t<BlockIcon\n\t\t\tclassName=\"block-editor-block-toolbar__block-icon\"\n\t\t\ticon={ icon }\n\t\t/>\n\t);\n\n\tif ( variant === 'switcher' ) {\n\t\treturn (\n\t\t\t<BlockSwitcher\n\t\t\t\tclientIds={ clientIds }\n\t\t\t\tlabel={ label }\n\t\t\t\ttext={ text }\n\t\t\t>\n\t\t\t\t{ BlockIconElement }\n\t\t\t</BlockSwitcher>\n\t\t);\n\t}\n\n\tif ( variant === 'styles-only' ) {\n\t\treturn (\n\t\t\t<BlockStylesDropdown\n\t\t\t\tclientIds={ clientIds }\n\t\t\t\tlabel={ label }\n\t\t\t\ttext={ text }\n\t\t\t>\n\t\t\t\t{ BlockIconElement }\n\t\t\t</BlockStylesDropdown>\n\t\t);\n\t}\n\n\tif ( variant === 'pattern-overrides' ) {\n\t\treturn (\n\t\t\t<PatternOverridesDropdown\n\t\t\t\ticon={ BlockIconElement }\n\t\t\t\tclientIds={ clientIds }\n\t\t\t\tblockTitle={ blockTitle }\n\t\t\t\tlabel={ label }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tdisabled\n\t\t\tclassName=\"block-editor-block-toolbar__block-icon-button\"\n\t\t\ttitle={ label }\n\t\t\ticon={ BlockIconElement }\n\t\t\ttext={ text }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA8B;AAC9B,kBAAmB;AACnB,kBAA0B;AAC1B,mBAA6B;AAC7B,oBAAmD;AACnD,yBAA0C;AAK1C,4BAA0B;AAC1B,wBAAsB;AACtB,mCAAgC;AAChC,wCAAqC;AACrC,qCAAiC;AACjC,mBAA0C;AAC1C,4BAAkD;AAClD,yBAAuB;AACvB,0BAAoC;AA0IlC;AAxIF,SAAS,oBAAqB,EAAE,QAAQ,UAAU,GAAI;AACrD,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI,2BAAQ,OAAQ,aAAAA,KAAiB,CAAE;AACvC,QAAM,EAAE,eAAe,IAAI,OAAQ,cAAAC,KAAY;AAC/C,QAAM,mBAAmB,CAAC,CAAE,YAAY,IAAK,uCAAoB;AAEjE,QAAM,kBAAkB,UAAU;AAAA,IACjC,CAAE,OAAQ,gBAAiB,EAAG,MAAM;AAAA,EACrC;AAGA,QAAM,gBAAgB,UAAU,WAAW;AAC3C,QAAM,YAAY,iBAAiB,aAAc,UAAW,CAAE,CAAE;AAChE,QAAM,iBACL,iBAAiB,CAAC,CAAE,eAAgB,SAAU,GAAG;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,IACH;AAAA,EAEF;AAEA,MAAK,YAAY,eAAgB;AAChC,WACC;AAAA,MAAC,6BAAAC;AAAA,MAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAEE;AAAA;AAAA,IACH;AAAA,EAEF;AAEA,MAAK,YAAY,qBAAsB;AACtC,WACC;AAAA,MAAC,kCAAAC;AAAA,MAAA;AAAA,QACA,MAAO;AAAA,QACP;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,EAEF;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,UAAQ;AAAA,MACR,WAAU;AAAA,MACV,OAAQ;AAAA,MACR,MAAO;AAAA,MACP;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": ["blockEditorStore", "blocksStore", "preferencesStore", "useBlockDisplayTitle", "BlockIcon", "BlockSwitcher", "BlockStylesDropdown", "PatternOverridesDropdown"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-toolbar/edit-section-button.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { isReusableBlock, isTemplatePart } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport useContentOnlySectionEdit from '../../hooks/use-content-only-section-edit';\n\nexport default function EditSectionButton( { clientId } ) {\n\tconst {\n\t\tisSectionBlock,\n\t\tisEditingContentOnlySection,\n\t\teditContentOnlySection,\n\t\tstopEditingContentOnlySection,\n\t} = useContentOnlySectionEdit( clientId );\n\n\tconst blockType = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst { getBlockName } = select( blockEditorStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\treturn blockName ? { name: blockName } : null;\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Don't show for synced patterns or template parts
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { isReusableBlock, isTemplatePart } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport useContentOnlySectionEdit from '../../hooks/use-content-only-section-edit';\n\nexport default function EditSectionButton( { clientId } ) {\n\tconst {\n\t\tisSectionBlock,\n\t\tisEditingContentOnlySection,\n\t\teditContentOnlySection,\n\t\tstopEditingContentOnlySection,\n\t} = useContentOnlySectionEdit( clientId );\n\n\tconst blockType = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst { getBlockName } = select( blockEditorStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\treturn blockName ? { name: blockName } : null;\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Don't show for synced patterns or template parts — they already have\n\t// their own toolbar buttons (\"Edit original\").\n\t// Note: isSectionBlock returns false while the section is being edited,\n\t// so we also check isEditingContentOnlySection to show \"Exit pattern\".\n\tif (\n\t\t! clientId ||\n\t\t( ! isSectionBlock && ! isEditingContentOnlySection ) ||\n\t\tisReusableBlock( blockType ) ||\n\t\tisTemplatePart( blockType )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst isEditing = isEditingContentOnlySection;\n\n\tconst handleClick = () => {\n\t\tif ( isEditing ) {\n\t\t\tstopEditingContentOnlySection();\n\t\t} else {\n\t\t\teditContentOnlySection( clientId );\n\t\t}\n\t};\n\n\treturn (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarButton onClick={ handleClick }>\n\t\t\t\t{ isEditing\n\t\t\t\t\t? /* translators: Button label to leave pattern editing mode. */\n\t\t\t\t\t __( 'Exit pattern' )\n\t\t\t\t\t: /* translators: Button label to enter pattern editing mode. */\n\t\t\t\t\t __( 'Edit pattern' ) }\n\t\t\t</ToolbarButton>\n\t\t</ToolbarGroup>\n\t);\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA4C;AAC5C,kBAAmB;AACnB,kBAA0B;AAC1B,oBAAgD;AAKhD,mBAA0C;AAC1C,2CAAsC;AA+CnC;AA7CY,SAAR,kBAAoC,EAAE,SAAS,GAAI;AACzD,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI,qCAAAA,SAA2B,QAAS;AAExC,QAAM,gBAAY;AAAA,IACjB,CAAE,WAAY;AACb,UAAK,CAAE,UAAW;AACjB,eAAO;AAAA,MACR;AACA,YAAM,EAAE,aAAa,IAAI,OAAQ,aAAAC,KAAiB;AAClD,YAAM,YAAY,aAAc,QAAS;AACzC,aAAO,YAAY,EAAE,MAAM,UAAU,IAAI;AAAA,IAC1C;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AAMA,MACC,CAAE,YACA,CAAE,kBAAkB,CAAE,mCACxB,+BAAiB,SAAU,SAC3B,8BAAgB,SAAU,GACzB;AACD,WAAO;AAAA,EACR;AAEA,QAAM,YAAY;AAElB,QAAM,cAAc,MAAM;AACzB,QAAK,WAAY;AAChB,oCAA8B;AAAA,IAC/B,OAAO;AACN,6BAAwB,QAAS;AAAA,IAClC;AAAA,EACD;AAEA,SACC,4CAAC,kCACA,sDAAC,mCAAc,SAAU,aACtB;AAAA;AAAA,QAEC,gBAAI,cAAe;AAAA;AAAA;AAAA,QAEnB,gBAAI,cAAe;AAAA,KACvB,GACD;AAEF;",
|
|
6
6
|
"names": ["useContentOnlySectionEdit", "blockEditorStore"]
|
|
7
7
|
}
|
|
@@ -107,7 +107,13 @@ function useBlockToolbarPopoverProps({
|
|
|
107
107
|
isSticky
|
|
108
108
|
)
|
|
109
109
|
),
|
|
110
|
-
[
|
|
110
|
+
[
|
|
111
|
+
contentElement,
|
|
112
|
+
selectedBlockElement,
|
|
113
|
+
scrollContainer,
|
|
114
|
+
toolbarHeight,
|
|
115
|
+
isSticky
|
|
116
|
+
]
|
|
111
117
|
);
|
|
112
118
|
(0, import_element.useLayoutEffect)(updateProps, [blockIndex, updateProps]);
|
|
113
119
|
(0, import_element.useLayoutEffect)(() => {
|
|
@@ -115,15 +121,15 @@ function useBlockToolbarPopoverProps({
|
|
|
115
121
|
return;
|
|
116
122
|
}
|
|
117
123
|
const contentView = contentElement?.ownerDocument?.defaultView;
|
|
118
|
-
contentView?.
|
|
124
|
+
contentView?.addEventListener?.("resize", updateProps);
|
|
119
125
|
let resizeObserver;
|
|
120
126
|
const blockView = selectedBlockElement?.ownerDocument?.defaultView;
|
|
121
|
-
if (blockView
|
|
127
|
+
if (blockView?.ResizeObserver) {
|
|
122
128
|
resizeObserver = new blockView.ResizeObserver(updateProps);
|
|
123
129
|
resizeObserver.observe(selectedBlockElement);
|
|
124
130
|
}
|
|
125
131
|
return () => {
|
|
126
|
-
contentView?.
|
|
132
|
+
contentView?.removeEventListener?.("resize", updateProps);
|
|
127
133
|
if (resizeObserver) {
|
|
128
134
|
resizeObserver.disconnect();
|
|
129
135
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-tools/use-block-toolbar-popover-props.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { getScrollContainer } from '@wordpress/dom';\nimport {\n\tuseCallback,\n\tuseLayoutEffect,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport { hasStickyOrFixedPositionValue } from '../../hooks/position';\nimport { getElementBounds } from '../../utils/dom';\n\nconst COMMON_PROPS = {\n\tplacement: 'top-start',\n};\n\n// By default the toolbar sets the `shift` prop. If the user scrolls the page\n// down the toolbar will stay on screen by adopting a sticky position at the\n// top of the viewport.\nconst DEFAULT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: false,\n\tshift: true,\n};\n\n// When there isn't enough height between the top of the block and the editor\n// canvas, the `shift` prop is set to `false`, as it will cause the block to be\n// obscured. The `flip` behavior is enabled, which positions the toolbar below\n// the block. This only happens if the block is smaller than the viewport, as\n// otherwise the toolbar will be off-screen.\nconst RESTRICTED_HEIGHT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: true,\n\tshift: false,\n};\n\n/**\n * Get the popover props for the block toolbar, determined by the space at the top of the canvas and the toolbar height.\n *\n * @param {Element} contentElement The DOM element that represents the editor content or canvas.\n * @param {Element} selectedBlockElement The outer DOM element of the first selected block.\n * @param {Element} scrollContainer The scrollable container for the contentElement.\n * @param {number} toolbarHeight The height of the toolbar in pixels.\n * @param {boolean} isSticky Whether or not the selected block is sticky or fixed.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nfunction getProps(\n\tcontentElement,\n\tselectedBlockElement,\n\tscrollContainer,\n\ttoolbarHeight,\n\tisSticky\n) {\n\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\t// Get how far the content area has been scrolled.\n\tconst scrollTop = scrollContainer?.scrollTop || 0;\n\n\tconst blockRect = getElementBounds( selectedBlockElement );\n\tconst contentRect = contentElement.getBoundingClientRect();\n\n\t// Get the vertical position of top of the visible content area.\n\tconst topOfContentElementInViewport = scrollTop + contentRect.top;\n\n\t// The document element's clientHeight represents the viewport height.\n\tconst viewportHeight =\n\t\tcontentElement.ownerDocument.documentElement.clientHeight;\n\n\t// The restricted height area is calculated as the sum of the\n\t// vertical position of the visible content area, plus the height\n\t// of the block toolbar.\n\tconst restrictedTopArea = topOfContentElementInViewport + toolbarHeight;\n\tconst hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea;\n\n\tconst isBlockTallerThanViewport =\n\t\tblockRect.height > viewportHeight - toolbarHeight;\n\n\t// Sticky blocks are treated as if they will never have enough space for the toolbar above.\n\tif (\n\t\t! isSticky &&\n\t\t( hasSpaceForToolbarAbove || isBlockTallerThanViewport )\n\t) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\treturn RESTRICTED_HEIGHT_PROPS;\n}\n\n/**\n * Determines the desired popover positioning behavior, returning a set of appropriate props.\n *\n * @param {Object} elements\n * @param {Element} elements.contentElement The DOM element that represents the editor content or canvas.\n * @param {string} elements.clientId The clientId of the first selected block.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nexport default function useBlockToolbarPopoverProps( {\n\tcontentElement,\n\tclientId,\n} ) {\n\tconst selectedBlockElement = useBlockElement( clientId );\n\tconst [ toolbarHeight, setToolbarHeight ] = useState( 0 );\n\tconst { blockIndex, isSticky } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockIndex, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\tisSticky: hasStickyOrFixedPositionValue(\n\t\t\t\t\tgetBlockAttributes( clientId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst scrollContainer = useMemo( () => {\n\t\tif ( ! contentElement ) {\n\t\t\treturn;\n\t\t}\n\t\treturn getScrollContainer( contentElement );\n\t}, [ contentElement ] );\n\tconst [ props, setProps ] = useState( () =>\n\t\tgetProps(\n\t\t\tcontentElement,\n\t\t\tselectedBlockElement,\n\t\t\tscrollContainer,\n\t\t\ttoolbarHeight,\n\t\t\tisSticky\n\t\t)\n\t);\n\n\tconst popoverRef = useRefEffect( ( popoverNode ) => {\n\t\tsetToolbarHeight( popoverNode.offsetHeight );\n\t}, [] );\n\n\tconst updateProps = useCallback(\n\t\t() =>\n\t\t\tsetProps(\n\t\t\t\tgetProps(\n\t\t\t\t\tcontentElement,\n\t\t\t\t\tselectedBlockElement,\n\t\t\t\t\tscrollContainer,\n\t\t\t\t\ttoolbarHeight,\n\t\t\t\t\tisSticky\n\t\t\t\t)\n\t\t\t),\n\t\t[
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA6B;AAC7B,kBAA0B;AAC1B,iBAAmC;AACnC,qBAKO;AAKP,mBAA0C;AAC1C,4BAAgC;AAChC,sBAA8C;AAC9C,IAAAA,cAAiC;AAEjC,IAAM,eAAe;AAAA,EACpB,WAAW;AACZ;AAKA,IAAM,gBAAgB;AAAA,EACrB,GAAG;AAAA,EACH,MAAM;AAAA,EACN,OAAO;AACR;AAOA,IAAM,0BAA0B;AAAA,EAC/B,GAAG;AAAA,EACH,MAAM;AAAA,EACN,OAAO;AACR;AAaA,SAAS,SACR,gBACA,sBACA,iBACA,eACA,UACC;AACD,MAAK,CAAE,kBAAkB,CAAE,sBAAuB;AACjD,WAAO;AAAA,EACR;AAGA,QAAM,YAAY,iBAAiB,aAAa;AAEhD,QAAM,gBAAY,8BAAkB,oBAAqB;AACzD,QAAM,cAAc,eAAe,sBAAsB;AAGzD,QAAM,gCAAgC,YAAY,YAAY;AAG9D,QAAM,iBACL,eAAe,cAAc,gBAAgB;AAK9C,QAAM,oBAAoB,gCAAgC;AAC1D,QAAM,0BAA0B,UAAU,MAAM;AAEhD,QAAM,4BACL,UAAU,SAAS,iBAAiB;AAGrC,MACC,CAAE,aACA,2BAA2B,4BAC5B;AACD,WAAO;AAAA,EACR;AAEA,SAAO;AACR;AAWe,SAAR,4BAA8C;AAAA,EACpD;AAAA,EACA;AACD,GAAI;AACH,QAAM,2BAAuB,uCAAiB,QAAS;AACvD,QAAM,CAAE,eAAe,gBAAiB,QAAI,yBAAU,CAAE;AACxD,QAAM,EAAE,YAAY,SAAS,QAAI;AAAA,IAChC,CAAE,WAAY;AACb,YAAM,EAAE,eAAe,mBAAmB,IACzC,OAAQ,aAAAC,KAAiB;AAC1B,aAAO;AAAA,QACN,YAAY,cAAe,QAAS;AAAA,QACpC,cAAU;AAAA,UACT,mBAAoB,QAAS;AAAA,QAC9B;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AACA,QAAM,sBAAkB,wBAAS,MAAM;AACtC,QAAK,CAAE,gBAAiB;AACvB;AAAA,IACD;AACA,eAAO,+BAAoB,cAAe;AAAA,EAC3C,GAAG,CAAE,cAAe,CAAE;AACtB,QAAM,CAAE,OAAO,QAAS,QAAI;AAAA,IAAU,MACrC;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAEA,QAAM,iBAAa,6BAAc,CAAE,gBAAiB;AACnD,qBAAkB,YAAY,YAAa;AAAA,EAC5C,GAAG,CAAC,CAAE;AAEN,QAAM,kBAAc;AAAA,IACnB,MACC;AAAA,MACC;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAAA,IACD,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { getScrollContainer } from '@wordpress/dom';\nimport {\n\tuseCallback,\n\tuseLayoutEffect,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport { hasStickyOrFixedPositionValue } from '../../hooks/position';\nimport { getElementBounds } from '../../utils/dom';\n\nconst COMMON_PROPS = {\n\tplacement: 'top-start',\n};\n\n// By default the toolbar sets the `shift` prop. If the user scrolls the page\n// down the toolbar will stay on screen by adopting a sticky position at the\n// top of the viewport.\nconst DEFAULT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: false,\n\tshift: true,\n};\n\n// When there isn't enough height between the top of the block and the editor\n// canvas, the `shift` prop is set to `false`, as it will cause the block to be\n// obscured. The `flip` behavior is enabled, which positions the toolbar below\n// the block. This only happens if the block is smaller than the viewport, as\n// otherwise the toolbar will be off-screen.\nconst RESTRICTED_HEIGHT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: true,\n\tshift: false,\n};\n\n/**\n * Get the popover props for the block toolbar, determined by the space at the top of the canvas and the toolbar height.\n *\n * @param {Element} contentElement The DOM element that represents the editor content or canvas.\n * @param {Element} selectedBlockElement The outer DOM element of the first selected block.\n * @param {Element} scrollContainer The scrollable container for the contentElement.\n * @param {number} toolbarHeight The height of the toolbar in pixels.\n * @param {boolean} isSticky Whether or not the selected block is sticky or fixed.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nfunction getProps(\n\tcontentElement,\n\tselectedBlockElement,\n\tscrollContainer,\n\ttoolbarHeight,\n\tisSticky\n) {\n\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\t// Get how far the content area has been scrolled.\n\tconst scrollTop = scrollContainer?.scrollTop || 0;\n\n\tconst blockRect = getElementBounds( selectedBlockElement );\n\tconst contentRect = contentElement.getBoundingClientRect();\n\n\t// Get the vertical position of top of the visible content area.\n\tconst topOfContentElementInViewport = scrollTop + contentRect.top;\n\n\t// The document element's clientHeight represents the viewport height.\n\tconst viewportHeight =\n\t\tcontentElement.ownerDocument.documentElement.clientHeight;\n\n\t// The restricted height area is calculated as the sum of the\n\t// vertical position of the visible content area, plus the height\n\t// of the block toolbar.\n\tconst restrictedTopArea = topOfContentElementInViewport + toolbarHeight;\n\tconst hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea;\n\n\tconst isBlockTallerThanViewport =\n\t\tblockRect.height > viewportHeight - toolbarHeight;\n\n\t// Sticky blocks are treated as if they will never have enough space for the toolbar above.\n\tif (\n\t\t! isSticky &&\n\t\t( hasSpaceForToolbarAbove || isBlockTallerThanViewport )\n\t) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\treturn RESTRICTED_HEIGHT_PROPS;\n}\n\n/**\n * Determines the desired popover positioning behavior, returning a set of appropriate props.\n *\n * @param {Object} elements\n * @param {Element} elements.contentElement The DOM element that represents the editor content or canvas.\n * @param {string} elements.clientId The clientId of the first selected block.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nexport default function useBlockToolbarPopoverProps( {\n\tcontentElement,\n\tclientId,\n} ) {\n\tconst selectedBlockElement = useBlockElement( clientId );\n\tconst [ toolbarHeight, setToolbarHeight ] = useState( 0 );\n\tconst { blockIndex, isSticky } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockIndex, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\tisSticky: hasStickyOrFixedPositionValue(\n\t\t\t\t\tgetBlockAttributes( clientId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst scrollContainer = useMemo( () => {\n\t\tif ( ! contentElement ) {\n\t\t\treturn;\n\t\t}\n\t\treturn getScrollContainer( contentElement );\n\t}, [ contentElement ] );\n\tconst [ props, setProps ] = useState( () =>\n\t\tgetProps(\n\t\t\tcontentElement,\n\t\t\tselectedBlockElement,\n\t\t\tscrollContainer,\n\t\t\ttoolbarHeight,\n\t\t\tisSticky\n\t\t)\n\t);\n\n\tconst popoverRef = useRefEffect( ( popoverNode ) => {\n\t\tsetToolbarHeight( popoverNode.offsetHeight );\n\t}, [] );\n\n\tconst updateProps = useCallback(\n\t\t() =>\n\t\t\tsetProps(\n\t\t\t\tgetProps(\n\t\t\t\t\tcontentElement,\n\t\t\t\t\tselectedBlockElement,\n\t\t\t\t\tscrollContainer,\n\t\t\t\t\ttoolbarHeight,\n\t\t\t\t\tisSticky\n\t\t\t\t)\n\t\t\t),\n\t\t[\n\t\t\tcontentElement,\n\t\t\tselectedBlockElement,\n\t\t\tscrollContainer,\n\t\t\ttoolbarHeight,\n\t\t\tisSticky,\n\t\t]\n\t);\n\n\t// Update props when the block is moved. This also ensures the props are\n\t// correct on initial mount, and when the selected block or content element\n\t// changes (since the callback ref will update).\n\tuseLayoutEffect( updateProps, [ blockIndex, updateProps ] );\n\n\t// Update props when the viewport is resized or the block is resized.\n\tuseLayoutEffect( () => {\n\t\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update the toolbar props on viewport resize.\n\t\tconst contentView = contentElement?.ownerDocument?.defaultView;\n\t\tcontentView?.addEventListener?.( 'resize', updateProps );\n\n\t\t// Update the toolbar props on block resize.\n\t\tlet resizeObserver;\n\t\tconst blockView = selectedBlockElement?.ownerDocument?.defaultView;\n\t\tif ( blockView?.ResizeObserver ) {\n\t\t\tresizeObserver = new blockView.ResizeObserver( updateProps );\n\t\t\tresizeObserver.observe( selectedBlockElement );\n\t\t}\n\n\t\treturn () => {\n\t\t\tcontentView?.removeEventListener?.( 'resize', updateProps );\n\n\t\t\tif ( resizeObserver ) {\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t}\n\t\t};\n\t}, [ updateProps, contentElement, selectedBlockElement ] );\n\n\treturn {\n\t\t...props,\n\t\tref: popoverRef,\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA6B;AAC7B,kBAA0B;AAC1B,iBAAmC;AACnC,qBAKO;AAKP,mBAA0C;AAC1C,4BAAgC;AAChC,sBAA8C;AAC9C,IAAAA,cAAiC;AAEjC,IAAM,eAAe;AAAA,EACpB,WAAW;AACZ;AAKA,IAAM,gBAAgB;AAAA,EACrB,GAAG;AAAA,EACH,MAAM;AAAA,EACN,OAAO;AACR;AAOA,IAAM,0BAA0B;AAAA,EA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