@wordpress/block-editor 15.21.0 → 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 +23 -1
- 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-compare/index.cjs +2 -2
- package/build/components/block-compare/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 +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-switcher/block-transformations-menu.cjs +16 -15
- package/build/components/block-switcher/block-transformations-menu.cjs.map +2 -2
- package/build/components/block-switcher/index.cjs +4 -4
- package/build/components/block-switcher/index.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/advanced-panel.cjs +23 -15
- package/build/components/global-styles/advanced-panel.cjs.map +2 -2
- package/build/components/global-styles/background-panel.cjs +154 -26
- package/build/components/global-styles/background-panel.cjs.map +3 -3
- package/build/components/global-styles/border-panel.cjs +2 -0
- package/build/components/global-styles/border-panel.cjs.map +2 -2
- 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 +2 -5
- 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/inner-blocks/use-inner-block-template-sync.cjs +3 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.cjs.map +2 -2
- package/build/components/inserter/get-appender-label.cjs.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.cjs +1 -1
- package/build/components/inserter/hooks/use-patterns-state.cjs.map +2 -2
- package/build/components/inserter/index.cjs +179 -220
- package/build/components/inserter/index.cjs.map +3 -3
- 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/inserter/search-results.cjs +1 -1
- package/build/components/inserter/search-results.cjs.map +2 -2
- 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 +9 -20
- package/build/components/list-view/block-select-button.cjs.map +3 -3
- package/build/components/list-view/block.cjs +2 -1
- package/build/components/list-view/block.cjs.map +2 -2
- 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 +14 -3
- package/build/components/provider/use-block-sync.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/before-input-rules.cjs +5 -5
- package/build/components/rich-text/event-listeners/before-input-rules.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/delete.cjs +4 -4
- package/build/components/rich-text/event-listeners/delete.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/enter.cjs +7 -2
- package/build/components/rich-text/event-listeners/enter.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/input-events.cjs +4 -4
- package/build/components/rich-text/event-listeners/input-events.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/input-rules.cjs +17 -4
- package/build/components/rich-text/event-listeners/input-rules.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/insert-replacement-text.cjs +4 -4
- package/build/components/rich-text/event-listeners/insert-replacement-text.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/paste-handler.cjs.map +1 -1
- package/build/components/rich-text/event-listeners/remove-browser-shortcuts.cjs +4 -4
- package/build/components/rich-text/event-listeners/remove-browser-shortcuts.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/shortcuts.cjs +4 -4
- package/build/components/rich-text/event-listeners/shortcuts.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/undo-automatic-change.cjs +4 -4
- package/build/components/rich-text/event-listeners/undo-automatic-change.cjs.map +3 -3
- package/build/components/rich-text/index.cjs +1 -23
- package/build/components/rich-text/index.cjs.map +2 -2
- 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-commands/index.cjs +5 -5
- package/build/components/use-block-commands/index.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 +12 -17
- 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/border.cjs +0 -3
- package/build/hooks/border.cjs.map +2 -2
- package/build/hooks/color.cjs +0 -165
- 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 -5
- 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/fit-text.cjs +11 -0
- package/build/hooks/fit-text.cjs.map +2 -2
- 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/position.cjs +19 -22
- package/build/hooks/position.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/supports.cjs +0 -7
- package/build/hooks/supports.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 +7 -3
- package/build/store/actions.cjs.map +2 -2
- package/build/store/private-actions.cjs +1 -2
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +42 -2
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +14 -6
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +60 -41
- package/build/store/selectors.cjs.map +2 -2
- 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/{components/rich-text/native/index.cjs → utils/transform-styles/types.cjs} +4 -13
- 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-compare/index.mjs +1 -1
- package/build-module/components/block-compare/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 +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-switcher/block-transformations-menu.mjs +16 -15
- package/build-module/components/block-switcher/block-transformations-menu.mjs.map +2 -2
- package/build-module/components/block-switcher/index.mjs +4 -4
- package/build-module/components/block-switcher/index.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/advanced-panel.mjs +23 -15
- package/build-module/components/global-styles/advanced-panel.mjs.map +2 -2
- package/build-module/components/global-styles/background-panel.mjs +157 -29
- package/build-module/components/global-styles/background-panel.mjs.map +2 -2
- package/build-module/components/global-styles/border-panel.mjs +2 -0
- package/build-module/components/global-styles/border-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 +3 -7
- 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/inner-blocks/use-inner-block-template-sync.mjs +3 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.mjs.map +2 -2
- package/build-module/components/inserter/get-appender-label.mjs.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.mjs +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.mjs.map +2 -2
- package/build-module/components/inserter/index.mjs +185 -222
- package/build-module/components/inserter/index.mjs.map +3 -3
- 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/inserter/search-results.mjs +1 -1
- package/build-module/components/inserter/search-results.mjs.map +2 -2
- 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 +10 -27
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +2 -1
- package/build-module/components/list-view/block.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 +14 -3
- package/build-module/components/provider/use-block-sync.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs +5 -5
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/delete.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/delete.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs +7 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/input-events.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/input-events.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/input-rules.mjs +17 -4
- package/build-module/components/rich-text/event-listeners/input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +1 -1
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/shortcuts.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/shortcuts.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +1 -23
- package/build-module/components/rich-text/index.mjs.map +2 -2
- 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-commands/index.mjs +5 -5
- package/build-module/components/use-block-commands/index.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 +12 -17
- 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/border.mjs +1 -4
- package/build-module/hooks/border.mjs.map +2 -2
- package/build-module/hooks/color.mjs +2 -178
- 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 +13 -6
- 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/fit-text.mjs +11 -0
- package/build-module/hooks/fit-text.mjs.map +2 -2
- 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/position.mjs +20 -23
- package/build-module/hooks/position.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/supports.mjs +0 -7
- package/build-module/hooks/supports.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 +7 -3
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +1 -2
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +39 -1
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +14 -6
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +62 -42
- package/build-module/store/selectors.mjs.map +2 -2
- 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 +14 -0
- package/build-style/content.css +14 -0
- package/build-style/style-rtl.css +60 -49
- package/build-style/style.css +60 -49
- 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 +55 -46
- 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-breadcrumb/README.md +2 -2
- package/src/components/block-card/index.js +7 -13
- package/src/components/block-compare/README.md +6 -6
- package/src/components/block-compare/index.js +1 -3
- 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 +1 -2
- package/src/components/block-preview/README.md +1 -1
- package/src/components/block-quick-navigation/index.js +7 -7
- package/src/components/block-rename/modal.js +0 -1
- package/src/components/block-switcher/block-transformations-menu.js +16 -18
- package/src/components/block-switcher/index.js +4 -4
- 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-types-list/README.md +0 -19
- 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/advanced-panel.js +5 -1
- package/src/components/global-styles/background-panel.js +203 -36
- package/src/components/global-styles/border-panel.js +2 -0
- 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 +13 -18
- 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/inner-blocks/use-inner-block-template-sync.js +3 -1
- package/src/components/inserter/hooks/use-patterns-state.js +1 -1
- package/src/components/inserter/index.js +257 -288
- package/src/components/inserter/media-tab/media-preview.js +0 -1
- package/src/components/inserter/search-results.js +1 -3
- 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/justify-content-control/README.md +1 -1
- 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 +9 -29
- package/src/components/list-view/block.js +1 -0
- package/src/components/media-placeholder/README.md +1 -29
- package/src/components/media-upload/README.md +0 -19
- package/src/components/preset-input-control/custom-value-controls.js +0 -1
- package/src/components/provider/test/use-block-sync.js +40 -0
- package/src/components/provider/use-block-sync.js +15 -3
- package/src/components/rich-text/content.scss +2 -0
- package/src/components/rich-text/event-listeners/before-input-rules.js +5 -4
- package/src/components/rich-text/event-listeners/delete.js +9 -4
- package/src/components/rich-text/event-listeners/enter.js +9 -2
- package/src/components/rich-text/event-listeners/input-events.js +13 -4
- package/src/components/rich-text/event-listeners/input-rules.js +20 -4
- package/src/components/rich-text/event-listeners/insert-replacement-text.js +9 -4
- package/src/components/rich-text/event-listeners/remove-browser-shortcuts.js +9 -4
- package/src/components/rich-text/event-listeners/shortcuts.js +13 -4
- package/src/components/rich-text/event-listeners/undo-automatic-change.js +5 -4
- package/src/components/rich-text/index.js +1 -33
- package/src/components/unit-control/README.md +1 -1
- package/src/components/url-popover/README.md +1 -1
- package/src/components/url-popover/image-url-input-ui.js +0 -2
- package/src/components/use-block-commands/index.js +5 -5
- 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 +9 -18
- 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/border.js +1 -5
- package/src/hooks/color.js +2 -210
- 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 +15 -8
- package/src/hooks/elements.js +140 -0
- package/src/hooks/elements.scss +8 -0
- package/src/hooks/fit-text.js +16 -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/position.js +23 -27
- package/src/hooks/states.js +2 -2
- package/src/hooks/style.js +91 -9
- package/src/hooks/supports.js +0 -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/actions.js +13 -3
- package/src/store/private-actions.js +1 -4
- package/src/store/private-selectors.js +89 -0
- package/src/store/reducer.js +19 -7
- package/src/store/selectors.js +91 -53
- package/src/store/test/actions.js +21 -0
- package/src/store/test/private-selectors.js +166 -7
- package/src/store/test/reducer.js +107 -10
- package/src/store/test/selectors.js +77 -0
- 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/build/components/media-upload-progress/constants.cjs +0 -46
- package/build/components/media-upload-progress/constants.cjs.map +0 -7
- package/build/components/rich-text/native/format-edit.cjs +0 -60
- package/build/components/rich-text/native/format-edit.cjs.map +0 -7
- package/build/components/rich-text/native/index.cjs.map +0 -7
- package/build/components/rich-text/native/use-format-types.cjs +0 -139
- package/build/components/rich-text/native/use-format-types.cjs.map +0 -7
- package/build-module/components/media-upload-progress/constants.mjs +0 -16
- package/build-module/components/media-upload-progress/constants.mjs.map +0 -7
- package/build-module/components/rich-text/native/format-edit.mjs +0 -39
- package/build-module/components/rich-text/native/format-edit.mjs.map +0 -7
- package/build-module/components/rich-text/native/index.mjs +0 -7
- package/build-module/components/rich-text/native/index.mjs.map +0 -7
- package/build-module/components/rich-text/native/use-format-types.mjs +0 -114
- package/build-module/components/rich-text/native/use-format-types.mjs.map +0 -7
- package/src/components/audio-player/audio-url-parser.native.js +0 -20
- package/src/components/audio-player/index.native.js +0 -225
- package/src/components/audio-player/styles.native.scss +0 -114
- package/src/components/audio-player/test/audio-url-parser.native.js +0 -53
- package/src/components/block-alignment-control/test/index.native.js +0 -37
- package/src/components/block-alignment-control/ui.native.js +0 -86
- package/src/components/block-caption/README.md +0 -104
- package/src/components/block-caption/index.native.js +0 -89
- package/src/components/block-caption/styles.native.scss +0 -7
- package/src/components/block-controls/slot.native.js +0 -33
- package/src/components/block-draggable/draggable-chip.native.js +0 -49
- package/src/components/block-draggable/dropping-insertion-point.native.js +0 -181
- package/src/components/block-draggable/dropping-insertion-point.native.scss +0 -8
- package/src/components/block-draggable/index.native.js +0 -467
- package/src/components/block-draggable/style.native.scss +0 -19
- package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +0 -73
- package/src/components/block-draggable/test/helpers.native.js +0 -182
- package/src/components/block-draggable/test/index.native.js +0 -419
- package/src/components/block-draggable/use-scroll-when-dragging.native.js +0 -135
- package/src/components/block-edit/edit.native.js +0 -49
- package/src/components/block-edit/test/edit.native.js +0 -65
- package/src/components/block-heading-level-dropdown/index.native.js +0 -68
- package/src/components/block-icon/index.native.js +0 -47
- package/src/components/block-icon/style.native.scss +0 -7
- package/src/components/block-list/block-crash-boundary.native.js +0 -43
- package/src/components/block-list/block-crash-warning.native.js +0 -21
- package/src/components/block-list/block-invalid-warning.native.js +0 -70
- package/src/components/block-list/block-list-context.native.js +0 -172
- package/src/components/block-list/block-list-item-cell.native.js +0 -62
- package/src/components/block-list/block-list-item.native.js +0 -209
- package/src/components/block-list/block-list-item.native.scss +0 -16
- package/src/components/block-list/block-outline.native.js +0 -77
- package/src/components/block-list/block-selection-button.native.js +0 -100
- package/src/components/block-list/block-selection-button.native.scss +0 -34
- package/src/components/block-list/block.native.js +0 -716
- package/src/components/block-list/block.native.scss +0 -62
- package/src/components/block-list/grid-item.native.js +0 -58
- package/src/components/block-list/index.native.js +0 -437
- package/src/components/block-list/insertion-point.native.js +0 -36
- package/src/components/block-list/style.native.scss +0 -117
- package/src/components/block-list/test/block-invalid-warning.native.js +0 -62
- package/src/components/block-list/test/block-list-context.native.js +0 -243
- package/src/components/block-list/test/block-outline.native.js +0 -255
- package/src/components/block-list/test/fixtures/block-list-context.native.js +0 -79
- package/src/components/block-list/test/index.native.js +0 -205
- package/src/components/block-list/use-block-props/index.native.js +0 -10
- package/src/components/block-list/use-scroll-upon-insertion.native.js +0 -52
- package/src/components/block-list-appender/index.native.js +0 -70
- package/src/components/block-list-appender/style.native.scss +0 -8
- package/src/components/block-media-update-progress/README.md +0 -100
- package/src/components/block-media-update-progress/index.native.js +0 -299
- package/src/components/block-media-update-progress/styles.native.scss +0 -9
- package/src/components/block-media-update-progress/test/index.native.js +0 -543
- package/src/components/block-mover/index.native.js +0 -193
- package/src/components/block-mover/mover-description.native.js +0 -155
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +0 -218
- package/src/components/block-mover/test/index.native.js +0 -186
- package/src/components/block-settings/button.native.js +0 -41
- package/src/components/block-settings/container.native.js +0 -91
- package/src/components/block-settings/container.native.scss +0 -4
- package/src/components/block-settings/index.native.js +0 -5
- package/src/components/block-styles/index.native.js +0 -94
- package/src/components/block-styles/preview.native.js +0 -109
- package/src/components/block-styles/style.native.scss +0 -64
- package/src/components/block-switcher/block-transformations-menu.native.js +0 -91
- package/src/components/block-toolbar/block-toolbar-menu.native.js +0 -477
- package/src/components/block-toolbar/index.native.js +0 -126
- package/src/components/block-toolbar/test/__snapshots__/block-toolbar-menu.native.js.snap +0 -125
- package/src/components/block-toolbar/test/block-toolbar-menu.native.js +0 -405
- package/src/components/block-toolbar/test/index.native.js +0 -36
- package/src/components/block-types-list/index.native.js +0 -175
- package/src/components/block-types-list/style.native.scss +0 -25
- package/src/components/block-variation-picker/index.native.js +0 -107
- package/src/components/block-variation-picker/style.native.scss +0 -32
- package/src/components/button-block-appender/index.native.js +0 -92
- package/src/components/button-block-appender/styles.native.scss +0 -43
- package/src/components/caption/README.md +0 -44
- package/src/components/caption/index.native.js +0 -61
- package/src/components/colors-gradients/panel-color-gradient-settings.native.js +0 -59
- package/src/components/contrast-checker/index.native.js +0 -113
- package/src/components/contrast-checker/style.native.scss +0 -26
- package/src/components/convert-to-group-buttons/index.native.js +0 -79
- package/src/components/default-block-appender/index.native.js +0 -113
- package/src/components/default-block-appender/style.native.scss +0 -18
- package/src/components/floating-toolbar/floatingToolbar.android.scss +0 -4
- package/src/components/floating-toolbar/floatingToolbar.ios.scss +0 -3
- package/src/components/floating-toolbar/index.native.js +0 -141
- package/src/components/floating-toolbar/styles.native.scss +0 -43
- package/src/components/font-sizes/index.native.js +0 -7
- package/src/components/global-styles/color-panel.native.js +0 -207
- package/src/components/global-styles/test/use-global-styles-context.native.js +0 -435
- package/src/components/global-styles/use-global-styles-context.native.js +0 -592
- package/src/components/gradients/index.native.js +0 -2
- package/src/components/image-link-destinations/index.native.js +0 -152
- package/src/components/image-link-destinations/style.native.scss +0 -16
- package/src/components/index.native.js +0 -108
- package/src/components/inner-blocks/constants.native.js +0 -5
- package/src/components/inner-blocks/index.native.js +0 -221
- package/src/components/inner-blocks/warning-max-depth-exceeded.native.js +0 -124
- package/src/components/inserter/block-types-tab.native.js +0 -76
- package/src/components/inserter/hooks/use-block-type-impressions.native.js +0 -47
- package/src/components/inserter/hooks/use-clipboard-block.native.js +0 -40
- package/src/components/inserter/index.native.js +0 -424
- package/src/components/inserter/menu.native.js +0 -237
- package/src/components/inserter/no-results.native.js +0 -49
- package/src/components/inserter/reusable-blocks-tab.native.js +0 -45
- package/src/components/inserter/search-results.native.js +0 -67
- package/src/components/inserter/style.native.scss +0 -83
- package/src/components/inserter/tabs.native.js +0 -152
- package/src/components/inserter/test/__snapshots__/index.native.js.snap +0 -117
- package/src/components/inserter/test/fixtures/index.native.js +0 -12
- package/src/components/inserter/test/index.native.js +0 -273
- package/src/components/inserter/test/reusable-blocks-tab.native.js +0 -62
- package/src/components/inserter/test/utils.native.js +0 -37
- package/src/components/inserter/utils.native.js +0 -46
- package/src/components/inserter-button/index.native.js +0 -108
- package/src/components/inserter-button/style.native.scss +0 -72
- package/src/components/inspector-controls/fill.native.js +0 -62
- package/src/components/inspector-controls/slot.native.js +0 -35
- package/src/components/inspector-controls-tabs/advanced-controls-panel.native.js +0 -31
- package/src/components/line-height-control/index.native.js +0 -28
- package/src/components/media-placeholder/index.native.js +0 -258
- package/src/components/media-placeholder/styles.native.scss +0 -108
- package/src/components/media-replace-flow/index.native.js +0 -12
- package/src/components/media-upload/constants.native.js +0 -14
- package/src/components/media-upload/index.native.js +0 -356
- package/src/components/media-upload/style.native.scss +0 -4
- package/src/components/media-upload/test/index.native.js +0 -172
- package/src/components/media-upload-progress/README.md +0 -100
- package/src/components/media-upload-progress/constants.js +0 -6
- package/src/components/media-upload-progress/index.native.js +0 -233
- package/src/components/media-upload-progress/styles.native.scss +0 -15
- package/src/components/media-upload-progress/test/index.native.js +0 -220
- package/src/components/plain-text/index.native.js +0 -164
- package/src/components/plain-text/style.native.scss +0 -10
- package/src/components/provider/index.native.js +0 -32
- package/src/components/rich-text/embed-handler-picker.native.js +0 -65
- package/src/components/rich-text/file-paste-handler.native.js +0 -3
- package/src/components/rich-text/format-toolbar/index.native.js +0 -21
- package/src/components/rich-text/format-toolbar-container.native.js +0 -16
- package/src/components/rich-text/index.native.js +0 -701
- package/src/components/rich-text/input-event.native.js +0 -10
- package/src/components/rich-text/native/format-edit.js +0 -44
- package/src/components/rich-text/native/get-format-colors.native.js +0 -47
- package/src/components/rich-text/native/index.js +0 -1
- package/src/components/rich-text/native/index.native.js +0 -1389
- package/src/components/rich-text/native/style.native.scss +0 -28
- package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +0 -79
- package/src/components/rich-text/native/test/index.native.js +0 -345
- package/src/components/rich-text/native/test/performance/rich-text.native.js +0 -44
- package/src/components/rich-text/native/toolbar-button-with-options.native.js +0 -61
- package/src/components/rich-text/native/use-format-types.js +0 -146
- package/src/components/rich-text/remove-browser-shortcuts.native.js +0 -1
- package/src/components/rich-text/shortcut.native.js +0 -10
- package/src/components/ungroup-button/README.md +0 -23
- package/src/components/ungroup-button/index.native.js +0 -77
- package/src/components/unsupported-block-details/index.native.js +0 -187
- package/src/components/unsupported-block-details/style.native.scss +0 -56
- package/src/components/url-input/index.native.js +0 -33
- package/src/components/use-block-drop-zone/index.native.js +0 -207
- package/src/components/use-on-block-drop/index.native.js +0 -115
- package/src/components/use-unsupported-block-editor/index.native.js +0 -59
- package/src/components/video-player/gridicon-play.native.js +0 -13
- package/src/components/video-player/index.native.js +0 -133
- package/src/components/video-player/styles.native.scss +0 -29
- package/src/components/warning/index.native.js +0 -64
- package/src/components/warning/style.native.scss +0 -47
- package/src/hooks/align.native.js +0 -49
- package/src/hooks/custom-class-name.native.js +0 -70
- package/src/hooks/index.native.js +0 -36
- package/src/hooks/layout.native.js +0 -23
- package/src/hooks/test/__snapshots__/align.native.js.snap +0 -73
- package/src/hooks/test/__snapshots__/anchor.native.js.snap +0 -7
- package/src/hooks/test/align.native.js +0 -134
- package/src/hooks/test/anchor.native.js +0 -32
- package/src/hooks/test/use-editor-wrapper-styles.native.js +0 -282
- package/src/hooks/typography.native.js +0 -60
- package/src/hooks/use-editor-wrapper-styles.native.js +0 -250
- package/src/hooks/use-editor-wrapper-styles.native.scss +0 -12
- package/src/index.native.js +0 -6
- package/src/private-apis.native.js +0 -21
- package/src/store/defaults.native.js +0 -23
- 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/hooks/layout-child.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { useStyleOverride } from './utils';\nimport { useLayout } from '../components/block-list/layout';\nimport {\n\tGridVisualizer,\n\tGridItemResizer,\n\tGridItemMovers,\n} from '../components/grid';\nimport useBlockVisibility from '../components/block-visibility/use-block-visibility';\nimport { deviceTypeKey } from '../store/private-keys';\nimport { BLOCK_VISIBILITY_VIEWPORTS } from '../components/block-visibility/constants';\n\n// Used for generating the instance ID\nconst LAYOUT_CHILD_BLOCK_PROPS_REFERENCE = {};\n// Keep in sync with WP_Theme_JSON_Gutenberg::RESPONSIVE_BREAKPOINTS.\nconst RESPONSIVE_BREAKPOINTS = {\n\tmobile: '@media (width <= 480px)',\n\ttablet: '@media (480px < width <= 782px)',\n};\n\nfunction serializeRule( { selector, declarations } ) {\n\treturn `${ selector } {\n\t\t${ Object.entries( declarations )\n\t\t\t.map( ( [ property, value ] ) => `${ property }: ${ value }` )\n\t\t\t.join( '; ' ) };\n\t}`;\n}\n\nexport function getChildLayoutStyleRules( {\n\tselector,\n\tlayout = {},\n\tviewportOverrides,\n\tparentLayout = {},\n\tincludeContainerQuery = true,\n} ) {\n\tconst hasViewportOverrides = viewportOverrides !== undefined;\n\tconst effectiveLayout = hasViewportOverrides\n\t\t? {\n\t\t\t\t...layout,\n\t\t\t\t...viewportOverrides,\n\t\t }\n\t\t: layout;\n\tconst hasViewportOverride = ( key ) =>\n\t\tObject.hasOwn( viewportOverrides || {}, key );\n\tconst {\n\t\tselfStretch,\n\t\tflexSize,\n\t\tcolumnStart,\n\t\trowStart,\n\t\tcolumnSpan,\n\t\trowSpan,\n\t} = effectiveLayout;\n\tconst { columnCount, minimumColumnWidth } = parentLayout;\n\tconst rules = [];\n\n\tconst declarations = {};\n\tif (\n\t\t! hasViewportOverrides ||\n\t\thasViewportOverride( 'selfStretch' ) ||\n\t\thasViewportOverride( 'flexSize' )\n\t) {\n\t\tif ( selfStretch === 'fixed' && flexSize ) {\n\t\t\tdeclarations[ 'flex-basis' ] = flexSize;\n\t\t\tdeclarations[ 'box-sizing' ] = 'border-box';\n\t\t} else if ( selfStretch === 'fill' ) {\n\t\t\tdeclarations[ 'flex-grow' ] = '1';\n\t\t}\n\t}\n\n\tif (\n\t\t! hasViewportOverrides ||\n\t\thasViewportOverride( 'columnStart' ) ||\n\t\thasViewportOverride( 'columnSpan' )\n\t) {\n\t\tif ( columnStart && columnSpan ) {\n\t\t\tdeclarations[\n\t\t\t\t'grid-column'\n\t\t\t] = `${ columnStart } / span ${ columnSpan }`;\n\t\t} else if ( columnStart ) {\n\t\t\tdeclarations[ 'grid-column' ] = `${ columnStart }`;\n\t\t} else if ( columnSpan ) {\n\t\t\tdeclarations[ 'grid-column' ] = `span ${ columnSpan }`;\n\t\t}\n\t}\n\n\tif (\n\t\t! hasViewportOverrides ||\n\t\thasViewportOverride( 'rowStart' ) ||\n\t\thasViewportOverride( 'rowSpan' )\n\t) {\n\t\tif ( rowStart && rowSpan ) {\n\t\t\tdeclarations[ 'grid-row' ] = `${ rowStart } / span ${ rowSpan }`;\n\t\t} else if ( rowStart ) {\n\t\t\tdeclarations[ 'grid-row' ] = `${ rowStart }`;\n\t\t} else if ( rowSpan ) {\n\t\t\tdeclarations[ 'grid-row' ] = `span ${ rowSpan }`;\n\t\t}\n\t}\n\n\tif ( Object.keys( declarations ).length ) {\n\t\trules.push( { selector, declarations } );\n\t}\n\n\tif ( includeContainerQuery && ! hasViewportOverrides ) {\n\t\t/**\n\t\t * If minimumColumnWidth is set on the parent, or if no\n\t\t * columnCount is set, the grid is responsive so a\n\t\t * container query is needed for the span to resize.\n\t\t */\n\t\tif (\n\t\t\t( columnSpan || columnStart ) &&\n\t\t\t( minimumColumnWidth || ! columnCount )\n\t\t) {\n\t\t\tlet parentColumnValue = parseFloat( minimumColumnWidth );\n\t\t\t/**\n\t\t\t * 12rem is the default minimumColumnWidth value.\n\t\t\t * If parentColumnValue is not a number, default to 12.\n\t\t\t */\n\t\t\tif ( isNaN( parentColumnValue ) ) {\n\t\t\t\tparentColumnValue = 12;\n\t\t\t}\n\n\t\t\tlet parentColumnUnit = minimumColumnWidth?.replace(\n\t\t\t\tparentColumnValue,\n\t\t\t\t''\n\t\t\t);\n\t\t\t/**\n\t\t\t * Check that parent column unit is either 'px', 'rem' or 'em'.\n\t\t\t * If not, default to 'rem'.\n\t\t\t */\n\t\t\tif ( ! [ 'px', 'rem', 'em' ].includes( parentColumnUnit ) ) {\n\t\t\t\tparentColumnUnit = 'rem';\n\t\t\t}\n\n\t\t\tlet numColsToBreakAt = 2;\n\n\t\t\tif ( columnSpan && columnStart ) {\n\t\t\t\tnumColsToBreakAt = columnSpan + columnStart - 1;\n\t\t\t} else if ( columnSpan ) {\n\t\t\t\tnumColsToBreakAt = columnSpan;\n\t\t\t} else {\n\t\t\t\tnumColsToBreakAt = columnStart;\n\t\t\t}\n\n\t\t\tconst defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5;\n\t\t\tconst containerQueryValue =\n\t\t\t\tnumColsToBreakAt * parentColumnValue +\n\t\t\t\t( numColsToBreakAt - 1 ) * defaultGapValue;\n\t\t\t// For blocks that only span one column, we want to remove any rowStart values as\n\t\t\t// the container reduces in size, so that blocks are still arranged in markup order.\n\t\t\tconst minimumContainerQueryValue =\n\t\t\t\tparentColumnValue * 2 + defaultGapValue - 1;\n\t\t\t// If a span is set we want to preserve it as long as possible, otherwise we just reset the value.\n\t\t\tconst gridColumnValue =\n\t\t\t\tcolumnSpan && columnSpan > 1 ? '1/-1' : 'auto';\n\n\t\t\trules.push( {\n\t\t\t\trulesGroup: `@container (max-width: ${ Math.max(\n\t\t\t\t\tcontainerQueryValue,\n\t\t\t\t\tminimumContainerQueryValue\n\t\t\t\t) }${ parentColumnUnit })`,\n\t\t\t\tselector,\n\t\t\t\tdeclarations: {\n\t\t\t\t\t'grid-column': gridColumnValue,\n\t\t\t\t\t'grid-row': 'auto',\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t}\n\n\treturn rules;\n}\n\nexport function getChildLayoutStyles( {\n\tselector,\n\tlayout = {},\n\tparentLayout = {},\n\tincludeContainerQuery = true,\n} ) {\n\treturn getChildLayoutStyleRules( {\n\t\tselector,\n\t\tlayout,\n\t\tparentLayout,\n\t\tincludeContainerQuery,\n\t} )\n\t\t.map( ( rule ) => {\n\t\t\tconst serializedRule = serializeRule( rule );\n\t\t\treturn rule.rulesGroup\n\t\t\t\t? `${ rule.rulesGroup } {\n\t\t\t\t${ serializedRule }\n\t\t\t}`\n\t\t\t\t: serializedRule;\n\t\t} )\n\t\t.join( '' );\n}\n\nexport function getResponsiveChildLayoutStyles( {\n\tstyle = {},\n\tselector,\n\tparentLayout = {},\n} ) {\n\tconst baseLayout = style?.layout ?? {};\n\n\treturn Object.entries( RESPONSIVE_BREAKPOINTS )\n\t\t.map( ( [ viewport, mediaQuery ] ) => {\n\t\t\tconst viewportLayout = style?.[ viewport ]?.layout;\n\t\t\tif ( ! viewportLayout || ! Object.keys( viewportLayout ).length ) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\tconst viewportRules = getChildLayoutStyleRules( {\n\t\t\t\tselector,\n\t\t\t\tlayout: baseLayout,\n\t\t\t\tviewportOverrides: viewportLayout,\n\t\t\t\tparentLayout,\n\t\t\t\tincludeContainerQuery: false,\n\t\t\t} );\n\t\t\tconst css = viewportRules.map( serializeRule ).join( '' );\n\n\t\t\treturn css ? `${ mediaQuery }{${ css }}` : '';\n\t\t} )\n\t\t.filter( Boolean )\n\t\t.join( '' );\n}\n\nfunction useBlockPropsChildLayoutStyles( { style } ) {\n\tconst shouldRenderChildLayoutStyles = useSelect( ( select ) => {\n\t\treturn ! select( blockEditorStore ).getSettings().disableLayoutStyles;\n\t} );\n\tconst layout = style?.layout ?? {};\n\tconst { columnStart, rowStart, columnSpan, rowSpan } = layout;\n\tconst parentLayout = useLayout() || {};\n\tconst id = useInstanceId( LAYOUT_CHILD_BLOCK_PROPS_REFERENCE );\n\tconst selector = `.wp-container-content-${ id }`;\n\n\t// Check that the grid layout attributes are of the correct type, so that we don't accidentally\n\t// write code that stores a string attribute instead of a number.\n\tif ( process.env.NODE_ENV === 'development' ) {\n\t\tif ( columnStart && typeof columnStart !== 'number' ) {\n\t\t\tthrow new Error( 'columnStart must be a number' );\n\t\t}\n\t\tif ( rowStart && typeof rowStart !== 'number' ) {\n\t\t\tthrow new Error( 'rowStart must be a number' );\n\t\t}\n\t\tif ( columnSpan && typeof columnSpan !== 'number' ) {\n\t\t\tthrow new Error( 'columnSpan must be a number' );\n\t\t}\n\t\tif ( rowSpan && typeof rowSpan !== 'number' ) {\n\t\t\tthrow new Error( 'rowSpan must be a number' );\n\t\t}\n\t}\n\n\tlet css = '';\n\tif ( shouldRenderChildLayoutStyles ) {\n\t\tcss = [\n\t\t\tgetChildLayoutStyles( {\n\t\t\t\tselector,\n\t\t\t\tlayout,\n\t\t\t\tparentLayout,\n\t\t\t} ),\n\t\t\tgetResponsiveChildLayoutStyles( {\n\t\t\t\tstyle,\n\t\t\t\tselector,\n\t\t\t\tparentLayout,\n\t\t\t} ),\n\t\t].join( '' );\n\t}\n\n\tuseStyleOverride( { css } );\n\n\t// Only attach a container class if there is generated CSS to be attached.\n\tif ( ! css ) {\n\t\treturn;\n\t}\n\n\t// Attach a `wp-container-content` id-based classname.\n\treturn { className: `wp-container-content-${ id }` };\n}\n\nfunction ChildLayoutControlsPure( { clientId, style, setAttributes } ) {\n\tconst parentLayout = useLayout() || {};\n\tconst {\n\t\ttype: parentLayoutType = 'default',\n\t\tallowSizingOnChildren = false,\n\t\tisManualPlacement,\n\t} = parentLayout;\n\n\tif ( parentLayoutType !== 'grid' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<GridTools\n\t\t\tclientId={ clientId }\n\t\t\tstyle={ style }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tallowSizingOnChildren={ allowSizingOnChildren }\n\t\t\tisManualPlacement={ isManualPlacement }\n\t\t\tparentLayout={ parentLayout }\n\t\t/>\n\t);\n}\n\nfunction GridTools( {\n\tclientId,\n\tstyle,\n\tsetAttributes,\n\tallowSizingOnChildren,\n\tisManualPlacement,\n\tparentLayout,\n} ) {\n\tconst {\n\t\trootClientId,\n\t\tisVisible,\n\t\tparentBlockVisibility,\n\t\tblockBlockVisibility,\n\t\tdeviceType,\n\t\tisChildBlockAGrid,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetSettings,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst _rootClientId = getBlockRootClientId( clientId );\n\n\t\t\tif (\n\t\t\t\tgetTemplateLock( _rootClientId ) ||\n\t\t\t\tgetBlockEditingMode( _rootClientId ) !== 'default'\n\t\t\t) {\n\t\t\t\treturn {\n\t\t\t\t\trootClientId: _rootClientId,\n\t\t\t\t\tisVisible: false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst parentAttributes = getBlockAttributes( _rootClientId );\n\t\t\tconst blockAttributes = getBlockAttributes( clientId );\n\t\t\tconst settings = getSettings();\n\n\t\t\treturn {\n\t\t\t\trootClientId: _rootClientId,\n\t\t\t\tisVisible: true,\n\t\t\t\tparentBlockVisibility:\n\t\t\t\t\tparentAttributes?.metadata?.blockVisibility,\n\t\t\t\tblockBlockVisibility:\n\t\t\t\t\tblockAttributes?.metadata?.blockVisibility,\n\t\t\t\tdeviceType:\n\t\t\t\t\tsettings?.[ deviceTypeKey ]?.toLowerCase() ||\n\t\t\t\t\tBLOCK_VISIBILITY_VIEWPORTS.desktop.key,\n\t\t\t\t// Check if the selected child block is itself a grid.\n\t\t\t\tisChildBlockAGrid: blockAttributes?.layout?.type === 'grid',\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { isBlockCurrentlyHidden: isParentBlockCurrentlyHidden } =\n\t\tuseBlockVisibility( {\n\t\t\tblockVisibility: parentBlockVisibility,\n\t\t\tdeviceType,\n\t\t} );\n\n\tconst { isBlockCurrentlyHidden: isBlockItselfCurrentlyHidden } =\n\t\tuseBlockVisibility( {\n\t\t\tblockVisibility: blockBlockVisibility,\n\t\t\tdeviceType,\n\t\t} );\n\n\t// Use useState() instead of useRef() so that GridItemResizer updates when ref is set.\n\tconst [ resizerBounds, setResizerBounds ] = useState();\n\n\tconst childGridClientId = isChildBlockAGrid ? clientId : undefined;\n\n\tif ( ! isVisible || isParentBlockCurrentlyHidden ) {\n\t\treturn null;\n\t}\n\n\tconst showResizer = allowSizingOnChildren && ! isBlockItselfCurrentlyHidden;\n\n\tfunction updateLayout( layout ) {\n\t\tsetAttributes( {\n\t\t\tstyle: {\n\t\t\t\t...style,\n\t\t\t\tlayout: {\n\t\t\t\t\t...style?.layout,\n\t\t\t\t\t...layout,\n\t\t\t\t},\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<GridVisualizer\n\t\t\t\tclientId={ rootClientId }\n\t\t\t\tcontentRef={ setResizerBounds }\n\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\tchildGridClientId={ childGridClientId }\n\t\t\t/>\n\t\t\t{ showResizer && (\n\t\t\t\t<GridItemResizer\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t// Don't allow resizing beyond the grid visualizer.\n\t\t\t\t\tbounds={ resizerBounds }\n\t\t\t\t\tonChange={ updateLayout }\n\t\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isManualPlacement &&\n\t\t\t\twindow.__experimentalEnableGridInteractivity && (\n\t\t\t\t\t<GridItemMovers\n\t\t\t\t\t\tlayout={ style?.layout }\n\t\t\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\t\t\tonChange={ updateLayout }\n\t\t\t\t\t\tgridClientId={ rootClientId }\n\t\t\t\t\t\tblockClientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tuseBlockProps: useBlockPropsChildLayoutStyles,\n\tedit: ChildLayoutControlsPure,\n\tattributeKeys: [ 'style' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AAKzB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,wBAAwB;AACjC,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,OAAO,wBAAwB;AAC/B,SAAS,qBAAqB;AAC9B,SAAS,kCAAkC;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\nimport { useStyleOverride } from './utils';\nimport { useLayout } from '../components/block-list/layout';\nimport {\n\tGridVisualizer,\n\tGridItemResizer,\n\tGridItemMovers,\n} from '../components/grid';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\nimport useBlockVisibility from '../components/block-visibility/use-block-visibility';\nimport { deviceTypeKey } from '../store/private-keys';\nimport { BLOCK_VISIBILITY_VIEWPORTS } from '../components/block-visibility/constants';\nimport {\n\tDEFAULT_BLOCK_STYLE_STATE,\n\tgetStyleForState,\n} from './block-style-state';\n\n// Used for generating the instance ID\nconst LAYOUT_CHILD_BLOCK_PROPS_REFERENCE = {};\n// Keep in sync with WP_Theme_JSON_Gutenberg::RESPONSIVE_BREAKPOINTS.\nconst RESPONSIVE_BREAKPOINTS = {\n\t'@mobile': '@media (width <= 480px)',\n\t'@tablet': '@media (480px < width <= 782px)',\n};\n\n// These are the serialized `selfStretch` values. `max` used to be called\n// \"Fixed\" in the UI, but was renamed and replaced by `fixedNoShrink`.\nconst FLEX_CHILD_LAYOUT_VALUES = {\n\tfit: 'fit',\n\tgrow: 'fill',\n\tmax: 'fixed',\n\tfixed: 'fixedNoShrink',\n};\n\nconst FLEX_SIZE_VALUES = [\n\tFLEX_CHILD_LAYOUT_VALUES.max,\n\tFLEX_CHILD_LAYOUT_VALUES.fixed,\n];\n\nfunction isFlexSizeValue( value ) {\n\treturn FLEX_SIZE_VALUES.includes( value );\n}\n\nfunction serializeRule( { selector, declarations } ) {\n\treturn `${ selector } {\n\t\t${ Object.entries( declarations )\n\t\t\t.map( ( [ property, value ] ) => `${ property }: ${ value }` )\n\t\t\t.join( '; ' ) };\n\t}`;\n}\n\nexport function getChildLayoutStyleRules( {\n\tselector,\n\tlayout = {},\n\tviewportOverrides,\n\tparentLayout = {},\n\tincludeContainerQuery = true,\n} ) {\n\tconst hasViewportOverrides = viewportOverrides !== undefined;\n\tconst effectiveLayout = hasViewportOverrides\n\t\t? {\n\t\t\t\t...layout,\n\t\t\t\t...viewportOverrides,\n\t\t }\n\t\t: layout;\n\tconst hasViewportOverride = ( key ) =>\n\t\tObject.hasOwn( viewportOverrides || {}, key );\n\tconst {\n\t\tselfStretch,\n\t\tflexSize,\n\t\tcolumnStart,\n\t\trowStart,\n\t\tcolumnSpan,\n\t\trowSpan,\n\t} = effectiveLayout;\n\tconst baseSelfStretch = layout.selfStretch;\n\tconst { columnCount, minimumColumnWidth } = parentLayout;\n\tconst rules = [];\n\n\tconst declarations = {};\n\tif (\n\t\t! hasViewportOverrides ||\n\t\thasViewportOverride( 'selfStretch' ) ||\n\t\thasViewportOverride( 'flexSize' )\n\t) {\n\t\tif (\n\t\t\thasViewportOverrides &&\n\t\t\t( selfStretch === FLEX_CHILD_LAYOUT_VALUES.fit ||\n\t\t\t\tselfStretch === FLEX_CHILD_LAYOUT_VALUES.grow ) &&\n\t\t\tisFlexSizeValue( baseSelfStretch ) &&\n\t\t\tlayout.flexSize\n\t\t) {\n\t\t\tdeclarations[ 'flex-basis' ] = 'unset';\n\t\t\tif ( baseSelfStretch === FLEX_CHILD_LAYOUT_VALUES.fixed ) {\n\t\t\t\tdeclarations[ 'flex-shrink' ] = 'unset';\n\t\t\t}\n\t\t}\n\t\tif ( isFlexSizeValue( selfStretch ) && flexSize ) {\n\t\t\tdeclarations[ 'flex-basis' ] = flexSize;\n\t\t\tif ( selfStretch === FLEX_CHILD_LAYOUT_VALUES.fixed ) {\n\t\t\t\tdeclarations[ 'flex-shrink' ] = '0';\n\t\t\t} else if (\n\t\t\t\thasViewportOverrides &&\n\t\t\t\tbaseSelfStretch === FLEX_CHILD_LAYOUT_VALUES.fixed\n\t\t\t) {\n\t\t\t\tdeclarations[ 'flex-shrink' ] = 'unset';\n\t\t\t}\n\t\t\tdeclarations[ 'box-sizing' ] = 'border-box';\n\t\t} else if ( selfStretch === FLEX_CHILD_LAYOUT_VALUES.grow ) {\n\t\t\tdeclarations[ 'flex-grow' ] = '1';\n\t\t}\n\t}\n\n\tif (\n\t\t! hasViewportOverrides ||\n\t\thasViewportOverride( 'columnStart' ) ||\n\t\thasViewportOverride( 'columnSpan' )\n\t) {\n\t\tif ( columnStart && columnSpan ) {\n\t\t\tdeclarations[\n\t\t\t\t'grid-column'\n\t\t\t] = `${ columnStart } / span ${ columnSpan }`;\n\t\t} else if ( columnStart ) {\n\t\t\tdeclarations[ 'grid-column' ] = `${ columnStart }`;\n\t\t} else if ( columnSpan ) {\n\t\t\tdeclarations[ 'grid-column' ] = `span ${ columnSpan }`;\n\t\t}\n\t}\n\n\tif (\n\t\t! hasViewportOverrides ||\n\t\thasViewportOverride( 'rowStart' ) ||\n\t\thasViewportOverride( 'rowSpan' )\n\t) {\n\t\tif ( rowStart && rowSpan ) {\n\t\t\tdeclarations[ 'grid-row' ] = `${ rowStart } / span ${ rowSpan }`;\n\t\t} else if ( rowStart ) {\n\t\t\tdeclarations[ 'grid-row' ] = `${ rowStart }`;\n\t\t} else if ( rowSpan ) {\n\t\t\tdeclarations[ 'grid-row' ] = `span ${ rowSpan }`;\n\t\t}\n\t}\n\n\tif ( Object.keys( declarations ).length ) {\n\t\trules.push( { selector, declarations } );\n\t}\n\n\tif ( includeContainerQuery && ! hasViewportOverrides ) {\n\t\t/**\n\t\t * If minimumColumnWidth is set on the parent, or if no\n\t\t * columnCount is set, the grid is responsive so a\n\t\t * container query is needed for the span to resize.\n\t\t */\n\t\tif (\n\t\t\t( columnSpan || columnStart ) &&\n\t\t\t( minimumColumnWidth || ! columnCount )\n\t\t) {\n\t\t\tlet parentColumnValue = parseFloat( minimumColumnWidth );\n\t\t\t/**\n\t\t\t * 12rem is the default minimumColumnWidth value.\n\t\t\t * If parentColumnValue is not a number, default to 12.\n\t\t\t */\n\t\t\tif ( isNaN( parentColumnValue ) ) {\n\t\t\t\tparentColumnValue = 12;\n\t\t\t}\n\n\t\t\tlet parentColumnUnit = minimumColumnWidth?.replace(\n\t\t\t\tparentColumnValue,\n\t\t\t\t''\n\t\t\t);\n\t\t\t/**\n\t\t\t * Check that parent column unit is either 'px', 'rem' or 'em'.\n\t\t\t * If not, default to 'rem'.\n\t\t\t */\n\t\t\tif ( ! [ 'px', 'rem', 'em' ].includes( parentColumnUnit ) ) {\n\t\t\t\tparentColumnUnit = 'rem';\n\t\t\t}\n\n\t\t\tlet numColsToBreakAt = 2;\n\n\t\t\tif ( columnSpan && columnStart ) {\n\t\t\t\tnumColsToBreakAt = columnSpan + columnStart - 1;\n\t\t\t} else if ( columnSpan ) {\n\t\t\t\tnumColsToBreakAt = columnSpan;\n\t\t\t} else {\n\t\t\t\tnumColsToBreakAt = columnStart;\n\t\t\t}\n\n\t\t\tconst defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5;\n\t\t\tconst containerQueryValue =\n\t\t\t\tnumColsToBreakAt * parentColumnValue +\n\t\t\t\t( numColsToBreakAt - 1 ) * defaultGapValue;\n\t\t\t// For blocks that only span one column, we want to remove any rowStart values as\n\t\t\t// the container reduces in size, so that blocks are still arranged in markup order.\n\t\t\tconst minimumContainerQueryValue =\n\t\t\t\tparentColumnValue * 2 + defaultGapValue - 1;\n\t\t\t// If a span is set we want to preserve it as long as possible, otherwise we just reset the value.\n\t\t\tconst gridColumnValue =\n\t\t\t\tcolumnSpan && columnSpan > 1 ? '1/-1' : 'auto';\n\n\t\t\trules.push( {\n\t\t\t\trulesGroup: `@container (max-width: ${ Math.max(\n\t\t\t\t\tcontainerQueryValue,\n\t\t\t\t\tminimumContainerQueryValue\n\t\t\t\t) }${ parentColumnUnit })`,\n\t\t\t\tselector,\n\t\t\t\tdeclarations: {\n\t\t\t\t\t'grid-column': gridColumnValue,\n\t\t\t\t\t'grid-row': 'auto',\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t}\n\n\treturn rules;\n}\n\nexport function getChildLayoutStyles( {\n\tselector,\n\tlayout = {},\n\tparentLayout = {},\n\tincludeContainerQuery = true,\n} ) {\n\treturn getChildLayoutStyleRules( {\n\t\tselector,\n\t\tlayout,\n\t\tparentLayout,\n\t\tincludeContainerQuery,\n\t} )\n\t\t.map( ( rule ) => {\n\t\t\tconst serializedRule = serializeRule( rule );\n\t\t\treturn rule.rulesGroup\n\t\t\t\t? `${ rule.rulesGroup } {\n\t\t\t\t${ serializedRule }\n\t\t\t}`\n\t\t\t\t: serializedRule;\n\t\t} )\n\t\t.join( '' );\n}\n\nexport function getResponsiveChildLayoutStyles( {\n\tstyle = {},\n\tselector,\n\tparentLayout = {},\n} ) {\n\tconst baseLayout = style?.layout ?? {};\n\n\treturn Object.entries( RESPONSIVE_BREAKPOINTS )\n\t\t.map( ( [ viewport, mediaQuery ] ) => {\n\t\t\tconst viewportLayout = getStyleForState( style, {\n\t\t\t\tviewport,\n\t\t\t\tpseudo: DEFAULT_BLOCK_STYLE_STATE.pseudo,\n\t\t\t} )?.layout;\n\t\t\tif ( ! viewportLayout || ! Object.keys( viewportLayout ).length ) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\tconst viewportRules = getChildLayoutStyleRules( {\n\t\t\t\tselector,\n\t\t\t\tlayout: baseLayout,\n\t\t\t\tviewportOverrides: viewportLayout,\n\t\t\t\tparentLayout,\n\t\t\t\tincludeContainerQuery: false,\n\t\t\t} );\n\t\t\tconst css = viewportRules.map( serializeRule ).join( '' );\n\n\t\t\treturn css ? `${ mediaQuery }{${ css }}` : '';\n\t\t} )\n\t\t.filter( Boolean )\n\t\t.join( '' );\n}\n\nfunction useBlockPropsChildLayoutStyles( { style } ) {\n\tconst shouldRenderChildLayoutStyles = useSelect( ( select ) => {\n\t\treturn ! select( blockEditorStore ).getSettings().disableLayoutStyles;\n\t} );\n\tconst layout = style?.layout ?? {};\n\tconst { columnStart, rowStart, columnSpan, rowSpan } = layout;\n\tconst parentLayout = useLayout() || {};\n\tconst id = useInstanceId( LAYOUT_CHILD_BLOCK_PROPS_REFERENCE );\n\tconst selector = `.wp-container-content-${ id }`;\n\n\t// Check that the grid layout attributes are of the correct type, so that we don't accidentally\n\t// write code that stores a string attribute instead of a number.\n\tif ( process.env.NODE_ENV === 'development' ) {\n\t\tif ( columnStart && typeof columnStart !== 'number' ) {\n\t\t\tthrow new Error( 'columnStart must be a number' );\n\t\t}\n\t\tif ( rowStart && typeof rowStart !== 'number' ) {\n\t\t\tthrow new Error( 'rowStart must be a number' );\n\t\t}\n\t\tif ( columnSpan && typeof columnSpan !== 'number' ) {\n\t\t\tthrow new Error( 'columnSpan must be a number' );\n\t\t}\n\t\tif ( rowSpan && typeof rowSpan !== 'number' ) {\n\t\t\tthrow new Error( 'rowSpan must be a number' );\n\t\t}\n\t}\n\n\tlet css = '';\n\tif ( shouldRenderChildLayoutStyles ) {\n\t\tcss = [\n\t\t\tgetChildLayoutStyles( {\n\t\t\t\tselector,\n\t\t\t\tlayout,\n\t\t\t\tparentLayout,\n\t\t\t} ),\n\t\t\tgetResponsiveChildLayoutStyles( {\n\t\t\t\tstyle,\n\t\t\t\tselector,\n\t\t\t\tparentLayout,\n\t\t\t} ),\n\t\t].join( '' );\n\t}\n\n\tuseStyleOverride( { css } );\n\n\t// Only attach a container class if there is generated CSS to be attached.\n\tif ( ! css ) {\n\t\treturn;\n\t}\n\n\t// Attach a `wp-container-content` id-based classname.\n\treturn { className: `wp-container-content-${ id }` };\n}\n\nfunction ChildLayoutControlsPure( { clientId, style, setAttributes } ) {\n\tconst parentLayout = useLayout() || {};\n\tconst {\n\t\ttype: parentLayoutType = 'default',\n\t\tallowSizingOnChildren = false,\n\t\tisManualPlacement,\n\t} = parentLayout;\n\n\tif ( parentLayoutType !== 'grid' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<GridTools\n\t\t\tclientId={ clientId }\n\t\t\tstyle={ style }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tallowSizingOnChildren={ allowSizingOnChildren }\n\t\t\tisManualPlacement={ isManualPlacement }\n\t\t\tparentLayout={ parentLayout }\n\t\t/>\n\t);\n}\n\nfunction GridTools( {\n\tclientId,\n\tstyle,\n\tsetAttributes,\n\tallowSizingOnChildren,\n\tisManualPlacement,\n\tparentLayout,\n} ) {\n\tconst {\n\t\trootClientId,\n\t\tisVisible,\n\t\tparentBlockVisibility,\n\t\tblockBlockVisibility,\n\t\tdeviceType,\n\t\tisChildBlockAGrid,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetSettings,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst _rootClientId = getBlockRootClientId( clientId );\n\n\t\t\tif (\n\t\t\t\tgetTemplateLock( _rootClientId ) ||\n\t\t\t\tgetBlockEditingMode( _rootClientId ) !== 'default'\n\t\t\t) {\n\t\t\t\treturn {\n\t\t\t\t\trootClientId: _rootClientId,\n\t\t\t\t\tisVisible: false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst parentAttributes = getBlockAttributes( _rootClientId );\n\t\t\tconst blockAttributes = getBlockAttributes( clientId );\n\t\t\tconst settings = getSettings();\n\t\t\tconst currentDeviceType =\n\t\t\t\tsettings?.[ deviceTypeKey ]?.toLowerCase() ||\n\t\t\t\tBLOCK_VISIBILITY_VIEWPORTS.desktop.key;\n\n\t\t\treturn {\n\t\t\t\trootClientId: _rootClientId,\n\t\t\t\tisVisible: true,\n\t\t\t\tparentBlockVisibility:\n\t\t\t\t\tparentAttributes?.metadata?.blockVisibility,\n\t\t\t\tblockBlockVisibility:\n\t\t\t\t\tblockAttributes?.metadata?.blockVisibility,\n\t\t\t\tdeviceType: currentDeviceType,\n\t\t\t\t// Check if the selected child block is itself a grid.\n\t\t\t\tisChildBlockAGrid: blockAttributes?.layout?.type === 'grid',\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Get the block's DOM element to derive the canvas iframe window,\n\t// so viewport detection matches the actual block rendering context\n\tconst blockElement = useBlockElement( clientId );\n\tconst rawCanvasView = blockElement?.ownerDocument?.defaultView;\n\tconst canvasView = rawCanvasView === null ? undefined : rawCanvasView;\n\n\tconst {\n\t\tisBlockCurrentlyHidden: isParentBlockCurrentlyHidden,\n\t\tcurrentViewport,\n\t} = useBlockVisibility( {\n\t\tblockVisibility: parentBlockVisibility,\n\t\tdeviceType,\n\t\tview: canvasView,\n\t} );\n\n\t// Check whether any ancestor of the parent grid is hidden at the viewport\n\t// actually detected from the canvas, so it stays consistent with how\n\t// blocks are hidden.\n\tconst isAnyAncestorHidden = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! rootClientId ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tconst { isBlockParentHiddenAtViewport } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\treturn isBlockParentHiddenAtViewport(\n\t\t\t\trootClientId,\n\t\t\t\tcurrentViewport\n\t\t\t);\n\t\t},\n\t\t[ rootClientId, currentViewport ]\n\t);\n\n\tconst { isBlockCurrentlyHidden: isBlockItselfCurrentlyHidden } =\n\t\tuseBlockVisibility( {\n\t\t\tblockVisibility: blockBlockVisibility,\n\t\t\tdeviceType,\n\t\t\tview: canvasView,\n\t\t} );\n\n\t// Use useState() instead of useRef() so that GridItemResizer updates when ref is set.\n\tconst [ resizerBounds, setResizerBounds ] = useState();\n\n\tconst childGridClientId = isChildBlockAGrid ? clientId : undefined;\n\n\tif ( ! isVisible || isParentBlockCurrentlyHidden || isAnyAncestorHidden ) {\n\t\treturn null;\n\t}\n\n\tconst showResizer = allowSizingOnChildren && ! isBlockItselfCurrentlyHidden;\n\n\tfunction updateLayout( layout ) {\n\t\tsetAttributes( {\n\t\t\tstyle: {\n\t\t\t\t...style,\n\t\t\t\tlayout: {\n\t\t\t\t\t...style?.layout,\n\t\t\t\t\t...layout,\n\t\t\t\t},\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<GridVisualizer\n\t\t\t\tclientId={ rootClientId }\n\t\t\t\tcontentRef={ setResizerBounds }\n\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\tchildGridClientId={ childGridClientId }\n\t\t\t/>\n\t\t\t{ showResizer && (\n\t\t\t\t<GridItemResizer\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t// Don't allow resizing beyond the grid visualizer.\n\t\t\t\t\tbounds={ resizerBounds }\n\t\t\t\t\tonChange={ updateLayout }\n\t\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isManualPlacement &&\n\t\t\t\twindow.__experimentalEnableGridInteractivity && (\n\t\t\t\t\t<GridItemMovers\n\t\t\t\t\t\tlayout={ style?.layout }\n\t\t\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\t\t\tonChange={ updateLayout }\n\t\t\t\t\t\tgridClientId={ rootClientId }\n\t\t\t\t\t\tblockClientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tuseBlockProps: useBlockPropsChildLayoutStyles,\n\tedit: ChildLayoutControlsPure,\n\tattributeKeys: [ 'style' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AAKzB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,cAAc;AACvB,SAAS,wBAAwB;AACjC,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,uBAAuB;AAChC,OAAO,wBAAwB;AAC/B,SAAS,qBAAqB;AAC9B,SAAS,kCAAkC;AAC3C;AAAA,EACC;AAAA,EACA;AAAA,OACM;AAoUL,SAuIA,UAvIA,KAuIA,YAvIA;AAjUF,IAAM,qCAAqC,CAAC;AAE5C,IAAM,yBAAyB;AAAA,EAC9B,WAAW;AAAA,EACX,WAAW;AACZ;AAIA,IAAM,2BAA2B;AAAA,EAChC,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AACR;AAEA,IAAM,mBAAmB;AAAA,EACxB,yBAAyB;AAAA,EACzB,yBAAyB;AAC1B;AAEA,SAAS,gBAAiB,OAAQ;AACjC,SAAO,iBAAiB,SAAU,KAAM;AACzC;AAEA,SAAS,cAAe,EAAE,UAAU,aAAa,GAAI;AACpD,SAAO,GAAI,QAAS;AAAA,IAChB,OAAO,QAAS,YAAa,EAC9B,IAAK,CAAE,CAAE,UAAU,KAAM,MAAO,GAAI,QAAS,KAAM,KAAM,EAAG,EAC5D,KAAM,IAAK,CAAE;AAAA;AAEjB;AAEO,SAAS,yBAA0B;AAAA,EACzC;AAAA,EACA,SAAS,CAAC;AAAA,EACV;AAAA,EACA,eAAe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R;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -39,8 +39,8 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
39
39
|
var VARIATION_PREFIX = "is-style-";
|
|
40
40
|
var layoutBlockSupportKey = "layout";
|
|
41
41
|
var RESPONSIVE_BREAKPOINTS = {
|
|
42
|
-
mobile: "@media (width <= 480px)",
|
|
43
|
-
tablet: "@media (480px < width <= 782px)"
|
|
42
|
+
"@mobile": "@media (width <= 480px)",
|
|
43
|
+
"@tablet": "@media (480px < width <= 782px)"
|
|
44
44
|
};
|
|
45
45
|
var CHILD_LAYOUT_KEYS = [
|
|
46
46
|
"selfStretch",
|
|
@@ -149,7 +149,10 @@ function getResponsiveLayoutStyles({
|
|
|
149
149
|
globalBlockGapValue
|
|
150
150
|
}) {
|
|
151
151
|
return Object.entries(RESPONSIVE_BREAKPOINTS).map(([viewport, mediaQuery]) => {
|
|
152
|
-
const viewportStyle = attributes?.style
|
|
152
|
+
const viewportStyle = getStyleForState(attributes?.style, {
|
|
153
|
+
viewport,
|
|
154
|
+
pseudo: DEFAULT_BLOCK_STYLE_STATE.pseudo
|
|
155
|
+
});
|
|
153
156
|
const viewportLayout = getLayoutContainerValues(
|
|
154
157
|
viewportStyle?.layout
|
|
155
158
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/hooks/layout.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useCallback } from '@wordpress/element';\nimport {\n\tgetBlockSupport,\n\thasBlockSupport,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\tToggleControl,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport { useSettings } from '../components/use-settings';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { LAYOUT_DEFINITIONS } from '../layouts/definitions';\nimport { cleanEmptyObject, useBlockSettings, useStyleOverride } from './utils';\nimport { unlock } from '../lock-unlock';\nimport { globalStylesDataKey } from '../store/private-keys';\nimport { getVariationNameFromClass } from './block-style-variation';\nimport {\n\tDEFAULT_BLOCK_STYLE_STATE,\n\tgetStyleForState,\n\thasPseudoBlockStyleState,\n\thasViewportBlockStyleState,\n\tisDefaultBlockStyleState,\n\tsetStyleForState,\n} from './block-style-state';\n\nconst VARIATION_PREFIX = 'is-style-';\n\nconst layoutBlockSupportKey = 'layout';\n// Keep in sync with WP_Theme_JSON_Gutenberg::RESPONSIVE_BREAKPOINTS and\n// packages/global-styles-engine/src/core/render.tsx.\nconst RESPONSIVE_BREAKPOINTS = {\n\tmobile: '@media (width <= 480px)',\n\ttablet: '@media (480px < width <= 782px)',\n};\nconst CHILD_LAYOUT_KEYS = [\n\t'selfStretch',\n\t'flexSize',\n\t'columnStart',\n\t'columnSpan',\n\t'rowStart',\n\t'rowSpan',\n];\nconst { kebabCase } = unlock( componentsPrivateApis );\n\nfunction getDefaultLayout( layoutBlockSupport = {}, blockVariation ) {\n\tconst defaultBlockLayout = layoutBlockSupport?.default;\n\n\treturn blockVariation?.attributes?.layout ?? defaultBlockLayout;\n}\n\n/**\n * Returns the layout values to use when resetting layout controls.\n *\n * @param { Object } layoutBlockSupport Block layout support settings.\n * @param { Object|undefined } blockVariation Block variation settings.\n *\n * @return { Object|undefined } Reset layout values.\n */\nexport function getResetLayout( layoutBlockSupport = {}, blockVariation ) {\n\treturn cleanEmptyObject( {\n\t\t...getDefaultLayout( layoutBlockSupport, blockVariation ),\n\t} );\n}\n\nfunction getLayoutStateOverrides(\n\tlayout = {},\n\tbaseLayout = {},\n\texistingLayout = {}\n) {\n\tconst overrides = {};\n\tconst childLayoutValues = Object.fromEntries(\n\t\tCHILD_LAYOUT_KEYS.filter( ( key ) =>\n\t\t\tObject.hasOwn( existingLayout || {}, key )\n\t\t).map( ( key ) => [ key, existingLayout[ key ] ] )\n\t);\n\n\tObject.entries( layout || {} ).forEach( ( [ key, value ] ) => {\n\t\tif (\n\t\t\t! CHILD_LAYOUT_KEYS.includes( key ) &&\n\t\t\tvalue !== baseLayout?.[ key ]\n\t\t) {\n\t\t\toverrides[ key ] = value;\n\t\t}\n\t} );\n\n\treturn cleanEmptyObject( {\n\t\t...childLayoutValues,\n\t\t...overrides,\n\t} );\n}\n\nfunction getLayoutContainerValues( layout = {} ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( layout || {} ).filter(\n\t\t\t( [ key ] ) => ! CHILD_LAYOUT_KEYS.includes( key )\n\t\t)\n\t);\n}\n\nfunction hasLayoutBlockSupport( blockName ) {\n\treturn (\n\t\thasBlockSupport( blockName, 'layout' ) ||\n\t\thasBlockSupport( blockName, '__experimentalLayout' )\n\t);\n}\n\n/**\n * Generates the utility classnames for the given block's layout attributes.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n *\n * @return { Array } Array of CSS classname strings.\n */\nexport function useLayoutClasses( blockAttributes = {}, blockName = '' ) {\n\tconst { layout } = blockAttributes;\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( blockName, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst layoutClassnames = [];\n\n\tif ( LAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className ) {\n\t\tconst baseClassName =\n\t\t\tLAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className;\n\t\tconst splitBlockName = blockName.split( '/' );\n\t\tconst fullBlockName =\n\t\t\tsplitBlockName[ 0 ] === 'core'\n\t\t\t\t? splitBlockName.pop()\n\t\t\t\t: splitBlockName.join( '-' );\n\t\tconst compoundClassName = `wp-block-${ fullBlockName }-${ baseClassName }`;\n\t\tlayoutClassnames.push( baseClassName, compoundClassName );\n\t}\n\n\tconst hasGlobalPadding = useSelect(\n\t\t( select ) => {\n\t\t\t// Early return to avoid subscription when layout doesn't use global padding\n\t\t\tif (\n\t\t\t\t! usedLayout?.inherit &&\n\t\t\t\t! usedLayout?.contentSize &&\n\t\t\t\tusedLayout?.type !== 'constrained'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn select( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalFeatures?.useRootPaddingAwareAlignments;\n\t\t},\n\t\t[ usedLayout?.contentSize, usedLayout?.inherit, usedLayout?.type ]\n\t);\n\n\tif ( hasGlobalPadding ) {\n\t\tlayoutClassnames.push( 'has-global-padding' );\n\t}\n\n\tif ( usedLayout?.orientation ) {\n\t\tlayoutClassnames.push( `is-${ kebabCase( usedLayout.orientation ) }` );\n\t}\n\n\tif ( usedLayout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase(\n\t\t\t\tusedLayout.justifyContent\n\t\t\t) }`\n\t\t);\n\t}\n\n\tif ( usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap' ) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\n/**\n * Generates a CSS rule with the given block's layout styles.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n * @param { string } selector A selector to use in generating the CSS rule.\n *\n * @return { string } CSS rule.\n */\nexport function useLayoutStyles( blockAttributes = {}, blockName, selector ) {\n\tconst { layout = {}, style = {} } = blockAttributes;\n\t// Update type for blocks using legacy layouts.\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || {};\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst [ blockGapSupport ] = useSettings( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\treturn fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName,\n\t\tselector,\n\t\tlayout,\n\t\tstyle,\n\t\thasBlockGapSupport,\n\t} );\n}\n\n/**\n * Generates responsive layout CSS for viewport state styles.\n *\n * Viewport state blockGap values need to go through the layout definitions\n * because flow/constrained layouts use child margins while flex/grid use gap.\n *\n * @param { Object } options Options.\n * @param { Object } options.attributes Block attributes.\n * @param { string } options.blockName Block name.\n * @param { string } options.selector CSS selector.\n * @param { Object } options.layout Active block layout.\n * @param { boolean } options.hasBlockGapSupport Whether block gap is supported.\n * @param { * } options.globalBlockGapValue Global block gap fallback.\n *\n * @return { string } CSS rule.\n */\nexport function getResponsiveLayoutStyles( {\n\tattributes = {},\n\tblockName,\n\tselector,\n\tlayout = {},\n\thasBlockGapSupport,\n\tglobalBlockGapValue,\n} ) {\n\treturn Object.entries( RESPONSIVE_BREAKPOINTS )\n\t\t.map( ( [ viewport, mediaQuery ] ) => {\n\t\t\tconst viewportStyle = attributes?.style?.[ viewport ];\n\t\t\tconst viewportLayout = getLayoutContainerValues(\n\t\t\t\tviewportStyle?.layout\n\t\t\t);\n\t\t\tconst hasViewportLayout = Object.keys( viewportLayout ).length > 0;\n\t\t\tconst hasViewportBlockGap =\n\t\t\t\tviewportStyle?.spacing &&\n\t\t\t\tObject.hasOwn( viewportStyle.spacing, 'blockGap' );\n\t\t\tconst hasViewportPadding =\n\t\t\t\tviewportStyle?.spacing &&\n\t\t\t\tObject.hasOwn( viewportStyle.spacing, 'padding' );\n\t\t\tif (\n\t\t\t\t! hasViewportLayout &&\n\t\t\t\t! hasViewportBlockGap &&\n\t\t\t\t! hasViewportPadding\n\t\t\t) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\tconst layoutType = getLayoutType( layout?.type || 'default' );\n\t\t\tconst viewportCSS = layoutType?.getLayoutStyle?.( {\n\t\t\t\tblockName,\n\t\t\t\tselector,\n\t\t\t\tlayout,\n\t\t\t\tviewportOverrides: viewportLayout,\n\t\t\t\tstyle: viewportStyle,\n\t\t\t\thasBlockGapSupport,\n\t\t\t\tglobalBlockGapValue,\n\t\t\t} );\n\n\t\t\treturn viewportCSS ? `${ mediaQuery }{${ viewportCSS }}` : '';\n\t\t} )\n\t\t.filter( Boolean )\n\t\t.join( '' );\n}\n\nfunction LayoutPanelPure( {\n\tlayout,\n\tstyle,\n\tsetAttributes,\n\tname: blockName,\n\tclientId,\n} ) {\n\tconst settings = useBlockSettings( blockName );\n\t// Block settings come from theme.json under settings.[blockName].\n\tconst { layout: layoutSettings } = settings;\n\tconst { themeSupportsLayout, activeBlockVariation, selectedState } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst blockEditorSelect = select( blockEditorStore );\n\t\t\t\tconst { getBlockAttributes, getSettings } = blockEditorSelect;\n\t\t\t\tconst { getSelectedBlockStyleState } =\n\t\t\t\t\tunlock( blockEditorSelect );\n\t\t\t\treturn {\n\t\t\t\t\tactiveBlockVariation: select(\n\t\t\t\t\t\tblocksStore\n\t\t\t\t\t).getActiveBlockVariation(\n\t\t\t\t\t\tblockName,\n\t\t\t\t\t\tgetBlockAttributes( clientId ) || {},\n\t\t\t\t\t\t'block'\n\t\t\t\t\t),\n\t\t\t\t\tthemeSupportsLayout: getSettings().supportsLayout,\n\t\t\t\t\tselectedState:\n\t\t\t\t\t\tgetSelectedBlockStyleState?.( clientId ) ??\n\t\t\t\t\t\tDEFAULT_BLOCK_STYLE_STATE,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ blockName, clientId ]\n\t\t);\n\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst isViewportLayoutState =\n\t\thasViewportBlockStyleState( selectedState ) &&\n\t\t! hasPseudoBlockStyleState( selectedState );\n\tconst resetLayoutFilter = useCallback(\n\t\t( ...resetArgs ) => {\n\t\t\tconst attributes = resetArgs[ 0 ] || {};\n\t\t\tconst context = resetArgs[ 1 ] || {};\n\n\t\t\tif ( isViewportLayoutState ) {\n\t\t\t\tconst existingStateStyle =\n\t\t\t\t\tgetStyleForState(\n\t\t\t\t\t\tattributes.style ?? style,\n\t\t\t\t\t\tselectedState\n\t\t\t\t\t) || {};\n\t\t\t\tconst nextStateStyle = cleanEmptyObject( {\n\t\t\t\t\t...existingStateStyle,\n\t\t\t\t\tlayout: undefined,\n\t\t\t\t} );\n\n\t\t\t\treturn {\n\t\t\t\t\tstyle: setStyleForState(\n\t\t\t\t\t\tattributes.style ?? style,\n\t\t\t\t\t\tselectedState,\n\t\t\t\t\t\tnextStateStyle\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst resetBlockName = context.name || blockName;\n\t\t\tconst resetLayoutBlockSupport = getBlockSupport(\n\t\t\t\tresetBlockName,\n\t\t\t\tlayoutBlockSupportKey,\n\t\t\t\t{}\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tlayout: getResetLayout(\n\t\t\t\t\tresetLayoutBlockSupport,\n\t\t\t\t\tactiveBlockVariation\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tblockName,\n\t\t\tactiveBlockVariation,\n\t\t\tisViewportLayoutState,\n\t\t\tselectedState,\n\t\t\tstyle,\n\t\t]\n\t);\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\t// Layout block support comes from the block's block.json.\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst blockSupportAndThemeSettings = {\n\t\t...layoutSettings,\n\t\t...layoutBlockSupport,\n\t};\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = blockSupportAndThemeSettings;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t/*\n\t * Try to find the layout type from either the\n\t * block's layout settings or any saved layout config.\n\t */\n\tconst baseLayout = layout || defaultBlockLayout || {};\n\tconst stateStyle = isViewportLayoutState\n\t\t? getStyleForState( style, selectedState )\n\t\t: undefined;\n\tconst stateLayout = stateStyle?.layout;\n\tconst usedLayout = isViewportLayoutState\n\t\t? cleanEmptyObject( {\n\t\t\t\t...baseLayout,\n\t\t\t\t...stateLayout,\n\t\t } ) || {}\n\t\t: baseLayout;\n\tconst resetLayoutDefaults = isViewportLayoutState\n\t\t? baseLayout\n\t\t: getResetLayout( layoutBlockSupport, activeBlockVariation );\n\tconst blockSupportAndLayout = {\n\t\t...layoutBlockSupport,\n\t\t...usedLayout,\n\t};\n\tconst { type, default: { type: defaultType = 'default' } = {} } =\n\t\tblockSupportAndLayout;\n\tconst blockLayoutType = type || defaultType;\n\n\t// Only show the inherit toggle if it's supported,\n\t// and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t( ! blockLayoutType ||\n\t\t\tblockLayoutType === 'default' ||\n\t\t\tblockLayoutType === 'constrained' ||\n\t\t\tblockSupportAndLayout.inherit )\n\t);\n\n\tconst { inherit = false, contentSize = null } = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow` or\n\t * `constrained` layouts and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif (\n\t\t( blockLayoutType === 'default' ||\n\t\t\tblockLayoutType === 'constrained' ) &&\n\t\t! themeSupportsLayout\n\t) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( blockLayoutType );\n\tconst constrainedType = getLayoutType( 'constrained' );\n\tconst displayControlsForLegacyLayouts =\n\t\t! usedLayout.type && ( contentSize || inherit );\n\tconst hasContentSizeOrLegacySettings = !! inherit || !! contentSize;\n\tconst showLayoutTypeSwitcher =\n\t\tisDefaultBlockStyleState( selectedState ) &&\n\t\t! inherit &&\n\t\tallowSwitching;\n\n\tconst onChangeLayout = ( newLayout ) => {\n\t\tif ( isViewportLayoutState ) {\n\t\t\tconst nextStateStyle = cleanEmptyObject( {\n\t\t\t\t...stateStyle,\n\t\t\t\tlayout: getLayoutStateOverrides(\n\t\t\t\t\tcleanEmptyObject( newLayout ),\n\t\t\t\t\tbaseLayout,\n\t\t\t\t\tstateStyle?.layout\n\t\t\t\t),\n\t\t\t} );\n\t\t\tsetAttributes( {\n\t\t\t\tstyle: setStyleForState( style, selectedState, nextStateStyle ),\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\tsetAttributes( { layout: cleanEmptyObject( newLayout ) } );\n\t};\n\tconst onChangeType = ( newType ) => onChangeLayout( { type: newType } );\n\tconst resetLayout = () => onChangeLayout( resetLayoutDefaults );\n\tconst resetInheritToggle = () => onChangeLayout( { type: 'default' } );\n\tconst isUsingContentWidth = () =>\n\t\tlayoutType?.name === 'constrained' || hasContentSizeOrLegacySettings;\n\tconst hasInheritToggleValue = () =>\n\t\tisViewportLayoutState\n\t\t\t? ( usedLayout?.type ?? 'default' ) !==\n\t\t\t ( resetLayoutDefaults?.type ?? 'default' )\n\t\t\t: layout?.type === 'constrained';\n\tconst hasLayoutTypeValue = () =>\n\t\t( usedLayout?.type ?? 'default' ) !==\n\t\t( resetLayoutDefaults?.type ?? 'default' );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls\n\t\t\t\tgroup=\"layout\"\n\t\t\t\tresetAllFilter={ resetLayoutFilter }\n\t\t\t>\n\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Use content width' ) }\n\t\t\t\t\t\thasValue={ hasInheritToggleValue }\n\t\t\t\t\t\tonDeselect={ resetInheritToggle }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use content width' ) }\n\t\t\t\t\t\t\tchecked={ isUsingContentWidth() }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tonChangeLayout( {\n\t\t\t\t\t\t\t\t\ttype: isUsingContentWidth()\n\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t: 'constrained',\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\tisUsingContentWidth()\n\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container.'\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\n\t\t\t\t{ showLayoutTypeSwitcher && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Layout type' ) }\n\t\t\t\t\t\thasValue={ hasLayoutTypeValue }\n\t\t\t\t\t\tonDeselect={ resetLayout }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ blockLayoutType }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\n\t\t\t\t{ layoutType && layoutType.name !== 'default' && (\n\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\tvalue={ layout }\n\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\tresetLayout={ resetLayoutDefaults }\n\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ constrainedType && displayControlsForLegacyLayouts && (\n\t\t\t\t\t<constrainedType.inspectorControls\n\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\tvalue={ layout }\n\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\tresetLayout={ resetLayoutDefaults }\n\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\tname={ blockName }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: LayoutPanelPure,\n\tattributeKeys: [ 'layout', 'style' ],\n\thasSupport( name ) {\n\t\treturn hasLayoutBlockSupport( name );\n\t},\n};\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\t__next40pxDefaultSize\n\t\t\tisBlock\n\t\t\tlabel={ __( 'Layout type' ) }\n\t\t\thideLabelFromVision\n\t\t\tisAdaptiveWidth\n\t\t\tvalue={ type }\n\t\t\tonChange={ onChange }\n\t\t>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tvalue={ name }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ToggleGroupControl>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( 'type' in ( settings.attributes?.layout ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasLayoutBlockSupport( settings ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockWithLayoutStyles( {\n\tblock: BlockListBlock,\n\tprops,\n\tblockGapSupport,\n\tglobalBlockGapValue,\n\tlayoutClasses,\n} ) {\n\tconst { name, attributes } = props;\n\tconst id = useInstanceId( BlockListBlock );\n\tconst { layout } = attributes;\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst selectorPrefix = `wp-container-${ kebabCase( name ) }-is-layout-`;\n\t// Higher specificity to override defaults from theme.json.\n\tconst selector = `.${ selectorPrefix }${ id }`;\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t// Get CSS string for the current layout type.\n\t// The CSS and `style` element is only output if it is not empty.\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst baseLayoutCSS = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName: name,\n\t\tselector,\n\t\tlayout: usedLayout,\n\t\tstyle: attributes?.style,\n\t\thasBlockGapSupport,\n\t\tglobalBlockGapValue,\n\t} );\n\tconst responsiveLayoutCSS = getResponsiveLayoutStyles( {\n\t\tattributes,\n\t\tblockName: name,\n\t\tselector,\n\t\tlayout: usedLayout,\n\t\thasBlockGapSupport,\n\t\tglobalBlockGapValue,\n\t} );\n\tconst css = [ baseLayoutCSS, responsiveLayoutCSS ]\n\t\t.filter( Boolean )\n\t\t.join( '' );\n\n\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\tconst layoutClassNames = clsx(\n\t\t{\n\t\t\t[ `${ selectorPrefix }${ id }` ]: !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t},\n\t\tlayoutClasses\n\t);\n\n\tuseStyleOverride( { css } );\n\n\treturn (\n\t\t<BlockListBlock\n\t\t\t{ ...props }\n\t\t\t__unstableLayoutClassNames={ layoutClassNames }\n\t\t/>\n\t);\n}\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) =>\n\t\tfunction WithLayoutStyles( props ) {\n\t\t\tconst { clientId, name, attributes } = props;\n\t\t\tconst blockSupportsLayout = hasLayoutBlockSupport( name );\n\t\t\tconst layoutClasses = useLayoutClasses( attributes, name );\n\t\t\tconst extraProps = useSelect(\n\t\t\t\t( select ) => {\n\t\t\t\t\t// The callback returns early to avoid block editor subscription.\n\t\t\t\t\tif ( ! blockSupportsLayout ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst { getSettings, getBlockSettings } = unlock(\n\t\t\t\t\t\tselect( blockEditorStore )\n\t\t\t\t\t);\n\t\t\t\t\tconst settings = getSettings();\n\t\t\t\t\tconst { disableLayoutStyles } = settings;\n\n\t\t\t\t\tif ( disableLayoutStyles ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst [ blockGapSupport ] = getBlockSettings(\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t'spacing.blockGap'\n\t\t\t\t\t);\n\n\t\t\t\t\t// Get default blockGap value from global styles for use in layouts like grid.\n\t\t\t\t\t// Check style variation first, then block-specific styles, then fall back to root styles.\n\t\t\t\t\tconst globalStyles = settings[ globalStylesDataKey ];\n\n\t\t\t\t\t// Check if the block has an active style variation with a blockGap value.\n\t\t\t\t\t// Only check the registry if the className contains a variation class to avoid unnecessary lookups.\n\t\t\t\t\tlet variationBlockGapValue;\n\t\t\t\t\tconst className = attributes?.className;\n\t\t\t\t\tif ( className?.includes( VARIATION_PREFIX ) ) {\n\t\t\t\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\t\t\t\tconst registeredStyles = getBlockStyles( name );\n\t\t\t\t\t\tconst variationName = getVariationNameFromClass(\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\tregisteredStyles\n\t\t\t\t\t\t);\n\t\t\t\t\t\tvariationBlockGapValue = variationName\n\t\t\t\t\t\t\t? globalStyles?.blocks?.[ name ]?.variations?.[\n\t\t\t\t\t\t\t\t\tvariationName\n\t\t\t\t\t\t\t ]?.spacing?.blockGap\n\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst globalBlockGapValue =\n\t\t\t\t\t\tvariationBlockGapValue ??\n\t\t\t\t\t\tglobalStyles?.blocks?.[ name ]?.spacing?.blockGap ??\n\t\t\t\t\t\tglobalStyles?.spacing?.blockGap;\n\n\t\t\t\t\treturn { blockGapSupport, globalBlockGapValue };\n\t\t\t\t},\n\t\t\t\t[ blockSupportsLayout, clientId, attributes?.className, name ]\n\t\t\t);\n\n\t\t\tif ( ! extraProps ) {\n\t\t\t\treturn (\n\t\t\t\t\t<BlockListBlock\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t__unstableLayoutClassNames={\n\t\t\t\t\t\t\tblockSupportsLayout ? layoutClasses : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<BlockWithLayoutStyles\n\t\t\t\t\tblock={ BlockListBlock }\n\t\t\t\t\tprops={ props }\n\t\t\t\t\tlayoutClasses={ layoutClasses }\n\t\t\t\t\t{ ...extraProps }\n\t\t\t\t/>\n\t\t\t);\n\t\t},\n\t'withLayoutStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,4BAA4B,qBAAqB;AAC1D,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B;AAAA,EACC;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,iBAAiB;AAC1B;AAAA,EACC,oCAAoC;AAAA,EACpC,0CAA0C;AAAA,EAC1C;AAAA,EACA,gCAAgC;AAAA,EAChC,eAAe;AAAA,OACT;AACP,SAAS,UAAU;AAKnB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,eAAe,sBAAsB;AAC9C,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AACnC,SAAS,kBAAkB,kBAAkB,wBAAwB;AACrE,SAAS,cAAc;AACvB,SAAS,2BAA2B;AACpC,SAAS,iCAAiC;AAC1C;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AA+bL,mBAaI,KAZH,YADD;AA7bF,IAAM,mBAAmB;AAEzB,IAAM,wBAAwB;AAG9B,IAAM,yBAAyB;AAAA,EAC9B,QAAQ;AAAA,EACR,QAAQ;AACT;AACA,IAAM,oBAAoB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AACA,IAAM,EAAE,U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,cAAc,SAAU,IAAK,GAAG,aAChC,aACA,GAAG,SAAS,WACZ;AAAA,QACJ;AAEA,cAAM,sBACL,0BACA,cAAc,SAAU,IAAK,GAAG,SAAS,YACzC,cAAc,SAAS;AAExB,eAAO,EAAE,iBAAiB,oBAAoB;AAAA,MAC/C;AAAA,MACA,CAAE,qBAAqB,UAAU,YAAY,WAAW,IAAK;AAAA,IAC9D;AAEA,QAAK,CAAE,YAAa;AACnB,aACC;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACL,4BACC,sBAAsB,gBAAgB;AAAA;AAAA,MAExC;AAAA,IAEF;AAEA,WACC;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ;AAAA,QACR;AAAA,QACA;AAAA,QACE,GAAG;AAAA;AAAA,IACN;AAAA,EAEF;AAAA,EACD;AACD;AAEA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;AACA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useCallback } from '@wordpress/element';\nimport {\n\tgetBlockSupport,\n\thasBlockSupport,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\tToggleControl,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport { useSettings } from '../components/use-settings';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { LAYOUT_DEFINITIONS } from '../layouts/definitions';\nimport { cleanEmptyObject, useBlockSettings, useStyleOverride } from './utils';\nimport { unlock } from '../lock-unlock';\nimport { globalStylesDataKey } from '../store/private-keys';\nimport { getVariationNameFromClass } from './block-style-variation';\nimport {\n\tDEFAULT_BLOCK_STYLE_STATE,\n\tgetStyleForState,\n\thasPseudoBlockStyleState,\n\thasViewportBlockStyleState,\n\tisDefaultBlockStyleState,\n\tsetStyleForState,\n} from './block-style-state';\n\nconst VARIATION_PREFIX = 'is-style-';\n\nconst layoutBlockSupportKey = 'layout';\n// Keep in sync with WP_Theme_JSON_Gutenberg::RESPONSIVE_BREAKPOINTS and\n// packages/global-styles-engine/src/core/render.tsx.\nconst RESPONSIVE_BREAKPOINTS = {\n\t'@mobile': '@media (width <= 480px)',\n\t'@tablet': '@media (480px < width <= 782px)',\n};\nconst CHILD_LAYOUT_KEYS = [\n\t'selfStretch',\n\t'flexSize',\n\t'columnStart',\n\t'columnSpan',\n\t'rowStart',\n\t'rowSpan',\n];\nconst { kebabCase } = unlock( componentsPrivateApis );\n\nfunction getDefaultLayout( layoutBlockSupport = {}, blockVariation ) {\n\tconst defaultBlockLayout = layoutBlockSupport?.default;\n\n\treturn blockVariation?.attributes?.layout ?? defaultBlockLayout;\n}\n\n/**\n * Returns the layout values to use when resetting layout controls.\n *\n * @param { Object } layoutBlockSupport Block layout support settings.\n * @param { Object|undefined } blockVariation Block variation settings.\n *\n * @return { Object|undefined } Reset layout values.\n */\nexport function getResetLayout( layoutBlockSupport = {}, blockVariation ) {\n\treturn cleanEmptyObject( {\n\t\t...getDefaultLayout( layoutBlockSupport, blockVariation ),\n\t} );\n}\n\nfunction getLayoutStateOverrides(\n\tlayout = {},\n\tbaseLayout = {},\n\texistingLayout = {}\n) {\n\tconst overrides = {};\n\tconst childLayoutValues = Object.fromEntries(\n\t\tCHILD_LAYOUT_KEYS.filter( ( key ) =>\n\t\t\tObject.hasOwn( existingLayout || {}, key )\n\t\t).map( ( key ) => [ key, existingLayout[ key ] ] )\n\t);\n\n\tObject.entries( layout || {} ).forEach( ( [ key, value ] ) => {\n\t\tif (\n\t\t\t! CHILD_LAYOUT_KEYS.includes( key ) &&\n\t\t\tvalue !== baseLayout?.[ key ]\n\t\t) {\n\t\t\toverrides[ key ] = value;\n\t\t}\n\t} );\n\n\treturn cleanEmptyObject( {\n\t\t...childLayoutValues,\n\t\t...overrides,\n\t} );\n}\n\nfunction getLayoutContainerValues( layout = {} ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( layout || {} ).filter(\n\t\t\t( [ key ] ) => ! CHILD_LAYOUT_KEYS.includes( key )\n\t\t)\n\t);\n}\n\nfunction hasLayoutBlockSupport( blockName ) {\n\treturn (\n\t\thasBlockSupport( blockName, 'layout' ) ||\n\t\thasBlockSupport( blockName, '__experimentalLayout' )\n\t);\n}\n\n/**\n * Generates the utility classnames for the given block's layout attributes.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n *\n * @return { Array } Array of CSS classname strings.\n */\nexport function useLayoutClasses( blockAttributes = {}, blockName = '' ) {\n\tconst { layout } = blockAttributes;\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( blockName, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst layoutClassnames = [];\n\n\tif ( LAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className ) {\n\t\tconst baseClassName =\n\t\t\tLAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className;\n\t\tconst splitBlockName = blockName.split( '/' );\n\t\tconst fullBlockName =\n\t\t\tsplitBlockName[ 0 ] === 'core'\n\t\t\t\t? splitBlockName.pop()\n\t\t\t\t: splitBlockName.join( '-' );\n\t\tconst compoundClassName = `wp-block-${ fullBlockName }-${ baseClassName }`;\n\t\tlayoutClassnames.push( baseClassName, compoundClassName );\n\t}\n\n\tconst hasGlobalPadding = useSelect(\n\t\t( select ) => {\n\t\t\t// Early return to avoid subscription when layout doesn't use global padding\n\t\t\tif (\n\t\t\t\t! usedLayout?.inherit &&\n\t\t\t\t! usedLayout?.contentSize &&\n\t\t\t\tusedLayout?.type !== 'constrained'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn select( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalFeatures?.useRootPaddingAwareAlignments;\n\t\t},\n\t\t[ usedLayout?.contentSize, usedLayout?.inherit, usedLayout?.type ]\n\t);\n\n\tif ( hasGlobalPadding ) {\n\t\tlayoutClassnames.push( 'has-global-padding' );\n\t}\n\n\tif ( usedLayout?.orientation ) {\n\t\tlayoutClassnames.push( `is-${ kebabCase( usedLayout.orientation ) }` );\n\t}\n\n\tif ( usedLayout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase(\n\t\t\t\tusedLayout.justifyContent\n\t\t\t) }`\n\t\t);\n\t}\n\n\tif ( usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap' ) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\n/**\n * Generates a CSS rule with the given block's layout styles.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n * @param { string } selector A selector to use in generating the CSS rule.\n *\n * @return { string } CSS rule.\n */\nexport function useLayoutStyles( blockAttributes = {}, blockName, selector ) {\n\tconst { layout = {}, style = {} } = blockAttributes;\n\t// Update type for blocks using legacy layouts.\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || {};\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst [ blockGapSupport ] = useSettings( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\treturn fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName,\n\t\tselector,\n\t\tlayout,\n\t\tstyle,\n\t\thasBlockGapSupport,\n\t} );\n}\n\n/**\n * Generates responsive layout CSS for viewport state styles.\n *\n * Viewport state blockGap values need to go through the layout definitions\n * because flow/constrained layouts use child margins while flex/grid use gap.\n *\n * @param { Object } options Options.\n * @param { Object } options.attributes Block attributes.\n * @param { string } options.blockName Block name.\n * @param { string } options.selector CSS selector.\n * @param { Object } options.layout Active block layout.\n * @param { boolean } options.hasBlockGapSupport Whether block gap is supported.\n * @param { * } options.globalBlockGapValue Global block gap fallback.\n *\n * @return { string } CSS rule.\n */\nexport function getResponsiveLayoutStyles( {\n\tattributes = {},\n\tblockName,\n\tselector,\n\tlayout = {},\n\thasBlockGapSupport,\n\tglobalBlockGapValue,\n} ) {\n\treturn Object.entries( RESPONSIVE_BREAKPOINTS )\n\t\t.map( ( [ viewport, mediaQuery ] ) => {\n\t\t\tconst viewportStyle = getStyleForState( attributes?.style, {\n\t\t\t\tviewport,\n\t\t\t\tpseudo: DEFAULT_BLOCK_STYLE_STATE.pseudo,\n\t\t\t} );\n\t\t\tconst viewportLayout = getLayoutContainerValues(\n\t\t\t\tviewportStyle?.layout\n\t\t\t);\n\t\t\tconst hasViewportLayout = Object.keys( viewportLayout ).length > 0;\n\t\t\tconst hasViewportBlockGap =\n\t\t\t\tviewportStyle?.spacing &&\n\t\t\t\tObject.hasOwn( viewportStyle.spacing, 'blockGap' );\n\t\t\tconst hasViewportPadding =\n\t\t\t\tviewportStyle?.spacing &&\n\t\t\t\tObject.hasOwn( viewportStyle.spacing, 'padding' );\n\t\t\tif (\n\t\t\t\t! hasViewportLayout &&\n\t\t\t\t! hasViewportBlockGap &&\n\t\t\t\t! hasViewportPadding\n\t\t\t) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\tconst layoutType = getLayoutType( layout?.type || 'default' );\n\t\t\tconst viewportCSS = layoutType?.getLayoutStyle?.( {\n\t\t\t\tblockName,\n\t\t\t\tselector,\n\t\t\t\tlayout,\n\t\t\t\tviewportOverrides: viewportLayout,\n\t\t\t\tstyle: viewportStyle,\n\t\t\t\thasBlockGapSupport,\n\t\t\t\tglobalBlockGapValue,\n\t\t\t} );\n\n\t\t\treturn viewportCSS ? `${ mediaQuery }{${ viewportCSS }}` : '';\n\t\t} )\n\t\t.filter( Boolean )\n\t\t.join( '' );\n}\n\nfunction LayoutPanelPure( {\n\tlayout,\n\tstyle,\n\tsetAttributes,\n\tname: blockName,\n\tclientId,\n} ) {\n\tconst settings = useBlockSettings( blockName );\n\t// Block settings come from theme.json under settings.[blockName].\n\tconst { layout: layoutSettings } = settings;\n\tconst { themeSupportsLayout, activeBlockVariation, selectedState } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst blockEditorSelect = select( blockEditorStore );\n\t\t\t\tconst { getBlockAttributes, getSettings } = blockEditorSelect;\n\t\t\t\tconst { getSelectedBlockStyleState } =\n\t\t\t\t\tunlock( blockEditorSelect );\n\t\t\t\treturn {\n\t\t\t\t\tactiveBlockVariation: select(\n\t\t\t\t\t\tblocksStore\n\t\t\t\t\t).getActiveBlockVariation(\n\t\t\t\t\t\tblockName,\n\t\t\t\t\t\tgetBlockAttributes( clientId ) || {},\n\t\t\t\t\t\t'block'\n\t\t\t\t\t),\n\t\t\t\t\tthemeSupportsLayout: getSettings().supportsLayout,\n\t\t\t\t\tselectedState:\n\t\t\t\t\t\tgetSelectedBlockStyleState?.( clientId ) ??\n\t\t\t\t\t\tDEFAULT_BLOCK_STYLE_STATE,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ blockName, clientId ]\n\t\t);\n\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst isViewportLayoutState =\n\t\thasViewportBlockStyleState( selectedState ) &&\n\t\t! hasPseudoBlockStyleState( selectedState );\n\tconst resetLayoutFilter = useCallback(\n\t\t( ...resetArgs ) => {\n\t\t\tconst attributes = resetArgs[ 0 ] || {};\n\t\t\tconst context = resetArgs[ 1 ] || {};\n\n\t\t\tif ( isViewportLayoutState ) {\n\t\t\t\tconst existingStateStyle =\n\t\t\t\t\tgetStyleForState(\n\t\t\t\t\t\tattributes.style ?? style,\n\t\t\t\t\t\tselectedState\n\t\t\t\t\t) || {};\n\t\t\t\tconst nextStateStyle = cleanEmptyObject( {\n\t\t\t\t\t...existingStateStyle,\n\t\t\t\t\tlayout: undefined,\n\t\t\t\t} );\n\n\t\t\t\treturn {\n\t\t\t\t\tstyle: setStyleForState(\n\t\t\t\t\t\tattributes.style ?? style,\n\t\t\t\t\t\tselectedState,\n\t\t\t\t\t\tnextStateStyle\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst resetBlockName = context.name || blockName;\n\t\t\tconst resetLayoutBlockSupport = getBlockSupport(\n\t\t\t\tresetBlockName,\n\t\t\t\tlayoutBlockSupportKey,\n\t\t\t\t{}\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tlayout: getResetLayout(\n\t\t\t\t\tresetLayoutBlockSupport,\n\t\t\t\t\tactiveBlockVariation\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tblockName,\n\t\t\tactiveBlockVariation,\n\t\t\tisViewportLayoutState,\n\t\t\tselectedState,\n\t\t\tstyle,\n\t\t]\n\t);\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\t// Layout block support comes from the block's block.json.\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst blockSupportAndThemeSettings = {\n\t\t...layoutSettings,\n\t\t...layoutBlockSupport,\n\t};\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = blockSupportAndThemeSettings;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t/*\n\t * Try to find the layout type from either the\n\t * block's layout settings or any saved layout config.\n\t */\n\tconst baseLayout = layout || defaultBlockLayout || {};\n\tconst stateStyle = isViewportLayoutState\n\t\t? getStyleForState( style, selectedState )\n\t\t: undefined;\n\tconst stateLayout = stateStyle?.layout;\n\tconst usedLayout = isViewportLayoutState\n\t\t? cleanEmptyObject( {\n\t\t\t\t...baseLayout,\n\t\t\t\t...stateLayout,\n\t\t } ) || {}\n\t\t: baseLayout;\n\tconst resetLayoutDefaults = isViewportLayoutState\n\t\t? baseLayout\n\t\t: getResetLayout( layoutBlockSupport, activeBlockVariation );\n\tconst blockSupportAndLayout = {\n\t\t...layoutBlockSupport,\n\t\t...usedLayout,\n\t};\n\tconst { type, default: { type: defaultType = 'default' } = {} } =\n\t\tblockSupportAndLayout;\n\tconst blockLayoutType = type || defaultType;\n\n\t// Only show the inherit toggle if it's supported,\n\t// and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t( ! blockLayoutType ||\n\t\t\tblockLayoutType === 'default' ||\n\t\t\tblockLayoutType === 'constrained' ||\n\t\t\tblockSupportAndLayout.inherit )\n\t);\n\n\tconst { inherit = false, contentSize = null } = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow` or\n\t * `constrained` layouts and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif (\n\t\t( blockLayoutType === 'default' ||\n\t\t\tblockLayoutType === 'constrained' ) &&\n\t\t! themeSupportsLayout\n\t) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( blockLayoutType );\n\tconst constrainedType = getLayoutType( 'constrained' );\n\tconst displayControlsForLegacyLayouts =\n\t\t! usedLayout.type && ( contentSize || inherit );\n\tconst hasContentSizeOrLegacySettings = !! inherit || !! contentSize;\n\tconst showLayoutTypeSwitcher =\n\t\tisDefaultBlockStyleState( selectedState ) &&\n\t\t! inherit &&\n\t\tallowSwitching;\n\n\tconst onChangeLayout = ( newLayout ) => {\n\t\tif ( isViewportLayoutState ) {\n\t\t\tconst nextStateStyle = cleanEmptyObject( {\n\t\t\t\t...stateStyle,\n\t\t\t\tlayout: getLayoutStateOverrides(\n\t\t\t\t\tcleanEmptyObject( newLayout ),\n\t\t\t\t\tbaseLayout,\n\t\t\t\t\tstateStyle?.layout\n\t\t\t\t),\n\t\t\t} );\n\t\t\tsetAttributes( {\n\t\t\t\tstyle: setStyleForState( style, selectedState, nextStateStyle ),\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\tsetAttributes( { layout: cleanEmptyObject( newLayout ) } );\n\t};\n\tconst onChangeType = ( newType ) => onChangeLayout( { type: newType } );\n\tconst resetLayout = () => onChangeLayout( resetLayoutDefaults );\n\tconst resetInheritToggle = () => onChangeLayout( { type: 'default' } );\n\tconst isUsingContentWidth = () =>\n\t\tlayoutType?.name === 'constrained' || hasContentSizeOrLegacySettings;\n\tconst hasInheritToggleValue = () =>\n\t\tisViewportLayoutState\n\t\t\t? ( usedLayout?.type ?? 'default' ) !==\n\t\t\t ( resetLayoutDefaults?.type ?? 'default' )\n\t\t\t: layout?.type === 'constrained';\n\tconst hasLayoutTypeValue = () =>\n\t\t( usedLayout?.type ?? 'default' ) !==\n\t\t( resetLayoutDefaults?.type ?? 'default' );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls\n\t\t\t\tgroup=\"layout\"\n\t\t\t\tresetAllFilter={ resetLayoutFilter }\n\t\t\t>\n\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Use content width' ) }\n\t\t\t\t\t\thasValue={ hasInheritToggleValue }\n\t\t\t\t\t\tonDeselect={ resetInheritToggle }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use content width' ) }\n\t\t\t\t\t\t\tchecked={ isUsingContentWidth() }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tonChangeLayout( {\n\t\t\t\t\t\t\t\t\ttype: isUsingContentWidth()\n\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t: 'constrained',\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\tisUsingContentWidth()\n\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container.'\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\n\t\t\t\t{ showLayoutTypeSwitcher && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Layout type' ) }\n\t\t\t\t\t\thasValue={ hasLayoutTypeValue }\n\t\t\t\t\t\tonDeselect={ resetLayout }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ blockLayoutType }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\n\t\t\t\t{ layoutType && layoutType.name !== 'default' && (\n\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\tvalue={ layout }\n\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\tresetLayout={ resetLayoutDefaults }\n\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ constrainedType && displayControlsForLegacyLayouts && (\n\t\t\t\t\t<constrainedType.inspectorControls\n\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\tvalue={ layout }\n\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\tresetLayout={ resetLayoutDefaults }\n\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\tname={ blockName }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: LayoutPanelPure,\n\tattributeKeys: [ 'layout', 'style' ],\n\thasSupport( name ) {\n\t\treturn hasLayoutBlockSupport( name );\n\t},\n};\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\t__next40pxDefaultSize\n\t\t\tisBlock\n\t\t\tlabel={ __( 'Layout type' ) }\n\t\t\thideLabelFromVision\n\t\t\tisAdaptiveWidth\n\t\t\tvalue={ type }\n\t\t\tonChange={ onChange }\n\t\t>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tvalue={ name }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ToggleGroupControl>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( 'type' in ( settings.attributes?.layout ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasLayoutBlockSupport( settings ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockWithLayoutStyles( {\n\tblock: BlockListBlock,\n\tprops,\n\tblockGapSupport,\n\tglobalBlockGapValue,\n\tlayoutClasses,\n} ) {\n\tconst { name, attributes } = props;\n\tconst id = useInstanceId( BlockListBlock );\n\tconst { layout } = attributes;\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst selectorPrefix = `wp-container-${ kebabCase( name ) }-is-layout-`;\n\t// Higher specificity to override defaults from theme.json.\n\tconst selector = `.${ selectorPrefix }${ id }`;\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t// Get CSS string for the current layout type.\n\t// The CSS and `style` element is only output if it is not empty.\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst baseLayoutCSS = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName: name,\n\t\tselector,\n\t\tlayout: usedLayout,\n\t\tstyle: attributes?.style,\n\t\thasBlockGapSupport,\n\t\tglobalBlockGapValue,\n\t} );\n\tconst responsiveLayoutCSS = getResponsiveLayoutStyles( {\n\t\tattributes,\n\t\tblockName: name,\n\t\tselector,\n\t\tlayout: usedLayout,\n\t\thasBlockGapSupport,\n\t\tglobalBlockGapValue,\n\t} );\n\tconst css = [ baseLayoutCSS, responsiveLayoutCSS ]\n\t\t.filter( Boolean )\n\t\t.join( '' );\n\n\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\tconst layoutClassNames = clsx(\n\t\t{\n\t\t\t[ `${ selectorPrefix }${ id }` ]: !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t},\n\t\tlayoutClasses\n\t);\n\n\tuseStyleOverride( { css } );\n\n\treturn (\n\t\t<BlockListBlock\n\t\t\t{ ...props }\n\t\t\t__unstableLayoutClassNames={ layoutClassNames }\n\t\t/>\n\t);\n}\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) =>\n\t\tfunction WithLayoutStyles( props ) {\n\t\t\tconst { clientId, name, attributes } = props;\n\t\t\tconst blockSupportsLayout = hasLayoutBlockSupport( name );\n\t\t\tconst layoutClasses = useLayoutClasses( attributes, name );\n\t\t\tconst extraProps = useSelect(\n\t\t\t\t( select ) => {\n\t\t\t\t\t// The callback returns early to avoid block editor subscription.\n\t\t\t\t\tif ( ! blockSupportsLayout ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst { getSettings, getBlockSettings } = unlock(\n\t\t\t\t\t\tselect( blockEditorStore )\n\t\t\t\t\t);\n\t\t\t\t\tconst settings = getSettings();\n\t\t\t\t\tconst { disableLayoutStyles } = settings;\n\n\t\t\t\t\tif ( disableLayoutStyles ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst [ blockGapSupport ] = getBlockSettings(\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t'spacing.blockGap'\n\t\t\t\t\t);\n\n\t\t\t\t\t// Get default blockGap value from global styles for use in layouts like grid.\n\t\t\t\t\t// Check style variation first, then block-specific styles, then fall back to root styles.\n\t\t\t\t\tconst globalStyles = settings[ globalStylesDataKey ];\n\n\t\t\t\t\t// Check if the block has an active style variation with a blockGap value.\n\t\t\t\t\t// Only check the registry if the className contains a variation class to avoid unnecessary lookups.\n\t\t\t\t\tlet variationBlockGapValue;\n\t\t\t\t\tconst className = attributes?.className;\n\t\t\t\t\tif ( className?.includes( VARIATION_PREFIX ) ) {\n\t\t\t\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\t\t\t\tconst registeredStyles = getBlockStyles( name );\n\t\t\t\t\t\tconst variationName = getVariationNameFromClass(\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\tregisteredStyles\n\t\t\t\t\t\t);\n\t\t\t\t\t\tvariationBlockGapValue = variationName\n\t\t\t\t\t\t\t? globalStyles?.blocks?.[ name ]?.variations?.[\n\t\t\t\t\t\t\t\t\tvariationName\n\t\t\t\t\t\t\t ]?.spacing?.blockGap\n\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst globalBlockGapValue =\n\t\t\t\t\t\tvariationBlockGapValue ??\n\t\t\t\t\t\tglobalStyles?.blocks?.[ name ]?.spacing?.blockGap ??\n\t\t\t\t\t\tglobalStyles?.spacing?.blockGap;\n\n\t\t\t\t\treturn { blockGapSupport, globalBlockGapValue };\n\t\t\t\t},\n\t\t\t\t[ blockSupportsLayout, clientId, attributes?.className, name ]\n\t\t\t);\n\n\t\t\tif ( ! extraProps ) {\n\t\t\t\treturn (\n\t\t\t\t\t<BlockListBlock\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t__unstableLayoutClassNames={\n\t\t\t\t\t\t\tblockSupportsLayout ? layoutClasses : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<BlockWithLayoutStyles\n\t\t\t\t\tblock={ BlockListBlock }\n\t\t\t\t\tprops={ props }\n\t\t\t\t\tlayoutClasses={ layoutClasses }\n\t\t\t\t\t{ ...extraProps }\n\t\t\t\t/>\n\t\t\t);\n\t\t},\n\t'withLayoutStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,4BAA4B,qBAAqB;AAC1D,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B;AAAA,EACC;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,iBAAiB;AAC1B;AAAA,EACC,oCAAoC;AAAA,EACpC,0CAA0C;AAAA,EAC1C;AAAA,EACA,gCAAgC;AAAA,EAChC,eAAe;AAAA,OACT;AACP,SAAS,UAAU;AAKnB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,eAAe,sBAAsB;AAC9C,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AACnC,SAAS,kBAAkB,kBAAkB,wBAAwB;AACrE,SAAS,cAAc;AACvB,SAAS,2BAA2B;AACpC,SAAS,iCAAiC;AAC1C;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAkcL,mBAaI,KAZH,YADD;AAhcF,IAAM,mBAAmB;AAEzB,IAAM,wBAAwB;AAG9B,IAAM,yBAAyB;AAAA,EAC9B,WAAW;AAAA,EACX,WAAW;AACZ;AACA,IAAM,oBAAoB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AACA,IAAM,EAAE,UAAU,IAAI,OAAQ,qBAAsB;AAEpD,SAAS,iBAAkB,qBAAqB,CAAC,GAAG,gBAAiB;AACpE,QAAM,qBAAqB,oBAAoB;AAE/C,SAAO,gBAAgB,YAAY,UAAU;AAC9C;AAUO,SAAS,eAAgB,qBAAqB,CAAC,GAAG,gBAAiB;AACzE,SAAO,iBAAkB;AAAA,I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,oBAAoB;AAAA,MAC/C;AAAA,MACA,CAAE,qBAAqB,UAAU,YAAY,WAAW,IAAK;AAAA,IAC9D;AAEA,QAAK,CAAE,YAAa;AACnB,aACC;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACL,4BACC,sBAAsB,gBAAgB;AAAA;AAAA,MAExC;AAAA,IAEF;AAEA,WACC;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ;AAAA,QACR;AAAA,QACA;AAAA,QACE,GAAG;AAAA;AAAA,IACN;AAAA,EAEF;AAAA,EACD;AACD;AAEA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;AACA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -21,16 +21,19 @@ function ListViewPanel({ clientId, name }) {
|
|
|
21
21
|
const { openListViewContentPanel } = unlock(
|
|
22
22
|
useDispatch(blockEditorStore)
|
|
23
23
|
);
|
|
24
|
-
const isEnabled =
|
|
25
|
-
const { hasChildren, isNestedListView } = useSelect(
|
|
24
|
+
const { isEnabled, hasChildren, isNestedListView } = useSelect(
|
|
26
25
|
(select) => {
|
|
27
|
-
const {
|
|
26
|
+
const {
|
|
27
|
+
getBlockCount,
|
|
28
|
+
getBlockParents,
|
|
29
|
+
shouldRenderBlockListView
|
|
30
|
+
} = unlock(select(blockEditorStore));
|
|
28
31
|
const parents = getBlockParents(clientId, false);
|
|
29
|
-
const _isNestedListView = parents.find(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
});
|
|
32
|
+
const _isNestedListView = parents.find(
|
|
33
|
+
(parentId) => shouldRenderBlockListView(parentId)
|
|
34
|
+
);
|
|
33
35
|
return {
|
|
36
|
+
isEnabled: shouldRenderBlockListView(clientId),
|
|
34
37
|
hasChildren: !!getBlockCount(clientId),
|
|
35
38
|
isNestedListView: _isNestedListView
|
|
36
39
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/hooks/list-view.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PanelBody } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { hasBlockSupport, getBlockType } from '@wordpress/blocks';\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { PrivateListView } from '../components/list-view';\nimport InspectorControls from '../components/inspector-controls/fill';\nimport { PrivateBlockContext } from '../components/block-list/private-block-context';\nimport useListViewPanelState from '../components/use-list-view-panel-state';\n\nimport { unlock } from '../lock-unlock';\n\nexport const LIST_VIEW_SUPPORT_KEY = 'listView';\n\n/**\n * Check if the block has list view support.\n *\n * @param {string|Object} nameOrType Block name or block type object.\n * @return {boolean} Whether the block has list view support.\n */\nexport function hasListViewSupport( nameOrType ) {\n\treturn hasBlockSupport( nameOrType, LIST_VIEW_SUPPORT_KEY );\n}\n\n/**\n * Inspector controls panel for list view.\n *\n * @param {Object} props Component props.\n * @param {string} props.clientId Block client ID.\n * @param {string} props.name Block name.\n * @return {Element|null} List view inspector controls or null.\n */\nexport function ListViewPanel( { clientId, name } ) {\n\tconst { isSelectionWithinCurrentSection } =\n\t\tuseContext( PrivateBlockContext );\n\n\tconst { isOpened, expandRevision, handleToggle } =\n\t\tuseListViewPanelState( clientId );\n\n\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\tconst { openListViewContentPanel } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst isEnabled
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,aAAa,iBAAiB;AACvC,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,kBAAkB;AAK3B,SAAS,SAAS,wBAAwB;AAC1C,SAAS,uBAAuB;AAChC,OAAO,uBAAuB;AAC9B,SAAS,2BAA2B;AACpC,OAAO,2BAA2B;AAElC,SAAS,cAAc;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PanelBody } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { hasBlockSupport, getBlockType } from '@wordpress/blocks';\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { PrivateListView } from '../components/list-view';\nimport InspectorControls from '../components/inspector-controls/fill';\nimport { PrivateBlockContext } from '../components/block-list/private-block-context';\nimport useListViewPanelState from '../components/use-list-view-panel-state';\n\nimport { unlock } from '../lock-unlock';\n\nexport const LIST_VIEW_SUPPORT_KEY = 'listView';\n\n/**\n * Check if the block has list view support.\n *\n * @param {string|Object} nameOrType Block name or block type object.\n * @return {boolean} Whether the block has list view support.\n */\nexport function hasListViewSupport( nameOrType ) {\n\treturn hasBlockSupport( nameOrType, LIST_VIEW_SUPPORT_KEY );\n}\n\n/**\n * Inspector controls panel for list view.\n *\n * @param {Object} props Component props.\n * @param {string} props.clientId Block client ID.\n * @param {string} props.name Block name.\n * @return {Element|null} List view inspector controls or null.\n */\nexport function ListViewPanel( { clientId, name } ) {\n\tconst { isSelectionWithinCurrentSection } =\n\t\tuseContext( PrivateBlockContext );\n\n\tconst { isOpened, expandRevision, handleToggle } =\n\t\tuseListViewPanelState( clientId );\n\n\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\tconst { openListViewContentPanel } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst { isEnabled, hasChildren, isNestedListView } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockParents,\n\t\t\t\tshouldRenderBlockListView,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\t// Avoid showing List Views for both parent and child blocks that have support.\n\t\t\t// In this situation the parent will show the child in its list already.\n\t\t\t// Search parents to see if there's one that also has support, and if so skip rendering.\n\t\t\t// This matches closely the logic in the `BlockCard` component.\n\t\t\tconst parents = getBlockParents( clientId, false );\n\t\t\tconst _isNestedListView = parents.find( ( parentId ) =>\n\t\t\t\tshouldRenderBlockListView( parentId )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tisEnabled: shouldRenderBlockListView( clientId ),\n\t\t\t\thasChildren: !! getBlockCount( clientId ),\n\t\t\t\tisNestedListView: _isNestedListView,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst blockType = getBlockType( name );\n\tconst title = blockType?.title || name;\n\n\tif ( ! isEnabled || isNestedListView ) {\n\t\treturn null;\n\t}\n\n\tconst showBlockTitle = isSelectionWithinCurrentSection;\n\n\treturn (\n\t\t<InspectorControls group=\"list\">\n\t\t\t<PanelBody\n\t\t\t\ttitle={ showBlockTitle ? title : undefined }\n\t\t\t\topened={ isOpened }\n\t\t\t\tonToggle={ handleToggle }\n\t\t\t>\n\t\t\t\t{ ! hasChildren && (\n\t\t\t\t\t<p className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t{ __( 'No items yet.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t<PrivateListView\n\t\t\t\t\tkey={ `${ clientId }-${ expandRevision }` }\n\t\t\t\t\trootClientId={ clientId }\n\t\t\t\t\tisExpanded\n\t\t\t\t\tdescription={ title }\n\t\t\t\t\tshowAppender\n\t\t\t\t\tonSelect={ openListViewContentPanel }\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n}\n\n/**\n * Export block support definition.\n */\nexport default {\n\tedit: ListViewPanel,\n\thasSupport: hasListViewSupport,\n\tattributeKeys: [],\n\tsupportsPatternEditing: true,\n};\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,aAAa,iBAAiB;AACvC,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,kBAAkB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B,GACvB;AAAA,QAED;AAAA,UAAC;AAAA;AAAA,YAEA,cAAe;AAAA,YACf,YAAU;AAAA,YACV,aAAc;AAAA,YACd,cAAY;AAAA,YACZ,UAAW;AAAA;AAAA,UALL,GAAI,QAAS,IAAK,cAAe;AAAA,QAMxC;AAAA;AAAA;AAAA,EACD,GACD;AAEF;AAKA,IAAO,oBAAQ;AAAA,EACd,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,eAAe,CAAC;AAAA,EAChB,wBAAwB;AACzB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,7 +5,7 @@ import { getBlockSupport, hasBlockSupport } from "@wordpress/blocks";
|
|
|
5
5
|
import { BaseControl, CustomSelectControl } from "@wordpress/components";
|
|
6
6
|
import { useInstanceId } from "@wordpress/compose";
|
|
7
7
|
import { useSelect } from "@wordpress/data";
|
|
8
|
-
import { useMemo
|
|
8
|
+
import { useMemo } from "@wordpress/element";
|
|
9
9
|
import { useSettings } from "../components/use-settings/index.mjs";
|
|
10
10
|
import InspectorControls from "../components/inspector-controls/index.mjs";
|
|
11
11
|
import useBlockDisplayInformation from "../components/use-block-display-information/index.mjs";
|
|
@@ -146,28 +146,25 @@ function PositionPanelPure({
|
|
|
146
146
|
});
|
|
147
147
|
};
|
|
148
148
|
const selectedOption = value ? options.find((option) => option.value === value) || DEFAULT_OPTION : DEFAULT_OPTION;
|
|
149
|
-
return
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
) }) }) : null,
|
|
169
|
-
native: null
|
|
170
|
-
});
|
|
149
|
+
return options.length > 1 ? /* @__PURE__ */ jsx(InspectorControls, { group: "position", children: /* @__PURE__ */ jsx(BaseControl, { help: stickyHelpText, children: /* @__PURE__ */ jsx(
|
|
150
|
+
CustomSelectControl,
|
|
151
|
+
{
|
|
152
|
+
__next40pxDefaultSize: true,
|
|
153
|
+
label: __("Position"),
|
|
154
|
+
hideLabelFromVision: true,
|
|
155
|
+
describedBy: sprintf(
|
|
156
|
+
// translators: %s: Currently selected position.
|
|
157
|
+
__("Currently selected position: %s"),
|
|
158
|
+
selectedOption.name
|
|
159
|
+
),
|
|
160
|
+
options,
|
|
161
|
+
value: selectedOption,
|
|
162
|
+
onChange: ({ selectedItem }) => {
|
|
163
|
+
onChangeType(selectedItem.value);
|
|
164
|
+
},
|
|
165
|
+
size: "__unstable-large"
|
|
166
|
+
}
|
|
167
|
+
) }) }) : null;
|
|
171
168
|
}
|
|
172
169
|
var position_default = {
|
|
173
170
|
edit: function Edit(props) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/hooks/position.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { BaseControl, CustomSelectControl } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../components/use-settings';\nimport InspectorControls from '../components/inspector-controls';\nimport useBlockDisplayInformation from '../components/use-block-display-information';\nimport { cleanEmptyObject, useStyleOverride } from './utils';\nimport { store as blockEditorStore } from '../store';\n\nconst POSITION_SUPPORT_KEY = 'position';\n\nconst DEFAULT_OPTION = {\n\tkey: 'default',\n\tvalue: '',\n\tname: __( 'Default' ),\n};\n\nconst STICKY_OPTION = {\n\tkey: 'sticky',\n\tvalue: 'sticky',\n\tname: _x( 'Sticky', 'Name for the value of the CSS position property' ),\n\thint: __(\n\t\t'The block will stick to the top of the window instead of scrolling.'\n\t),\n};\n\nconst FIXED_OPTION = {\n\tkey: 'fixed',\n\tvalue: 'fixed',\n\tname: _x( 'Fixed', 'Name for the value of the CSS position property' ),\n\thint: __( 'The block will not move when the page is scrolled.' ),\n};\n\nconst POSITION_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nconst VALID_POSITION_TYPES = [ 'sticky', 'fixed' ];\n\n/**\n * Get calculated position CSS.\n *\n * @param {Object} props Component props.\n * @param {string} props.selector Selector to use.\n * @param {Object} props.style Style object.\n * @return {string} The generated CSS rules.\n */\nexport function getPositionCSS( { selector, style } ) {\n\tlet output = '';\n\n\tconst { type: positionType } = style?.position || {};\n\n\tif ( ! VALID_POSITION_TYPES.includes( positionType ) ) {\n\t\treturn output;\n\t}\n\n\toutput += `${ selector } {`;\n\toutput += `position: ${ positionType };`;\n\n\tPOSITION_SIDES.forEach( ( side ) => {\n\t\tif ( style?.position?.[ side ] !== undefined ) {\n\t\t\toutput += `${ side }: ${ style.position[ side ] };`;\n\t\t}\n\t} );\n\n\tif ( positionType === 'sticky' || positionType === 'fixed' ) {\n\t\t// TODO: Replace hard-coded z-index value with a z-index preset approach in theme.json.\n\t\toutput += `z-index: 10`;\n\t}\n\toutput += `}`;\n\n\treturn output;\n}\n\n/**\n * Determines if there is sticky position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasStickyPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.sticky );\n}\n\n/**\n * Determines if there is fixed position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasFixedPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.fixed );\n}\n\n/**\n * Determines if there is position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! support;\n}\n\n/**\n * Checks if there is a current value in the position block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a position value set.\n */\nexport function hasPositionValue( props ) {\n\treturn props.attributes.style?.position?.type !== undefined;\n}\n\n/**\n * Checks if the block is currently set to a sticky or fixed position.\n * This check is helpful for determining how to position block toolbars or other elements.\n *\n * @param {Object} attributes Block attributes.\n * @return {boolean} Whether or not the block is set to a sticky or fixed position.\n */\nexport function hasStickyOrFixedPositionValue( attributes ) {\n\tconst positionType = attributes?.style?.position?.type;\n\treturn positionType === 'sticky' || positionType === 'fixed';\n}\n\n/**\n * Resets the position block support attributes. This can be used when disabling\n * the position support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetPosition( { attributes = {}, setAttributes } ) {\n\tconst { style = {} } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: undefined,\n\t\t\t\ttop: undefined,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t\tleft: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if position settings have been disabled.\n *\n * @param {string} name The name of the block.\n *\n * @return {boolean} Whether padding setting is disabled.\n */\nexport function useIsPositionDisabled( { name: blockName } = {} ) {\n\tconst [ allowFixed, allowSticky ] = useSettings(\n\t\t'position.fixed',\n\t\t'position.sticky'\n\t);\n\tconst isDisabled = ! allowFixed && ! allowSticky;\n\n\treturn ! hasPositionSupport( blockName ) || isDisabled;\n}\n\n/*\n * Position controls rendered in an inspector control panel.\n *\n * @param {Object} props\n *\n * @return {Element} Position panel.\n */\nexport function PositionPanelPure( {\n\tstyle = {},\n\tclientId,\n\tname: blockName,\n\tsetAttributes,\n} ) {\n\tconst allowFixed = hasFixedPositionSupport( blockName );\n\tconst allowSticky = hasStickyPositionSupport( blockName );\n\tconst value = style?.position?.type;\n\n\tconst { firstParentClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParents } = select( blockEditorStore );\n\t\t\tconst parents = getBlockParents( clientId );\n\t\t\treturn { firstParentClientId: parents[ parents.length - 1 ] };\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst blockInformation = useBlockDisplayInformation( firstParentClientId );\n\tconst stickyHelpText =\n\t\tallowSticky && value === STICKY_OPTION.value && blockInformation\n\t\t\t? sprintf(\n\t\t\t\t\t/* translators: %s: the name of the parent block. */\n\t\t\t\t\t__(\n\t\t\t\t\t\t'The block will stick to the scrollable area of the parent %s block.'\n\t\t\t\t\t),\n\t\t\t\t\tblockInformation.title\n\t\t\t )\n\t\t\t: null;\n\n\tconst options = useMemo( () => {\n\t\tconst availableOptions = [ DEFAULT_OPTION ];\n\t\t// Display options if they are allowed, or if a block already has a valid value set.\n\t\t// This allows for a block to be switched off from a position type that is not allowed.\n\t\tif ( allowSticky || value === STICKY_OPTION.value ) {\n\t\t\tavailableOptions.push( STICKY_OPTION );\n\t\t}\n\t\tif ( allowFixed || value === FIXED_OPTION.value ) {\n\t\t\tavailableOptions.push( FIXED_OPTION );\n\t\t}\n\t\treturn availableOptions;\n\t}, [ allowFixed, allowSticky, value ] );\n\n\tconst onChangeType = ( next ) => {\n\t\t// For now, use a hard-coded `0px` value for the position.\n\t\t// `0px` is preferred over `0` as it can be used in `calc()` functions.\n\t\t// In the future, it could be useful to allow for an offset value.\n\t\tconst placementValue = '0px';\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: next,\n\t\t\t\ttop:\n\t\t\t\t\tnext === 'sticky' || next === 'fixed'\n\t\t\t\t\t\t? placementValue\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tconst selectedOption = value\n\t\t? options.find( ( option ) => option.value === value ) || DEFAULT_OPTION\n\t\t: DEFAULT_OPTION;\n\n\t// Only display position controls if there is at least one option to choose from.\n\treturn Platform.select( {\n\t\tweb:\n\t\t\toptions.length > 1 ? (\n\t\t\t\t<InspectorControls group=\"position\">\n\t\t\t\t\t<BaseControl help={ stickyHelpText }>\n\t\t\t\t\t\t<CustomSelectControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tdescribedBy={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Currently selected position.\n\t\t\t\t\t\t\t\t__( 'Currently selected position: %s' ),\n\t\t\t\t\t\t\t\tselectedOption.name\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\tvalue={ selectedOption }\n\t\t\t\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\t\t\t\tonChangeType( selectedItem.value );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</InspectorControls>\n\t\t\t) : null,\n\t\tnative: null,\n\t} );\n}\n\nexport default {\n\tedit: function Edit( props ) {\n\t\tconst isPositionDisabled = useIsPositionDisabled( props );\n\t\tif ( isPositionDisabled ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn <PositionPanelPure { ...props } />;\n\t},\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, POSITION_SUPPORT_KEY );\n\t},\n};\n\n// Used for generating the instance ID\nconst POSITION_BLOCK_PROPS_REFERENCE = {};\n\nfunction useBlockProps( { name, style } ) {\n\tconst hasPositionBlockSupport = hasBlockSupport(\n\t\tname,\n\t\tPOSITION_SUPPORT_KEY\n\t);\n\tconst isPositionDisabled = useIsPositionDisabled( { name } );\n\tconst allowPositionStyles = hasPositionBlockSupport && ! isPositionDisabled;\n\n\tconst id = useInstanceId( POSITION_BLOCK_PROPS_REFERENCE );\n\n\t// Higher specificity to override defaults in editor UI.\n\tconst positionSelector = `.wp-container-${ id }.wp-container-${ id }`;\n\n\t// Get CSS string for the current position values.\n\tlet css;\n\tif ( allowPositionStyles ) {\n\t\tcss =\n\t\t\tgetPositionCSS( {\n\t\t\t\tselector: positionSelector,\n\t\t\t\tstyle,\n\t\t\t} ) || '';\n\t}\n\n\t// Attach a `wp-container-` id-based class name.\n\tconst className = clsx( {\n\t\t[ `wp-container-${ id }` ]: allowPositionStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t[ `is-position-${ style?.position?.type }` ]:\n\t\t\tallowPositionStyles && !! css && !! style?.position?.type,\n\t} );\n\n\tuseStyleOverride( { css } );\n\n\treturn { className };\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,IAAI,IAAI,eAAe;AAChC,SAAS,iBAAiB,uBAAuB;AACjD,SAAS,aAAa,2BAA2B;AACjD,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAC1B,SAAS,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { BaseControl, CustomSelectControl } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../components/use-settings';\nimport InspectorControls from '../components/inspector-controls';\nimport useBlockDisplayInformation from '../components/use-block-display-information';\nimport { cleanEmptyObject, useStyleOverride } from './utils';\nimport { store as blockEditorStore } from '../store';\n\nconst POSITION_SUPPORT_KEY = 'position';\n\nconst DEFAULT_OPTION = {\n\tkey: 'default',\n\tvalue: '',\n\tname: __( 'Default' ),\n};\n\nconst STICKY_OPTION = {\n\tkey: 'sticky',\n\tvalue: 'sticky',\n\tname: _x( 'Sticky', 'Name for the value of the CSS position property' ),\n\thint: __(\n\t\t'The block will stick to the top of the window instead of scrolling.'\n\t),\n};\n\nconst FIXED_OPTION = {\n\tkey: 'fixed',\n\tvalue: 'fixed',\n\tname: _x( 'Fixed', 'Name for the value of the CSS position property' ),\n\thint: __( 'The block will not move when the page is scrolled.' ),\n};\n\nconst POSITION_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nconst VALID_POSITION_TYPES = [ 'sticky', 'fixed' ];\n\n/**\n * Get calculated position CSS.\n *\n * @param {Object} props Component props.\n * @param {string} props.selector Selector to use.\n * @param {Object} props.style Style object.\n * @return {string} The generated CSS rules.\n */\nexport function getPositionCSS( { selector, style } ) {\n\tlet output = '';\n\n\tconst { type: positionType } = style?.position || {};\n\n\tif ( ! VALID_POSITION_TYPES.includes( positionType ) ) {\n\t\treturn output;\n\t}\n\n\toutput += `${ selector } {`;\n\toutput += `position: ${ positionType };`;\n\n\tPOSITION_SIDES.forEach( ( side ) => {\n\t\tif ( style?.position?.[ side ] !== undefined ) {\n\t\t\toutput += `${ side }: ${ style.position[ side ] };`;\n\t\t}\n\t} );\n\n\tif ( positionType === 'sticky' || positionType === 'fixed' ) {\n\t\t// TODO: Replace hard-coded z-index value with a z-index preset approach in theme.json.\n\t\toutput += `z-index: 10`;\n\t}\n\toutput += `}`;\n\n\treturn output;\n}\n\n/**\n * Determines if there is sticky position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasStickyPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.sticky );\n}\n\n/**\n * Determines if there is fixed position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasFixedPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.fixed );\n}\n\n/**\n * Determines if there is position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! support;\n}\n\n/**\n * Checks if there is a current value in the position block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a position value set.\n */\nexport function hasPositionValue( props ) {\n\treturn props.attributes.style?.position?.type !== undefined;\n}\n\n/**\n * Checks if the block is currently set to a sticky or fixed position.\n * This check is helpful for determining how to position block toolbars or other elements.\n *\n * @param {Object} attributes Block attributes.\n * @return {boolean} Whether or not the block is set to a sticky or fixed position.\n */\nexport function hasStickyOrFixedPositionValue( attributes ) {\n\tconst positionType = attributes?.style?.position?.type;\n\treturn positionType === 'sticky' || positionType === 'fixed';\n}\n\n/**\n * Resets the position block support attributes. This can be used when disabling\n * the position support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetPosition( { attributes = {}, setAttributes } ) {\n\tconst { style = {} } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: undefined,\n\t\t\t\ttop: undefined,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t\tleft: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if position settings have been disabled.\n *\n * @param {string} name The name of the block.\n *\n * @return {boolean} Whether padding setting is disabled.\n */\nexport function useIsPositionDisabled( { name: blockName } = {} ) {\n\tconst [ allowFixed, allowSticky ] = useSettings(\n\t\t'position.fixed',\n\t\t'position.sticky'\n\t);\n\tconst isDisabled = ! allowFixed && ! allowSticky;\n\n\treturn ! hasPositionSupport( blockName ) || isDisabled;\n}\n\n/*\n * Position controls rendered in an inspector control panel.\n *\n * @param {Object} props\n *\n * @return {Element} Position panel.\n */\nexport function PositionPanelPure( {\n\tstyle = {},\n\tclientId,\n\tname: blockName,\n\tsetAttributes,\n} ) {\n\tconst allowFixed = hasFixedPositionSupport( blockName );\n\tconst allowSticky = hasStickyPositionSupport( blockName );\n\tconst value = style?.position?.type;\n\n\tconst { firstParentClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParents } = select( blockEditorStore );\n\t\t\tconst parents = getBlockParents( clientId );\n\t\t\treturn { firstParentClientId: parents[ parents.length - 1 ] };\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst blockInformation = useBlockDisplayInformation( firstParentClientId );\n\tconst stickyHelpText =\n\t\tallowSticky && value === STICKY_OPTION.value && blockInformation\n\t\t\t? sprintf(\n\t\t\t\t\t/* translators: %s: the name of the parent block. */\n\t\t\t\t\t__(\n\t\t\t\t\t\t'The block will stick to the scrollable area of the parent %s block.'\n\t\t\t\t\t),\n\t\t\t\t\tblockInformation.title\n\t\t\t )\n\t\t\t: null;\n\n\tconst options = useMemo( () => {\n\t\tconst availableOptions = [ DEFAULT_OPTION ];\n\t\t// Display options if they are allowed, or if a block already has a valid value set.\n\t\t// This allows for a block to be switched off from a position type that is not allowed.\n\t\tif ( allowSticky || value === STICKY_OPTION.value ) {\n\t\t\tavailableOptions.push( STICKY_OPTION );\n\t\t}\n\t\tif ( allowFixed || value === FIXED_OPTION.value ) {\n\t\t\tavailableOptions.push( FIXED_OPTION );\n\t\t}\n\t\treturn availableOptions;\n\t}, [ allowFixed, allowSticky, value ] );\n\n\tconst onChangeType = ( next ) => {\n\t\t// For now, use a hard-coded `0px` value for the position.\n\t\t// `0px` is preferred over `0` as it can be used in `calc()` functions.\n\t\t// In the future, it could be useful to allow for an offset value.\n\t\tconst placementValue = '0px';\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: next,\n\t\t\t\ttop:\n\t\t\t\t\tnext === 'sticky' || next === 'fixed'\n\t\t\t\t\t\t? placementValue\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tconst selectedOption = value\n\t\t? options.find( ( option ) => option.value === value ) || DEFAULT_OPTION\n\t\t: DEFAULT_OPTION;\n\n\t// Only display position controls if there is at least one option to choose from.\n\treturn options.length > 1 ? (\n\t\t<InspectorControls group=\"position\">\n\t\t\t<BaseControl help={ stickyHelpText }>\n\t\t\t\t<CustomSelectControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tdescribedBy={ sprintf(\n\t\t\t\t\t\t// translators: %s: Currently selected position.\n\t\t\t\t\t\t__( 'Currently selected position: %s' ),\n\t\t\t\t\t\tselectedOption.name\n\t\t\t\t\t) }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tvalue={ selectedOption }\n\t\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\t\tonChangeType( selectedItem.value );\n\t\t\t\t\t} }\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t/>\n\t\t\t</BaseControl>\n\t\t</InspectorControls>\n\t) : null;\n}\n\nexport default {\n\tedit: function Edit( props ) {\n\t\tconst isPositionDisabled = useIsPositionDisabled( props );\n\t\tif ( isPositionDisabled ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn <PositionPanelPure { ...props } />;\n\t},\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, POSITION_SUPPORT_KEY );\n\t},\n};\n\n// Used for generating the instance ID\nconst POSITION_BLOCK_PROPS_REFERENCE = {};\n\nfunction useBlockProps( { name, style } ) {\n\tconst hasPositionBlockSupport = hasBlockSupport(\n\t\tname,\n\t\tPOSITION_SUPPORT_KEY\n\t);\n\tconst isPositionDisabled = useIsPositionDisabled( { name } );\n\tconst allowPositionStyles = hasPositionBlockSupport && ! isPositionDisabled;\n\n\tconst id = useInstanceId( POSITION_BLOCK_PROPS_REFERENCE );\n\n\t// Higher specificity to override defaults in editor UI.\n\tconst positionSelector = `.wp-container-${ id }.wp-container-${ id }`;\n\n\t// Get CSS string for the current position values.\n\tlet css;\n\tif ( allowPositionStyles ) {\n\t\tcss =\n\t\t\tgetPositionCSS( {\n\t\t\t\tselector: positionSelector,\n\t\t\t\tstyle,\n\t\t\t} ) || '';\n\t}\n\n\t// Attach a `wp-container-` id-based class name.\n\tconst className = clsx( {\n\t\t[ `wp-container-${ id }` ]: allowPositionStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t[ `is-position-${ style?.position?.type }` ]:\n\t\t\tallowPositionStyles && !! css && !! style?.position?.type,\n\t} );\n\n\tuseStyleOverride( { css } );\n\n\treturn { className };\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,IAAI,IAAI,eAAe;AAChC,SAAS,iBAAiB,uBAAuB;AACjD,SAAS,aAAa,2BAA2B;AACjD,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AAKxB,SAAS,mBAAmB;AAC5B,OAAO,uBAAuB;AAC9B,OAAO,gCAAgC;AACvC,SAAS,kBAAkB,wBAAwB;AACnD,SAAS,SAAS,wBAAwB;AAuPtC;AArPJ,IAAM,uBAAuB;AAE7B,IAAM,iBAAiB;AAAA,EACtB,KAAK;AAAA,EACL,OAAO;AAAA,EACP,M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,IACR;AACA,WAAO,oBAAC,qBAAoB,GAAG,OAAQ;AAAA,EACxC;AAAA,EACA;AAAA,EACA,eAAe,CAAE,OAAQ;AAAA,EACzB,WAAY,MAAO;AAClB,WAAO,gBAAiB,MAAM,oBAAqB;AAAA,EACpD;AACD;AAGA,IAAM,iCAAiC,CAAC;AAExC,SAAS,cAAe,EAAE,MAAM,MAAM,GAAI;AACzC,QAAM,0BAA0B;AAAA,IAC/B;AAAA,IACA;AAAA,EACD;AACA,QAAM,qBAAqB,sBAAuB,EAAE,KAAK,CAAE;AAC3D,QAAM,sBAAsB,2BAA2B,CAAE;AAEzD,QAAM,KAAK,cAAe,8BAA+B;AAGzD,QAAM,mBAAmB,iBAAkB,EAAG,iBAAkB,EAAG;AAGnE,MAAI;AACJ,MAAK,qBAAsB;AAC1B,UACC,eAAgB;AAAA,MACf,UAAU;AAAA,MACV;AAAA,IACD,CAAE,KAAK;AAAA,EACT;AAGA,QAAM,YAAY,KAAM;AAAA,IACvB,CAAE,gBAAiB,EAAG,EAAG,GAAG,uBAAuB,CAAC,CAAE;AAAA;AAAA,IACtD,CAAE,eAAgB,OAAO,UAAU,IAAK,EAAG,GAC1C,uBAAuB,CAAC,CAAE,OAAO,CAAC,CAAE,OAAO,UAAU;AAAA,EACvD,CAAE;AAEF,mBAAkB,EAAE,IAAI,CAAE;AAE1B,SAAO,EAAE,UAAU;AACpB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/hooks/spacing-visualizer.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect, useReducer } from '@wordpress/element';\nimport { isShallowEqual } from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport BlockPopoverCover from '../components/block-popover/cover';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nfunction SpacingVisualizer( { clientId, value, computeStyle, forceShow } ) {\n\tconst blockElement = useBlockElement( clientId );\n\tconst [ style, updateStyle ] = useReducer( () =>\n\t\tcomputeStyle( blockElement )\n\t);\n\n\t// Force style computation when forceShow becomes true (e.g., when hovering control)\n\t// to ensure visualizer displays correct dimensions on first render.\n\tuseEffect( () => {\n\t\tif ( blockElement && forceShow ) {\n\t\t\tupdateStyle();\n\t\t}\n\t}, [ blockElement, forceShow ] );\n\n\t// It's not sufficient to read the block's computed style when `value` changes because\n\t// the effect would run before the block
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect, useReducer } from '@wordpress/element';\nimport { isShallowEqual } from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport BlockPopoverCover from '../components/block-popover/cover';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nfunction SpacingVisualizer( { clientId, value, computeStyle, forceShow } ) {\n\tconst blockElement = useBlockElement( clientId );\n\tconst [ style, updateStyle ] = useReducer( () =>\n\t\tcomputeStyle( blockElement )\n\t);\n\n\t// Force style computation when forceShow becomes true (e.g., when hovering control)\n\t// to ensure visualizer displays correct dimensions on first render.\n\tuseEffect( () => {\n\t\tif ( blockElement && forceShow ) {\n\t\t\tupdateStyle();\n\t\t}\n\t}, [ blockElement, forceShow ] );\n\n\t// It's not sufficient to read the block's computed style when `value` changes because\n\t// the effect would run before the block’s style has updated. Thus observing mutations\n\t// to the block’s attributes is used to trigger updates to the visualizer’s styles.\n\tuseEffect( () => {\n\t\tif ( ! blockElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( updateStyle );\n\t\tobserver.observe( blockElement, {\n\t\t\tattributes: true,\n\t\t\tattributeFilter: [ 'style', 'class' ],\n\t\t} );\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ blockElement ] );\n\n\tconst previousValueRef = useRef( value );\n\tconst [ isActive, setIsActive ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( isShallowEqual( value, previousValueRef.current ) || forceShow ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsActive( true );\n\t\tpreviousValueRef.current = value;\n\n\t\tconst timeout = setTimeout( () => {\n\t\t\tsetIsActive( false );\n\t\t}, 400 );\n\n\t\treturn () => {\n\t\t\tsetIsActive( false );\n\t\t\tclearTimeout( timeout );\n\t\t};\n\t}, [ value, forceShow ] );\n\n\tif ( ! isActive && ! forceShow ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPopoverCover\n\t\t\tclientId={ clientId }\n\t\t\t__unstablePopoverSlot=\"block-toolbar\"\n\t\t>\n\t\t\t<div className=\"block-editor__spacing-visualizer\" style={ style } />\n\t\t</BlockPopoverCover>\n\t);\n}\n\nfunction getComputedCSS( element, property ) {\n\treturn element.ownerDocument.defaultView\n\t\t.getComputedStyle( element )\n\t\t.getPropertyValue( property );\n}\n\nexport function MarginVisualizer( { clientId, value, forceShow } ) {\n\treturn (\n\t\t<SpacingVisualizer\n\t\t\tclientId={ clientId }\n\t\t\tvalue={ value?.spacing?.margin }\n\t\t\tcomputeStyle={ ( blockElement ) => {\n\t\t\t\tconst top = getComputedCSS( blockElement, 'margin-top' );\n\t\t\t\tconst right = getComputedCSS( blockElement, 'margin-right' );\n\t\t\t\tconst bottom = getComputedCSS( blockElement, 'margin-bottom' );\n\t\t\t\tconst left = getComputedCSS( blockElement, 'margin-left' );\n\t\t\t\treturn {\n\t\t\t\t\tborderTopWidth: top,\n\t\t\t\t\tborderRightWidth: right,\n\t\t\t\t\tborderBottomWidth: bottom,\n\t\t\t\t\tborderLeftWidth: left,\n\t\t\t\t\ttop: top ? `-${ top }` : 0,\n\t\t\t\t\tright: right ? `-${ right }` : 0,\n\t\t\t\t\tbottom: bottom ? `-${ bottom }` : 0,\n\t\t\t\t\tleft: left ? `-${ left }` : 0,\n\t\t\t\t};\n\t\t\t} }\n\t\t\tforceShow={ forceShow }\n\t\t/>\n\t);\n}\n\nexport function PaddingVisualizer( { clientId, value, forceShow } ) {\n\treturn (\n\t\t<SpacingVisualizer\n\t\t\tclientId={ clientId }\n\t\t\tvalue={ value?.spacing?.padding }\n\t\t\tcomputeStyle={ ( blockElement ) => ( {\n\t\t\t\tborderTopWidth: getComputedCSS( blockElement, 'padding-top' ),\n\t\t\t\tborderRightWidth: getComputedCSS(\n\t\t\t\t\tblockElement,\n\t\t\t\t\t'padding-right'\n\t\t\t\t),\n\t\t\t\tborderBottomWidth: getComputedCSS(\n\t\t\t\t\tblockElement,\n\t\t\t\t\t'padding-bottom'\n\t\t\t\t),\n\t\t\t\tborderLeftWidth: getComputedCSS( blockElement, 'padding-left' ),\n\t\t\t} ) }\n\t\t\tforceShow={ forceShow }\n\t\t/>\n\t);\n}\n"],
|
|
5
5
|
"mappings": ";AAGA,SAAS,UAAU,QAAQ,WAAW,kBAAkB;AACxD,SAAS,sBAAsB;AAK/B,OAAO,uBAAuB;AAC9B,SAAS,uBAAuB;AA+D7B;AA7DH,SAAS,kBAAmB,EAAE,UAAU,OAAO,cAAc,UAAU,GAAI;AAC1E,QAAM,eAAe,gBAAiB,QAAS;AAC/C,QAAM,CAAE,OAAO,WAAY,IAAI;AAAA,IAAY,MAC1C,aAAc,YAAa;AAAA,EAC5B;AAIA,YAAW,MAAM;AAChB,QAAK,gBAAgB,WAAY;AAChC,kBAAY;AAAA,IACb;AAAA,EACD,GAAG,CAAE,cAAc,SAAU,CAAE;AAK/B,YAAW,MAAM;AAChB,QAAK,CAAE,cAAe;AACrB;AAAA,IACD;AACA,UAAM,WAAW,IAAI,OAAO,iBAAkB,WAAY;AAC1D,aAAS,QAAS,cAAc;AAAA,MAC/B,YAAY;AAAA,MACZ,iBAAiB,CAAE,SAAS,OAAQ;AAAA,IACrC,CAAE;AACF,WAAO,MAAM;AACZ,eAAS,WAAW;AAAA,IACrB;AAAA,EACD,GAAG,CAAE,YAAa,CAAE;AAEpB,QAAM,mBAAmB,OAAQ,KAAM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;AAAA,QAC7B;AAAA,MACD;AAAA,MACA;AAAA;AAAA,EACD;AAEF;AAEO,SAAS,kBAAmB,EAAE,UAAU,OAAO,UAAU,GAAI;AACnE,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,OAAQ,OAAO,SAAS;AAAA,MACxB,cAAe,CAAE,kBAAoB;AAAA,QACpC,gBAAgB,eAAgB,cAAc,aAAc;AAAA,QAC5D,kBAAkB;AAAA,UACjB;AAAA,UACA;AAAA,QACD;AAAA,QACA,mBAAmB;AAAA,UAClB;AAAA,UACA;AAAA,QACD;AAAA,QACA,iBAAiB,eAAgB,cAAc,cAAe;AAAA,MAC/D;AAAA,MACA;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/hooks/state-utils.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { splitSelectorList } from '@wordpress/global-styles-engine';\n\n/**\n * Given a block's `selectors.root` value, returns the part of the selector\n * that is relative to the block wrapper
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { splitSelectorList } from '@wordpress/global-styles-engine';\n\n/**\n * Given a block's `selectors.root` value, returns the part of the selector\n * that is relative to the block wrapper — i.e., everything after the first\n * compound selector segment.\n *\n * Examples:\n * \".wp-block-button .wp-block-button__link\" → \".wp-block-button__link\"\n * \".wp-block-foo > .inner\" → \"> .inner\"\n * \".wp-block-foo\" → null (no descendant)\n *\n * @param {string} rootSelector The block's `selectors.root` value.\n * @return {string|null} Relative selector, or null if rootSelector targets the wrapper itself.\n */\nexport function getRelativeRootSelector( rootSelector ) {\n\t// Match everything after the first compound selector (up to the first\n\t// whitespace or combinator character).\n\t// Require at least one combinator character (space, >, +, ~) between the\n\t// first compound selector and the rest. Without this anchor, a greedy\n\t// quantifier would backtrack into the first token and produce false matches.\n\tconst match = rootSelector.trim().match( /^[^ >+~]+[ >+~](.*)$/ );\n\tif ( ! match ) {\n\t\treturn null;\n\t}\n\tconst rest = match[ 1 ].trim();\n\treturn rest || null;\n}\n\n/**\n * Builds a scoped selector from a block selector and optional suffix.\n *\n * If the block selector targets a descendant, the descendant portion is scoped\n * under the provided base selector. Otherwise the base selector itself is used.\n *\n * @param {string} baseSelector The block-instance scoping selector.\n * @param {string} blockSelector The block or feature selector from block metadata.\n * @param {string} suffix Optional selector suffix, e.g. \":hover\".\n * @return {string} The scoped CSS selector.\n */\nexport function buildScopedBlockSelector(\n\tbaseSelector,\n\tblockSelector,\n\tsuffix = ''\n) {\n\tif ( typeof blockSelector !== 'string' || ! blockSelector ) {\n\t\treturn splitSelectorList( baseSelector )\n\t\t\t.map( ( selector ) => `${ selector.trim() }${ suffix }` )\n\t\t\t.join( ', ' );\n\t}\n\n\tconst baseSelectors = splitSelectorList( baseSelector ).filter(\n\t\t( selector ) => selector.trim()\n\t);\n\tconst selectors = splitSelectorList( blockSelector ).filter( ( selector ) =>\n\t\tselector.trim()\n\t);\n\n\tif ( ! selectors.length ) {\n\t\treturn baseSelectors\n\t\t\t.map( ( selector ) => `${ selector.trim() }${ suffix }` )\n\t\t\t.join( ', ' );\n\t}\n\n\treturn selectors\n\t\t.map( ( selector ) => {\n\t\t\tselector = selector.trim();\n\n\t\t\t/*\n\t\t\t * Replace only the leading block selector part (e.g. class name,\n\t\t\t * attribute selector, ID, or tag name) with the block instance selector.\n\t\t\t * Preserve anything after that prefix, including modifier classes on the\n\t\t\t * same element and combinators without spaces.\n\t\t\t */\n\t\t\tconst match = selector.match( /^([.#]?[-_a-zA-Z0-9]+|\\[[^\\]]+\\])/ );\n\t\t\tif ( match ) {\n\t\t\t\treturn baseSelectors\n\t\t\t\t\t.map(\n\t\t\t\t\t\t( base ) =>\n\t\t\t\t\t\t\t`${ base.trim() }${ selector.slice(\n\t\t\t\t\t\t\t\tmatch[ 0 ].length\n\t\t\t\t\t\t\t) }${ suffix }`\n\t\t\t\t\t)\n\t\t\t\t\t.join( ', ' );\n\t\t\t}\n\n\t\t\treturn baseSelectors\n\t\t\t\t.map( ( base ) => `${ base.trim() }${ suffix }` )\n\t\t\t\t.join( ', ' );\n\t\t} )\n\t\t.join( ', ' );\n}\n\n/**\n * Builds the scoped selector for root block style state styles.\n *\n * Uses the block's `selectors.root` to determine which element should receive\n * root-level state styles. If `selectors.root` describes a descendant element\n * (e.g. `.wp-block-button .wp-block-button__link`), the relative portion is\n * scoped under `baseSelector`. If no descendant is present, falls back to the\n * base selector.\n *\n * @param {string} baseSelector The block-instance scoping class selector.\n * @param {string} name The block name, used to look up selectors.\n * @return {string} The fully-scoped CSS selector for root state styles.\n */\nexport function buildRootStyleStateSelector( baseSelector, name ) {\n\tconst rootSelector = getBlockType( name )?.selectors?.root;\n\treturn buildScopedBlockSelector( baseSelector, rootSelector );\n}\n\n/**\n * Builds the scoped CSS selector for a block state (e.g. :hover, :focus).\n *\n * Uses the block's `selectors.root` to determine which element the state\n * pseudo-class should apply to. If `selectors.root` describes a descendant\n * element (e.g. \".wp-block-button .wp-block-button__link\"), the relative\n * portion (\".wp-block-button__link\") is scoped under `baseSelector`. If no\n * descendant is present, falls back to appending the state to `baseSelector`.\n *\n * @param {string} baseSelector The block-instance scoping class selector.\n * @param {string} name The block name, used to look up selectors.\n * @param {string} state The pseudo-class string, e.g. \":hover\".\n * @return {string} The fully-scoped CSS selector for this state.\n */\nexport function buildPseudoStyleStateSelector( baseSelector, name, state ) {\n\treturn `${ buildRootStyleStateSelector( baseSelector, name ) }${ state }`;\n}\n\nexport function buildStateSelector( baseSelector, name, state ) {\n\tconst rootSelector = getBlockType( name )?.selectors?.root;\n\treturn buildScopedBlockSelector( baseSelector, rootSelector, state );\n}\n\n/**\n * Builds the CSS selector used to preview a state on the editor canvas,\n * scoped to a specific block instance via its `data-block` attribute.\n *\n * For blocks whose `selectors.root` targets a descendant element\n * (e.g. \".wp-block-button .wp-block-button__link\"), the selector targets\n * that descendant inside the block wrapper. Otherwise it targets the wrapper\n * itself.\n *\n * @param {string} clientId The block's clientId.\n * @param {string} name The block name, used to look up selectors.\n * @return {string} CSS selector scoped to this block instance.\n */\nexport function buildCanvasStateSelector( clientId, name ) {\n\tconst rootSelector = getBlockType( name )?.selectors?.root;\n\treturn buildScopedBlockSelector(\n\t\t`[data-block=\"${ clientId }\"]`,\n\t\trootSelector\n\t);\n}\n"],
|
|
5
5
|
"mappings": ";AAGA,SAAS,oBAAoB;AAC7B,SAAS,yBAAyB;AAe3B,SAAS,wBAAyB,cAAe;AAMvD,QAAM,QAAQ,aAAa,KAAK,EAAE,MAAO,sBAAuB;AAChE,MAAK,CAAE,OAAQ;AACd,WAAO;AAAA,EACR;AACA,QAAM,OAAO,MAAO,CAAE,EAAE,KAAK;AAC7B,SAAO,QAAQ;AAChB;AAaO,SAAS,yBACf,cACA,eACA,SAAS,IACR;AACD,MAAK,OAAO,kBAAkB,YAAY,CAAE,eAAgB;AAC3D,WAAO,kBAAmB,YAAa,EACrC,IAAK,CAAE,aAAc,GAAI,SAAS,KAAK,CAAE,GAAI,MAAO,EAAG,EACvD,KAAM,IAAK;AAAA,EACd;AAEA,QAAM,gBAAgB,kBAAmB,YAAa,EAAE;AAAA,IACvD,CAAE,aAAc,SAAS,KAAK;AAAA,EAC/B;AACA,QAAM,YAAY,kBAAmB,aAAc,EAAE;AAAA,IAAQ,CAAE,aAC9D,SAAS,KAAK;AAAA,EACf;AAEA,MAAK,CAAE,UAAU,QAAS;AACzB,WAAO,cACL,IAAK,CAAE,aAAc,GAAI,SAAS,KAAK,CAAE,GAAI,MAAO,EAAG,EACvD,KAAM,IAAK;AAAA,EACd;AAEA,SAAO,UACL,IAAK,CAAE,aAAc;AACrB,eAAW,SAAS,KAAK;AAQzB,UAAM,QAAQ,SAAS,MAAO,mCAAoC;AAClE,QAAK,OAAQ;AACZ,a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