@wordpress/block-editor 11.7.0 → 12.0.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 +8 -0
- package/README.md +56 -57
- package/build/components/block-info-slot-fill/index.js +47 -0
- package/build/components/block-info-slot-fill/index.js.map +1 -0
- package/build/components/block-inspector/index.js +4 -2
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/index.native.js +11 -21
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +3 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-popover/inbetween.js +2 -9
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +1 -10
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-toolbar/index.js +2 -1
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +83 -9
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +11 -28
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/caption/index.native.js +0 -1
- package/build/components/caption/index.native.js.map +1 -1
- package/build/components/date-format-picker/index.js +1 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/editor-styles/index.js +4 -3
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +21 -14
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/global-styles/border-panel.js +15 -59
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +12 -12
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.native.js +174 -0
- package/build/components/global-styles/color-panel.native.js.map +1 -0
- package/build/components/global-styles/dimensions-panel.js +21 -20
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/effects-panel.js +244 -0
- package/build/components/global-styles/effects-panel.js.map +1 -0
- package/build/components/global-styles/filters-panel.js +215 -0
- package/build/components/global-styles/filters-panel.js.map +1 -0
- package/build/components/global-styles/get-block-css-selector.js +1 -12
- package/build/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build/components/global-styles/hooks.js +7 -0
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +28 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +9 -9
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +100 -82
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/iframe/index.js +1 -1
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-size-control/use-dimension-handler.js +5 -3
- package/build/components/image-size-control/use-dimension-handler.js.map +1 -1
- package/build/components/index.js +23 -0
- package/build/components/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +4 -2
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.js +12 -7
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/index.js +2 -1
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inspector-controls/groups.js +2 -0
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +2 -0
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/inspector-controls-tabs/utils.js +5 -3
- package/build/components/inspector-controls-tabs/utils.js.map +1 -1
- package/build/components/list-view/block-select-button.js +7 -2
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +13 -21
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/drop-indicator.js +37 -10
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js +31 -7
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/leaf.js +2 -1
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +1 -1
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +7 -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 +8 -2
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/media-replace-flow/index.js +5 -5
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +12 -4
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +2 -7
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/components/off-canvas-editor/block-contents.js +6 -1
- package/build/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +17 -14
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/resizable-box-popover/index.js +38 -0
- package/build/components/resizable-box-popover/index.js.map +1 -0
- package/build/components/rich-text/index.js +0 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +7 -11
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +8 -0
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build/hooks/anchor.js +1 -1
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border.js +1 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/duotone.js +121 -70
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/margin.js +27 -17
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +19 -9
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/utils.js +22 -7
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/utils.js +3 -2
- package/build/layouts/utils.js.map +1 -1
- package/build/private-apis.js +13 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +8 -1
- package/build/store/actions.js.map +1 -1
- package/build/utils/object.js +6 -6
- package/build/utils/object.js.map +1 -1
- package/build/utils/transform-styles/index.js +2 -2
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build/utils/use-should-contextual-toolbar-show.js +68 -0
- package/build/utils/use-should-contextual-toolbar-show.js.map +1 -0
- package/build-module/components/block-info-slot-fill/index.js +34 -0
- package/build-module/components/block-info-slot-fill/index.js.map +1 -0
- package/build-module/components/block-inspector/index.js +3 -2
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/index.native.js +11 -19
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +2 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +2 -9
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +1 -9
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +2 -1
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +79 -9
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +10 -27
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/caption/index.native.js +0 -1
- package/build-module/components/caption/index.native.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +1 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/editor-styles/index.js +4 -3
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +21 -14
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +15 -59
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +13 -13
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.native.js +150 -0
- package/build-module/components/global-styles/color-panel.native.js.map +1 -0
- package/build-module/components/global-styles/dimensions-panel.js +22 -21
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/effects-panel.js +228 -0
- package/build-module/components/global-styles/effects-panel.js.map +1 -0
- package/build-module/components/global-styles/filters-panel.js +201 -0
- package/build-module/components/global-styles/filters-panel.js.map +1 -0
- package/build-module/components/global-styles/get-block-css-selector.js +1 -12
- package/build-module/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +7 -0
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +2 -0
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +10 -10
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +101 -83
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/iframe/index.js +1 -1
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-size-control/use-dimension-handler.js +5 -3
- package/build-module/components/image-size-control/use-dimension-handler.js.map +1 -1
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +5 -2
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +12 -6
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/index.js +2 -1
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +2 -0
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +2 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/utils.js +4 -3
- package/build-module/components/inspector-controls-tabs/utils.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +7 -2
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +15 -22
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +36 -10
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js +31 -8
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/leaf.js +2 -1
- package/build-module/components/list-view/leaf.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +1 -1
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +7 -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 +8 -4
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +5 -5
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +12 -4
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +1 -5
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/components/off-canvas-editor/block-contents.js +5 -1
- package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +17 -14
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/resizable-box-popover/index.js +26 -0
- package/build-module/components/resizable-box-popover/index.js.map +1 -0
- package/build-module/components/rich-text/index.js +0 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +7 -10
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +7 -0
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build-module/hooks/anchor.js +1 -1
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border.js +1 -1
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/duotone.js +118 -71
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/margin.js +29 -18
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +21 -10
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/utils.js +24 -9
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/utils.js +3 -2
- package/build-module/layouts/utils.js.map +1 -1
- package/build-module/private-apis.js +9 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +8 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/utils/object.js +5 -5
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +2 -2
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-module/utils/use-should-contextual-toolbar-show.js +56 -0
- package/build-module/utils/use-should-contextual-toolbar-show.js.map +1 -0
- package/build-style/content-rtl.css +9 -6
- package/build-style/content.css +9 -6
- package/build-style/style-rtl.css +272 -54
- package/build-style/style.css +272 -54
- package/package.json +32 -32
- package/src/components/block-info-slot-fill/index.js +24 -0
- package/src/components/block-inspector/index.js +3 -0
- package/src/components/block-inspector/style.scss +6 -4
- package/src/components/block-list/content.scss +16 -15
- package/src/components/block-list/index.native.js +19 -38
- package/src/components/block-list/use-in-between-inserter.js +4 -1
- package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +9 -9
- package/src/components/block-mover/style.scss +10 -4
- package/src/components/block-mover/test/index.native.js +4 -4
- package/src/components/block-popover/inbetween.js +2 -13
- package/src/components/block-settings-menu/block-settings-dropdown.js +2 -12
- package/src/components/block-toolbar/index.js +4 -3
- package/src/components/block-toolbar/style.scss +56 -33
- package/src/components/block-tools/block-contextual-toolbar.js +94 -11
- package/src/components/block-tools/selected-block-popover.js +11 -44
- package/src/components/block-tools/style.scss +157 -3
- package/src/components/caption/index.native.js +0 -1
- package/src/components/date-format-picker/index.js +1 -1
- package/src/components/editor-styles/index.js +9 -5
- package/src/components/font-sizes/fluid-utils.js +31 -14
- package/src/components/font-sizes/test/fluid-utils.js +5 -16
- package/src/components/global-styles/README.md +129 -16
- package/src/components/global-styles/border-panel.js +13 -61
- package/src/components/global-styles/color-panel.js +13 -13
- package/src/components/global-styles/color-panel.native.js +207 -0
- package/src/components/global-styles/dimensions-panel.js +47 -20
- package/src/components/global-styles/effects-panel.js +228 -0
- package/src/components/global-styles/filters-panel.js +230 -0
- package/src/components/global-styles/get-block-css-selector.js +0 -11
- package/src/components/global-styles/hooks.js +10 -0
- package/src/components/global-styles/index.js +2 -0
- package/src/components/global-styles/style.scss +43 -0
- package/src/components/global-styles/test/typography-utils.js +63 -22
- package/src/components/global-styles/test/use-global-styles-output.js +130 -8
- package/src/components/global-styles/typography-panel.js +37 -11
- package/src/components/global-styles/use-global-styles-output.js +88 -72
- package/src/components/iframe/index.js +1 -1
- package/src/components/image-size-control/use-dimension-handler.js +4 -3
- package/src/components/index.js +5 -1
- package/src/components/inserter/block-patterns-tab.js +3 -1
- package/src/components/inserter/block-types-tab.js +9 -6
- package/src/components/inserter/index.js +1 -1
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/styles-tab.js +1 -0
- package/src/components/inspector-controls-tabs/utils.js +4 -3
- package/src/components/list-view/README.md +2 -0
- package/src/components/list-view/block-select-button.js +6 -1
- package/src/components/list-view/block.js +24 -31
- package/src/components/list-view/drop-indicator.js +67 -22
- package/src/components/list-view/index.js +26 -3
- package/src/components/list-view/leaf.js +1 -0
- package/src/components/list-view/style.scss +18 -4
- package/src/components/list-view/test/use-list-view-drop-zone.js +188 -0
- package/src/components/list-view/use-block-selection.js +1 -1
- package/src/components/list-view/use-list-view-client-ids.js +5 -3
- package/src/components/list-view/use-list-view-drop-zone.js +9 -3
- package/src/components/media-replace-flow/README.md +3 -2
- package/src/components/media-replace-flow/index.js +4 -5
- package/src/components/navigable-toolbar/index.js +12 -3
- package/src/components/off-canvas-editor/appender.js +1 -4
- package/src/components/off-canvas-editor/block-contents.js +4 -0
- package/src/components/off-canvas-editor/index.js +15 -11
- package/src/components/resizable-box-popover/index.js +27 -0
- package/src/components/rich-text/index.js +0 -1
- package/src/components/rich-text/index.native.js +2 -5
- package/src/components/spacing-sizes-control/spacing-input-control.js +10 -0
- package/src/components/spacing-sizes-control/style.scss +7 -7
- package/src/components/url-popover/test/__snapshots__/index.js.snap +3 -3
- package/src/hooks/anchor.js +1 -1
- package/src/hooks/border.js +1 -1
- package/src/hooks/duotone.js +162 -99
- package/src/hooks/margin.js +31 -26
- package/src/hooks/padding.js +24 -18
- package/src/hooks/test/anchor.js +113 -0
- package/src/hooks/test/color.js +0 -9
- package/src/hooks/test/use-typography-props.js +2 -2
- package/src/hooks/test/utils.js +20 -101
- package/src/hooks/utils.js +23 -6
- package/src/layouts/utils.js +2 -2
- package/src/private-apis.js +8 -0
- package/src/store/actions.js +8 -1
- package/src/style.scss +1 -0
- package/src/utils/object.js +5 -5
- package/src/utils/test/object.js +53 -15
- package/src/utils/transform-styles/index.js +2 -2
- package/src/utils/use-should-contextual-toolbar-show.js +75 -0
- package/tsconfig.json +1 -0
- package/build/components/rich-text/use-native-props.js +0 -11
- package/build/components/rich-text/use-native-props.js.map +0 -1
- package/build/components/rich-text/use-native-props.native.js +0 -24
- package/build/components/rich-text/use-native-props.native.js.map +0 -1
- package/build/hooks/color-panel.native.js +0 -77
- package/build/hooks/color-panel.native.js.map +0 -1
- package/build-module/components/rich-text/use-native-props.js +0 -4
- package/build-module/components/rich-text/use-native-props.js.map +0 -1
- package/build-module/components/rich-text/use-native-props.native.js +0 -15
- package/build-module/components/rich-text/use-native-props.native.js.map +0 -1
- package/build-module/hooks/color-panel.native.js +0 -62
- package/build-module/hooks/color-panel.native.js.map +0 -1
- package/src/components/rich-text/use-native-props.js +0 -3
- package/src/components/rich-text/use-native-props.native.js +0 -17
- package/src/hooks/color-panel.native.js +0 -63
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"names":["classnames","extend","namesPlugin","getBlockSupport","getBlockType","hasBlockSupport","createHigherOrderComponent","useInstanceId","addFilter","useMemo","useContext","createPortal","useSelect","BlockControls","__experimentalDuotoneControl","DuotoneControl","useSetting","BlockList","__unstableDuotoneFilter","DuotoneFilter","__unstableDuotoneStylesheet","DuotoneStylesheet","__unstableDuotoneUnsetStylesheet","DuotoneUnsetStylesheet","store","blockEditorStore","EMPTY_ARRAY","InlineDuotone","selector","id","colors","useMultiOriginPresets","presetSetting","defaultSetting","disableDefault","userPresets","themePresets","defaultPresets","getColorsFromDuotonePreset","duotone","duotonePalette","preset","find","slug","undefined","getDuotonePresetFromColors","Array","isArray","duotonePreset","every","val","index","DuotonePanel","attributes","setAttributes","style","duotoneStyle","color","colorPalette","disableCustomColors","disableCustomDuotone","length","duotonePresetOrColors","newDuotone","maybePreset","newStyle","addDuotoneAttributes","settings","Object","assign","type","withDuotoneControls","BlockEdit","props","hasDuotoneSupport","name","isContentLocked","select","__unstableGetContentLockingParent","clientId","scopeSelector","scope","scopes","split","selectors","selectorsScoped","forEach","outer","inner","push","trim","join","BlockDuotoneStyles","element","__unstableElementContext","duotoneSupportSelectors","filter","selectorsGroup","withDuotoneStyles","BlockListBlock","duotoneSupport","className"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,MAAT,QAAuB,QAAvB;AACA,OAAOC,WAAP,MAAwB,sBAAxB;AAEA;AACA;AACA;;AACA,SACCC,eADD,EAECC,YAFD,EAGCC,eAHD,QAIO,mBAJP;AAKA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,OAAT,EAAkBC,UAAlB,EAA8BC,YAA9B,QAAkD,oBAAlD;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SACCC,aADD,EAECC,4BAA4B,IAAIC,cAFjC,EAGCC,UAHD,QAIO,eAJP;AAKA,OAAOC,SAAP,MAAsB,0BAAtB;AAC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AK,CAAEE,IADf;AAEC,IAAA,YAAY,EAAGnB,YAFhB;AAGC,IAAA,EAAE,EAAG3B;AAHN,IAFF,EAQC,cAAC,cAAD,eAAqB4C,KAArB;AAA6B,IAAA,SAAS,EAAG4B;AAAzC,KARD,CADD;AAYA,CA7BkD,EA8BnD,mBA9BmD,CAApD;AAiCA7F,SAAS,CACR,0BADQ,EAER,oCAFQ,EAGR0D,oBAHQ,CAAT;AAKA1D,SAAS,CACR,kBADQ,EAER,0CAFQ,EAGR+D,mBAHQ,CAAT;AAKA/D,SAAS,CACR,uBADQ,EAER,iCAFQ,EAGR0F,iBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useContext, createPortal } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSetting,\n} from '../components';\nimport BlockList from '../components/block-list';\nimport {\n\t__unstableDuotoneFilter as DuotoneFilter,\n\t__unstableDuotoneStylesheet as DuotoneStylesheet,\n\t__unstableDuotoneUnsetStylesheet as DuotoneUnsetStylesheet,\n} from '../components/duotone';\nimport { store as blockEditorStore } from '../store';\n\nconst EMPTY_ARRAY = [];\n\nextend( [ namesPlugin ] );\n\n/**\n * SVG and stylesheet needed for rendering the duotone filter.\n *\n * @param {Object} props Duotone props.\n * @param {string} props.selector Selector to apply the filter to.\n * @param {string} props.id Unique id for this duotone filter.\n * @param {string[]|\"unset\"} props.colors Array of RGB color strings ordered from dark to light.\n *\n * @return {WPElement} Duotone element.\n */\nfunction InlineDuotone( { selector, id, colors } ) {\n\tif ( colors === 'unset' ) {\n\t\treturn <DuotoneUnsetStylesheet selector={ selector } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DuotoneFilter id={ id } colors={ colors } />\n\t\t\t<DuotoneStylesheet id={ id } selector={ selector } />\n\t\t</>\n\t);\n}\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst disableDefault = ! useSetting( defaultSetting );\n\tconst userPresets =\n\t\tuseSetting( `${ presetSetting }.custom` ) || EMPTY_ARRAY;\n\tconst themePresets =\n\t\tuseSetting( `${ presetSetting }.theme` ) || EMPTY_ARRAY;\n\tconst defaultPresets =\n\t\tuseSetting( `${ presetSetting }.default` ) || EMPTY_ARRAY;\n\treturn useMemo(\n\t\t() => [\n\t\t\t...userPresets,\n\t\t\t...themePresets,\n\t\t\t...( disableDefault ? EMPTY_ARRAY : defaultPresets ),\n\t\t],\n\t\t[ disableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nexport function getColorsFromDuotonePreset( duotone, duotonePalette ) {\n\tif ( ! duotone ) {\n\t\treturn;\n\t}\n\tconst preset = duotonePalette?.find( ( { slug } ) => {\n\t\treturn duotone === `var:preset|duotone|${ slug }`;\n\t} );\n\n\treturn preset ? preset.colors : undefined;\n}\n\nexport function getDuotonePresetFromColors( colors, duotonePalette ) {\n\tif ( ! colors || ! Array.isArray( colors ) ) {\n\t\treturn;\n\t}\n\n\tconst preset = duotonePalette?.find( ( duotonePreset ) => {\n\t\treturn duotonePreset?.colors?.every(\n\t\t\t( val, index ) => val === colors[ index ]\n\t\t);\n\t} );\n\n\treturn preset ? `var:preset|duotone|${ preset.slug }` : undefined;\n}\n\nfunction DuotonePanel( { attributes, setAttributes } ) {\n\tconst style = attributes?.style;\n\tconst duotoneStyle = style?.color?.duotone;\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst disableCustomColors = ! useSetting( 'color.custom' );\n\tconst disableCustomDuotone =\n\t\t! useSetting( 'color.customDuotone' ) ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\tconst duotonePresetOrColors = ! Array.isArray( duotoneStyle )\n\t\t? getColorsFromDuotonePreset( duotoneStyle, duotonePalette )\n\t\t: duotoneStyle;\n\n\treturn (\n\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t<DuotoneControl\n\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\tvalue={ duotonePresetOrColors }\n\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\tconst maybePreset = getDuotonePresetFromColors(\n\t\t\t\t\t\tnewDuotone,\n\t\t\t\t\t\tduotonePalette\n\t\t\t\t\t);\n\n\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t...style,\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\tduotone: maybePreset ?? newDuotone, // use preset or fallback to custom colors.\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, 'color.__experimentalDuotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// 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 * Override the default edit UI to include toolbar controls for duotone if the\n * block supports duotone.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst hasDuotoneSupport = hasBlockSupport(\n\t\t\tprops.name,\n\t\t\t'color.__experimentalDuotone'\n\t\t);\n\t\tconst isContentLocked = useSelect(\n\t\t\t( select ) => {\n\t\t\t\treturn select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).__unstableGetContentLockingParent( props.clientId );\n\t\t\t},\n\t\t\t[ props.clientId ]\n\t\t);\n\n\t\t// CAUTION: code added before this line will be executed\n\t\t// for all blocks, not just those that support duotone. Code added\n\t\t// above this line should be carefully evaluated for its impact on\n\t\t// performance.\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ hasDuotoneSupport && ! isContentLocked && (\n\t\t\t\t\t<DuotonePanel { ...props } />\n\t\t\t\t) }\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneControls'\n);\n\n/**\n * Function that scopes a selector with another one. This works a bit like\n * SCSS nesting except the `&` operator isn't supported.\n *\n * @example\n * ```js\n * const scope = '.a, .b .c';\n * const selector = '> .x, .y';\n * const merged = scopeSelector( scope, selector );\n * // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y'\n * ```\n *\n * @param {string} scope Selector to scope to.\n * @param {string} selector Original selector.\n *\n * @return {string} Scoped selector.\n */\nfunction scopeSelector( scope, selector ) {\n\tconst scopes = scope.split( ',' );\n\tconst selectors = selector.split( ',' );\n\n\tconst selectorsScoped = [];\n\tscopes.forEach( ( outer ) => {\n\t\tselectors.forEach( ( inner ) => {\n\t\t\tselectorsScoped.push( `${ outer.trim() } ${ inner.trim() }` );\n\t\t} );\n\t} );\n\n\treturn selectorsScoped.join( ', ' );\n}\n\nfunction BlockDuotoneStyles( { name, duotoneStyle, id } ) {\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\n\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t// Portals cannot exist without a container.\n\t// Guard against empty Duotone styles.\n\tif ( ! element || ! duotoneStyle ) {\n\t\treturn null;\n\t}\n\n\tlet colors = duotoneStyle;\n\n\tif ( ! Array.isArray( colors ) && colors !== 'unset' ) {\n\t\tcolors = getColorsFromDuotonePreset( colors, duotonePalette );\n\t}\n\n\tconst duotoneSupportSelectors =\n\t\tgetBlockType( name ).selectors?.filter?.duotone ||\n\t\tgetBlockSupport( name, 'color.__experimentalDuotone' );\n\n\t// Extra .editor-styles-wrapper specificity is needed in the editor\n\t// since we're not using inline styles to apply the filter. We need to\n\t// override duotone applied by global styles and theme.json.\n\tconst selectorsGroup = scopeSelector(\n\t\t`.editor-styles-wrapper .${ id }`,\n\t\tduotoneSupportSelectors\n\t);\n\n\treturn createPortal(\n\t\t<InlineDuotone\n\t\t\tselector={ selectorsGroup }\n\t\t\tid={ id }\n\t\t\tcolors={ colors }\n\t\t/>,\n\t\telement\n\t);\n}\n\n/**\n * Override the default block element to include duotone styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst duotoneSupport = getBlockSupport(\n\t\t\tprops.name,\n\t\t\t'color.__experimentalDuotone'\n\t\t);\n\n\t\tconst id = `wp-duotone-${ useInstanceId( BlockListBlock ) }`;\n\t\tconst className = duotoneSupport\n\t\t\t? classnames( props?.className, id )\n\t\t\t: props?.className;\n\t\tconst duotoneStyle = props?.attributes?.style?.color?.duotone;\n\n\t\t// CAUTION: code added before this line will be executed\n\t\t// for all blocks, not just those that support duotone. Code added\n\t\t// above this line should be carefully evaluated for its impact on\n\t\t// performance.\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ duotoneSupport && duotoneStyle && (\n\t\t\t\t\t<BlockDuotoneStyles\n\t\t\t\t\t\tname={ props?.name }\n\t\t\t\t\t\tduotoneStyle={ duotoneStyle }\n\t\t\t\t\t\tid={ id }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/duotone/with-editor-controls',\n\twithDuotoneControls\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/duotone/with-styles',\n\twithDuotoneStyles\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"names":["classnames","extend","namesPlugin","getBlockSupport","getBlockType","hasBlockSupport","createHigherOrderComponent","useInstanceId","addFilter","useMemo","useContext","createPortal","useSelect","BlockControls","InspectorControls","__experimentalDuotoneControl","DuotoneControl","useSetting","BlockList","__unstableDuotoneFilter","DuotoneFilter","__unstableDuotoneStylesheet","DuotoneStylesheet","__unstableDuotoneUnsetStylesheet","DuotoneUnsetStylesheet","getBlockCSSSelector","scopeSelector","useBlockSettings","store","blockEditorStore","default","StylesFiltersPanel","EMPTY_ARRAY","InlineDuotone","selector","id","colors","useMultiOriginPresets","presetSetting","defaultSetting","disableDefault","userPresets","themePresets","defaultPresets","getColorsFromDuotonePreset","duotone","duotonePalette","preset","find","slug","undefined","getDuotonePresetFromColors","Array","isArray","duotonePreset","every","val","index","DuotonePanel","attributes","setAttributes","name","style","duotoneStyle","color","settings","colorPalette","disableCustomColors","disableCustomDuotone","length","duotonePresetOrColors","filter","newDuotone","newStyle","maybePreset","addDuotoneAttributes","Object","assign","type","withDuotoneControls","BlockEdit","props","hasDuotoneSupport","isContentLocked","select","__unstableGetContentLockingParent","clientId","DuotoneStyles","filterId","duotoneSelector","attribute","duotoneAttr","element","__unstableElementContext","isCustom","isPreset","isCSS","selectors","split","selectorsScoped","map","selectorPart","trim","join","isValidFilter","withDuotoneStyles","BlockListBlock","blockType","duotoneSupport","experimentalDuotone","rootSelector","fallback","filterClass","shouldRender","className"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,MAAT,QAAuB,QAAvB;AACA,OAAOC,WAAP,MAAwB,sBAAxB;AAEA;AACA;AACA;;AACA,SACCC,eADD,EAECC,YAFD,EAGCC,eAHD,QAIO,mBAJP;AAKA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,OAAT,EAAkBC,UAAlB,EAA8BC,YAA9B,QAAkD,oBAAlD;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SACCC,aADD,EAECC,iBAFD,EAGCC,4BAA4B,IAAIC,cAHjC,EAICC,UAJD,QAKO,eALP;AAMA,OAAOC,SAAP,MAAsB,0BAAtB;AACA,SACCC,uBAAuB,IAAIC,aAD5B,EAECC,2BAA2B,IAAIC,iBAFhC,EAGCC,gCAAgC,IAAIC,sBAHrC,QAIO,uBAJP;AAKA,SAASC,mBAAT,QAAoC,oDAApC;AACA,SAASC,aAAT,QAA8B,mCAA9B;AACA,SAASC,gBAAT,QAAiC,SAAjC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AACA,SAASC,OAAO,IAAIC,kBAApB,QAA8C,2CAA9C;AAEA,MAAMC,WAAW,GAAG,EAApB;AAEA/B,MAAM,CAAE,CAAEC,WAAF,CAAF,CAAN;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAAS+B,aAAT,OAAmD;AAAA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FQ,EAGRmE,oBAHQ,CAAT;AAKAnE,SAAS,CACR,kBADQ,EAER,0CAFQ,EAGRuE,mBAHQ,CAAT;AAKAvE,SAAS,CACR,uBADQ,EAER,iCAFQ,EAGRiG,iBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useContext, createPortal } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSetting,\n} from '../components';\nimport BlockList from '../components/block-list';\nimport {\n\t__unstableDuotoneFilter as DuotoneFilter,\n\t__unstableDuotoneStylesheet as DuotoneStylesheet,\n\t__unstableDuotoneUnsetStylesheet as DuotoneUnsetStylesheet,\n} from '../components/duotone';\nimport { getBlockCSSSelector } from '../components/global-styles/get-block-css-selector';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport { useBlockSettings } from './utils';\nimport { store as blockEditorStore } from '../store';\nimport { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';\n\nconst EMPTY_ARRAY = [];\n\nextend( [ namesPlugin ] );\n\n/**\n * SVG and stylesheet needed for rendering the duotone filter.\n *\n * @param {Object} props Duotone props.\n * @param {string} props.selector Selector to apply the filter to.\n * @param {string} props.id Unique id for this duotone filter.\n * @param {string[]|\"unset\"} props.colors Array of RGB color strings ordered from dark to light.\n *\n * @return {WPElement} Duotone element.\n */\nfunction InlineDuotone( { selector, id, colors } ) {\n\tif ( colors === 'unset' ) {\n\t\treturn <DuotoneUnsetStylesheet selector={ selector } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DuotoneFilter id={ id } colors={ colors } />\n\t\t\t<DuotoneStylesheet id={ id } selector={ selector } />\n\t\t</>\n\t);\n}\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst disableDefault = ! useSetting( defaultSetting );\n\tconst userPresets =\n\t\tuseSetting( `${ presetSetting }.custom` ) || EMPTY_ARRAY;\n\tconst themePresets =\n\t\tuseSetting( `${ presetSetting }.theme` ) || EMPTY_ARRAY;\n\tconst defaultPresets =\n\t\tuseSetting( `${ presetSetting }.default` ) || EMPTY_ARRAY;\n\treturn useMemo(\n\t\t() => [\n\t\t\t...userPresets,\n\t\t\t...themePresets,\n\t\t\t...( disableDefault ? EMPTY_ARRAY : defaultPresets ),\n\t\t],\n\t\t[ disableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nexport function getColorsFromDuotonePreset( duotone, duotonePalette ) {\n\tif ( ! duotone ) {\n\t\treturn;\n\t}\n\tconst preset = duotonePalette?.find( ( { slug } ) => {\n\t\treturn duotone === `var:preset|duotone|${ slug }`;\n\t} );\n\n\treturn preset ? preset.colors : undefined;\n}\n\nexport function getDuotonePresetFromColors( colors, duotonePalette ) {\n\tif ( ! colors || ! Array.isArray( colors ) ) {\n\t\treturn;\n\t}\n\n\tconst preset = duotonePalette?.find( ( duotonePreset ) => {\n\t\treturn duotonePreset?.colors?.every(\n\t\t\t( val, index ) => val === colors[ index ]\n\t\t);\n\t} );\n\n\treturn preset ? `var:preset|duotone|${ preset.slug }` : undefined;\n}\n\nfunction DuotonePanel( { attributes, setAttributes, name } ) {\n\tconst style = attributes?.style;\n\tconst duotoneStyle = style?.color?.duotone;\n\tconst settings = useBlockSettings( name );\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst disableCustomColors = ! useSetting( 'color.custom' );\n\tconst disableCustomDuotone =\n\t\t! useSetting( 'color.customDuotone' ) ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\tconst duotonePresetOrColors = ! Array.isArray( duotoneStyle )\n\t\t? getColorsFromDuotonePreset( duotoneStyle, duotonePalette )\n\t\t: duotoneStyle;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"filter\">\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tvalue={ { filter: { duotone: duotonePresetOrColors } } }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...newDuotone?.filter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t<DuotoneControl\n\t\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tvalue={ duotonePresetOrColors }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst maybePreset = getDuotonePresetFromColors(\n\t\t\t\t\t\t\tnewDuotone,\n\t\t\t\t\t\t\tduotonePalette\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\t\tduotone: maybePreset ?? newDuotone, // use preset or fallback to custom colors.\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\t// Previous `color.__experimentalDuotone` support flag is migrated via\n\t// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.\n\tif ( ! hasBlockSupport( settings, 'filter.duotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// 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 * Override the default edit UI to include toolbar controls for duotone if the\n * block supports duotone.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\t// Previous `color.__experimentalDuotone` support flag is migrated via\n\t\t// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.\n\t\tconst hasDuotoneSupport = hasBlockSupport(\n\t\t\tprops.name,\n\t\t\t'filter.duotone'\n\t\t);\n\n\t\tconst isContentLocked = useSelect(\n\t\t\t( select ) => {\n\t\t\t\treturn select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).__unstableGetContentLockingParent( props.clientId );\n\t\t\t},\n\t\t\t[ props.clientId ]\n\t\t);\n\n\t\t// CAUTION: code added before this line will be executed\n\t\t// for all blocks, not just those that support duotone. Code added\n\t\t// above this line should be carefully evaluated for its impact on\n\t\t// performance.\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ hasDuotoneSupport && ! isContentLocked && (\n\t\t\t\t\t<DuotonePanel { ...props } />\n\t\t\t\t) }\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneControls'\n);\n\nfunction DuotoneStyles( {\n\tid: filterId,\n\tselector: duotoneSelector,\n\tattribute: duotoneAttr,\n} ) {\n\tconst element = useContext( BlockList.__unstableElementContext );\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\n\t// Possible values for duotone attribute:\n\t// 1. Array of colors - e.g. ['#000000', '#ffffff'].\n\t// 2. Variable for an existing Duotone preset - e.g. 'var:preset|duotone|green-blue' or 'var(--wp--preset--duotone--green-blue)''\n\t// 3. A CSS string - e.g. 'unset' to remove globally applied duotone.\n\tconst isCustom = Array.isArray( duotoneAttr );\n\tconst duotonePreset = isCustom\n\t\t? undefined\n\t\t: getColorsFromDuotonePreset( duotoneAttr, duotonePalette );\n\tconst isPreset = typeof duotoneAttr === 'string' && duotonePreset;\n\tconst isCSS = typeof duotoneAttr === 'string' && ! isPreset;\n\n\t// Match the structure of WP_Duotone_Gutenberg::render_duotone_support() in PHP.\n\tlet colors = null;\n\tif ( isPreset ) {\n\t\t// Array of colors.\n\t\tcolors = duotonePreset;\n\t} else if ( isCSS ) {\n\t\t// CSS filter property string (e.g. 'unset').\n\t\tcolors = duotoneAttr;\n\t} else if ( isCustom ) {\n\t\t// Array of colors.\n\t\tcolors = duotoneAttr;\n\t}\n\n\t// Build the CSS selectors to which the filter will be applied.\n\tconst selectors = duotoneSelector.split( ',' );\n\n\tconst selectorsScoped = selectors.map( ( selectorPart ) => {\n\t\t// Extra .editor-styles-wrapper specificity is needed in the editor\n\t\t// since we're not using inline styles to apply the filter. We need to\n\t\t// override duotone applied by global styles and theme.json.\n\n\t\t// Assuming the selector part is a subclass selector (not a tag name)\n\t\t// so we can prepend the filter id class. If we want to support elements\n\t\t// such as `img` or namespaces, we'll need to add a case for that here.\n\t\treturn `.editor-styles-wrapper .${ filterId }${ selectorPart.trim() }`;\n\t} );\n\n\tconst selector = selectorsScoped.join( ', ' );\n\n\tconst isValidFilter = Array.isArray( colors ) || colors === 'unset';\n\n\treturn (\n\t\telement &&\n\t\tisValidFilter &&\n\t\tcreatePortal(\n\t\t\t<InlineDuotone\n\t\t\t\tselector={ selector }\n\t\t\t\tid={ filterId }\n\t\t\t\tcolors={ colors }\n\t\t\t/>,\n\t\t\telement\n\t\t)\n\t);\n}\n\n/**\n * Override the default block element to include duotone styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst id = useInstanceId( BlockListBlock );\n\n\t\tconst selector = useMemo( () => {\n\t\t\tconst blockType = getBlockType( props.name );\n\n\t\t\tif ( blockType ) {\n\t\t\t\t// Backwards compatibility for `supports.color.__experimentalDuotone`\n\t\t\t\t// is provided via the `block_type_metadata_settings` filter. If\n\t\t\t\t// `supports.filter.duotone` has not been set and the\n\t\t\t\t// experimental property has been, the experimental property\n\t\t\t\t// value is copied into `supports.filter.duotone`.\n\t\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\t\tblockType,\n\t\t\t\t\t'filter.duotone',\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t\tif ( ! duotoneSupport ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\t// If the experimental duotone support was set, that value is\n\t\t\t\t// to be treated as a selector and requires scoping.\n\t\t\t\tconst experimentalDuotone = getBlockSupport(\n\t\t\t\t\tblockType,\n\t\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t\tif ( experimentalDuotone ) {\n\t\t\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\t\t\treturn typeof experimentalDuotone === 'string'\n\t\t\t\t\t\t? scopeSelector( rootSelector, experimentalDuotone )\n\t\t\t\t\t\t: rootSelector;\n\t\t\t\t}\n\n\t\t\t\t// Regular filter.duotone support uses filter.duotone selectors with fallbacks.\n\t\t\t\treturn getBlockCSSSelector( blockType, 'filter.duotone', {\n\t\t\t\t\tfallback: true,\n\t\t\t\t} );\n\t\t\t}\n\t\t}, [ props.name ] );\n\n\t\tconst attribute = props?.attributes?.style?.color?.duotone;\n\n\t\tconst filterClass = `wp-duotone-${ id }`;\n\n\t\tconst shouldRender = selector && attribute;\n\n\t\tconst className = shouldRender\n\t\t\t? classnames( props?.className, filterClass )\n\t\t\t: props?.className;\n\n\t\t// CAUTION: code added before this line will be executed\n\t\t// for all blocks, not just those that support duotone. Code added\n\t\t// above this line should be carefully evaluated for its impact on\n\t\t// performance.\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRender && (\n\t\t\t\t\t<DuotoneStyles\n\t\t\t\t\t\tid={ filterClass }\n\t\t\t\t\t\tselector={ selector }\n\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/duotone/with-editor-controls',\n\twithDuotoneControls\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/duotone/with-styles',\n\twithDuotoneStyles\n);\n"]}
|
|
@@ -3,14 +3,19 @@ import { createElement } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { useState, useRef, useEffect } from '@wordpress/element';
|
|
7
7
|
import isShallowEqual from '@wordpress/is-shallow-equal';
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import BlockPopover from '../components/block-popover';
|
|
13
|
-
import {
|
|
13
|
+
import { __unstableUseBlockElement as useBlockElement } from '../components/block-list/use-block-props/use-block-refs';
|
|
14
|
+
|
|
15
|
+
function getComputedCSS(element, property) {
|
|
16
|
+
return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property);
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
export function MarginVisualizer(_ref) {
|
|
15
20
|
var _attributes$style, _attributes$style$spa;
|
|
16
21
|
|
|
@@ -19,23 +24,29 @@ export function MarginVisualizer(_ref) {
|
|
|
19
24
|
attributes,
|
|
20
25
|
forceShow
|
|
21
26
|
} = _ref;
|
|
27
|
+
const blockElement = useBlockElement(clientId);
|
|
28
|
+
const [style, setStyle] = useState();
|
|
22
29
|
const margin = attributes === null || attributes === void 0 ? void 0 : (_attributes$style = attributes.style) === null || _attributes$style === void 0 ? void 0 : (_attributes$style$spa = _attributes$style.spacing) === null || _attributes$style$spa === void 0 ? void 0 : _attributes$style$spa.margin;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (!blockElement) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const top = getComputedCSS(blockElement, 'margin-top');
|
|
36
|
+
const right = getComputedCSS(blockElement, 'margin-right');
|
|
37
|
+
const bottom = getComputedCSS(blockElement, 'margin-bottom');
|
|
38
|
+
const left = getComputedCSS(blockElement, 'margin-left');
|
|
39
|
+
setStyle({
|
|
40
|
+
borderTopWidth: top,
|
|
41
|
+
borderRightWidth: right,
|
|
42
|
+
borderBottomWidth: bottom,
|
|
43
|
+
borderLeftWidth: left,
|
|
44
|
+
top: top ? `-${top}` : 0,
|
|
45
|
+
right: right ? `-${right}` : 0,
|
|
46
|
+
bottom: bottom ? `-${bottom}` : 0,
|
|
47
|
+
left: left ? `-${left}` : 0
|
|
48
|
+
});
|
|
49
|
+
}, [blockElement, margin]);
|
|
39
50
|
const [isActive, setIsActive] = useState(false);
|
|
40
51
|
const valueRef = useRef(margin);
|
|
41
52
|
const timeoutRef = useRef();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/margin.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/margin.js"],"names":["useState","useRef","useEffect","isShallowEqual","BlockPopover","__unstableUseBlockElement","useBlockElement","getComputedCSS","element","property","ownerDocument","defaultView","getComputedStyle","getPropertyValue","MarginVisualizer","clientId","attributes","forceShow","blockElement","style","setStyle","margin","spacing","top","right","bottom","left","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","isActive","setIsActive","valueRef","timeoutRef","clearTimer","current","window","clearTimeout","setTimeout"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,MAAnB,EAA2BC,SAA3B,QAA4C,oBAA5C;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,6BAAzB;AACA,SAASC,yBAAyB,IAAIC,eAAtC,QAA6D,yDAA7D;;AAEA,SAASC,cAAT,CAAyBC,OAAzB,EAAkCC,QAAlC,EAA6C;AAC5C,SAAOD,OAAO,CAACE,aAAR,CAAsBC,WAAtB,CACLC,gBADK,CACaJ,OADb,EAELK,gBAFK,CAEaJ,QAFb,CAAP;AAGA;;AAED,OAAO,SAASK,gBAAT,OAAiE;AAAA;;AAAA,MAAtC;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,UAAZ;AAAwBC,IAAAA;AAAxB,GAAsC;AACvE,QAAMC,YAAY,GAAGZ,eAAe,CAAES,QAAF,CAApC;AACA,QAAM,CAAEI,KAA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AAU,GAAG,MAAM;AACxB,QAAKD,UAAU,CAACE,OAAhB,EAA0B;AACzBC,MAAAA,MAAM,CAACC,YAAP,CAAqBJ,UAAU,CAACE,OAAhC;AACA;AACD,GAJD;;AAMAlC,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAK,CAAEC,cAAc,CAAEkB,MAAF,EAAUY,QAAQ,CAACG,OAAnB,CAAhB,IAAgD,CAAEnB,SAAvD,EAAmE;AAClEe,MAAAA,WAAW,CAAE,IAAF,CAAX;AACAC,MAAAA,QAAQ,CAACG,OAAT,GAAmBf,MAAnB;AAEAa,MAAAA,UAAU,CAACE,OAAX,GAAqBG,UAAU,CAAE,MAAM;AACtCP,QAAAA,WAAW,CAAE,KAAF,CAAX;AACA,OAF8B,EAE5B,GAF4B,CAA/B;AAGA;;AAED,WAAO,MAAM;AACZA,MAAAA,WAAW,CAAE,KAAF,CAAX;AACAG,MAAAA,UAAU;AACV,KAHD;AAIA,GAdQ,EAcN,CAAEd,MAAF,EAAUJ,SAAV,CAdM,CAAT;;AAgBA,MAAK,CAAEc,QAAF,IAAc,CAAEd,SAArB,EAAiC;AAChC,WAAO,IAAP;AACA;;AAED,SACC,cAAC,YAAD;AACC,IAAA,QAAQ,EAAGF,QADZ;AAEC,IAAA,qBAAqB,MAFtB;AAGC,IAAA,qBAAqB,EAAGM,MAHzB;AAIC,IAAA,qBAAqB,EAAC,eAJvB;AAKC,IAAA,KAAK,EAAG;AALT,KAOC;AAAK,IAAA,SAAS,EAAC,kCAAf;AAAkD,IAAA,KAAK,EAAGF;AAA1D,IAPD,CADD;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect } from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport BlockPopover from '../components/block-popover';\nimport { __unstableUseBlockElement as useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nfunction getComputedCSS( element, property ) {\n\treturn element.ownerDocument.defaultView\n\t\t.getComputedStyle( element )\n\t\t.getPropertyValue( property );\n}\n\nexport function MarginVisualizer( { clientId, attributes, forceShow } ) {\n\tconst blockElement = useBlockElement( clientId );\n\tconst [ style, setStyle ] = useState();\n\n\tconst margin = attributes?.style?.spacing?.margin;\n\n\tuseEffect( () => {\n\t\tif ( ! blockElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst top = getComputedCSS( blockElement, 'margin-top' );\n\t\tconst right = getComputedCSS( blockElement, 'margin-right' );\n\t\tconst bottom = getComputedCSS( blockElement, 'margin-bottom' );\n\t\tconst left = getComputedCSS( blockElement, 'margin-left' );\n\n\t\tsetStyle( {\n\t\t\tborderTopWidth: top,\n\t\t\tborderRightWidth: right,\n\t\t\tborderBottomWidth: bottom,\n\t\t\tborderLeftWidth: left,\n\t\t\ttop: top ? `-${ top }` : 0,\n\t\t\tright: right ? `-${ right }` : 0,\n\t\t\tbottom: bottom ? `-${ bottom }` : 0,\n\t\t\tleft: left ? `-${ left }` : 0,\n\t\t} );\n\t}, [ blockElement, margin ] );\n\n\tconst [ isActive, setIsActive ] = useState( false );\n\tconst valueRef = useRef( margin );\n\tconst timeoutRef = useRef();\n\n\tconst clearTimer = () => {\n\t\tif ( timeoutRef.current ) {\n\t\t\twindow.clearTimeout( timeoutRef.current );\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tif ( ! isShallowEqual( margin, valueRef.current ) && ! forceShow ) {\n\t\t\tsetIsActive( true );\n\t\t\tvalueRef.current = margin;\n\n\t\t\ttimeoutRef.current = setTimeout( () => {\n\t\t\t\tsetIsActive( false );\n\t\t\t}, 400 );\n\t\t}\n\n\t\treturn () => {\n\t\t\tsetIsActive( false );\n\t\t\tclearTimer();\n\t\t};\n\t}, [ margin, forceShow ] );\n\n\tif ( ! isActive && ! forceShow ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPopover\n\t\t\tclientId={ clientId }\n\t\t\t__unstableCoverTarget\n\t\t\t__unstableRefreshSize={ margin }\n\t\t\t__unstablePopoverSlot=\"block-toolbar\"\n\t\t\tshift={ false }\n\t\t>\n\t\t\t<div className=\"block-editor__padding-visualizer\" style={ style } />\n\t\t</BlockPopover>\n\t);\n}\n"]}
|
|
@@ -3,14 +3,19 @@ import { createElement } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import { useState, useRef, useEffect
|
|
6
|
+
import { useState, useRef, useEffect } from '@wordpress/element';
|
|
7
7
|
import isShallowEqual from '@wordpress/is-shallow-equal';
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import BlockPopover from '../components/block-popover';
|
|
13
|
-
import {
|
|
13
|
+
import { __unstableUseBlockElement as useBlockElement } from '../components/block-list/use-block-props/use-block-refs';
|
|
14
|
+
|
|
15
|
+
function getComputedCSS(element, property) {
|
|
16
|
+
return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property);
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
export function PaddingVisualizer(_ref) {
|
|
15
20
|
var _attributes$style, _attributes$style$spa;
|
|
16
21
|
|
|
@@ -19,15 +24,21 @@ export function PaddingVisualizer(_ref) {
|
|
|
19
24
|
attributes,
|
|
20
25
|
forceShow
|
|
21
26
|
} = _ref;
|
|
27
|
+
const blockElement = useBlockElement(clientId);
|
|
28
|
+
const [style, setStyle] = useState();
|
|
22
29
|
const padding = attributes === null || attributes === void 0 ? void 0 : (_attributes$style = attributes.style) === null || _attributes$style === void 0 ? void 0 : (_attributes$style$spa = _attributes$style.spacing) === null || _attributes$style$spa === void 0 ? void 0 : _attributes$style$spa.padding;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (!blockElement) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
setStyle({
|
|
36
|
+
borderTopWidth: getComputedCSS(blockElement, 'padding-top'),
|
|
37
|
+
borderRightWidth: getComputedCSS(blockElement, 'padding-right'),
|
|
38
|
+
borderBottomWidth: getComputedCSS(blockElement, 'padding-bottom'),
|
|
39
|
+
borderLeftWidth: getComputedCSS(blockElement, 'padding-left')
|
|
40
|
+
});
|
|
41
|
+
}, [blockElement, padding]);
|
|
31
42
|
const [isActive, setIsActive] = useState(false);
|
|
32
43
|
const valueRef = useRef(padding);
|
|
33
44
|
const timeoutRef = useRef();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/padding.js"],"names":["useState","useRef","useEffect","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/padding.js"],"names":["useState","useRef","useEffect","isShallowEqual","BlockPopover","__unstableUseBlockElement","useBlockElement","getComputedCSS","element","property","ownerDocument","defaultView","getComputedStyle","getPropertyValue","PaddingVisualizer","clientId","attributes","forceShow","blockElement","style","setStyle","padding","spacing","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","isActive","setIsActive","valueRef","timeoutRef","clearTimer","current","window","clearTimeout","setTimeout"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,MAAnB,EAA2BC,SAA3B,QAA4C,oBAA5C;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,6BAAzB;AACA,SAASC,yBAAyB,IAAIC,eAAtC,QAA6D,yDAA7D;;AAEA,SAASC,cAAT,CAAyBC,OAAzB,EAAkCC,QAAlC,EAA6C;AAC5C,SAAOD,OAAO,CAACE,aAAR,CAAsBC,WAAtB,CACLC,gBADK,CACaJ,OADb,EAELK,gBAFK,CAEaJ,QAFb,CAAP;AAGA;;AAED,OAAO,SAASK,iBAAT,OAAkE;AAAA;;AAAA,MAAtC;AAAEC,IAAAA,QAAF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,IAAF,CAAX;AACAC,MAAAA,QAAQ,CAACG,OAAT,GAAmBX,OAAnB;AAEAS,MAAAA,UAAU,CAACE,OAAX,GAAqBG,UAAU,CAAE,MAAM;AACtCP,QAAAA,WAAW,CAAE,KAAF,CAAX;AACA,OAF8B,EAE5B,GAF4B,CAA/B;AAGA;;AAED,WAAO,MAAM;AACZA,MAAAA,WAAW,CAAE,KAAF,CAAX;AACAG,MAAAA,UAAU;AACV,KAHD;AAIA,GAdQ,EAcN,CAAEV,OAAF,EAAWJ,SAAX,CAdM,CAAT;;AAgBA,MAAK,CAAEU,QAAF,IAAc,CAAEV,SAArB,EAAiC;AAChC,WAAO,IAAP;AACA;;AAED,SACC,cAAC,YAAD;AACC,IAAA,QAAQ,EAAGF,QADZ;AAEC,IAAA,qBAAqB,MAFtB;AAGC,IAAA,qBAAqB,EAAGM,OAHzB;AAIC,IAAA,qBAAqB,EAAC,eAJvB;AAKC,IAAA,KAAK,EAAG;AALT,KAOC;AAAK,IAAA,SAAS,EAAC,kCAAf;AAAkD,IAAA,KAAK,EAAGF;AAA1D,IAPD,CADD;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect } from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport BlockPopover from '../components/block-popover';\nimport { __unstableUseBlockElement as useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nfunction getComputedCSS( element, property ) {\n\treturn element.ownerDocument.defaultView\n\t\t.getComputedStyle( element )\n\t\t.getPropertyValue( property );\n}\n\nexport function PaddingVisualizer( { clientId, attributes, forceShow } ) {\n\tconst blockElement = useBlockElement( clientId );\n\tconst [ style, setStyle ] = useState();\n\n\tconst padding = attributes?.style?.spacing?.padding;\n\n\tuseEffect( () => {\n\t\tif ( ! blockElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetStyle( {\n\t\t\tborderTopWidth: getComputedCSS( blockElement, 'padding-top' ),\n\t\t\tborderRightWidth: getComputedCSS( blockElement, 'padding-right' ),\n\t\t\tborderBottomWidth: getComputedCSS( blockElement, 'padding-bottom' ),\n\t\t\tborderLeftWidth: getComputedCSS( blockElement, 'padding-left' ),\n\t\t} );\n\t}, [ blockElement, padding ] );\n\n\tconst [ isActive, setIsActive ] = useState( false );\n\tconst valueRef = useRef( padding );\n\tconst timeoutRef = useRef();\n\n\tconst clearTimer = () => {\n\t\tif ( timeoutRef.current ) {\n\t\t\twindow.clearTimeout( timeoutRef.current );\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tif ( ! isShallowEqual( padding, valueRef.current ) && ! forceShow ) {\n\t\t\tsetIsActive( true );\n\t\t\tvalueRef.current = padding;\n\n\t\t\ttimeoutRef.current = setTimeout( () => {\n\t\t\t\tsetIsActive( false );\n\t\t\t}, 400 );\n\t\t}\n\n\t\treturn () => {\n\t\t\tsetIsActive( false );\n\t\t\tclearTimer();\n\t\t};\n\t}, [ padding, forceShow ] );\n\n\tif ( ! isActive && ! forceShow ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPopover\n\t\t\tclientId={ clientId }\n\t\t\t__unstableCoverTarget\n\t\t\t__unstableRefreshSize={ padding }\n\t\t\t__unstablePopoverSlot=\"block-toolbar\"\n\t\t\tshift={ false }\n\t\t>\n\t\t\t<div className=\"block-editor__padding-visualizer\" style={ style } />\n\t\t</BlockPopover>\n\t);\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { isEmpty,
|
|
4
|
+
import { isEmpty, get } from 'lodash';
|
|
5
5
|
/**
|
|
6
6
|
* WordPress dependencies
|
|
7
7
|
*/
|
|
@@ -14,7 +14,7 @@ import { useMemo } from '@wordpress/element';
|
|
|
14
14
|
|
|
15
15
|
import { useSetting } from '../components';
|
|
16
16
|
import { useSettingsForBlockElement } from '../components/global-styles/hooks';
|
|
17
|
-
import {
|
|
17
|
+
import { setImmutably } from '../utils/object';
|
|
18
18
|
/**
|
|
19
19
|
* Removed falsy values from nested object.
|
|
20
20
|
*
|
|
@@ -27,9 +27,12 @@ export const cleanEmptyObject = object => {
|
|
|
27
27
|
return object;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const cleanedNestedObjects = Object.fromEntries(Object.entries(
|
|
31
|
-
let [, value] = _ref;
|
|
32
|
-
return
|
|
30
|
+
const cleanedNestedObjects = Object.fromEntries(Object.entries(object).map(_ref => {
|
|
31
|
+
let [key, value] = _ref;
|
|
32
|
+
return [key, cleanEmptyObject(value)];
|
|
33
|
+
}).filter(_ref2 => {
|
|
34
|
+
let [, value] = _ref2;
|
|
35
|
+
return value !== undefined;
|
|
33
36
|
}));
|
|
34
37
|
return isEmpty(cleanedNestedObjects) ? undefined : cleanedNestedObjects;
|
|
35
38
|
};
|
|
@@ -66,8 +69,8 @@ export function transformStyles(activeSupports, migrationPaths, result, source,
|
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
let returnBlock = result;
|
|
69
|
-
Object.entries(activeSupports).forEach(
|
|
70
|
-
let [support, isActive] =
|
|
72
|
+
Object.entries(activeSupports).forEach(_ref3 => {
|
|
73
|
+
let [support, isActive] = _ref3;
|
|
71
74
|
|
|
72
75
|
if (isActive) {
|
|
73
76
|
migrationPaths[support].forEach(path => {
|
|
@@ -75,7 +78,7 @@ export function transformStyles(activeSupports, migrationPaths, result, source,
|
|
|
75
78
|
|
|
76
79
|
if (styleValue) {
|
|
77
80
|
returnBlock = { ...returnBlock,
|
|
78
|
-
attributes:
|
|
81
|
+
attributes: setImmutably(returnBlock.attributes, path, styleValue)
|
|
79
82
|
};
|
|
80
83
|
}
|
|
81
84
|
});
|
|
@@ -139,9 +142,14 @@ export function useBlockSettings(name, parentLayout) {
|
|
|
139
142
|
const borderWidth = useSetting('border.width');
|
|
140
143
|
const customColorsEnabled = useSetting('color.custom');
|
|
141
144
|
const customColors = useSetting('color.palette.custom');
|
|
145
|
+
const customDuotone = useSetting('color.customDuotone');
|
|
142
146
|
const themeColors = useSetting('color.palette.theme');
|
|
143
147
|
const defaultColors = useSetting('color.palette.default');
|
|
144
148
|
const defaultPalette = useSetting('color.defaultPalette');
|
|
149
|
+
const defaultDuotone = useSetting('color.defaultDuotone');
|
|
150
|
+
const userDuotonePalette = useSetting('color.duotone.custom');
|
|
151
|
+
const themeDuotonePalette = useSetting('color.duotone.theme');
|
|
152
|
+
const defaultDuotonePalette = useSetting('color.duotone.default');
|
|
145
153
|
const userGradientPalette = useSetting('color.gradients.custom');
|
|
146
154
|
const themeGradientPalette = useSetting('color.gradients.theme');
|
|
147
155
|
const defaultGradientPalette = useSetting('color.gradients.default');
|
|
@@ -163,10 +171,17 @@ export function useBlockSettings(name, parentLayout) {
|
|
|
163
171
|
theme: themeGradientPalette,
|
|
164
172
|
default: defaultGradientPalette
|
|
165
173
|
},
|
|
174
|
+
duotone: {
|
|
175
|
+
custom: userDuotonePalette,
|
|
176
|
+
theme: themeDuotonePalette,
|
|
177
|
+
default: defaultDuotonePalette
|
|
178
|
+
},
|
|
166
179
|
defaultGradients,
|
|
167
180
|
defaultPalette,
|
|
181
|
+
defaultDuotone,
|
|
168
182
|
custom: customColorsEnabled,
|
|
169
183
|
customGradient: areCustomGradientsEnabled,
|
|
184
|
+
customDuotone,
|
|
170
185
|
background: isBackgroundEnabled,
|
|
171
186
|
link: isLinkEnabled,
|
|
172
187
|
text: isTextEnabled
|
|
@@ -208,7 +223,7 @@ export function useBlockSettings(name, parentLayout) {
|
|
|
208
223
|
layout,
|
|
209
224
|
parentLayout
|
|
210
225
|
};
|
|
211
|
-
}, [fontFamilies, fontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textColumns, textDecoration, textTransform, letterSpacing, padding, margin, blockGap, spacingSizes, units, minHeight, layout, parentLayout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, themeColors, defaultColors, defaultPalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled]);
|
|
226
|
+
}, [fontFamilies, fontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textColumns, textDecoration, textTransform, letterSpacing, padding, margin, blockGap, spacingSizes, units, minHeight, layout, parentLayout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled]);
|
|
212
227
|
return useSettingsForBlockElement(rawSettings, name);
|
|
213
228
|
}
|
|
214
229
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/utils.js"],"names":["isEmpty","mapValues","get","getBlockSupport","useMemo","useSetting","useSettingsForBlockElement","immutableSet","cleanEmptyObject","object","Array","isArray","cleanedNestedObjects","Object","fromEntries","entries","filter","value","Boolean","undefined","transformStyles","activeSupports","migrationPaths","result","source","index","results","values","every","isActive","length","innerBlocks","referenceBlockAttributes","attributes","returnBlock","forEach","support","path","styleValue","shouldSkipSerialization","blockType","featureSet","feature","skipSerialization","__experimentalSkipSerialization","includes","useBlockSettings","name","parentLayout","fontFamilies","fontSizes","customFontSize","fontStyle","fontWeight","lineHeight","textColumns","textDecoration","textTransform","letterSpacing","padding","margin","blockGap","spacingSizes","units","minHeight","layout","borderColor","borderRadius","borderStyle","borderWidth","customColorsEnabled","customColors","themeColors","defaultColors","defaultPalette","userGradientPalette","themeGradientPalette","defaultGradientPalette","defaultGradients","areCustomGradientsEnabled","isBackgroundEnabled","isLinkEnabled","isTextEnabled","rawSettings","color","palette","custom","theme","default","gradients","customGradient","background","link","text","typography","spacing","border","radius","style","width","dimensions"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,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BFC,SAhBE,EAiBFC,MAjBE,EAkBFjB,YAlBE,EAmBFkB,WAnBE,EAoBFC,YApBE,EAqBFC,WArBE,EAsBFC,WAtBE,EAuBFC,mBAvBE,EAwBFC,YAxBE,EAyBFC,WAzBE,EA0BFC,aA1BE,EA2BFC,cA3BE,EA4BFC,mBA5BE,EA6BFC,oBA7BE,EA8BFC,sBA9BE,EA+BFC,gBA/BE,EAgCFC,yBAhCE,EAiCFC,mBAjCE,EAkCFC,aAlCE,EAmCFC,aAnCE,CA1DwB,CAA3B;AAgGA,SAAO5E,0BAA0B,CAAE6E,WAAF,EAAepC,IAAf,CAAjC;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty, mapValues, get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSetting } from '../components';\nimport { useSettingsForBlockElement } from '../components/global-styles/hooks';\nimport { immutableSet } from '../utils/object';\n\n/**\n * Removed falsy values from nested object.\n *\n * @param {*} object\n * @return {*} Object cleaned from falsy values\n */\nexport const cleanEmptyObject = ( object ) => {\n\tif (\n\t\tobject === null ||\n\t\ttypeof object !== 'object' ||\n\t\tArray.isArray( object )\n\t) {\n\t\treturn object;\n\t}\n\tconst cleanedNestedObjects = Object.fromEntries(\n\t\tObject.entries( mapValues( object, cleanEmptyObject ) ).filter(\n\t\t\t( [ , value ] ) => Boolean( value )\n\t\t)\n\t);\n\treturn isEmpty( cleanedNestedObjects ) ? undefined : cleanedNestedObjects;\n};\n\nexport function transformStyles(\n\tactiveSupports,\n\tmigrationPaths,\n\tresult,\n\tsource,\n\tindex,\n\tresults\n) {\n\t// If there are no active supports return early.\n\tif (\n\t\tObject.values( activeSupports ?? {} ).every(\n\t\t\t( isActive ) => ! isActive\n\t\t)\n\t) {\n\t\treturn result;\n\t}\n\t// If the condition verifies we are probably in the presence of a wrapping transform\n\t// e.g: nesting paragraphs in a group or columns and in that case the styles should not be transformed.\n\tif ( results.length === 1 && result.innerBlocks.length === source.length ) {\n\t\treturn result;\n\t}\n\t// For cases where we have a transform from one block to multiple blocks\n\t// or multiple blocks to one block we apply the styles of the first source block\n\t// to the result(s).\n\tlet referenceBlockAttributes = source[ 0 ]?.attributes;\n\t// If we are in presence of transform between more than one block in the source\n\t// that has more than one block in the result\n\t// we apply the styles on source N to the result N,\n\t// if source N does not exists we do nothing.\n\tif ( results.length > 1 && source.length > 1 ) {\n\t\tif ( source[ index ] ) {\n\t\t\treferenceBlockAttributes = source[ index ]?.attributes;\n\t\t} else {\n\t\t\treturn result;\n\t\t}\n\t}\n\tlet returnBlock = result;\n\tObject.entries( activeSupports ).forEach( ( [ support, isActive ] ) => {\n\t\tif ( isActive ) {\n\t\t\tmigrationPaths[ support ].forEach( ( path ) => {\n\t\t\t\tconst styleValue = get( referenceBlockAttributes, path );\n\t\t\t\tif ( styleValue ) {\n\t\t\t\t\treturnBlock = {\n\t\t\t\t\t\t...returnBlock,\n\t\t\t\t\t\tattributes: immutableSet(\n\t\t\t\t\t\t\treturnBlock.attributes,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tstyleValue\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t} );\n\treturn returnBlock;\n}\n\n/**\n * Check whether serialization of specific block support feature or set should\n * be skipped.\n *\n * @param {string|Object} blockType Block name or block type object.\n * @param {string} featureSet Name of block support feature set.\n * @param {string} feature Name of the individual feature to check.\n *\n * @return {boolean} Whether serialization should occur.\n */\nexport function shouldSkipSerialization( blockType, featureSet, feature ) {\n\tconst support = getBlockSupport( blockType, featureSet );\n\tconst skipSerialization = support?.__experimentalSkipSerialization;\n\n\tif ( Array.isArray( skipSerialization ) ) {\n\t\treturn skipSerialization.includes( feature );\n\t}\n\n\treturn skipSerialization;\n}\n\n/**\n * Based on the block and its context, returns an object of all the block settings.\n * This object can be passed as a prop to all the Styles UI components\n * (TypographyPanel, DimensionsPanel...).\n *\n * @param {string} name Block name.\n * @param {*} parentLayout Parent layout.\n *\n * @return {Object} Settings object.\n */\nexport function useBlockSettings( name, parentLayout ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\tconst customFontSize = useSetting( 'typography.customFontSize' );\n\tconst fontStyle = useSetting( 'typography.fontStyle' );\n\tconst fontWeight = useSetting( 'typography.fontWeight' );\n\tconst lineHeight = useSetting( 'typography.lineHeight' );\n\tconst textColumns = useSetting( 'typography.textColumns' );\n\tconst textDecoration = useSetting( 'typography.textDecoration' );\n\tconst textTransform = useSetting( 'typography.textTransform' );\n\tconst letterSpacing = useSetting( 'typography.letterSpacing' );\n\tconst padding = useSetting( 'spacing.padding' );\n\tconst margin = useSetting( 'spacing.margin' );\n\tconst blockGap = useSetting( 'spacing.blockGap' );\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\tconst units = useSetting( 'spacing.units' );\n\tconst minHeight = useSetting( 'dimensions.minHeight' );\n\tconst layout = useSetting( 'layout' );\n\tconst borderColor = useSetting( 'border.color' );\n\tconst borderRadius = useSetting( 'border.radius' );\n\tconst borderStyle = useSetting( 'border.style' );\n\tconst borderWidth = useSetting( 'border.width' );\n\tconst customColorsEnabled = useSetting( 'color.custom' );\n\tconst customColors = useSetting( 'color.palette.custom' );\n\tconst themeColors = useSetting( 'color.palette.theme' );\n\tconst defaultColors = useSetting( 'color.palette.default' );\n\tconst defaultPalette = useSetting( 'color.defaultPalette' );\n\tconst userGradientPalette = useSetting( 'color.gradients.custom' );\n\tconst themeGradientPalette = useSetting( 'color.gradients.theme' );\n\tconst defaultGradientPalette = useSetting( 'color.gradients.default' );\n\tconst defaultGradients = useSetting( 'color.defaultGradients' );\n\tconst areCustomGradientsEnabled = useSetting( 'color.customGradient' );\n\tconst isBackgroundEnabled = useSetting( 'color.background' );\n\tconst isLinkEnabled = useSetting( 'color.link' );\n\tconst isTextEnabled = useSetting( 'color.text' );\n\n\tconst rawSettings = useMemo( () => {\n\t\treturn {\n\t\t\tcolor: {\n\t\t\t\tpalette: {\n\t\t\t\t\tcustom: customColors,\n\t\t\t\t\ttheme: themeColors,\n\t\t\t\t\tdefault: defaultColors,\n\t\t\t\t},\n\t\t\t\tgradients: {\n\t\t\t\t\tcustom: userGradientPalette,\n\t\t\t\t\ttheme: themeGradientPalette,\n\t\t\t\t\tdefault: defaultGradientPalette,\n\t\t\t\t},\n\t\t\t\tdefaultGradients,\n\t\t\t\tdefaultPalette,\n\t\t\t\tcustom: customColorsEnabled,\n\t\t\t\tcustomGradient: areCustomGradientsEnabled,\n\t\t\t\tbackground: isBackgroundEnabled,\n\t\t\t\tlink: isLinkEnabled,\n\t\t\t\ttext: isTextEnabled,\n\t\t\t},\n\t\t\ttypography: {\n\t\t\t\tfontFamilies: {\n\t\t\t\t\tcustom: fontFamilies,\n\t\t\t\t},\n\t\t\t\tfontSizes: {\n\t\t\t\t\tcustom: fontSizes,\n\t\t\t\t},\n\t\t\t\tcustomFontSize,\n\t\t\t\tfontStyle,\n\t\t\t\tfontWeight,\n\t\t\t\tlineHeight,\n\t\t\t\ttextColumns,\n\t\t\t\ttextDecoration,\n\t\t\t\ttextTransform,\n\t\t\t\tletterSpacing,\n\t\t\t},\n\t\t\tspacing: {\n\t\t\t\tspacingSizes: {\n\t\t\t\t\tcustom: spacingSizes,\n\t\t\t\t},\n\t\t\t\tpadding,\n\t\t\t\tmargin,\n\t\t\t\tblockGap,\n\t\t\t\tunits,\n\t\t\t},\n\t\t\tborder: {\n\t\t\t\tcolor: borderColor,\n\t\t\t\tradius: borderRadius,\n\t\t\t\tstyle: borderStyle,\n\t\t\t\twidth: borderWidth,\n\t\t\t},\n\t\t\tdimensions: {\n\t\t\t\tminHeight,\n\t\t\t},\n\t\t\tlayout,\n\t\t\tparentLayout,\n\t\t};\n\t}, [\n\t\tfontFamilies,\n\t\tfontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextColumns,\n\t\ttextDecoration,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tspacingSizes,\n\t\tunits,\n\t\tminHeight,\n\t\tlayout,\n\t\tparentLayout,\n\t\tborderColor,\n\t\tborderRadius,\n\t\tborderStyle,\n\t\tborderWidth,\n\t\tcustomColorsEnabled,\n\t\tcustomColors,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t\tuserGradientPalette,\n\t\tthemeGradientPalette,\n\t\tdefaultGradientPalette,\n\t\tdefaultGradients,\n\t\tareCustomGradientsEnabled,\n\t\tisBackgroundEnabled,\n\t\tisLinkEnabled,\n\t\tisTextEnabled,\n\t] );\n\n\treturn useSettingsForBlockElement( rawSettings, name );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/utils.js"],"names":["isEmpty","get","getBlockSupport","useMemo","useSetting","useSettingsForBlockElement","setImmutably","cleanEmptyObject","object","Array","isArray","cleanedNestedObjects","Object","fromEntries","entries","map","key","value","filter","undefined","transformStyles","activeSupports","migrationPaths","result","source","index","results","values","every","isActive","length","innerBlocks","referenceBlockAttributes","attributes","returnBlock","forEach","support","path","styleValue","shouldSkipSerialization","blockType","featureSet","feature","skipSerialization","__experimentalSkipSerialization","includes","useBlockSettings","name","parentLayout","fontFamilies","fontSizes","customFontSize","fontStyle","fontWeight","lineHeight","textColumns","textDecoration","textTransform","letterSpacing","padding","margin","blockGap","spacingSizes","units","minHeight","layout","borderColor","borderRadius","borderStyle","borderWidth","customColorsEnabled","customColors","customDuotone","themeColors","defaultColors","defaultPalette","defaultDuotone","userDuotonePalette","themeDuotonePalette","defaultDuotonePalette","userGradientPalette","themeGradientPalette","defaultGradientPalette","defaultGradients","areCustomGradientsEnabled","isBackgroundEnabled","isLinkEnabled","isTextEnabled","rawSettings","color","palette","custom","theme","default","gradients","duotone","customGradient","background","link","text","typography","spacing","border","radius","style","width","dimensions"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,GAAlB,QAA6B,QAA7B;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,eAA3B;AACA,SAASC,0BAAT,QAA2C,mCAA3C;AACA,SAASC,YAAT,QAA6B,iBAA7B;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,gBAAgB,GAAKC,MAAF,IAAc;AAC7C,MACCA,MAAM,KAAK,IAAX,IACA,OAAOA,MAAP,KAAkB,QADlB,IAEAC,KAAK,CAACC,OAAN,CAAeF,MAAf,CAHD,EAIE;AACD,WAAOA,MAAP;AACA;;AACD,QAAMG,oBAAoB,GAAGC,MAAM,CAACC,WAAP,CAC5BD,MAAM,CAACE,OAAP,CAAgBN,MAAhB,EACEO,GADF,CACO;AAAA,QAAE,CAAEC,GAAF,EAAOC,KAAP,CAAF;AAAA,WAAsB,CAAED,GAAF,EAAOT,gBAAgB,CAAEU,KAAF,CAAvB,CAAtB;AAAA,GADP,EAEEC,MAFF,CAEU;AAAA,QAAE,GAAID,KAAJ,CAAF;AAAA,WAAmBA,KAAK,KAAKE,SAA7B;AAAA,GAFV,CAD4B,CAA7B;AAKA,SAAOnB,OAAO,CAAEW,oBAAF,CAAP,GAAkCQ,SAAlC,GAA8CR,oBAArD;AACA,CAdM;AAgBP,OAAO,SAASS,eAAT,CACNC,cADM,EAENC,cAFM,EAGNC,MAHM,EAINC,MAJM,EAKNC,KALM,EAMNC,OANM,EAOL;AAAA;;AACD;AACA,MACCd,MAAM,CAACe,MAAP,CAAeN,cAAf,aAAeA,cAAf,cAAeA,cAAf,GAAiC,EAAjC,EAAsCO,KAAtC,CACGC,QAAF,IAAgB,CAAEA,QADnB,CADD,EAIE;AACD,WAAON,MAAP;AACA,G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AAAA,YAAY,EAAE;AACb6B,UAAAA,MAAM,EAAE7B;AADK,SADN;AAIRH,QAAAA,OAJQ;AAKRC,QAAAA,MALQ;AAMRC,QAAAA,QANQ;AAORE,QAAAA;AAPQ,OA3CH;AAoDNuC,MAAAA,MAAM,EAAE;AACPb,QAAAA,KAAK,EAAEvB,WADA;AAEPqC,QAAAA,MAAM,EAAEpC,YAFD;AAGPqC,QAAAA,KAAK,EAAEpC,WAHA;AAIPqC,QAAAA,KAAK,EAAEpC;AAJA,OApDF;AA0DNqC,MAAAA,UAAU,EAAE;AACX1C,QAAAA;AADW,OA1DN;AA6DNC,MAAAA,MA7DM;AA8DNjB,MAAAA;AA9DM,KAAP;AAgEA,GAjE0B,EAiExB,CACFC,YADE,EAEFC,SAFE,EAGFC,cAHE,EAIFC,SAJE,EAKFC,UALE,EAMFC,UANE,EAOFC,WAPE,EAQFC,cARE,EASFC,aATE,EAUFC,aAVE,EAWFC,OAXE,EAYFC,MAZE,EAaFC,QAbE,EAcFC,YAdE,EAeFC,KAfE,EAgBFC,SAhBE,EAiBFC,MAjBE,EAkBFjB,YAlBE,EAmBFkB,WAnBE,EAoBFC,YApBE,EAqBFC,WArBE,EAsBFC,WAtBE,EAuBFC,mBAvBE,EAwBFC,YAxBE,EAyBFC,aAzBE,EA0BFC,WA1BE,EA2BFC,aA3BE,EA4BFC,cA5BE,EA6BFC,cA7BE,EA8BFC,kBA9BE,EA+BFC,mBA/BE,EAgCFC,qBAhCE,EAiCFC,mBAjCE,EAkCFC,oBAlCE,EAmCFC,sBAnCE,EAoCFC,gBApCE,EAqCFC,yBArCE,EAsCFC,mBAtCE,EAuCFC,aAvCE,EAwCFC,aAxCE,CAjEwB,CAA3B;AA4GA,SAAOlF,0BAA0B,CAAEmF,WAAF,EAAezC,IAAf,CAAjC;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty, get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSetting } from '../components';\nimport { useSettingsForBlockElement } from '../components/global-styles/hooks';\nimport { setImmutably } from '../utils/object';\n\n/**\n * Removed falsy values from nested object.\n *\n * @param {*} object\n * @return {*} Object cleaned from falsy values\n */\nexport const cleanEmptyObject = ( object ) => {\n\tif (\n\t\tobject === null ||\n\t\ttypeof object !== 'object' ||\n\t\tArray.isArray( object )\n\t) {\n\t\treturn object;\n\t}\n\tconst cleanedNestedObjects = Object.fromEntries(\n\t\tObject.entries( object )\n\t\t\t.map( ( [ key, value ] ) => [ key, cleanEmptyObject( value ) ] )\n\t\t\t.filter( ( [ , value ] ) => value !== undefined )\n\t);\n\treturn isEmpty( cleanedNestedObjects ) ? undefined : cleanedNestedObjects;\n};\n\nexport function transformStyles(\n\tactiveSupports,\n\tmigrationPaths,\n\tresult,\n\tsource,\n\tindex,\n\tresults\n) {\n\t// If there are no active supports return early.\n\tif (\n\t\tObject.values( activeSupports ?? {} ).every(\n\t\t\t( isActive ) => ! isActive\n\t\t)\n\t) {\n\t\treturn result;\n\t}\n\t// If the condition verifies we are probably in the presence of a wrapping transform\n\t// e.g: nesting paragraphs in a group or columns and in that case the styles should not be transformed.\n\tif ( results.length === 1 && result.innerBlocks.length === source.length ) {\n\t\treturn result;\n\t}\n\t// For cases where we have a transform from one block to multiple blocks\n\t// or multiple blocks to one block we apply the styles of the first source block\n\t// to the result(s).\n\tlet referenceBlockAttributes = source[ 0 ]?.attributes;\n\t// If we are in presence of transform between more than one block in the source\n\t// that has more than one block in the result\n\t// we apply the styles on source N to the result N,\n\t// if source N does not exists we do nothing.\n\tif ( results.length > 1 && source.length > 1 ) {\n\t\tif ( source[ index ] ) {\n\t\t\treferenceBlockAttributes = source[ index ]?.attributes;\n\t\t} else {\n\t\t\treturn result;\n\t\t}\n\t}\n\tlet returnBlock = result;\n\tObject.entries( activeSupports ).forEach( ( [ support, isActive ] ) => {\n\t\tif ( isActive ) {\n\t\t\tmigrationPaths[ support ].forEach( ( path ) => {\n\t\t\t\tconst styleValue = get( referenceBlockAttributes, path );\n\t\t\t\tif ( styleValue ) {\n\t\t\t\t\treturnBlock = {\n\t\t\t\t\t\t...returnBlock,\n\t\t\t\t\t\tattributes: setImmutably(\n\t\t\t\t\t\t\treturnBlock.attributes,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tstyleValue\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t} );\n\treturn returnBlock;\n}\n\n/**\n * Check whether serialization of specific block support feature or set should\n * be skipped.\n *\n * @param {string|Object} blockType Block name or block type object.\n * @param {string} featureSet Name of block support feature set.\n * @param {string} feature Name of the individual feature to check.\n *\n * @return {boolean} Whether serialization should occur.\n */\nexport function shouldSkipSerialization( blockType, featureSet, feature ) {\n\tconst support = getBlockSupport( blockType, featureSet );\n\tconst skipSerialization = support?.__experimentalSkipSerialization;\n\n\tif ( Array.isArray( skipSerialization ) ) {\n\t\treturn skipSerialization.includes( feature );\n\t}\n\n\treturn skipSerialization;\n}\n\n/**\n * Based on the block and its context, returns an object of all the block settings.\n * This object can be passed as a prop to all the Styles UI components\n * (TypographyPanel, DimensionsPanel...).\n *\n * @param {string} name Block name.\n * @param {*} parentLayout Parent layout.\n *\n * @return {Object} Settings object.\n */\nexport function useBlockSettings( name, parentLayout ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\tconst customFontSize = useSetting( 'typography.customFontSize' );\n\tconst fontStyle = useSetting( 'typography.fontStyle' );\n\tconst fontWeight = useSetting( 'typography.fontWeight' );\n\tconst lineHeight = useSetting( 'typography.lineHeight' );\n\tconst textColumns = useSetting( 'typography.textColumns' );\n\tconst textDecoration = useSetting( 'typography.textDecoration' );\n\tconst textTransform = useSetting( 'typography.textTransform' );\n\tconst letterSpacing = useSetting( 'typography.letterSpacing' );\n\tconst padding = useSetting( 'spacing.padding' );\n\tconst margin = useSetting( 'spacing.margin' );\n\tconst blockGap = useSetting( 'spacing.blockGap' );\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\tconst units = useSetting( 'spacing.units' );\n\tconst minHeight = useSetting( 'dimensions.minHeight' );\n\tconst layout = useSetting( 'layout' );\n\tconst borderColor = useSetting( 'border.color' );\n\tconst borderRadius = useSetting( 'border.radius' );\n\tconst borderStyle = useSetting( 'border.style' );\n\tconst borderWidth = useSetting( 'border.width' );\n\tconst customColorsEnabled = useSetting( 'color.custom' );\n\tconst customColors = useSetting( 'color.palette.custom' );\n\tconst customDuotone = useSetting( 'color.customDuotone' );\n\tconst themeColors = useSetting( 'color.palette.theme' );\n\tconst defaultColors = useSetting( 'color.palette.default' );\n\tconst defaultPalette = useSetting( 'color.defaultPalette' );\n\tconst defaultDuotone = useSetting( 'color.defaultDuotone' );\n\tconst userDuotonePalette = useSetting( 'color.duotone.custom' );\n\tconst themeDuotonePalette = useSetting( 'color.duotone.theme' );\n\tconst defaultDuotonePalette = useSetting( 'color.duotone.default' );\n\tconst userGradientPalette = useSetting( 'color.gradients.custom' );\n\tconst themeGradientPalette = useSetting( 'color.gradients.theme' );\n\tconst defaultGradientPalette = useSetting( 'color.gradients.default' );\n\tconst defaultGradients = useSetting( 'color.defaultGradients' );\n\tconst areCustomGradientsEnabled = useSetting( 'color.customGradient' );\n\tconst isBackgroundEnabled = useSetting( 'color.background' );\n\tconst isLinkEnabled = useSetting( 'color.link' );\n\tconst isTextEnabled = useSetting( 'color.text' );\n\n\tconst rawSettings = useMemo( () => {\n\t\treturn {\n\t\t\tcolor: {\n\t\t\t\tpalette: {\n\t\t\t\t\tcustom: customColors,\n\t\t\t\t\ttheme: themeColors,\n\t\t\t\t\tdefault: defaultColors,\n\t\t\t\t},\n\t\t\t\tgradients: {\n\t\t\t\t\tcustom: userGradientPalette,\n\t\t\t\t\ttheme: themeGradientPalette,\n\t\t\t\t\tdefault: defaultGradientPalette,\n\t\t\t\t},\n\t\t\t\tduotone: {\n\t\t\t\t\tcustom: userDuotonePalette,\n\t\t\t\t\ttheme: themeDuotonePalette,\n\t\t\t\t\tdefault: defaultDuotonePalette,\n\t\t\t\t},\n\t\t\t\tdefaultGradients,\n\t\t\t\tdefaultPalette,\n\t\t\t\tdefaultDuotone,\n\t\t\t\tcustom: customColorsEnabled,\n\t\t\t\tcustomGradient: areCustomGradientsEnabled,\n\t\t\t\tcustomDuotone,\n\t\t\t\tbackground: isBackgroundEnabled,\n\t\t\t\tlink: isLinkEnabled,\n\t\t\t\ttext: isTextEnabled,\n\t\t\t},\n\t\t\ttypography: {\n\t\t\t\tfontFamilies: {\n\t\t\t\t\tcustom: fontFamilies,\n\t\t\t\t},\n\t\t\t\tfontSizes: {\n\t\t\t\t\tcustom: fontSizes,\n\t\t\t\t},\n\t\t\t\tcustomFontSize,\n\t\t\t\tfontStyle,\n\t\t\t\tfontWeight,\n\t\t\t\tlineHeight,\n\t\t\t\ttextColumns,\n\t\t\t\ttextDecoration,\n\t\t\t\ttextTransform,\n\t\t\t\tletterSpacing,\n\t\t\t},\n\t\t\tspacing: {\n\t\t\t\tspacingSizes: {\n\t\t\t\t\tcustom: spacingSizes,\n\t\t\t\t},\n\t\t\t\tpadding,\n\t\t\t\tmargin,\n\t\t\t\tblockGap,\n\t\t\t\tunits,\n\t\t\t},\n\t\t\tborder: {\n\t\t\t\tcolor: borderColor,\n\t\t\t\tradius: borderRadius,\n\t\t\t\tstyle: borderStyle,\n\t\t\t\twidth: borderWidth,\n\t\t\t},\n\t\t\tdimensions: {\n\t\t\t\tminHeight,\n\t\t\t},\n\t\t\tlayout,\n\t\t\tparentLayout,\n\t\t};\n\t}, [\n\t\tfontFamilies,\n\t\tfontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextColumns,\n\t\ttextDecoration,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tspacingSizes,\n\t\tunits,\n\t\tminHeight,\n\t\tlayout,\n\t\tparentLayout,\n\t\tborderColor,\n\t\tborderRadius,\n\t\tborderStyle,\n\t\tborderWidth,\n\t\tcustomColorsEnabled,\n\t\tcustomColors,\n\t\tcustomDuotone,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t\tdefaultDuotone,\n\t\tuserDuotonePalette,\n\t\tthemeDuotonePalette,\n\t\tdefaultDuotonePalette,\n\t\tuserGradientPalette,\n\t\tthemeGradientPalette,\n\t\tdefaultGradientPalette,\n\t\tdefaultGradients,\n\t\tareCustomGradientsEnabled,\n\t\tisBackgroundEnabled,\n\t\tisLinkEnabled,\n\t\tisTextEnabled,\n\t] );\n\n\treturn useSettingsForBlockElement( rawSettings, name );\n}\n"]}
|
|
@@ -68,12 +68,13 @@ export function getBlockGapCSS(selector, layoutDefinitions, layoutType, blockGap
|
|
|
68
68
|
export function getAlignmentsInfo(layout) {
|
|
69
69
|
const {
|
|
70
70
|
contentSize,
|
|
71
|
-
wideSize
|
|
71
|
+
wideSize,
|
|
72
|
+
type = 'default'
|
|
72
73
|
} = layout;
|
|
73
74
|
const alignmentInfo = {};
|
|
74
75
|
const sizeRegex = /^(?!0)\d+(px|em|rem|vw|vh|%)?$/i;
|
|
75
76
|
|
|
76
|
-
if (sizeRegex.test(contentSize)) {
|
|
77
|
+
if (sizeRegex.test(contentSize) && type === 'constrained') {
|
|
77
78
|
// translators: %s: container size (i.e. 600px etc)
|
|
78
79
|
alignmentInfo.none = sprintf(__('Max %s wide'), contentSize);
|
|
79
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/layouts/utils.js"],"names":["__","sprintf","appendSelectors","selectors","append","split","map","subselector","join","getBlockGapCSS","selector","layoutDefinitions","layoutType","blockGapValue","output","spacingStyles","length","forEach","gapStyle","trim","Object","entries","rules","cssProperty","value","getAlignmentsInfo","layout","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,IAAI,KAAV;AACA,KAZD;AAaA;;AACD,SAAOA,MAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASW,iBAAT,CAA4BC,MAA5B,EAAqC;AAC3C,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/layouts/utils.js"],"names":["__","sprintf","appendSelectors","selectors","append","split","map","subselector","join","getBlockGapCSS","selector","layoutDefinitions","layoutType","blockGapValue","output","spacingStyles","length","forEach","gapStyle","trim","Object","entries","rules","cssProperty","value","getAlignmentsInfo","layout","contentSize","wideSize","type","alignmentInfo","sizeRegex","test","none","wide"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,eAAT,CAA0BC,SAA1B,EAAmD;AAAA,MAAdC,MAAc,uEAAL,EAAK;AACzD;AACA;AACA;AACA;AACA;AAEA,SAAOD,SAAS,CACdE,KADK,CACE,GADF,EAELC,GAFK,CAGHC,WAAF,IACE,0BAA0BA,WAAa,GACvCH,MAAM,GAAI,IAAIA,MAAQ,EAAhB,GAAoB,EAC1B,EANG,EAQLI,IARK,CAQC,GARD,CAAP;AASA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,cAAT,CACNC,QADM,EAENC,iBAFM,EAGNC,UAHM,EAINC,aAJM,EAKL;AAAA;;AACD,MAAIC,MAAM,GAAG,EAAb;;AACA,MACCH,iBAAiB,SAAjB,IAAAA,iBAAiB,WAAjB,6BAAAA,iBAAiB,CAAIC,UAAJ,CAAjB,kGAAmCG,aAAnC,0EAAkDC,MAAlD,IACAH,aAFD,EAGE;AACDF,IAAAA,iBAAiB,CAAEC,UAAF,CAAjB,CAAgCG,aAAhC,CAA8CE,OAA9C,CAAyDC,QAAF,IAAgB;AACtEJ,MAAAA,MAAM,IAAK,GAAGZ,eAAe,CAC5BQ,QAD4B,EAE5BQ,QAAQ,CAACR,QAAT,CAAkBS,IAAlB,EAF4B,CAG1B,KAHH;AAIAL,MAAAA,MAAM,IAAIM,MAAM,CAACC,OAAP,CAAgBH,QAAQ,CAACI,KAAzB,EACRhB,GADQ,CAER;AAAA,YAAE,CAAEiB,WAAF,EAAeC,KAAf,CAAF;AAAA,eACE,GAAGD,WAAa,KAAKC,KAAK,GAAGA,KAAH,GAAWX,aAAe,EADtD;AAAA,OAFQ,EAKRL,IALQ,CAKF,IALE,CAAV;AAMAM,MAAAA,MAAM,IAAI,KAAV;AACA,KAZD;AAaA;;AACD,SAAOA,MAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASW,iBAAT,CAA4BC,MAA5B,EAAqC;AAC3C,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,QAAf;AAAyBC,IAAAA,IAAI,GAAG;AAAhC,MAA8CH,MAApD;AACA,QAAMI,aAAa,GAAG,EAAtB;AACA,QAAMC,SAAS,GAAG,iCAAlB;;AACA,MAAKA,SAAS,CAACC,IAAV,CAAgBL,WAAhB,KAAiCE,IAAI,KAAK,aAA/C,EAA+D;AAC9D;AACAC,IAAAA,aAAa,CAACG,IAAd,GAAqBhC,OAAO,CAAED,EAAE,CAAE,aAAF,CAAJ,EAAuB2B,WAAvB,CAA5B;AACA;;AACD,MAAKI,SAAS,CAACC,IAAV,CAAgBJ,QAAhB,CAAL,EAAkC;AACjC;AACAE,IAAAA,aAAa,CAACI,IAAd,GAAqBjC,OAAO,CAAED,EAAE,CAAE,aAAF,CAAJ,EAAuB4B,QAAvB,CAA5B;AACA;;AACD,SAAOE,aAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Utility to generate the proper CSS selector for layout styles.\n *\n * @param {string} selectors CSS selector, also supports multiple comma-separated selectors.\n * @param {string} append The string to append.\n *\n * @return {string} - CSS selector.\n */\nexport function appendSelectors( selectors, append = '' ) {\n\t// Ideally we shouldn't need the `.editor-styles-wrapper` increased specificity here\n\t// The problem though is that we have a `.editor-styles-wrapper p { margin: reset; }` style\n\t// it's used to reset the default margin added by wp-admin to paragraphs\n\t// so we need this to be higher speficity otherwise, it won't be applied to paragraphs inside containers\n\t// When the post editor is fully iframed, this extra classname could be removed.\n\n\treturn selectors\n\t\t.split( ',' )\n\t\t.map(\n\t\t\t( subselector ) =>\n\t\t\t\t`.editor-styles-wrapper ${ subselector }${\n\t\t\t\t\tappend ? ` ${ append }` : ''\n\t\t\t\t}`\n\t\t)\n\t\t.join( ',' );\n}\n\n/**\n * Get generated blockGap CSS rules based on layout definitions provided in theme.json\n * Falsy values in the layout definition's spacingStyles rules will be swapped out\n * with the provided `blockGapValue`.\n *\n * @param {string} selector The CSS selector to target for the generated rules.\n * @param {Object} layoutDefinitions Layout definitions object from theme.json.\n * @param {string} layoutType The layout type (e.g. `default` or `flex`).\n * @param {string} blockGapValue The current blockGap value to be applied.\n * @return {string} The generated CSS rules.\n */\nexport function getBlockGapCSS(\n\tselector,\n\tlayoutDefinitions,\n\tlayoutType,\n\tblockGapValue\n) {\n\tlet output = '';\n\tif (\n\t\tlayoutDefinitions?.[ layoutType ]?.spacingStyles?.length &&\n\t\tblockGapValue\n\t) {\n\t\tlayoutDefinitions[ layoutType ].spacingStyles.forEach( ( gapStyle ) => {\n\t\t\toutput += `${ appendSelectors(\n\t\t\t\tselector,\n\t\t\t\tgapStyle.selector.trim()\n\t\t\t) } { `;\n\t\t\toutput += Object.entries( gapStyle.rules )\n\t\t\t\t.map(\n\t\t\t\t\t( [ cssProperty, value ] ) =>\n\t\t\t\t\t\t`${ cssProperty }: ${ value ? value : blockGapValue }`\n\t\t\t\t)\n\t\t\t\t.join( '; ' );\n\t\t\toutput += '; }';\n\t\t} );\n\t}\n\treturn output;\n}\n\n/**\n * Helper method to assign contextual info to clarify\n * alignment settings.\n *\n * Besides checking if `contentSize` and `wideSize` have a\n * value, we now show this information only if their values\n * are not a `css var`. This needs to change when parsing\n * css variables land.\n *\n * @see https://github.com/WordPress/gutenberg/pull/34710#issuecomment-918000752\n *\n * @param {Object} layout The layout object.\n * @return {Object} An object with contextual info per alignment.\n */\nexport function getAlignmentsInfo( layout ) {\n\tconst { contentSize, wideSize, type = 'default' } = layout;\n\tconst alignmentInfo = {};\n\tconst sizeRegex = /^(?!0)\\d+(px|em|rem|vw|vh|%)?$/i;\n\tif ( sizeRegex.test( contentSize ) && type === 'constrained' ) {\n\t\t// translators: %s: container size (i.e. 600px etc)\n\t\talignmentInfo.none = sprintf( __( 'Max %s wide' ), contentSize );\n\t}\n\tif ( sizeRegex.test( wideSize ) ) {\n\t\t// translators: %s: container size (i.e. 600px etc)\n\t\talignmentInfo.wide = sprintf( __( 'Max %s wide' ), wideSize );\n\t}\n\treturn alignmentInfo;\n}\n"]}
|
|
@@ -6,8 +6,12 @@ import { ExperimentalBlockEditorProvider } from './components/provider';
|
|
|
6
6
|
import { lock } from './lock-unlock';
|
|
7
7
|
import OffCanvasEditor from './components/off-canvas-editor';
|
|
8
8
|
import LeafMoreMenu from './components/off-canvas-editor/leaf-more-menu';
|
|
9
|
+
import ResizableBoxPopover from './components/resizable-box-popover';
|
|
9
10
|
import { ComposedPrivateInserter as PrivateInserter } from './components/inserter';
|
|
10
11
|
import { PrivateListView } from './components/list-view';
|
|
12
|
+
import BlockInfo from './components/block-info-slot-fill';
|
|
13
|
+
import { useShouldContextualToolbarShow } from './utils/use-should-contextual-toolbar-show';
|
|
14
|
+
import { cleanEmptyObject } from './hooks/utils';
|
|
11
15
|
/**
|
|
12
16
|
* Private @wordpress/block-editor APIs.
|
|
13
17
|
*/
|
|
@@ -18,6 +22,10 @@ lock(privateApis, { ...globalStyles,
|
|
|
18
22
|
LeafMoreMenu,
|
|
19
23
|
OffCanvasEditor,
|
|
20
24
|
PrivateInserter,
|
|
21
|
-
PrivateListView
|
|
25
|
+
PrivateListView,
|
|
26
|
+
ResizableBoxPopover,
|
|
27
|
+
BlockInfo,
|
|
28
|
+
useShouldContextualToolbarShow,
|
|
29
|
+
cleanEmptyObject
|
|
22
30
|
});
|
|
23
31
|
//# sourceMappingURL=private-apis.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/private-apis.js"],"names":["globalStyles","ExperimentalBlockEditorProvider","lock","OffCanvasEditor","LeafMoreMenu","ComposedPrivateInserter","PrivateInserter","PrivateListView","privateApis"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,YAAZ,MAA8B,4BAA9B;AACA,SAASC,+BAAT,QAAgD,uBAAhD;AACA,SAASC,IAAT,QAAqB,eAArB;AACA,OAAOC,eAAP,MAA4B,gCAA5B;AACA,OAAOC,YAAP,MAAyB,+CAAzB;AACA,SAASC,uBAAuB,IAAIC,eAApC,QAA2D,uBAA3D;AACA,SAASC,eAAT,QAAgC,wBAAhC;AAEA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAG,EAApB;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/private-apis.js"],"names":["globalStyles","ExperimentalBlockEditorProvider","lock","OffCanvasEditor","LeafMoreMenu","ResizableBoxPopover","ComposedPrivateInserter","PrivateInserter","PrivateListView","BlockInfo","useShouldContextualToolbarShow","cleanEmptyObject","privateApis"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,YAAZ,MAA8B,4BAA9B;AACA,SAASC,+BAAT,QAAgD,uBAAhD;AACA,SAASC,IAAT,QAAqB,eAArB;AACA,OAAOC,eAAP,MAA4B,gCAA5B;AACA,OAAOC,YAAP,MAAyB,+CAAzB;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;AAEA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAG,EAApB;AACPV,IAAI,CAAEU,WAAF,EAAe,EAClB,GAAGZ,YADe;AAElBC,EAAAA,+BAFkB;AAGlBG,EAAAA,YAHkB;AAIlBD,EAAAA,eAJkB;AAKlBI,EAAAA,eALkB;AAMlBC,EAAAA,eANkB;AAOlBH,EAAAA,mBAPkB;AAQlBI,EAAAA,SARkB;AASlBC,EAAAA,8BATkB;AAUlBC,EAAAA;AAVkB,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 OffCanvasEditor from './components/off-canvas-editor';\nimport LeafMoreMenu from './components/off-canvas-editor/leaf-more-menu';\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';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockEditorProvider,\n\tLeafMoreMenu,\n\tOffCanvasEditor,\n\tPrivateInserter,\n\tPrivateListView,\n\tResizableBoxPopover,\n\tBlockInfo,\n\tuseShouldContextualToolbarShow,\n\tcleanEmptyObject,\n} );\n"]}
|
|
@@ -71,7 +71,7 @@ export const resetBlocks = blocks => _ref2 => {
|
|
|
71
71
|
/**
|
|
72
72
|
* Block validity is a function of blocks state (at the point of a
|
|
73
73
|
* reset) and the template setting. As a compromise to its placement
|
|
74
|
-
* across distinct parts of state, it is implemented here as a side
|
|
74
|
+
* across distinct parts of state, it is implemented here as a side
|
|
75
75
|
* effect of the block reset action.
|
|
76
76
|
*
|
|
77
77
|
* @param {Array} blocks Array of blocks.
|
|
@@ -544,6 +544,9 @@ export function moveBlockToPosition(clientId) {
|
|
|
544
544
|
/**
|
|
545
545
|
* Action that inserts a single block, optionally at a specific index respective a root block list.
|
|
546
546
|
*
|
|
547
|
+
* Only allowed blocks are inserted. The action may fail silently for blocks that are not allowed or if
|
|
548
|
+
* a templateLock is active on the block list.
|
|
549
|
+
*
|
|
547
550
|
* @param {Object} block Block object to insert.
|
|
548
551
|
* @param {?number} index Index at which block should be inserted.
|
|
549
552
|
* @param {?string} rootClientId Optional root client ID of block list on which to insert.
|
|
@@ -561,12 +564,16 @@ export function insertBlock(block, index, rootClientId, updateSelection, meta) {
|
|
|
561
564
|
/**
|
|
562
565
|
* Action that inserts an array of blocks, optionally at a specific index respective a root block list.
|
|
563
566
|
*
|
|
567
|
+
* Only allowed blocks are inserted. The action may fail silently for blocks that are not allowed or if
|
|
568
|
+
* a templateLock is active on the block list.
|
|
569
|
+
*
|
|
564
570
|
* @param {Object[]} blocks Block objects to insert.
|
|
565
571
|
* @param {?number} index Index at which block should be inserted.
|
|
566
572
|
* @param {?string} rootClientId Optional root client ID of block list on which to insert.
|
|
567
573
|
* @param {?boolean} updateSelection If true block selection will be updated. If false, block selection will not change. Defaults to true.
|
|
568
574
|
* @param {0|-1|null} initialPosition Initial focus position. Setting it to null prevent focusing the inserted block.
|
|
569
575
|
* @param {?Object} meta Optional Meta values to be passed to the action object.
|
|
576
|
+
*
|
|
570
577
|
* @return {Object} Action object.
|
|
571
578
|
*/
|
|
572
579
|
|