@wordpress/block-editor 12.0.0 → 12.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/build/autocompleters/block.js +13 -5
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/block-breadcrumb/index.js +6 -3
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-controls/slot.js +12 -4
- package/build/components/block-controls/slot.js.map +1 -1
- package/build/components/block-controls/slot.native.js +10 -1
- package/build/components/block-controls/slot.native.js.map +1 -1
- package/build/components/block-draggable/index.js +11 -7
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.js +2 -2
- package/build/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
- package/build/components/block-editing-mode/index.js +84 -0
- package/build/components/block-editing-mode/index.js.map +1 -0
- package/build/components/block-list/block-invalid-warning.native.js +15 -7
- package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build/components/block-list/block-list-block-context.js +15 -0
- package/build/components/block-list/block-list-block-context.js.map +1 -0
- package/build/components/block-list/block-list-item-cell.native.js +15 -2
- package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js +158 -195
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-outline.native.js +57 -0
- package/build/components/block-list/block-outline.native.js.map +1 -0
- package/build/components/block-list/block.js +29 -37
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +347 -311
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +260 -357
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/insertion-point.native.js +4 -2
- package/build/components/block-list/insertion-point.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +2 -2
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +7 -5
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list-appender/index.js +15 -1
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +19 -4
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +8 -10
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +15 -4
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/preview-panel.js +1 -2
- package/build/components/block-styles/preview-panel.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.js +8 -0
- package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/block-variation-transformations.js +125 -0
- package/build/components/block-switcher/block-variation-transformations.js.map +1 -0
- package/build/components/block-switcher/index.js +34 -12
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +3 -3
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-toolbar/index.js +9 -7
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +22 -65
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +11 -5
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +3 -8
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build/components/convert-to-group-buttons/index.js +7 -2
- package/build/components/convert-to-group-buttons/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/index.native.js +87 -3
- package/build/components/convert-to-group-buttons/index.native.js.map +1 -1
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +23 -37
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build/components/global-styles/advanced-panel.js +86 -0
- package/build/components/global-styles/advanced-panel.js.map +1 -0
- package/build/components/global-styles/color-panel.js +4 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +9 -8
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +1 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +24 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +1 -1
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +27 -4
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +30 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +14 -7
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +24 -8
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/inner-blocks/index.js +2 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +7 -7
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +13 -5
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/index.js +3 -7
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -4
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-results.js +19 -6
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +5 -0
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls/fill.js +1 -1
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +1 -1
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/slot.js +3 -6
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls/slot.native.js +1 -1
- package/build/components/inspector-controls/slot.native.js.map +1 -1
- package/build/components/line-height-control/index.js +7 -2
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/use-internal-input-value.js +9 -8
- package/build/components/link-control/use-internal-input-value.js.map +1 -1
- package/build/components/list-view/appender.js +6 -1
- package/build/components/list-view/appender.js.map +1 -1
- package/build/components/list-view/block-contents.js +9 -2
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block-select-button.js +2 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +25 -29
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +1 -3
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +43 -22
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +27 -3
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +163 -11
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/media-placeholder/index.js +68 -7
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +2 -2
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/preview-options/index.js +6 -1
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/publish-date-time-picker/index.js +0 -2
- package/build/components/publish-date-time-picker/index.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +4 -2
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +25 -15
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +8 -1
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +13 -7
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/hooks/align.js +4 -8
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/behaviors.js +115 -0
- package/build/hooks/behaviors.js.map +1 -0
- package/build/hooks/border.js +1 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +1 -1
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +8 -12
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/dimensions.js +0 -30
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +5 -9
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +8 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout.js +10 -11
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +1 -1
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +1 -1
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/use-editor-wrapper-styles.native.js +255 -0
- package/build/hooks/use-editor-wrapper-styles.native.js.map +1 -0
- package/build/hooks/use-typography-props.js +14 -10
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/index.native.js +31 -0
- package/build/index.native.js.map +1 -0
- package/build/private-apis.js +4 -7
- package/build/private-apis.js.map +1 -1
- package/build/store/private-actions.js +46 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +88 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +36 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +28 -18
- package/build/store/selectors.js.map +1 -1
- package/build/utils/order-inserter-block-items.js +41 -0
- package/build/utils/order-inserter-block-items.js.map +1 -0
- package/build/utils/use-should-contextual-toolbar-show.js +16 -12
- package/build/utils/use-should-contextual-toolbar-show.js.map +1 -1
- package/build-module/autocompleters/block.js +12 -5
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +5 -3
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-controls/slot.js +11 -4
- package/build-module/components/block-controls/slot.js.map +1 -1
- package/build-module/components/block-controls/slot.native.js +9 -1
- package/build-module/components/block-controls/slot.native.js.map +1 -1
- package/build-module/components/block-draggable/index.js +10 -6
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.js +2 -2
- package/build-module/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
- package/build-module/components/block-editing-mode/index.js +72 -0
- package/build-module/components/block-editing-mode/index.js.map +1 -0
- package/build-module/components/block-list/block-invalid-warning.native.js +16 -8
- package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build-module/components/block-list/block-list-block-context.js +6 -0
- package/build-module/components/block-list/block-list-block-context.js.map +1 -0
- package/build-module/components/block-list/block-list-item-cell.native.js +13 -2
- package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +160 -190
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-outline.native.js +44 -0
- package/build-module/components/block-list/block-outline.native.js.map +1 -0
- package/build-module/components/block-list/block.js +26 -34
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +345 -310
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +263 -355
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/insertion-point.native.js +4 -2
- package/build-module/components/block-list/insertion-point.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -1
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +6 -5
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +15 -1
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +18 -4
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +8 -9
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +13 -5
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/preview-panel.js +1 -2
- package/build-module/components/block-styles/preview-panel.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.js +7 -0
- package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/block-variation-transformations.js +108 -0
- package/build-module/components/block-switcher/block-variation-transformations.js.map +1 -0
- package/build-module/components/block-switcher/index.js +33 -12
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +3 -3
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +8 -7
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +22 -65
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +11 -5
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +3 -7
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.js +7 -2
- package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.native.js +76 -1
- package/build-module/components/convert-to-group-buttons/index.native.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +22 -36
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +74 -0
- package/build-module/components/global-styles/advanced-panel.js.map +1 -0
- package/build-module/components/global-styles/color-panel.js +5 -2
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +9 -8
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +1 -2
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +3 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +1 -1
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +25 -4
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +25 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +15 -8
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +24 -8
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +2 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +7 -6
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +13 -5
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/index.js +3 -7
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -4
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-results.js +16 -6
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +4 -0
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +1 -1
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +1 -1
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +4 -7
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls/slot.native.js +1 -1
- package/build-module/components/inspector-controls/slot.native.js.map +1 -1
- package/build-module/components/line-height-control/index.js +7 -2
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/use-internal-input-value.js +9 -8
- package/build-module/components/link-control/use-internal-input-value.js.map +1 -1
- package/build-module/components/list-view/appender.js +6 -2
- package/build-module/components/list-view/appender.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +9 -3
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +2 -1
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +24 -29
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +1 -3
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +44 -23
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +26 -3
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +160 -11
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +66 -7
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +2 -2
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/preview-options/index.js +7 -2
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +0 -2
- package/build-module/components/publish-date-time-picker/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/index.js +4 -2
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +25 -16
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +8 -1
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +13 -7
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/hooks/align.js +4 -7
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/behaviors.js +97 -0
- package/build-module/hooks/behaviors.js.map +1 -0
- package/build-module/hooks/border.js +1 -1
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +1 -1
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +8 -11
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/dimensions.js +0 -28
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +4 -7
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +1 -0
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout.js +9 -11
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +1 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +1 -1
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/use-editor-wrapper-styles.native.js +242 -0
- package/build-module/hooks/use-editor-wrapper-styles.native.js.map +1 -0
- package/build-module/hooks/use-typography-props.js +14 -10
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/index.native.js +6 -0
- package/build-module/index.native.js.map +1 -0
- package/build-module/private-apis.js +3 -5
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/private-actions.js +42 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +79 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +34 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +26 -17
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/order-inserter-block-items.js +32 -0
- package/build-module/utils/order-inserter-block-items.js.map +1 -0
- package/build-module/utils/use-should-contextual-toolbar-show.js +16 -12
- package/build-module/utils/use-should-contextual-toolbar-show.js.map +1 -1
- package/build-style/content-rtl.css +32 -14
- package/build-style/content.css +32 -14
- package/build-style/default-editor-styles-rtl.css +1 -1
- package/build-style/default-editor-styles.css +1 -1
- package/build-style/style-rtl.css +56 -77
- package/build-style/style.css +57 -77
- package/package.json +32 -31
- package/src/autocompleters/block.js +15 -7
- package/src/components/block-breadcrumb/index.js +11 -3
- package/src/components/block-breadcrumb/style.scss +2 -1
- package/src/components/block-controls/slot.js +8 -4
- package/src/components/block-controls/slot.native.js +6 -1
- package/src/components/block-draggable/index.js +10 -6
- package/src/components/block-draggable/use-scroll-when-dragging.js +8 -2
- package/src/components/block-editing-mode/index.js +71 -0
- package/src/components/block-list/block-invalid-warning.native.js +17 -9
- package/src/components/block-list/block-list-block-context.js +6 -0
- package/src/components/block-list/block-list-item-cell.native.js +10 -1
- package/src/components/block-list/block-list-item.native.js +180 -208
- package/src/components/block-list/block-outline.native.js +58 -0
- package/src/components/block-list/block.js +38 -56
- package/src/components/block-list/block.native.js +531 -501
- package/src/components/block-list/content.scss +5 -6
- package/src/components/block-list/index.native.js +324 -382
- package/src/components/block-list/insertion-point.native.js +2 -2
- package/src/components/block-list/test/block-invalid-warning.native.js +48 -0
- package/src/components/block-list/test/index.native.js +205 -0
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-list/use-in-between-inserter.js +7 -3
- package/src/components/block-list-appender/index.js +22 -4
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +26 -1
- package/src/components/block-mover/style.scss +1 -0
- package/src/components/block-pattern-setup/style.scss +1 -4
- package/src/components/block-patterns-list/style.scss +1 -4
- package/src/components/block-settings-menu/block-settings-dropdown.js +10 -17
- package/src/components/block-settings-menu-controls/index.js +24 -4
- package/src/components/block-styles/preview-panel.js +1 -3
- package/src/components/block-styles/style.scss +4 -4
- package/src/components/block-switcher/block-transformations-menu.js +12 -0
- package/src/components/block-switcher/block-variation-transformations.js +115 -0
- package/src/components/block-switcher/index.js +38 -5
- package/src/components/block-switcher/pattern-transformations-menu.js +5 -5
- package/src/components/block-switcher/style.scss +6 -5
- package/src/components/block-toolbar/index.js +10 -11
- package/src/components/block-tools/block-contextual-toolbar.js +32 -67
- package/src/components/block-tools/insertion-point.js +23 -9
- package/src/components/block-tools/selected-block-popover.js +3 -5
- package/src/components/block-tools/style.scss +8 -0
- package/src/components/button-block-appender/content.scss +22 -0
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +16 -2
- package/src/components/convert-to-group-buttons/index.js +9 -2
- package/src/components/convert-to-group-buttons/index.native.js +79 -1
- package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +32 -38
- package/src/components/global-styles/advanced-panel.js +82 -0
- package/src/components/global-styles/color-panel.js +6 -1
- package/src/components/global-styles/dimensions-panel.js +9 -8
- package/src/components/global-styles/hooks.js +1 -5
- package/src/components/global-styles/index.js +6 -1
- package/src/components/global-styles/style.scss +17 -0
- package/src/components/global-styles/test/utils.js +57 -1
- package/src/components/global-styles/typography-panel.js +1 -1
- package/src/components/global-styles/use-global-styles-output.js +21 -3
- package/src/components/global-styles/utils.js +27 -0
- package/src/components/iframe/index.js +22 -12
- package/src/components/image-editor/use-save-image.js +20 -9
- package/src/components/inner-blocks/README.md +5 -0
- package/src/components/inner-blocks/index.js +2 -0
- package/src/components/inner-blocks/index.native.js +16 -6
- package/src/components/inner-blocks/use-nested-settings-update.js +20 -3
- package/src/components/inserter/index.js +1 -9
- package/src/components/inserter/quick-inserter.js +0 -2
- package/src/components/inserter/search-results.js +32 -6
- package/src/components/inserter-draggable-blocks/index.js +4 -0
- package/src/components/inspector-controls/fill.js +1 -1
- package/src/components/inspector-controls/fill.native.js +1 -1
- package/src/components/inspector-controls/slot.js +4 -9
- package/src/components/inspector-controls/slot.native.js +1 -1
- package/src/components/line-height-control/index.js +7 -2
- package/src/components/line-height-control/stories/index.js +1 -1
- package/src/components/link-control/test/index.js +42 -0
- package/src/components/link-control/use-internal-input-value.js +8 -7
- package/src/components/list-view/appender.js +3 -2
- package/src/components/list-view/block-contents.js +32 -20
- package/src/components/list-view/block-select-button.js +5 -1
- package/src/components/list-view/block.js +34 -37
- package/src/components/list-view/branch.js +1 -7
- package/src/components/list-view/index.js +42 -17
- package/src/components/list-view/style.scss +7 -7
- package/src/components/list-view/test/use-list-view-drop-zone.js +88 -12
- package/src/components/list-view/use-list-view-client-ids.js +21 -4
- package/src/components/list-view/use-list-view-drop-zone.js +194 -11
- package/src/components/media-placeholder/index.js +74 -1
- package/src/components/multi-selection-inspector/index.js +2 -2
- package/src/components/preview-options/index.js +9 -2
- package/src/components/publish-date-time-picker/index.js +0 -2
- package/src/components/spacing-sizes-control/spacing-input-control.js +1 -0
- package/src/components/url-input/README.md +6 -0
- package/src/components/url-input/index.js +2 -2
- package/src/components/use-block-drop-zone/index.js +31 -17
- package/src/components/use-resize-canvas/index.js +9 -1
- package/src/components/writing-flow/test/index.js +15 -0
- package/src/components/writing-flow/use-arrow-nav.js +17 -4
- package/src/hooks/align.js +5 -12
- package/src/hooks/behaviors.js +104 -0
- package/src/hooks/border.js +2 -1
- package/src/hooks/color.js +2 -1
- package/src/hooks/content-lock-ui.js +3 -15
- package/src/hooks/dimensions.js +0 -40
- package/src/hooks/duotone.js +4 -11
- package/src/hooks/index.js +1 -0
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/layout.js +14 -20
- package/src/hooks/position.js +2 -1
- package/src/hooks/style.js +2 -1
- package/src/hooks/test/use-editor-wrapper-styles.native.js +282 -0
- package/src/hooks/test/use-typography-props.js +47 -2
- package/src/hooks/use-editor-wrapper-styles.native.js +250 -0
- package/src/hooks/use-editor-wrapper-styles.native.scss +11 -0
- package/src/hooks/use-typography-props.js +10 -11
- package/src/index.native.js +6 -0
- package/src/private-apis.js +2 -4
- package/src/store/private-actions.js +39 -0
- package/src/store/private-selectors.js +95 -0
- package/src/store/reducer.js +27 -0
- package/src/store/selectors.js +25 -15
- package/src/store/test/private-actions.js +32 -1
- package/src/store/test/private-selectors.js +158 -0
- package/src/store/test/reducer.js +48 -0
- package/src/style.scss +0 -3
- package/src/utils/order-inserter-block-items.js +26 -0
- package/src/utils/use-should-contextual-toolbar-show.js +19 -9
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-list/block-list-compact.native.js +0 -75
- package/build/components/block-list/block-list-compact.native.js.map +0 -1
- package/build/components/off-canvas-editor/appender.js +0 -125
- package/build/components/off-canvas-editor/appender.js.map +0 -1
- package/build/components/off-canvas-editor/block-contents.js +0 -141
- package/build/components/off-canvas-editor/block-contents.js.map +0 -1
- package/build/components/off-canvas-editor/block-select-button.js +0 -126
- package/build/components/off-canvas-editor/block-select-button.js.map +0 -1
- package/build/components/off-canvas-editor/block.js +0 -297
- package/build/components/off-canvas-editor/block.js.map +0 -1
- package/build/components/off-canvas-editor/branch.js +0 -197
- package/build/components/off-canvas-editor/branch.js.map +0 -1
- package/build/components/off-canvas-editor/context.js +0 -19
- package/build/components/off-canvas-editor/context.js.map +0 -1
- package/build/components/off-canvas-editor/drop-indicator.js +0 -118
- package/build/components/off-canvas-editor/drop-indicator.js.map +0 -1
- package/build/components/off-canvas-editor/expander.js +0 -41
- package/build/components/off-canvas-editor/expander.js.map +0 -1
- package/build/components/off-canvas-editor/index.js +0 -236
- package/build/components/off-canvas-editor/index.js.map +0 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js +0 -146
- package/build/components/off-canvas-editor/leaf-more-menu.js.map +0 -1
- package/build/components/off-canvas-editor/leaf.js +0 -60
- package/build/components/off-canvas-editor/leaf.js.map +0 -1
- package/build/components/off-canvas-editor/link-ui.js +0 -186
- package/build/components/off-canvas-editor/link-ui.js.map +0 -1
- package/build/components/off-canvas-editor/update-attributes.js +0 -108
- package/build/components/off-canvas-editor/update-attributes.js.map +0 -1
- package/build/components/off-canvas-editor/use-block-selection.js +0 -139
- package/build/components/off-canvas-editor/use-block-selection.js.map +0 -1
- package/build/components/off-canvas-editor/use-inserted-block.js +0 -58
- package/build/components/off-canvas-editor/use-inserted-block.js.map +0 -1
- package/build/components/off-canvas-editor/use-list-view-client-ids.js +0 -33
- package/build/components/off-canvas-editor/use-list-view-client-ids.js.map +0 -1
- package/build/components/off-canvas-editor/use-list-view-drop-zone.js +0 -235
- package/build/components/off-canvas-editor/use-list-view-drop-zone.js.map +0 -1
- package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -60
- package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +0 -1
- package/build/components/off-canvas-editor/utils.js +0 -60
- package/build/components/off-canvas-editor/utils.js.map +0 -1
- package/build-module/components/block-list/block-list-compact.native.js +0 -60
- package/build-module/components/block-list/block-list-compact.native.js.map +0 -1
- package/build-module/components/off-canvas-editor/appender.js +0 -108
- package/build-module/components/off-canvas-editor/appender.js.map +0 -1
- package/build-module/components/off-canvas-editor/block-contents.js +0 -121
- package/build-module/components/off-canvas-editor/block-contents.js.map +0 -1
- package/build-module/components/off-canvas-editor/block-select-button.js +0 -107
- package/build-module/components/off-canvas-editor/block-select-button.js.map +0 -1
- package/build-module/components/off-canvas-editor/block.js +0 -273
- package/build-module/components/off-canvas-editor/block.js.map +0 -1
- package/build-module/components/off-canvas-editor/branch.js +0 -179
- package/build-module/components/off-canvas-editor/branch.js.map +0 -1
- package/build-module/components/off-canvas-editor/context.js +0 -7
- package/build-module/components/off-canvas-editor/context.js.map +0 -1
- package/build-module/components/off-canvas-editor/drop-indicator.js +0 -111
- package/build-module/components/off-canvas-editor/drop-indicator.js.map +0 -1
- package/build-module/components/off-canvas-editor/expander.js +0 -32
- package/build-module/components/off-canvas-editor/expander.js.map +0 -1
- package/build-module/components/off-canvas-editor/index.js +0 -213
- package/build-module/components/off-canvas-editor/index.js.map +0 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js +0 -128
- package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +0 -1
- package/build-module/components/off-canvas-editor/leaf.js +0 -45
- package/build-module/components/off-canvas-editor/leaf.js.map +0 -1
- package/build-module/components/off-canvas-editor/link-ui.js +0 -166
- package/build-module/components/off-canvas-editor/link-ui.js.map +0 -1
- package/build-module/components/off-canvas-editor/update-attributes.js +0 -97
- package/build-module/components/off-canvas-editor/update-attributes.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-block-selection.js +0 -124
- package/build-module/components/off-canvas-editor/use-block-selection.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-inserted-block.js +0 -47
- package/build-module/components/off-canvas-editor/use-inserted-block.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-list-view-client-ids.js +0 -24
- package/build-module/components/off-canvas-editor/use-list-view-client-ids.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js +0 -220
- package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -50
- package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +0 -1
- package/build-module/components/off-canvas-editor/utils.js +0 -44
- package/build-module/components/off-canvas-editor/utils.js.map +0 -1
- package/src/components/block-list/block-list-compact.native.js +0 -63
- package/src/components/off-canvas-editor/README.md +0 -5
- package/src/components/off-canvas-editor/appender.js +0 -124
- package/src/components/off-canvas-editor/block-contents.js +0 -156
- package/src/components/off-canvas-editor/block-select-button.js +0 -128
- package/src/components/off-canvas-editor/block.js +0 -347
- package/src/components/off-canvas-editor/branch.js +0 -238
- package/src/components/off-canvas-editor/context.js +0 -8
- package/src/components/off-canvas-editor/drop-indicator.js +0 -126
- package/src/components/off-canvas-editor/expander.js +0 -26
- package/src/components/off-canvas-editor/index.js +0 -271
- package/src/components/off-canvas-editor/leaf-more-menu.js +0 -157
- package/src/components/off-canvas-editor/leaf.js +0 -52
- package/src/components/off-canvas-editor/link-ui.js +0 -167
- package/src/components/off-canvas-editor/style.scss +0 -34
- package/src/components/off-canvas-editor/test/use-inserted-block.js +0 -108
- package/src/components/off-canvas-editor/test/utils.js +0 -50
- package/src/components/off-canvas-editor/update-attributes.js +0 -99
- package/src/components/off-canvas-editor/use-block-selection.js +0 -169
- package/src/components/off-canvas-editor/use-inserted-block.js +0 -47
- package/src/components/off-canvas-editor/use-list-view-client-ids.js +0 -29
- package/src/components/off-canvas-editor/use-list-view-drop-zone.js +0 -260
- package/src/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -58
- package/src/components/off-canvas-editor/utils.js +0 -58
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/style.js"],"names":["classnames","useContext","useMemo","createPortal","addFilter","getBlockSupport","hasBlockSupport","__EXPERIMENTAL_ELEMENTS","ELEMENTS","createHigherOrderComponent","useInstanceId","getCSSRules","compileCSS","BlockList","BORDER_SUPPORT_KEY","BorderPanel","COLOR_SUPPORT_KEY","ColorEdit","TypographyPanel","TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","DIMENSIONS_SUPPORT_KEY","SPACING_SUPPORT_KEY","DimensionsPanel","useDisplayBlockControls","shouldSkipSerialization","styleSupportKeys","hasStyleSupport","blockType","some","key","getInlineStyles","styles","output","forEach","rule","value","addAttribute","settings","attributes","style","Object","assign","type","skipSerializationPathsEdit","skipSerializationPathsSave","renamedFeatures","gradients","omitStyle","paths","preserveReference","newStyle","JSON","parse","stringify","Array","isArray","path","split","length","firstSubpath","restPath","addSaveProps","props","skipPaths","entries","indicator","skipSerialization","featureName","feature","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","withBlockControls","BlockEdit","shouldDisplayControls","withElementsStyles","BlockListBlock","blockElementsContainerIdentifier","skipLinkColorSerialization","name","elements","link","undefined","selector","elementCssRules","elementStyles","cssRule","push","join","element","__unstableElementContext","__html","className"],"mappings":";;;AAAA;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ACX;AACC,IAAA,uBAAuB,EAAG;AACzByF,MAAAA,MAAM,EAAE5D;AADiB;AAD3B,IADW,EAMX0D,OANW,CAHd,EAYC,cAAC,cAAD,eACM3B,KADN;AAEC,IAAA,SAAS,EACR,0BAAAA,KAAK,CAACxB,UAAN,CAAiBC,KAAjB,0EAAwByC,QAAxB,GACGjF,UAAU,CACV+D,KAAK,CAAC8B,SADI,EAEVf,gCAFU,CADb,GAKGf,KAAK,CAAC8B;AARX,KAZD,CADD;AA0BA,CA5EmD,CAArD;AA+EAzF,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGRiC,YAHQ,CAAT;AAMAjC,SAAS,CACR,kCADQ,EAER,yBAFQ,EAGR0D,YAHQ,CAAT;AAMA1D,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGRkE,YAHQ,CAAT;AAMAlE,SAAS,CACR,kBADQ,EAER,gCAFQ,EAGRqE,iBAHQ,CAAT;AAMArE,SAAS,CACR,uBADQ,EAER,kCAFQ,EAGRwE,kBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useMemo, createPortal } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\thasBlockSupport,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n} from '@wordpress/blocks';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { getCSSRules, compileCSS } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../components/block-list';\nimport { BORDER_SUPPORT_KEY, BorderPanel } from './border';\nimport { COLOR_SUPPORT_KEY, ColorEdit } from './color';\nimport {\n\tTypographyPanel,\n\tTYPOGRAPHY_SUPPORT_KEY,\n\tTYPOGRAPHY_SUPPORT_KEYS,\n} from './typography';\nimport {\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n\tDimensionsPanel,\n} from './dimensions';\nimport useDisplayBlockControls from '../components/use-display-block-controls';\nimport { shouldSkipSerialization } from './utils';\n\nconst styleSupportKeys = [\n\t...TYPOGRAPHY_SUPPORT_KEYS,\n\tBORDER_SUPPORT_KEY,\n\tCOLOR_SUPPORT_KEY,\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n];\n\nconst hasStyleSupport = ( blockType ) =>\n\tstyleSupportKeys.some( ( key ) => hasBlockSupport( blockType, key ) );\n\n/**\n * Returns the inline styles to add depending on the style object\n *\n * @param {Object} styles Styles configuration.\n *\n * @return {Object} Flattened CSS variables declaration.\n */\nexport function getInlineStyles( styles = {} ) {\n\tconst output = {};\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tgetCSSRules( styles ).forEach( ( rule ) => {\n\t\toutput[ rule.key ] = rule.value;\n\t} );\n\n\treturn output;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `style` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttribute( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsEdit = {\n\t[ `${ BORDER_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ 'border' ],\n\t[ `${ COLOR_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tCOLOR_SUPPORT_KEY,\n\t],\n\t[ `${ TYPOGRAPHY_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t],\n\t[ `${ DIMENSIONS_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tDIMENSIONS_SUPPORT_KEY,\n\t],\n\t[ `${ SPACING_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tSPACING_SUPPORT_KEY,\n\t],\n};\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * Extends the Edit skip paths to enable skipping additional paths in just\n * the Save component. This allows a block support to be serialized within the\n * editor, while using an alternate approach, such as server-side rendering, when\n * the support is saved.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsSave = {\n\t...skipSerializationPathsEdit,\n\t[ `${ SPACING_SUPPORT_KEY }` ]: [ 'spacing.blockGap' ],\n};\n\n/**\n * A dictionary used to normalize feature names between support flags, style\n * object properties and __experimentSkipSerialization configuration arrays.\n *\n * This allows not having to provide a migration for a support flag and possible\n * backwards compatibility bridges, while still achieving consistency between\n * the support flag and the skip serialization array.\n *\n * @constant\n * @type {Record<string, string>}\n */\nconst renamedFeatures = { gradients: 'gradient' };\n\n/**\n * A utility function used to remove one or more paths from a style object.\n * Works in a way similar to Lodash's `omit()`. See unit tests and examples below.\n *\n * It supports a single string path:\n *\n * ```\n * omitStyle( { color: 'red' }, 'color' ); // {}\n * ```\n *\n * or an array of paths:\n *\n * ```\n * omitStyle( { color: 'red', background: '#fff' }, [ 'color', 'background' ] ); // {}\n * ```\n *\n * It also allows you to specify paths at multiple levels in a string.\n *\n * ```\n * omitStyle( { typography: { textDecoration: 'underline' } }, 'typography.textDecoration' ); // {}\n * ```\n *\n * You can remove multiple paths at the same time:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t'typography.textDecoration',\n * \t\t\t'typography.textTransform',\n *\t\t]\n * );\n * // {}\n * ```\n *\n * You can also specify nested paths as arrays:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'typography', 'textDecoration' ],\n * \t\t\t[ 'typography', 'textTransform' ],\n *\t\t]\n * );\n * // {}\n * ```\n *\n * With regards to nesting of styles, infinite depth is supported:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\tborder: {\n * \t\t\t\tradius: {\n * \t\t\t\t\ttopLeft: '10px',\n * \t\t\t\t\ttopRight: '0.5rem',\n * \t\t\t\t}\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'border', 'radius', 'topRight' ],\n *\t\t]\n * );\n * // { border: { radius: { topLeft: '10px' } } }\n * ```\n *\n * The third argument, `preserveReference`, defines how to treat the input style object.\n * It is mostly necessary to properly handle mutation when recursively handling the style object.\n * Defaulting to `false`, this will always create a new object, avoiding to mutate `style`.\n * However, when recursing, we change that value to `true` in order to work with a single copy\n * of the original style object.\n *\n * @see https://lodash.com/docs/4.17.15#omit\n *\n * @param {Object} style Styles object.\n * @param {Array|string} paths Paths to remove.\n * @param {boolean} preserveReference True to mutate the `style` object, false otherwise.\n * @return {Object} Styles object with the specified paths removed.\n */\nexport function omitStyle( style, paths, preserveReference = false ) {\n\tif ( ! style ) {\n\t\treturn style;\n\t}\n\n\tlet newStyle = style;\n\tif ( ! preserveReference ) {\n\t\tnewStyle = JSON.parse( JSON.stringify( style ) );\n\t}\n\n\tif ( ! Array.isArray( paths ) ) {\n\t\tpaths = [ paths ];\n\t}\n\n\tpaths.forEach( ( path ) => {\n\t\tif ( ! Array.isArray( path ) ) {\n\t\t\tpath = path.split( '.' );\n\t\t}\n\n\t\tif ( path.length > 1 ) {\n\t\t\tconst [ firstSubpath, ...restPath ] = path;\n\t\t\tomitStyle( newStyle[ firstSubpath ], [ restPath ], true );\n\t\t} else if ( path.length === 1 ) {\n\t\t\tdelete newStyle[ path[ 0 ] ];\n\t\t}\n\t} );\n\n\treturn newStyle;\n}\n\n/**\n * Override props assigned to save component to inject the CSS variables definition.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n * @param {?Record<string, string[]>} skipPaths An object of keys and paths to skip serialization.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps(\n\tprops,\n\tblockType,\n\tattributes,\n\tskipPaths = skipSerializationPathsSave\n) {\n\tif ( ! hasStyleSupport( blockType ) ) {\n\t\treturn props;\n\t}\n\n\tlet { style } = attributes;\n\tObject.entries( skipPaths ).forEach( ( [ indicator, path ] ) => {\n\t\tconst skipSerialization = getBlockSupport( blockType, indicator );\n\n\t\tif ( skipSerialization === true ) {\n\t\t\tstyle = omitStyle( style, path );\n\t\t}\n\n\t\tif ( Array.isArray( skipSerialization ) ) {\n\t\t\tskipSerialization.forEach( ( featureName ) => {\n\t\t\t\tconst feature = renamedFeatures[ featureName ] || featureName;\n\t\t\t\tstyle = omitStyle( style, [ [ ...path, feature ] ] );\n\t\t\t} );\n\t\t}\n\t} );\n\n\tprops.style = {\n\t\t...getInlineStyles( style ),\n\t\t...props.style,\n\t};\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to extend the block edit wrapper\n * to apply the desired styles and classnames properly.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object}.Filtered block settings.\n */\nexport function addEditProps( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\n\t\treturn addSaveProps(\n\t\t\tprops,\n\t\t\tsettings,\n\t\t\tattributes,\n\t\t\tskipSerializationPathsEdit\n\t\t);\n\t};\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include new inspector controls for\n * all the custom styles configs.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst shouldDisplayControls = useDisplayBlockControls();\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldDisplayControls && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ColorEdit { ...props } />\n\t\t\t\t\t\t<TypographyPanel { ...props } />\n\t\t\t\t\t\t<BorderPanel { ...props } />\n\t\t\t\t\t\t<DimensionsPanel { ...props } />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\n/**\n * Override the default block element to include elements styles.\n *\n * @param {Function} BlockListBlock Original component\n * @return {Function} Wrapped component\n */\nconst withElementsStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst blockElementsContainerIdentifier = `wp-elements-${ useInstanceId(\n\t\t\tBlockListBlock\n\t\t) }`;\n\n\t\tconst skipLinkColorSerialization = shouldSkipSerialization(\n\t\t\tprops.name,\n\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\t'link'\n\t\t);\n\n\t\tconst styles = useMemo( () => {\n\t\t\t// The .editor-styles-wrapper selector is required on elements styles. As it is\n\t\t\t// added to all other editor styles, not providing it causes reset and global\n\t\t\t// styles to override element styles because of higher specificity.\n\t\t\tconst elements = [\n\t\t\t\t{\n\t\t\t\t\tstyles: ! skipLinkColorSerialization\n\t\t\t\t\t\t? props.attributes.style?.elements?.link\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tselector: `.editor-styles-wrapper .${ blockElementsContainerIdentifier } ${ ELEMENTS.link }`,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstyles: ! skipLinkColorSerialization\n\t\t\t\t\t\t? props.attributes.style?.elements?.link?.[ ':hover' ]\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tselector: `.editor-styles-wrapper .${ blockElementsContainerIdentifier } ${ ELEMENTS.link }:hover`,\n\t\t\t\t},\n\t\t\t];\n\t\t\tconst elementCssRules = [];\n\t\t\tfor ( const { styles: elementStyles, selector } of elements ) {\n\t\t\t\tif ( elementStyles ) {\n\t\t\t\t\tconst cssRule = compileCSS( elementStyles, {\n\t\t\t\t\t\tselector,\n\t\t\t\t\t} );\n\t\t\t\t\telementCssRules.push( cssRule );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn elementCssRules.length > 0\n\t\t\t\t? elementCssRules.join( '' )\n\t\t\t\t: undefined;\n\t\t}, [\n\t\t\tprops.attributes.style?.elements,\n\t\t\tblockElementsContainerIdentifier,\n\t\t\tskipLinkColorSerialization,\n\t\t] );\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ styles &&\n\t\t\t\t\telement &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<style\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t__html: styles,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tclassName={\n\t\t\t\t\t\tprops.attributes.style?.elements\n\t\t\t\t\t\t\t? classnames(\n\t\t\t\t\t\t\t\t\tprops.className,\n\t\t\t\t\t\t\t\t\tblockElementsContainerIdentifier\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: props.className\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addAttribute',\n\taddAttribute\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/style/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addEditProps',\n\taddEditProps\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/style/with-block-controls',\n\twithBlockControls\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/with-elements-styles',\n\twithElementsStyles\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/style.js"],"names":["classnames","useContext","useMemo","createPortal","addFilter","getBlockSupport","hasBlockSupport","__EXPERIMENTAL_ELEMENTS","ELEMENTS","createHigherOrderComponent","useInstanceId","getCSSRules","compileCSS","BlockList","BORDER_SUPPORT_KEY","BorderPanel","COLOR_SUPPORT_KEY","ColorEdit","TypographyPanel","TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","DIMENSIONS_SUPPORT_KEY","SPACING_SUPPORT_KEY","DimensionsPanel","useDisplayBlockControls","shouldSkipSerialization","styleSupportKeys","hasStyleSupport","blockType","some","key","getInlineStyles","styles","output","forEach","rule","value","addAttribute","settings","attributes","style","Object","assign","type","skipSerializationPathsEdit","skipSerializationPathsSave","renamedFeatures","gradients","omitStyle","paths","preserveReference","newStyle","JSON","parse","stringify","Array","isArray","path","split","length","firstSubpath","restPath","addSaveProps","props","skipPaths","entries","indicator","skipSerialization","featureName","feature","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","withBlockControls","BlockEdit","shouldDisplayControls","withElementsStyles","BlockListBlock","blockElementsContainerIdentifier","skipLinkColorSerialization","name","elements","link","undefined","selector","elementCssRules","elementStyles","cssRule","push","join","element","__unstableElementContext","__html","className"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,EAAqBC,OAArB,EAA8BC,YAA9B,QAAkD,oBAAlD;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SACCC,eADD,EAECC,eAFD,EAGCC,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AK,CAAEA,QAAQ,CAACC,UAAT,CAAoBC,KAA3B,EAAmC;AAClCC,IAAAA,MAAM,CAACC,MAAP,CAAeJ,QAAQ,CAACC,UAAxB,EAAoC;AACnCC,MAAAA,KAAK,EAAE;AACNG,QAAAA,IAAI,EAAE;AADA;AAD4B,KAApC;AAKA;;AAED,SAAOL,QAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMM,0BAA0B,GAAG;AAClC,GAAG,GAAG9B,kBAAoB,kCAA1B,GAA+D,CAAE,QAAF,CAD7B;AAElC,GAAG,GAAGE,iBAAmB,kCAAzB,GAA8D,CAC7DA,iBAD6D,CAF5B;AAKlC,GAAG,GAAGG,sBAAwB,kCAA9B,GAAmE,CAClEA,sBADkE,CALjC;AAQlC,GAAG,GAAGE,sBAAwB,kCAA9B,GAAmE,CAClEA,sBADkE,CARjC;AAWlC,GAAG,GAAGC,mBAAqB,kCAA3B,GAAgE,CAC/DA,mBAD+D;AAX9B,CAAnC;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMuB,0BAA0B,GAAG,EAClC,GAAGD,0BAD+B;AAElC,GAAG,GAAGtB,mBAAqB,EAA3B,GAAgC,CAAE,kBAAF;AAFE,CAAnC;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMwB,eAAe,GAAG;AAAEC,EAAAA,SAAS,EAAE;AAAb,CAAxB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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B,0EAAwByC,QAAxB,GACGjF,UAAU,CACV+D,KAAK,CAAC8B,SADI,EAEVf,gCAFU,CADb,GAKGf,KAAK,CAAC8B;AARX,KAZD,CADD;AA0BA,CA5EmD,EA6EpD,oBA7EoD,CAArD;AAgFAzF,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGRiC,YAHQ,CAAT;AAMAjC,SAAS,CACR,kCADQ,EAER,yBAFQ,EAGR0D,YAHQ,CAAT;AAMA1D,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGRkE,YAHQ,CAAT;AAMAlE,SAAS,CACR,kBADQ,EAER,gCAFQ,EAGRqE,iBAHQ,CAAT;AAMArE,SAAS,CACR,uBADQ,EAER,kCAFQ,EAGRwE,kBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useMemo, createPortal } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\thasBlockSupport,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n} from '@wordpress/blocks';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { getCSSRules, compileCSS } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../components/block-list';\nimport { BORDER_SUPPORT_KEY, BorderPanel } from './border';\nimport { COLOR_SUPPORT_KEY, ColorEdit } from './color';\nimport {\n\tTypographyPanel,\n\tTYPOGRAPHY_SUPPORT_KEY,\n\tTYPOGRAPHY_SUPPORT_KEYS,\n} from './typography';\nimport {\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n\tDimensionsPanel,\n} from './dimensions';\nimport useDisplayBlockControls from '../components/use-display-block-controls';\nimport { shouldSkipSerialization } from './utils';\n\nconst styleSupportKeys = [\n\t...TYPOGRAPHY_SUPPORT_KEYS,\n\tBORDER_SUPPORT_KEY,\n\tCOLOR_SUPPORT_KEY,\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n];\n\nconst hasStyleSupport = ( blockType ) =>\n\tstyleSupportKeys.some( ( key ) => hasBlockSupport( blockType, key ) );\n\n/**\n * Returns the inline styles to add depending on the style object\n *\n * @param {Object} styles Styles configuration.\n *\n * @return {Object} Flattened CSS variables declaration.\n */\nexport function getInlineStyles( styles = {} ) {\n\tconst output = {};\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tgetCSSRules( styles ).forEach( ( rule ) => {\n\t\toutput[ rule.key ] = rule.value;\n\t} );\n\n\treturn output;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `style` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttribute( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsEdit = {\n\t[ `${ BORDER_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ 'border' ],\n\t[ `${ COLOR_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tCOLOR_SUPPORT_KEY,\n\t],\n\t[ `${ TYPOGRAPHY_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t],\n\t[ `${ DIMENSIONS_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tDIMENSIONS_SUPPORT_KEY,\n\t],\n\t[ `${ SPACING_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tSPACING_SUPPORT_KEY,\n\t],\n};\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * Extends the Edit skip paths to enable skipping additional paths in just\n * the Save component. This allows a block support to be serialized within the\n * editor, while using an alternate approach, such as server-side rendering, when\n * the support is saved.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsSave = {\n\t...skipSerializationPathsEdit,\n\t[ `${ SPACING_SUPPORT_KEY }` ]: [ 'spacing.blockGap' ],\n};\n\n/**\n * A dictionary used to normalize feature names between support flags, style\n * object properties and __experimentSkipSerialization configuration arrays.\n *\n * This allows not having to provide a migration for a support flag and possible\n * backwards compatibility bridges, while still achieving consistency between\n * the support flag and the skip serialization array.\n *\n * @constant\n * @type {Record<string, string>}\n */\nconst renamedFeatures = { gradients: 'gradient' };\n\n/**\n * A utility function used to remove one or more paths from a style object.\n * Works in a way similar to Lodash's `omit()`. See unit tests and examples below.\n *\n * It supports a single string path:\n *\n * ```\n * omitStyle( { color: 'red' }, 'color' ); // {}\n * ```\n *\n * or an array of paths:\n *\n * ```\n * omitStyle( { color: 'red', background: '#fff' }, [ 'color', 'background' ] ); // {}\n * ```\n *\n * It also allows you to specify paths at multiple levels in a string.\n *\n * ```\n * omitStyle( { typography: { textDecoration: 'underline' } }, 'typography.textDecoration' ); // {}\n * ```\n *\n * You can remove multiple paths at the same time:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t'typography.textDecoration',\n * \t\t\t'typography.textTransform',\n *\t\t]\n * );\n * // {}\n * ```\n *\n * You can also specify nested paths as arrays:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'typography', 'textDecoration' ],\n * \t\t\t[ 'typography', 'textTransform' ],\n *\t\t]\n * );\n * // {}\n * ```\n *\n * With regards to nesting of styles, infinite depth is supported:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\tborder: {\n * \t\t\t\tradius: {\n * \t\t\t\t\ttopLeft: '10px',\n * \t\t\t\t\ttopRight: '0.5rem',\n * \t\t\t\t}\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'border', 'radius', 'topRight' ],\n *\t\t]\n * );\n * // { border: { radius: { topLeft: '10px' } } }\n * ```\n *\n * The third argument, `preserveReference`, defines how to treat the input style object.\n * It is mostly necessary to properly handle mutation when recursively handling the style object.\n * Defaulting to `false`, this will always create a new object, avoiding to mutate `style`.\n * However, when recursing, we change that value to `true` in order to work with a single copy\n * of the original style object.\n *\n * @see https://lodash.com/docs/4.17.15#omit\n *\n * @param {Object} style Styles object.\n * @param {Array|string} paths Paths to remove.\n * @param {boolean} preserveReference True to mutate the `style` object, false otherwise.\n * @return {Object} Styles object with the specified paths removed.\n */\nexport function omitStyle( style, paths, preserveReference = false ) {\n\tif ( ! style ) {\n\t\treturn style;\n\t}\n\n\tlet newStyle = style;\n\tif ( ! preserveReference ) {\n\t\tnewStyle = JSON.parse( JSON.stringify( style ) );\n\t}\n\n\tif ( ! Array.isArray( paths ) ) {\n\t\tpaths = [ paths ];\n\t}\n\n\tpaths.forEach( ( path ) => {\n\t\tif ( ! Array.isArray( path ) ) {\n\t\t\tpath = path.split( '.' );\n\t\t}\n\n\t\tif ( path.length > 1 ) {\n\t\t\tconst [ firstSubpath, ...restPath ] = path;\n\t\t\tomitStyle( newStyle[ firstSubpath ], [ restPath ], true );\n\t\t} else if ( path.length === 1 ) {\n\t\t\tdelete newStyle[ path[ 0 ] ];\n\t\t}\n\t} );\n\n\treturn newStyle;\n}\n\n/**\n * Override props assigned to save component to inject the CSS variables definition.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n * @param {?Record<string, string[]>} skipPaths An object of keys and paths to skip serialization.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps(\n\tprops,\n\tblockType,\n\tattributes,\n\tskipPaths = skipSerializationPathsSave\n) {\n\tif ( ! hasStyleSupport( blockType ) ) {\n\t\treturn props;\n\t}\n\n\tlet { style } = attributes;\n\tObject.entries( skipPaths ).forEach( ( [ indicator, path ] ) => {\n\t\tconst skipSerialization = getBlockSupport( blockType, indicator );\n\n\t\tif ( skipSerialization === true ) {\n\t\t\tstyle = omitStyle( style, path );\n\t\t}\n\n\t\tif ( Array.isArray( skipSerialization ) ) {\n\t\t\tskipSerialization.forEach( ( featureName ) => {\n\t\t\t\tconst feature = renamedFeatures[ featureName ] || featureName;\n\t\t\t\tstyle = omitStyle( style, [ [ ...path, feature ] ] );\n\t\t\t} );\n\t\t}\n\t} );\n\n\tprops.style = {\n\t\t...getInlineStyles( style ),\n\t\t...props.style,\n\t};\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to extend the block edit wrapper\n * to apply the desired styles and classnames properly.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object}.Filtered block settings.\n */\nexport function addEditProps( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\n\t\treturn addSaveProps(\n\t\t\tprops,\n\t\t\tsettings,\n\t\t\tattributes,\n\t\t\tskipSerializationPathsEdit\n\t\t);\n\t};\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include new inspector controls for\n * all the custom styles configs.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst shouldDisplayControls = useDisplayBlockControls();\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldDisplayControls && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ColorEdit { ...props } />\n\t\t\t\t\t\t<TypographyPanel { ...props } />\n\t\t\t\t\t\t<BorderPanel { ...props } />\n\t\t\t\t\t\t<DimensionsPanel { ...props } />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\n/**\n * Override the default block element to include elements styles.\n *\n * @param {Function} BlockListBlock Original component\n * @return {Function} Wrapped component\n */\nconst withElementsStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst blockElementsContainerIdentifier = `wp-elements-${ useInstanceId(\n\t\t\tBlockListBlock\n\t\t) }`;\n\n\t\tconst skipLinkColorSerialization = shouldSkipSerialization(\n\t\t\tprops.name,\n\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\t'link'\n\t\t);\n\n\t\tconst styles = useMemo( () => {\n\t\t\t// The .editor-styles-wrapper selector is required on elements styles. As it is\n\t\t\t// added to all other editor styles, not providing it causes reset and global\n\t\t\t// styles to override element styles because of higher specificity.\n\t\t\tconst elements = [\n\t\t\t\t{\n\t\t\t\t\tstyles: ! skipLinkColorSerialization\n\t\t\t\t\t\t? props.attributes.style?.elements?.link\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tselector: `.editor-styles-wrapper .${ blockElementsContainerIdentifier } ${ ELEMENTS.link }`,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstyles: ! skipLinkColorSerialization\n\t\t\t\t\t\t? props.attributes.style?.elements?.link?.[ ':hover' ]\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tselector: `.editor-styles-wrapper .${ blockElementsContainerIdentifier } ${ ELEMENTS.link }:hover`,\n\t\t\t\t},\n\t\t\t];\n\t\t\tconst elementCssRules = [];\n\t\t\tfor ( const { styles: elementStyles, selector } of elements ) {\n\t\t\t\tif ( elementStyles ) {\n\t\t\t\t\tconst cssRule = compileCSS( elementStyles, {\n\t\t\t\t\t\tselector,\n\t\t\t\t\t} );\n\t\t\t\t\telementCssRules.push( cssRule );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn elementCssRules.length > 0\n\t\t\t\t? elementCssRules.join( '' )\n\t\t\t\t: undefined;\n\t\t}, [\n\t\t\tprops.attributes.style?.elements,\n\t\t\tblockElementsContainerIdentifier,\n\t\t\tskipLinkColorSerialization,\n\t\t] );\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ styles &&\n\t\t\t\t\telement &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<style\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t__html: styles,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tclassName={\n\t\t\t\t\t\tprops.attributes.style?.elements\n\t\t\t\t\t\t\t? classnames(\n\t\t\t\t\t\t\t\t\tprops.className,\n\t\t\t\t\t\t\t\t\tblockElementsContainerIdentifier\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: props.className\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n\t'withElementsStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addAttribute',\n\taddAttribute\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/style/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addEditProps',\n\taddEditProps\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/style/with-block-controls',\n\twithBlockControls\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/with-elements-styles',\n\twithElementsStyles\n);\n"]}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useWindowDimensions } from 'react-native';
|
|
5
|
+
/**
|
|
6
|
+
* WordPress dependencies
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { useMemo } from '@wordpress/element';
|
|
10
|
+
import { ALIGNMENT_BREAKPOINTS, WIDE_ALIGNMENTS, alignmentHelpers } from '@wordpress/components';
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import styles from './use-editor-wrapper-styles.scss';
|
|
16
|
+
const ALIGNMENT_MAX_WIDTH = {
|
|
17
|
+
full: '100%',
|
|
18
|
+
wide: 1054,
|
|
19
|
+
wideMedium: 770,
|
|
20
|
+
wideLandscape: 662
|
|
21
|
+
};
|
|
22
|
+
const BLOCK_DEFAULT_MARGIN = 16;
|
|
23
|
+
/**
|
|
24
|
+
* Get the styles for the wide width alignment.
|
|
25
|
+
*
|
|
26
|
+
* @param {Object} [options] The options for the helper.
|
|
27
|
+
* @param {string} options.align The alignment value.
|
|
28
|
+
* @param {boolean} options.isLandscape Whether the screen is in landscape mode.
|
|
29
|
+
* @param {number} options.width The width of the screen.
|
|
30
|
+
* @return {Object} An object containing the styles for the wide width alignment.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
function getWideWidthStyles() {
|
|
34
|
+
let {
|
|
35
|
+
align,
|
|
36
|
+
isLandscape,
|
|
37
|
+
width
|
|
38
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
39
|
+
|
|
40
|
+
if (align !== WIDE_ALIGNMENTS.alignments.wide) {
|
|
41
|
+
return {};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (isLandscape && width < ALIGNMENT_BREAKPOINTS.large) {
|
|
45
|
+
return {
|
|
46
|
+
maxWidth: ALIGNMENT_MAX_WIDTH.wideLandscape
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (width <= ALIGNMENT_BREAKPOINTS.small) {
|
|
51
|
+
return {
|
|
52
|
+
maxWidth: width
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (width >= ALIGNMENT_BREAKPOINTS.medium && width < ALIGNMENT_BREAKPOINTS.wide) {
|
|
57
|
+
return {
|
|
58
|
+
maxWidth: ALIGNMENT_MAX_WIDTH.wideMedium
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
maxWidth: ALIGNMENT_MAX_WIDTH.wide
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get the styles for the full width alignment.
|
|
68
|
+
*
|
|
69
|
+
* @param {Object} [options] The options for the helper.
|
|
70
|
+
* @param {string} options.align The alignment value.
|
|
71
|
+
* @param {string} options.blockName The name of the block.
|
|
72
|
+
* @param {boolean} options.hasParents Whether the block has parents.
|
|
73
|
+
* @param {string} options.parentBlockName The name of the parent block.
|
|
74
|
+
* @return {Object} An object containing the styles for the full width alignment.
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
function getFullWidthStyles() {
|
|
79
|
+
let {
|
|
80
|
+
align,
|
|
81
|
+
blockName,
|
|
82
|
+
hasParents,
|
|
83
|
+
parentBlockName
|
|
84
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
85
|
+
const {
|
|
86
|
+
isContainerRelated,
|
|
87
|
+
isFullWidth
|
|
88
|
+
} = alignmentHelpers;
|
|
89
|
+
const fullWidthStyles = isFullWidth(align) ? {
|
|
90
|
+
maxWidth: ALIGNMENT_MAX_WIDTH.full
|
|
91
|
+
} : {};
|
|
92
|
+
|
|
93
|
+
if (!align && hasParents && !isContainerRelated(parentBlockName) && isContainerRelated(blockName)) {
|
|
94
|
+
fullWidthStyles.paddingHorizontal = BLOCK_DEFAULT_MARGIN;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return fullWidthStyles;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Get the block margin based on various conditions.
|
|
101
|
+
*
|
|
102
|
+
* @param {Object} [options] The options for the helper.
|
|
103
|
+
* @param {string} options.align The alignment value.
|
|
104
|
+
* @param {string} options.blockName The name of the block.
|
|
105
|
+
* @param {number} options.blockWidth The width of the block.
|
|
106
|
+
* @param {boolean} options.hasParents Whether the block has parents.
|
|
107
|
+
* @param {number} options.marginHorizontal Default horizontal margin.
|
|
108
|
+
* @param {string} options.parentBlockAlignment The alignment of the parent block.
|
|
109
|
+
* @param {string} options.parentBlockName The name of the parent block.
|
|
110
|
+
* @param {number} options.parentWidth The width of the parent block.
|
|
111
|
+
* @param {number} options.width The width of the screen.
|
|
112
|
+
* @return {number} The calculated block margin.
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
function getBlockMargin() {
|
|
117
|
+
let {
|
|
118
|
+
align,
|
|
119
|
+
blockName,
|
|
120
|
+
blockWidth,
|
|
121
|
+
hasParents,
|
|
122
|
+
marginHorizontal,
|
|
123
|
+
parentBlockAlignment,
|
|
124
|
+
parentBlockName,
|
|
125
|
+
parentWidth,
|
|
126
|
+
width
|
|
127
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
128
|
+
const {
|
|
129
|
+
isContainerRelated,
|
|
130
|
+
isWider,
|
|
131
|
+
isWideWidth,
|
|
132
|
+
isFullWidth
|
|
133
|
+
} = alignmentHelpers;
|
|
134
|
+
|
|
135
|
+
if (isFullWidth(align)) {
|
|
136
|
+
if (!hasParents) {
|
|
137
|
+
return 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return marginHorizontal;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (isWideWidth(align)) {
|
|
144
|
+
return marginHorizontal;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (isFullWidth(parentBlockAlignment) && !isWider(blockWidth, 'medium')) {
|
|
148
|
+
if (isContainerRelated(blockName) || isWider(width, 'mobile')) {
|
|
149
|
+
return marginHorizontal;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return marginHorizontal * 2;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (isContainerRelated(parentBlockName) && !isContainerRelated(blockName)) {
|
|
156
|
+
const isScreenWidthEqual = parentWidth === width;
|
|
157
|
+
|
|
158
|
+
if (isScreenWidthEqual || isWider(width, 'mobile')) {
|
|
159
|
+
return marginHorizontal;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return marginHorizontal;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Custom hook to get the styles and margin for the editor wrapper.
|
|
167
|
+
*
|
|
168
|
+
* @param {Object} [props] The props for the hook.
|
|
169
|
+
* @param {string} props.align The alignment value.
|
|
170
|
+
* @param {string} props.blockName The name of the block.
|
|
171
|
+
* @param {number} props.blockWidth The width of the block.
|
|
172
|
+
* @param {string} props.contentResizeMode The content resize mode.
|
|
173
|
+
* @param {boolean} props.hasParents Whether the block has parents.
|
|
174
|
+
* @param {number} props.marginHorizontal Default horizontal margin.
|
|
175
|
+
* @param {string} props.parentBlockAlignment The alignment of the parent block.
|
|
176
|
+
* @param {string} props.parentBlockName The name of the parent block.
|
|
177
|
+
* @param {number} props.parentWidth The width of the parent block.
|
|
178
|
+
* @param {boolean} [props.reversed=false] Whether the flex direction should be reversed.
|
|
179
|
+
* @return {[Array, number]} An array containing the wrapper styles and block margin.
|
|
180
|
+
*/
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
export function useEditorWrapperStyles() {
|
|
184
|
+
let {
|
|
185
|
+
align,
|
|
186
|
+
blockName,
|
|
187
|
+
blockWidth,
|
|
188
|
+
contentResizeMode,
|
|
189
|
+
hasParents,
|
|
190
|
+
marginHorizontal,
|
|
191
|
+
parentBlockAlignment,
|
|
192
|
+
parentBlockName,
|
|
193
|
+
parentWidth,
|
|
194
|
+
reversed = false
|
|
195
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
196
|
+
const {
|
|
197
|
+
width,
|
|
198
|
+
height
|
|
199
|
+
} = useWindowDimensions();
|
|
200
|
+
const isLandscape = width >= height;
|
|
201
|
+
const blockMargin = useMemo(() => getBlockMargin({
|
|
202
|
+
align,
|
|
203
|
+
blockName,
|
|
204
|
+
blockWidth,
|
|
205
|
+
hasParents,
|
|
206
|
+
marginHorizontal,
|
|
207
|
+
parentBlockAlignment,
|
|
208
|
+
parentBlockName,
|
|
209
|
+
parentWidth,
|
|
210
|
+
width
|
|
211
|
+
}), [align, blockName, blockWidth, hasParents, marginHorizontal, parentBlockAlignment, parentBlockName, parentWidth, width]);
|
|
212
|
+
const wrapperStyles = useMemo(() => {
|
|
213
|
+
let canvasStyles;
|
|
214
|
+
|
|
215
|
+
if (contentResizeMode === 'stretch') {
|
|
216
|
+
// For these cases, no width constraints should be added.
|
|
217
|
+
canvasStyles = {
|
|
218
|
+
flex: 1
|
|
219
|
+
};
|
|
220
|
+
} else if (reversed) {
|
|
221
|
+
canvasStyles = styles['use-editor-wrapper-styles--reversed'];
|
|
222
|
+
} else {
|
|
223
|
+
canvasStyles = styles['use-editor-wrapper-styles'];
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const alignmentStyles = { ...getWideWidthStyles({
|
|
227
|
+
align,
|
|
228
|
+
isLandscape,
|
|
229
|
+
width
|
|
230
|
+
}),
|
|
231
|
+
...getFullWidthStyles({
|
|
232
|
+
align,
|
|
233
|
+
blockName,
|
|
234
|
+
hasParents,
|
|
235
|
+
parentBlockName
|
|
236
|
+
})
|
|
237
|
+
};
|
|
238
|
+
return [canvasStyles, alignmentStyles];
|
|
239
|
+
}, [align, blockName, hasParents, parentBlockName, isLandscape, width, contentResizeMode, reversed]);
|
|
240
|
+
return [wrapperStyles, blockMargin];
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=use-editor-wrapper-styles.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/use-editor-wrapper-styles.native.js"],"names":["useWindowDimensions","useMemo","ALIGNMENT_BREAKPOINTS","WIDE_ALIGNMENTS","alignmentHelpers","styles","ALIGNMENT_MAX_WIDTH","full","wide","wideMedium","wideLandscape","BLOCK_DEFAULT_MARGIN","getWideWidthStyles","align","isLandscape","width","alignments","large","maxWidth","small","medium","getFullWidthStyles","blockName","hasParents","parentBlockName","isContainerRelated","isFullWidth","fullWidthStyles","paddingHorizontal","getBlockMargin","blockWidth","marginHorizontal","parentBlockAlignment","parentWidth","isWider","isWideWidth","isScreenWidthEqual","useEditorWrapperStyles","contentResizeMode","reversed","height","blockMargin","wrapperStyles","canvasStyles","flex","alignmentStyles"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,mBAAT,QAAoC,cAApC;AAEA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SACCC,qBADD,EAECC,eAFD,EAGCC,gBAHD,QAIO,uBAJP;AAMA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,kCAAnB;AAEA,MAAMC,mBAAmB,GAAG;AAC3BC,EAAAA,IAAI,EAAE,MADqB;AAE3BC,EAAAA,IAAI,EAAE,IAFqB;AAG3BC,EAAAA,UAAU,EAAE,GAHe;AAI3BC,EAAAA,aAAa,EAAE;AAJY,CAA5B;AAOA,MAAMC,oBAAoB,GAAG,EAA7B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,kBAAT,GAAkE;AAAA,MAArC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,WAAT;AAAsBC,IAAAA;AAAtB,GAAqC,uEAAL,EAAK;;AACjE,MAAKF,KAAK,KAAKV,eAAe,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AAA;AAAtB,OAAF,CADE;AAEvB,SAAGM,kBAAkB,CAAE;AACtBR,QAAAA,KADsB;AAEtBS,QAAAA,SAFsB;AAGtBC,QAAAA,UAHsB;AAItBC,QAAAA;AAJsB,OAAF;AAFE,KAAxB;AAUA,WAAO,CAAEmB,YAAF,EAAgBE,eAAhB,CAAP;AACA,GAvB4B,EAuB1B,CACFhC,KADE,EAEFS,SAFE,EAGFC,UAHE,EAIFC,eAJE,EAKFV,WALE,EAMFC,KANE,EAOFuB,iBAPE,EAQFC,QARE,CAvB0B,CAA7B;AAkCA,SAAO,CAAEG,aAAF,EAAiBD,WAAjB,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { useWindowDimensions } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport {\n\tALIGNMENT_BREAKPOINTS,\n\tWIDE_ALIGNMENTS,\n\talignmentHelpers,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport styles from './use-editor-wrapper-styles.scss';\n\nconst ALIGNMENT_MAX_WIDTH = {\n\tfull: '100%',\n\twide: 1054,\n\twideMedium: 770,\n\twideLandscape: 662,\n};\n\nconst BLOCK_DEFAULT_MARGIN = 16;\n\n/**\n * Get the styles for the wide width alignment.\n *\n * @param {Object} [options] The options for the helper.\n * @param {string} options.align The alignment value.\n * @param {boolean} options.isLandscape Whether the screen is in landscape mode.\n * @param {number} options.width The width of the screen.\n * @return {Object} An object containing the styles for the wide width alignment.\n */\nfunction getWideWidthStyles( { align, isLandscape, width } = {} ) {\n\tif ( align !== WIDE_ALIGNMENTS.alignments.wide ) {\n\t\treturn {};\n\t}\n\n\tif ( isLandscape && width < ALIGNMENT_BREAKPOINTS.large ) {\n\t\treturn { maxWidth: ALIGNMENT_MAX_WIDTH.wideLandscape };\n\t}\n\n\tif ( width <= ALIGNMENT_BREAKPOINTS.small ) {\n\t\treturn { maxWidth: width };\n\t}\n\n\tif (\n\t\twidth >= ALIGNMENT_BREAKPOINTS.medium &&\n\t\twidth < ALIGNMENT_BREAKPOINTS.wide\n\t) {\n\t\treturn { maxWidth: ALIGNMENT_MAX_WIDTH.wideMedium };\n\t}\n\n\treturn { maxWidth: ALIGNMENT_MAX_WIDTH.wide };\n}\n\n/**\n * Get the styles for the full width alignment.\n *\n * @param {Object} [options] The options for the helper.\n * @param {string} options.align The alignment value.\n * @param {string} options.blockName The name of the block.\n * @param {boolean} options.hasParents Whether the block has parents.\n * @param {string} options.parentBlockName The name of the parent block.\n * @return {Object} An object containing the styles for the full width alignment.\n */\nfunction getFullWidthStyles( {\n\talign,\n\tblockName,\n\thasParents,\n\tparentBlockName,\n} = {} ) {\n\tconst { isContainerRelated, isFullWidth } = alignmentHelpers;\n\tconst fullWidthStyles = isFullWidth( align )\n\t\t? { maxWidth: ALIGNMENT_MAX_WIDTH.full }\n\t\t: {};\n\n\tif (\n\t\t! align &&\n\t\thasParents &&\n\t\t! isContainerRelated( parentBlockName ) &&\n\t\tisContainerRelated( blockName )\n\t) {\n\t\tfullWidthStyles.paddingHorizontal = BLOCK_DEFAULT_MARGIN;\n\t}\n\n\treturn fullWidthStyles;\n}\n\n/**\n * Get the block margin based on various conditions.\n *\n * @param {Object} [options] The options for the helper.\n * @param {string} options.align The alignment value.\n * @param {string} options.blockName The name of the block.\n * @param {number} options.blockWidth The width of the block.\n * @param {boolean} options.hasParents Whether the block has parents.\n * @param {number} options.marginHorizontal Default horizontal margin.\n * @param {string} options.parentBlockAlignment The alignment of the parent block.\n * @param {string} options.parentBlockName The name of the parent block.\n * @param {number} options.parentWidth The width of the parent block.\n * @param {number} options.width The width of the screen.\n * @return {number} The calculated block margin.\n */\nfunction getBlockMargin( {\n\talign,\n\tblockName,\n\tblockWidth,\n\thasParents,\n\tmarginHorizontal,\n\tparentBlockAlignment,\n\tparentBlockName,\n\tparentWidth,\n\twidth,\n} = {} ) {\n\tconst { isContainerRelated, isWider, isWideWidth, isFullWidth } =\n\t\talignmentHelpers;\n\n\tif ( isFullWidth( align ) ) {\n\t\tif ( ! hasParents ) {\n\t\t\treturn 0;\n\t\t}\n\t\treturn marginHorizontal;\n\t}\n\n\tif ( isWideWidth( align ) ) {\n\t\treturn marginHorizontal;\n\t}\n\n\tif (\n\t\tisFullWidth( parentBlockAlignment ) &&\n\t\t! isWider( blockWidth, 'medium' )\n\t) {\n\t\tif ( isContainerRelated( blockName ) || isWider( width, 'mobile' ) ) {\n\t\t\treturn marginHorizontal;\n\t\t}\n\t\treturn marginHorizontal * 2;\n\t}\n\n\tif (\n\t\tisContainerRelated( parentBlockName ) &&\n\t\t! isContainerRelated( blockName )\n\t) {\n\t\tconst isScreenWidthEqual = parentWidth === width;\n\t\tif ( isScreenWidthEqual || isWider( width, 'mobile' ) ) {\n\t\t\treturn marginHorizontal;\n\t\t}\n\t}\n\n\treturn marginHorizontal;\n}\n\n/**\n * Custom hook to get the styles and margin for the editor wrapper.\n *\n * @param {Object} [props] The props for the hook.\n * @param {string} props.align The alignment value.\n * @param {string} props.blockName The name of the block.\n * @param {number} props.blockWidth The width of the block.\n * @param {string} props.contentResizeMode The content resize mode.\n * @param {boolean} props.hasParents Whether the block has parents.\n * @param {number} props.marginHorizontal Default horizontal margin.\n * @param {string} props.parentBlockAlignment The alignment of the parent block.\n * @param {string} props.parentBlockName The name of the parent block.\n * @param {number} props.parentWidth The width of the parent block.\n * @param {boolean} [props.reversed=false] Whether the flex direction should be reversed.\n * @return {[Array, number]} An array containing the wrapper styles and block margin.\n */\nexport function useEditorWrapperStyles( {\n\talign,\n\tblockName,\n\tblockWidth,\n\tcontentResizeMode,\n\thasParents,\n\tmarginHorizontal,\n\tparentBlockAlignment,\n\tparentBlockName,\n\tparentWidth,\n\treversed = false,\n} = {} ) {\n\tconst { width, height } = useWindowDimensions();\n\tconst isLandscape = width >= height;\n\n\tconst blockMargin = useMemo(\n\t\t() =>\n\t\t\tgetBlockMargin( {\n\t\t\t\talign,\n\t\t\t\tblockName,\n\t\t\t\tblockWidth,\n\t\t\t\thasParents,\n\t\t\t\tmarginHorizontal,\n\t\t\t\tparentBlockAlignment,\n\t\t\t\tparentBlockName,\n\t\t\t\tparentWidth,\n\t\t\t\twidth,\n\t\t\t} ),\n\t\t[\n\t\t\talign,\n\t\t\tblockName,\n\t\t\tblockWidth,\n\t\t\thasParents,\n\t\t\tmarginHorizontal,\n\t\t\tparentBlockAlignment,\n\t\t\tparentBlockName,\n\t\t\tparentWidth,\n\t\t\twidth,\n\t\t]\n\t);\n\n\tconst wrapperStyles = useMemo( () => {\n\t\tlet canvasStyles;\n\n\t\tif ( contentResizeMode === 'stretch' ) {\n\t\t\t// For these cases, no width constraints should be added.\n\t\t\tcanvasStyles = { flex: 1 };\n\t\t} else if ( reversed ) {\n\t\t\tcanvasStyles = styles[ 'use-editor-wrapper-styles--reversed' ];\n\t\t} else {\n\t\t\tcanvasStyles = styles[ 'use-editor-wrapper-styles' ];\n\t\t}\n\n\t\tconst alignmentStyles = {\n\t\t\t...getWideWidthStyles( { align, isLandscape, width } ),\n\t\t\t...getFullWidthStyles( {\n\t\t\t\talign,\n\t\t\t\tblockName,\n\t\t\t\thasParents,\n\t\t\t\tparentBlockName,\n\t\t\t} ),\n\t\t};\n\n\t\treturn [ canvasStyles, alignmentStyles ];\n\t}, [\n\t\talign,\n\t\tblockName,\n\t\thasParents,\n\t\tparentBlockName,\n\t\tisLandscape,\n\t\twidth,\n\t\tcontentResizeMode,\n\t\treversed,\n\t] );\n\n\treturn [ wrapperStyles, blockMargin ];\n}\n"]}
|
|
@@ -9,32 +9,36 @@ import classnames from 'classnames';
|
|
|
9
9
|
|
|
10
10
|
import { getInlineStyles } from './style';
|
|
11
11
|
import { getFontSizeClass } from '../components/font-sizes';
|
|
12
|
-
import { getComputedFluidTypographyValue } from '../components/font-sizes/fluid-utils';
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
import { getComputedFluidTypographyValue } from '../components/font-sizes/fluid-utils';
|
|
13
|
+
/*
|
|
14
|
+
* This utility is intended to assist where the serialization of the typography
|
|
15
|
+
* block support is being skipped for a block but the typography related CSS
|
|
16
|
+
* styles still need to be generated so they can be applied to inner elements.
|
|
17
|
+
*/
|
|
15
18
|
|
|
16
19
|
/**
|
|
17
20
|
* Provides the CSS class names and inline styles for a block's typography support
|
|
18
21
|
* attributes.
|
|
19
22
|
*
|
|
20
|
-
* @param {Object} attributes
|
|
21
|
-
* @param {Object|boolean}
|
|
22
|
-
* otherwise an object containing theme fluid typography settings.
|
|
23
|
+
* @param {Object} attributes Block attributes.
|
|
24
|
+
* @param {Object|boolean} settings Merged theme.json settings
|
|
23
25
|
*
|
|
24
26
|
* @return {Object} Typography block support derived CSS classes & styles.
|
|
25
27
|
*/
|
|
26
28
|
|
|
27
|
-
export function getTypographyClassesAndStyles(attributes,
|
|
28
|
-
var _attributes$style;
|
|
29
|
+
export function getTypographyClassesAndStyles(attributes, settings) {
|
|
30
|
+
var _attributes$style, _settings$typography;
|
|
29
31
|
|
|
30
32
|
let typographyStyles = (attributes === null || attributes === void 0 ? void 0 : (_attributes$style = attributes.style) === null || _attributes$style === void 0 ? void 0 : _attributes$style.typography) || {};
|
|
33
|
+
const fluidTypographySettings = settings === null || settings === void 0 ? void 0 : (_settings$typography = settings.typography) === null || _settings$typography === void 0 ? void 0 : _settings$typography.fluid;
|
|
31
34
|
|
|
32
35
|
if (!!fluidTypographySettings && (true === fluidTypographySettings || Object.keys(fluidTypographySettings).length !== 0)) {
|
|
33
|
-
var _attributes$style2, _attributes$style2$ty, _attributes$style3, _attributes$style3$ty;
|
|
36
|
+
var _attributes$style2, _attributes$style2$ty, _settings$layout, _attributes$style3, _attributes$style3$ty;
|
|
34
37
|
|
|
35
38
|
const newFontSize = getComputedFluidTypographyValue({
|
|
36
39
|
fontSize: attributes === null || attributes === void 0 ? void 0 : (_attributes$style2 = attributes.style) === null || _attributes$style2 === void 0 ? void 0 : (_attributes$style2$ty = _attributes$style2.typography) === null || _attributes$style2$ty === void 0 ? void 0 : _attributes$style2$ty.fontSize,
|
|
37
|
-
minimumFontSizeLimit: fluidTypographySettings === null || fluidTypographySettings === void 0 ? void 0 : fluidTypographySettings.minFontSize
|
|
40
|
+
minimumFontSizeLimit: fluidTypographySettings === null || fluidTypographySettings === void 0 ? void 0 : fluidTypographySettings.minFontSize,
|
|
41
|
+
maximumViewPortWidth: settings === null || settings === void 0 ? void 0 : (_settings$layout = settings.layout) === null || _settings$layout === void 0 ? void 0 : _settings$layout.wideSize
|
|
38
42
|
}) || (attributes === null || attributes === void 0 ? void 0 : (_attributes$style3 = attributes.style) === null || _attributes$style3 === void 0 ? void 0 : (_attributes$style3$ty = _attributes$style3.typography) === null || _attributes$style3$ty === void 0 ? void 0 : _attributes$style3$ty.fontSize);
|
|
39
43
|
typographyStyles = { ...typographyStyles,
|
|
40
44
|
fontSize: newFontSize
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/use-typography-props.js"],"names":["kebabCase","classnames","getInlineStyles","getFontSizeClass","getComputedFluidTypographyValue","getTypographyClassesAndStyles","attributes","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/use-typography-props.js"],"names":["kebabCase","classnames","getInlineStyles","getFontSizeClass","getComputedFluidTypographyValue","getTypographyClassesAndStyles","attributes","settings","typographyStyles","style","typography","fluidTypographySettings","fluid","Object","keys","length","newFontSize","fontSize","minimumFontSizeLimit","minFontSize","maximumViewPortWidth","layout","wideSize","fontFamilyClassName","fontFamily","className"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,SAAhC;AACA,SAASC,gBAAT,QAAiC,0BAAjC;AACA,SAASC,+BAAT,QAAgD,sCAAhD;AAEA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,6BAAT,CAAwCC,UA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,SAAS,GAAGxB,UAAU,CAC3BsB,mBAD2B,EAE3BpB,gBAAgB,CAAEG,UAAF,aAAEA,UAAF,uBAAEA,UAAU,CAAEW,QAAd,CAFW,CAA5B;AAKA,SAAO;AACNQ,IAAAA,SADM;AAENhB,IAAAA;AAFM,GAAP;AAIA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * Internal dependencies\n */\nimport { getInlineStyles } from './style';\nimport { getFontSizeClass } from '../components/font-sizes';\nimport { getComputedFluidTypographyValue } from '../components/font-sizes/fluid-utils';\n\n/*\n * This utility is intended to assist where the serialization of the typography\n * block support is being skipped for a block but the typography related CSS\n * styles still need to be generated so they can be applied to inner elements.\n */\n/**\n * Provides the CSS class names and inline styles for a block's typography support\n * attributes.\n *\n * @param {Object} attributes Block attributes.\n * @param {Object|boolean} settings Merged theme.json settings\n *\n * @return {Object} Typography block support derived CSS classes & styles.\n */\nexport function getTypographyClassesAndStyles( attributes, settings ) {\n\tlet typographyStyles = attributes?.style?.typography || {};\n\tconst fluidTypographySettings = settings?.typography?.fluid;\n\n\tif (\n\t\t!! fluidTypographySettings &&\n\t\t( true === fluidTypographySettings ||\n\t\t\tObject.keys( fluidTypographySettings ).length !== 0 )\n\t) {\n\t\tconst newFontSize =\n\t\t\tgetComputedFluidTypographyValue( {\n\t\t\t\tfontSize: attributes?.style?.typography?.fontSize,\n\t\t\t\tminimumFontSizeLimit: fluidTypographySettings?.minFontSize,\n\t\t\t\tmaximumViewPortWidth: settings?.layout?.wideSize,\n\t\t\t} ) || attributes?.style?.typography?.fontSize;\n\t\ttypographyStyles = {\n\t\t\t...typographyStyles,\n\t\t\tfontSize: newFontSize,\n\t\t};\n\t}\n\n\tconst style = getInlineStyles( { typography: typographyStyles } );\n\tconst fontFamilyClassName = !! attributes?.fontFamily\n\t\t? `has-${ kebabCase( attributes.fontFamily ) }-font-family`\n\t\t: '';\n\n\tconst className = classnames(\n\t\tfontFamilyClassName,\n\t\tgetFontSizeClass( attributes?.fontSize )\n\t);\n\n\treturn {\n\t\tclassName,\n\t\tstyle,\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/index.native.js"],"names":["useEditorWrapperStyles"],"mappings":"AAAA;AACA;AACA;AACA,cAAc,YAAd;AAEA,SAASA,sBAAT,QAAuC,SAAvC","sourcesContent":["/**\n * Internal dependencies\n */\nexport * from './index.js';\n\nexport { useEditorWrapperStyles } from './hooks';\n"]}
|
|
@@ -4,14 +4,13 @@
|
|
|
4
4
|
import * as globalStyles from './components/global-styles';
|
|
5
5
|
import { ExperimentalBlockEditorProvider } from './components/provider';
|
|
6
6
|
import { lock } from './lock-unlock';
|
|
7
|
-
import OffCanvasEditor from './components/off-canvas-editor';
|
|
8
|
-
import LeafMoreMenu from './components/off-canvas-editor/leaf-more-menu';
|
|
9
7
|
import ResizableBoxPopover from './components/resizable-box-popover';
|
|
10
8
|
import { ComposedPrivateInserter as PrivateInserter } from './components/inserter';
|
|
11
9
|
import { PrivateListView } from './components/list-view';
|
|
12
10
|
import BlockInfo from './components/block-info-slot-fill';
|
|
13
11
|
import { useShouldContextualToolbarShow } from './utils/use-should-contextual-toolbar-show';
|
|
14
12
|
import { cleanEmptyObject } from './hooks/utils';
|
|
13
|
+
import { useBlockEditingMode } from './components/block-editing-mode';
|
|
15
14
|
/**
|
|
16
15
|
* Private @wordpress/block-editor APIs.
|
|
17
16
|
*/
|
|
@@ -19,13 +18,12 @@ import { cleanEmptyObject } from './hooks/utils';
|
|
|
19
18
|
export const privateApis = {};
|
|
20
19
|
lock(privateApis, { ...globalStyles,
|
|
21
20
|
ExperimentalBlockEditorProvider,
|
|
22
|
-
LeafMoreMenu,
|
|
23
|
-
OffCanvasEditor,
|
|
24
21
|
PrivateInserter,
|
|
25
22
|
PrivateListView,
|
|
26
23
|
ResizableBoxPopover,
|
|
27
24
|
BlockInfo,
|
|
28
25
|
useShouldContextualToolbarShow,
|
|
29
|
-
cleanEmptyObject
|
|
26
|
+
cleanEmptyObject,
|
|
27
|
+
useBlockEditingMode
|
|
30
28
|
});
|
|
31
29
|
//# sourceMappingURL=private-apis.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/private-apis.js"],"names":["globalStyles","ExperimentalBlockEditorProvider","lock","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/private-apis.js"],"names":["globalStyles","ExperimentalBlockEditorProvider","lock","ResizableBoxPopover","ComposedPrivateInserter","PrivateInserter","PrivateListView","BlockInfo","useShouldContextualToolbarShow","cleanEmptyObject","useBlockEditingMode","privateApis"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,YAAZ,MAA8B,4BAA9B;AACA,SAASC,+BAAT,QAAgD,uBAAhD;AACA,SAASC,IAAT,QAAqB,eAArB;AACA,OAAOC,mBAAP,MAAgC,oCAAhC;AACA,SAASC,uBAAuB,IAAIC,eAApC,QAA2D,uBAA3D;AACA,SAASC,eAAT,QAAgC,wBAAhC;AACA,OAAOC,SAAP,MAAsB,mCAAtB;AACA,SAASC,8BAAT,QAA+C,4CAA/C;AACA,SAASC,gBAAT,QAAiC,eAAjC;AACA,SAASC,mBAAT,QAAoC,iCAApC;AAEA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAG,EAApB;AACPT,IAAI,CAAES,WAAF,EAAe,EAClB,GAAGX,YADe;AAElBC,EAAAA,+BAFkB;AAGlBI,EAAAA,eAHkB;AAIlBC,EAAAA,eAJkB;AAKlBH,EAAAA,mBALkB;AAMlBI,EAAAA,SANkB;AAOlBC,EAAAA,8BAPkB;AAQlBC,EAAAA,gBARkB;AASlBC,EAAAA;AATkB,CAAf,CAAJ","sourcesContent":["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport ResizableBoxPopover from './components/resizable-box-popover';\nimport { ComposedPrivateInserter as PrivateInserter } from './components/inserter';\nimport { PrivateListView } from './components/list-view';\nimport BlockInfo from './components/block-info-slot-fill';\nimport { useShouldContextualToolbarShow } from './utils/use-should-contextual-toolbar-show';\nimport { cleanEmptyObject } from './hooks/utils';\nimport { useBlockEditingMode } from './components/block-editing-mode';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockEditorProvider,\n\tPrivateInserter,\n\tPrivateListView,\n\tResizableBoxPopover,\n\tBlockInfo,\n\tuseShouldContextualToolbarShow,\n\tcleanEmptyObject,\n\tuseBlockEditingMode,\n} );\n"]}
|
|
@@ -63,4 +63,46 @@ export function showBlockInterface() {
|
|
|
63
63
|
type: 'SHOW_BLOCK_INTERFACE'
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* @typedef {import('../components/block-editing-mode').BlockEditingMode} BlockEditingMode
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Sets the block editing mode for a given block.
|
|
72
|
+
*
|
|
73
|
+
* @see useBlockEditingMode
|
|
74
|
+
*
|
|
75
|
+
* @param {string} clientId The block client ID, or `''` for the root container.
|
|
76
|
+
* @param {BlockEditingMode} mode The block editing mode. One of `'disabled'`,
|
|
77
|
+
* `'contentOnly'`, or `'default'`.
|
|
78
|
+
*
|
|
79
|
+
* @return {Object} Action object.
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
export function setBlockEditingMode() {
|
|
83
|
+
let clientId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
84
|
+
let mode = arguments.length > 1 ? arguments[1] : undefined;
|
|
85
|
+
return {
|
|
86
|
+
type: 'SET_BLOCK_EDITING_MODE',
|
|
87
|
+
clientId,
|
|
88
|
+
mode
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Clears the block editing mode for a given block.
|
|
93
|
+
*
|
|
94
|
+
* @see useBlockEditingMode
|
|
95
|
+
*
|
|
96
|
+
* @param {string} clientId The block client ID, or `''` for the root container.
|
|
97
|
+
*
|
|
98
|
+
* @return {Object} Action object.
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
export function unsetBlockEditingMode() {
|
|
102
|
+
let clientId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
103
|
+
return {
|
|
104
|
+
type: 'UNSET_BLOCK_EDITING_MODE',
|
|
105
|
+
clientId
|
|
106
|
+
};
|
|
107
|
+
}
|
|
66
108
|
//# sourceMappingURL=private-actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/store/private-actions.js"],"names":["Platform","privateSettings","__experimentalUpdateSettings","settings","stripExperimentalSettings","cleanSettings","OS","key","includes","type","hideBlockInterface","showBlockInterface"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,eAAe,GAAG,CACvB,yBADuB,EAEvB,yBAFuB,CAAxB;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,4BAAT,CACNC,QADM,EAGL;AAAA,MADDC,yBACC,uEAD2B,KAC3B;AACD,MAAIC,aAAa,GAAGF,QAApB,CADC,CAED;AACA;;AACA,MAAKC,yBAAyB,IAAIJ,QAAQ,CAACM,EAAT,KAAgB,KAAlD,EAA0D;AACzDD,IAAAA,aAAa,GAAG,EAAhB;;AACA,SAAM,MAAME,GAAZ,IAAmBJ,QAAnB,EAA8B;AAC7B,UAAK,CAAEF,eAAe,CAACO,QAAhB,CAA0BD,GAA1B,CAAP,EAAyC;AACxCF,QAAAA,aAAa,CAAEE,GAAF,CAAb,GAAuBJ,QAAQ,CAAEI,GAAF,CAA/B;AACA;AACD;AACD;;AACD,SAAO;AACNE,IAAAA,IAAI,EAAE,iBADA;AAENN,IAAAA,QAAQ,EAAEE;AAFJ,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASK,kBAAT,GAA8B;AACpC,SAAO;AACND,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,kBAAT,GAA8B;AACpC,SAAO;AACNF,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Platform } from '@wordpress/element';\n\n/**\n * A list of private/experimental block editor settings that\n * should not become a part of the WordPress public API.\n * BlockEditorProvider will remove these settings from the\n * settings object it receives.\n *\n * @see https://github.com/WordPress/gutenberg/pull/46131\n */\nconst privateSettings = [\n\t'inserterMediaCategories',\n\t'blockInspectorAnimation',\n];\n\n/**\n * Action that updates the block editor settings and\n * conditionally preserves the experimental ones.\n *\n * @param {Object} settings Updated settings\n * @param {boolean} stripExperimentalSettings Whether to strip experimental settings.\n * @return {Object} Action object\n */\nexport function __experimentalUpdateSettings(\n\tsettings,\n\tstripExperimentalSettings = false\n) {\n\tlet cleanSettings = settings;\n\t// There are no plugins in the mobile apps, so there is no\n\t// need to strip the experimental settings:\n\tif ( stripExperimentalSettings && Platform.OS === 'web' ) {\n\t\tcleanSettings = {};\n\t\tfor ( const key in settings ) {\n\t\t\tif ( ! privateSettings.includes( key ) ) {\n\t\t\t\tcleanSettings[ key ] = settings[ key ];\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings: cleanSettings,\n\t};\n}\n\n/**\n * Hides the block interface (eg. toolbar, outline, etc.)\n *\n * @return {Object} Action object.\n */\nexport function hideBlockInterface() {\n\treturn {\n\t\ttype: 'HIDE_BLOCK_INTERFACE',\n\t};\n}\n\n/**\n * Shows the block interface (eg. toolbar, outline, etc.)\n *\n * @return {Object} Action object.\n */\nexport function showBlockInterface() {\n\treturn {\n\t\ttype: 'SHOW_BLOCK_INTERFACE',\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/store/private-actions.js"],"names":["Platform","privateSettings","__experimentalUpdateSettings","settings","stripExperimentalSettings","cleanSettings","OS","key","includes","type","hideBlockInterface","showBlockInterface","setBlockEditingMode","clientId","mode","unsetBlockEditingMode"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,eAAe,GAAG,CACvB,yBADuB,EAEvB,yBAFuB,CAAxB;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,4BAAT,CACNC,QADM,EAGL;AAAA,MADDC,yBACC,uEAD2B,KAC3B;AACD,MAAIC,aAAa,GAAGF,QAApB,CADC,CAED;AACA;;AACA,MAAKC,yBAAyB,IAAIJ,QAAQ,CAACM,EAAT,KAAgB,KAAlD,EAA0D;AACzDD,IAAAA,aAAa,GAAG,EAAhB;;AACA,SAAM,MAAME,GAAZ,IAAmBJ,QAAnB,EAA8B;AAC7B,UAAK,CAAEF,eAAe,CAACO,QAAhB,CAA0BD,GAA1B,CAAP,EAAyC;AACxCF,QAAAA,aAAa,CAAEE,GAAF,CAAb,GAAuBJ,QAAQ,CAAEI,GAAF,CAA/B;AACA;AACD;AACD;;AACD,SAAO;AACNE,IAAAA,IAAI,EAAE,iBADA;AAENN,IAAAA,QAAQ,EAAEE;AAFJ,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASK,kBAAT,GAA8B;AACpC,SAAO;AACND,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,kBAAT,GAA8B;AACpC,SAAO;AACNF,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA;AAED;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,mBAAT,GAAoD;AAAA,MAAtBC,QAAsB,uEAAX,EAAW;AAAA,MAAPC,IAAO;AAC1D,SAAO;AACNL,IAAAA,IAAI,EAAE,wBADA;AAENI,IAAAA,QAFM;AAGNC,IAAAA;AAHM,GAAP;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,qBAAT,GAAgD;AAAA,MAAhBF,QAAgB,uEAAL,EAAK;AACtD,SAAO;AACNJ,IAAAA,IAAI,EAAE,0BADA;AAENI,IAAAA;AAFM,GAAP;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Platform } from '@wordpress/element';\n\n/**\n * A list of private/experimental block editor settings that\n * should not become a part of the WordPress public API.\n * BlockEditorProvider will remove these settings from the\n * settings object it receives.\n *\n * @see https://github.com/WordPress/gutenberg/pull/46131\n */\nconst privateSettings = [\n\t'inserterMediaCategories',\n\t'blockInspectorAnimation',\n];\n\n/**\n * Action that updates the block editor settings and\n * conditionally preserves the experimental ones.\n *\n * @param {Object} settings Updated settings\n * @param {boolean} stripExperimentalSettings Whether to strip experimental settings.\n * @return {Object} Action object\n */\nexport function __experimentalUpdateSettings(\n\tsettings,\n\tstripExperimentalSettings = false\n) {\n\tlet cleanSettings = settings;\n\t// There are no plugins in the mobile apps, so there is no\n\t// need to strip the experimental settings:\n\tif ( stripExperimentalSettings && Platform.OS === 'web' ) {\n\t\tcleanSettings = {};\n\t\tfor ( const key in settings ) {\n\t\t\tif ( ! privateSettings.includes( key ) ) {\n\t\t\t\tcleanSettings[ key ] = settings[ key ];\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings: cleanSettings,\n\t};\n}\n\n/**\n * Hides the block interface (eg. toolbar, outline, etc.)\n *\n * @return {Object} Action object.\n */\nexport function hideBlockInterface() {\n\treturn {\n\t\ttype: 'HIDE_BLOCK_INTERFACE',\n\t};\n}\n\n/**\n * Shows the block interface (eg. toolbar, outline, etc.)\n *\n * @return {Object} Action object.\n */\nexport function showBlockInterface() {\n\treturn {\n\t\ttype: 'SHOW_BLOCK_INTERFACE',\n\t};\n}\n\n/**\n * @typedef {import('../components/block-editing-mode').BlockEditingMode} BlockEditingMode\n */\n\n/**\n * Sets the block editing mode for a given block.\n *\n * @see useBlockEditingMode\n *\n * @param {string} clientId The block client ID, or `''` for the root container.\n * @param {BlockEditingMode} mode The block editing mode. One of `'disabled'`,\n * `'contentOnly'`, or `'default'`.\n *\n * @return {Object} Action object.\n */\nexport function setBlockEditingMode( clientId = '', mode ) {\n\treturn {\n\t\ttype: 'SET_BLOCK_EDITING_MODE',\n\t\tclientId,\n\t\tmode,\n\t};\n}\n\n/**\n * Clears the block editing mode for a given block.\n *\n * @see useBlockEditingMode\n *\n * @param {string} clientId The block client ID, or `''` for the root container.\n *\n * @return {Object} Action object.\n */\nexport function unsetBlockEditingMode( clientId = '' ) {\n\treturn {\n\t\ttype: 'UNSET_BLOCK_EDITING_MODE',\n\t\tclientId,\n\t};\n}\n"]}
|