@wordpress/block-editor 9.0.0 → 9.1.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 +2 -0
- package/README.md +1 -0
- package/build/components/block-alignment-matrix-control/index.js +1 -6
- package/build/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build/components/block-content-overlay/index.js +4 -82
- package/build/components/block-content-overlay/index.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.native.js +64 -0
- package/build/components/block-draggable/draggable-chip.native.js.map +1 -0
- package/build/components/block-draggable/dropping-insertion-point.native.js +157 -0
- package/build/components/block-draggable/dropping-insertion-point.native.js.map +1 -0
- package/build/components/block-draggable/index.native.js +484 -0
- package/build/components/block-draggable/index.native.js.map +1 -0
- package/build/components/block-draggable/use-scroll-when-dragging.native.js +130 -0
- package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -0
- package/build/components/block-list/block-list-context.native.js +195 -0
- package/build/components/block-list/block-list-context.native.js.map +1 -0
- package/build/components/block-list/block-list-item-cell.native.js +67 -0
- package/build/components/block-list/block-list-item-cell.native.js.map +1 -0
- package/build/components/block-list/block-list-item.native.js +12 -9
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block.native.js +26 -5
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +75 -23
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +8 -4
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +1 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-mobile-toolbar/index.native.js +9 -3
- package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build/components/block-mover/index.native.js +17 -4
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-popover/inbetween.js +10 -2
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +4 -16
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/index.js +1 -1
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +1 -29
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/border-radius-control/input-controls.js +10 -3
- package/build/components/border-radius-control/input-controls.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +149 -44
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/iframe/index.js +51 -50
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +3 -1
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/index.js +5 -14
- package/build/components/index.js.map +1 -1
- package/build/components/inserter/index.native.js +1 -1
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/link-control/constants.js +11 -1
- package/build/components/link-control/constants.js.map +1 -1
- package/build/components/link-control/search-results.js +4 -3
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/use-search-handler.js +4 -4
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/list-view/drop-indicator.js +0 -1
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +12 -2
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +0 -1
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +1 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/url-input/index.js +4 -1
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.native.js +167 -0
- package/build/components/use-block-drop-zone/index.native.js.map +1 -0
- package/build/components/use-on-block-drop/index.native.js +95 -0
- package/build/components/use-on-block-drop/index.native.js.map +1 -0
- package/build/components/warning/index.js +6 -1
- package/build/components/warning/index.js.map +1 -1
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border.js +2 -7
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +14 -7
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/style.js +14 -13
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +6 -2
- package/build/hooks/typography.js.map +1 -1
- package/build-module/components/block-alignment-matrix-control/index.js +1 -6
- package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build-module/components/block-content-overlay/index.js +3 -78
- package/build-module/components/block-content-overlay/index.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.native.js +50 -0
- package/build-module/components/block-draggable/draggable-chip.native.js.map +1 -0
- package/build-module/components/block-draggable/dropping-insertion-point.native.js +137 -0
- package/build-module/components/block-draggable/dropping-insertion-point.native.js.map +1 -0
- package/build-module/components/block-draggable/index.native.js +449 -0
- package/build-module/components/block-draggable/index.native.js.map +1 -0
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +120 -0
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -0
- package/build-module/components/block-list/block-list-context.native.js +179 -0
- package/build-module/components/block-list/block-list-context.native.js.map +1 -0
- package/build-module/components/block-list/block-list-item-cell.native.js +59 -0
- package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -0
- package/build-module/components/block-list/block-list-item.native.js +12 -9
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block.native.js +25 -5
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +72 -23
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +9 -5
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +8 -3
- package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +18 -5
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +10 -2
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +4 -15
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/index.js +1 -1
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +2 -29
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/border-radius-control/input-controls.js +11 -4
- package/build-module/components/border-radius-control/input-controls.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +151 -46
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/iframe/index.js +52 -51
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +2 -1
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/index.js +1 -2
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +1 -1
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/link-control/constants.js +5 -0
- package/build-module/components/link-control/constants.js.map +1 -1
- package/build-module/components/link-control/search-results.js +3 -4
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js +5 -5
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +0 -1
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +12 -2
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +0 -1
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/url-input/index.js +4 -1
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.native.js +148 -0
- package/build-module/components/use-block-drop-zone/index.native.js.map +1 -0
- package/build-module/components/use-on-block-drop/index.native.js +83 -0
- package/build-module/components/use-on-block-drop/index.native.js.map +1 -0
- package/build-module/components/warning/index.js +6 -1
- package/build-module/components/warning/index.js.map +1 -1
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border.js +2 -7
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +11 -6
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/style.js +15 -14
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/typography.js +6 -2
- package/build-module/hooks/typography.js.map +1 -1
- package/build-style/style-rtl.css +60 -174
- package/build-style/style.css +60 -174
- package/package.json +28 -28
- package/src/components/block-alignment-matrix-control/index.js +1 -5
- package/src/components/block-content-overlay/index.js +8 -95
- package/src/components/block-content-overlay/style.scss +2 -11
- package/src/components/block-draggable/draggable-chip.native.js +49 -0
- package/src/components/block-draggable/dropping-insertion-point.native.js +181 -0
- package/src/components/block-draggable/dropping-insertion-point.native.scss +8 -0
- package/src/components/block-draggable/index.native.js +458 -0
- package/src/components/block-draggable/style.native.scss +19 -0
- package/src/components/block-draggable/use-scroll-when-dragging.native.js +135 -0
- package/src/components/block-list/block-list-context.native.js +175 -0
- package/src/components/block-list/block-list-item-cell.native.js +49 -0
- package/src/components/block-list/block-list-item.native.js +7 -11
- package/src/components/block-list/block.native.js +36 -8
- package/src/components/block-list/index.native.js +54 -13
- package/src/components/block-list/test/block-list-context.native.js +253 -0
- package/src/components/block-list/test/fixtures/block-list-context.native.js +79 -0
- package/src/components/block-list/use-block-props/index.js +10 -5
- package/src/components/block-list/use-in-between-inserter.js +1 -1
- package/src/components/block-mobile-toolbar/index.native.js +8 -1
- package/src/components/block-mover/index.native.js +22 -6
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +6 -0
- package/src/components/block-popover/inbetween.js +9 -1
- package/src/components/block-popover/index.js +1 -16
- package/src/components/block-popover/style.scss +1 -0
- package/src/components/block-preview/index.js +1 -4
- package/src/components/block-switcher/style.scss +2 -39
- package/src/components/block-tools/selected-block-popover.js +1 -36
- package/src/components/block-tools/style.scss +1 -12
- package/src/components/border-radius-control/input-controls.js +16 -8
- package/src/components/border-radius-control/style.scss +3 -2
- package/src/components/colors-gradients/dropdown.js +156 -62
- package/src/components/colors-gradients/style.scss +51 -23
- package/src/components/duotone-control/style.scss +1 -7
- package/src/components/iframe/index.js +62 -54
- package/src/components/image-editor/use-save-image.js +2 -1
- package/src/components/index.js +1 -2
- package/src/components/inserter/index.native.js +1 -1
- package/src/components/inserter/style.scss +2 -1
- package/src/components/link-control/constants.js +11 -0
- package/src/components/link-control/search-results.js +4 -5
- package/src/components/link-control/use-search-handler.js +11 -5
- package/src/components/list-view/drop-indicator.js +0 -1
- package/src/components/list-view/style.scss +2 -1
- package/src/components/navigable-toolbar/index.js +12 -2
- package/src/components/preview-options/style.scss +0 -4
- package/src/components/rich-text/format-toolbar-container.js +0 -1
- package/src/components/rich-text/index.js +1 -1
- package/src/components/rich-text/style.scss +2 -8
- package/src/components/url-input/index.js +3 -1
- package/src/components/use-block-drop-zone/index.native.js +173 -0
- package/src/components/use-on-block-drop/index.native.js +119 -0
- package/src/components/warning/index.js +47 -42
- package/src/components/warning/test/__snapshots__/index.js.snap +15 -6
- package/src/components/warning/test/index.js +1 -1
- package/src/hooks/anchor.js +1 -1
- package/src/hooks/border.js +2 -11
- package/src/hooks/border.scss +0 -48
- package/src/hooks/color-panel.js +13 -9
- package/src/hooks/color.scss +0 -62
- package/src/hooks/style.js +25 -39
- package/src/hooks/typography.js +2 -0
- package/src/style.scss +0 -1
- package/build/components/colors-gradients/tools-panel-color-dropdown.js +0 -89
- package/build/components/colors-gradients/tools-panel-color-dropdown.js.map +0 -1
- package/build-module/components/colors-gradients/tools-panel-color-dropdown.js +0 -75
- package/build-module/components/colors-gradients/tools-panel-color-dropdown.js.map +0 -1
- package/src/components/block-alignment-matrix-control/style.scss +0 -10
- package/src/components/colors-gradients/tools-panel-color-dropdown.js +0 -85
|
@@ -18,7 +18,7 @@ describe( 'Warning', () => {
|
|
|
18
18
|
it( 'should have valid class', () => {
|
|
19
19
|
const wrapper = shallow( <Warning /> );
|
|
20
20
|
|
|
21
|
-
expect( wrapper.
|
|
21
|
+
expect( wrapper.find( '.block-editor-warning' ) ).toHaveLength( 1 );
|
|
22
22
|
expect( wrapper.find( '.block-editor-warning__actions' ) ).toHaveLength(
|
|
23
23
|
0
|
|
24
24
|
);
|
package/src/hooks/anchor.js
CHANGED
|
@@ -117,7 +117,7 @@ export const withInspectorControl = createHigherOrderComponent(
|
|
|
117
117
|
* We plan to remove scoping anchors to 'core/heading' to support
|
|
118
118
|
* anchors for all eligble blocks. Additionally we plan to explore
|
|
119
119
|
* leveraging InspectorAdvancedControls instead of a custom
|
|
120
|
-
* PanelBody title. https://
|
|
120
|
+
* PanelBody title. https://github.com/WordPress/gutenberg/issues/28363
|
|
121
121
|
*/ }
|
|
122
122
|
{ ! isWeb && props.name === 'core/heading' && (
|
|
123
123
|
<InspectorControls>
|
package/src/hooks/border.js
CHANGED
|
@@ -269,17 +269,8 @@ export function BorderPanel( props ) {
|
|
|
269
269
|
colors={ colors }
|
|
270
270
|
enableAlpha={ true }
|
|
271
271
|
onChange={ onBorderChange }
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
top:
|
|
275
|
-
'block-editor__border-box-control__popover-top',
|
|
276
|
-
right:
|
|
277
|
-
'block-editor__border-box-control__popover-right',
|
|
278
|
-
bottom:
|
|
279
|
-
'block-editor__border-box-control__popover-bottom',
|
|
280
|
-
left:
|
|
281
|
-
'block-editor__border-box-control__popover-left',
|
|
282
|
-
} }
|
|
272
|
+
popoverPlacement="left-start"
|
|
273
|
+
popoverOffset={ 40 }
|
|
283
274
|
showStyle={ isStyleSupported }
|
|
284
275
|
value={ hydratedBorder }
|
|
285
276
|
__experimentalHasMultipleOrigins={ true }
|
package/src/hooks/border.scss
CHANGED
|
@@ -3,51 +3,3 @@
|
|
|
3
3
|
grid-column: span 1;
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
.block-editor__border-box-control__popover,
|
|
8
|
-
.block-editor__border-box-control__popover-top,
|
|
9
|
-
.block-editor__border-box-control__popover-right,
|
|
10
|
-
.block-editor__border-box-control__popover-bottom,
|
|
11
|
-
.block-editor__border-box-control__popover-left {
|
|
12
|
-
.components-popover__content {
|
|
13
|
-
width: 282px;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
$split-border-control-offset: 55px;
|
|
18
|
-
|
|
19
|
-
@include break-medium() {
|
|
20
|
-
.block-editor__border-box-control__popover,
|
|
21
|
-
.block-editor__border-box-control__popover-left {
|
|
22
|
-
.components-popover__content {
|
|
23
|
-
margin-right: #{ $grid-unit-50 + $grid-unit-15 } !important;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.block-editor__border-box-control__popover-top,
|
|
28
|
-
.block-editor__border-box-control__popover-bottom {
|
|
29
|
-
.components-popover__content {
|
|
30
|
-
margin-right: #{ $grid-unit-50 + $grid-unit-15 + $split-border-control-offset } !important;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.block-editor__border-box-control__popover-right {
|
|
35
|
-
.components-popover__content {
|
|
36
|
-
margin-right: #{ $grid-unit-50 + $grid-unit-15 + ( $split-border-control-offset * 2 )} !important;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.block-editor__border-box-control__popover,
|
|
41
|
-
.block-editor__border-box-control__popover-top,
|
|
42
|
-
.block-editor__border-box-control__popover-right,
|
|
43
|
-
.block-editor__border-box-control__popover-bottom,
|
|
44
|
-
.block-editor__border-box-control__popover-left {
|
|
45
|
-
&.is-from-top .components-popover__content {
|
|
46
|
-
margin-top: #{ -($grid-unit-50 + $grid-unit-15) } !important;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
&.is-from-bottom .components-popover__content {
|
|
50
|
-
margin-bottom: #{ -($grid-unit-50 + $grid-unit-15) } !important;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
package/src/hooks/color-panel.js
CHANGED
|
@@ -6,9 +6,10 @@ import { useState, useEffect } from '@wordpress/element';
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
+
import ColorGradientSettingsDropdown from '../components/colors-gradients/dropdown';
|
|
9
10
|
import ContrastChecker from '../components/contrast-checker';
|
|
10
|
-
import ToolsPanelColorDropdown from '../components/colors-gradients/tools-panel-color-dropdown';
|
|
11
11
|
import InspectorControls from '../components/inspector-controls';
|
|
12
|
+
import useMultipleOriginColorsAndGradients from '../components/colors-gradients/use-multiple-origin-colors-and-gradients';
|
|
12
13
|
import { __unstableUseBlockRef as useBlockRef } from '../components/block-list/use-block-props/use-block-refs';
|
|
13
14
|
|
|
14
15
|
function getComputedStyle( node ) {
|
|
@@ -58,16 +59,19 @@ export default function ColorPanel( {
|
|
|
58
59
|
setDetectedBackgroundColor( backgroundColor );
|
|
59
60
|
} );
|
|
60
61
|
|
|
62
|
+
const colorGradientSettings = useMultipleOriginColorsAndGradients();
|
|
63
|
+
|
|
61
64
|
return (
|
|
62
65
|
<InspectorControls __experimentalGroup="color">
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
<ColorGradientSettingsDropdown
|
|
67
|
+
enableAlpha={ enableAlpha }
|
|
68
|
+
panelId={ clientId }
|
|
69
|
+
settings={ settings }
|
|
70
|
+
__experimentalIsItemGroup={ false }
|
|
71
|
+
__experimentalHasMultipleOrigins
|
|
72
|
+
__experimentalIsRenderedInSidebar
|
|
73
|
+
{ ...colorGradientSettings }
|
|
74
|
+
/>
|
|
71
75
|
{ enableContrastChecking && (
|
|
72
76
|
<ContrastChecker
|
|
73
77
|
backgroundColor={ detectedBackgroundColor }
|
package/src/hooks/color.scss
CHANGED
|
@@ -20,66 +20,4 @@
|
|
|
20
20
|
row-gap: 0;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* The following styles replicate the separated border of the
|
|
26
|
-
* `ItemGroup` component but allows for hidden items. This is because
|
|
27
|
-
* to maintain the order of `ToolsPanel` controls, each `ToolsPanelItem`
|
|
28
|
-
* must at least render a placeholder which would otherwise interfere
|
|
29
|
-
* with the `:last-child` styles.
|
|
30
|
-
*/
|
|
31
|
-
.block-editor-tools-panel-color-gradient-settings__item {
|
|
32
|
-
padding: 0;
|
|
33
|
-
|
|
34
|
-
// Border styles.
|
|
35
|
-
border-left: 1px solid rgba(0, 0, 0, 0.1);
|
|
36
|
-
border-right: 1px solid rgba(0, 0, 0, 0.1);
|
|
37
|
-
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
38
|
-
|
|
39
|
-
&.first {
|
|
40
|
-
border-top-left-radius: 2px;
|
|
41
|
-
border-top-right-radius: 2px;
|
|
42
|
-
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&.last {
|
|
46
|
-
border-bottom-left-radius: 2px;
|
|
47
|
-
border-bottom-right-radius: 2px;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
> div,
|
|
51
|
-
> div > button {
|
|
52
|
-
border-radius: inherit;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.block-editor-panel-color-gradient-settings__color-indicator {
|
|
57
|
-
// Show a diagonal line (crossed out) for empty swatches.
|
|
58
|
-
background: linear-gradient(-45deg, transparent 48%, $gray-300 48%, $gray-300 52%, transparent 52%);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* The following few styles fix the layout and spacing for the due to the
|
|
63
|
-
* introduced wrapper element by the `Item` component.
|
|
64
|
-
*/
|
|
65
|
-
.block-editor-tools-panel-color-dropdown {
|
|
66
|
-
display: block;
|
|
67
|
-
padding: 0;
|
|
68
|
-
|
|
69
|
-
> button {
|
|
70
|
-
height: 46px;
|
|
71
|
-
|
|
72
|
-
&.is-open {
|
|
73
|
-
background: $gray-100;
|
|
74
|
-
color: var(--wp-admin-theme-color);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.color-block-support-panel__item-group {
|
|
80
|
-
> div {
|
|
81
|
-
grid-column: span 2;
|
|
82
|
-
border-radius: inherit;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
23
|
}
|
package/src/hooks/style.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
first,
|
|
6
|
-
forEach,
|
|
7
|
-
get,
|
|
8
|
-
has,
|
|
9
|
-
isEmpty,
|
|
10
|
-
isString,
|
|
11
|
-
kebabCase,
|
|
12
|
-
map,
|
|
13
|
-
omit,
|
|
14
|
-
startsWith,
|
|
15
|
-
} from 'lodash';
|
|
4
|
+
import { get, has, isEmpty, kebabCase, omit } from 'lodash';
|
|
16
5
|
import classnames from 'classnames';
|
|
17
6
|
|
|
18
7
|
/**
|
|
@@ -58,7 +47,7 @@ const VARIABLE_REFERENCE_PREFIX = 'var:';
|
|
|
58
47
|
const VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';
|
|
59
48
|
const VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';
|
|
60
49
|
function compileStyleValue( uncompiledValue ) {
|
|
61
|
-
if ( startsWith(
|
|
50
|
+
if ( uncompiledValue?.startsWith?.( VARIABLE_REFERENCE_PREFIX ) ) {
|
|
62
51
|
const variable = uncompiledValue
|
|
63
52
|
.slice( VARIABLE_REFERENCE_PREFIX.length )
|
|
64
53
|
.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )
|
|
@@ -82,13 +71,13 @@ export function getInlineStyles( styles = {} ) {
|
|
|
82
71
|
const path = STYLE_PROPERTY[ propKey ].value;
|
|
83
72
|
const subPaths = STYLE_PROPERTY[ propKey ].properties;
|
|
84
73
|
// Ignore styles on elements because they are handled on the server.
|
|
85
|
-
if ( has( styles, path ) && 'elements' !==
|
|
74
|
+
if ( has( styles, path ) && 'elements' !== path?.[ 0 ] ) {
|
|
86
75
|
// Checking if style value is a string allows for shorthand css
|
|
87
76
|
// option and backwards compatibility for border radius support.
|
|
88
77
|
const styleValue = get( styles, path );
|
|
89
78
|
|
|
90
79
|
if ( ! STYLE_PROPERTY[ propKey ].useEngine ) {
|
|
91
|
-
if ( !! subPaths &&
|
|
80
|
+
if ( !! subPaths && typeof styleValue !== 'string' ) {
|
|
92
81
|
Object.entries( subPaths ).forEach( ( entry ) => {
|
|
93
82
|
const [ name, subPath ] = entry;
|
|
94
83
|
const value = get( styleValue, [ subPath ] );
|
|
@@ -108,11 +97,8 @@ export function getInlineStyles( styles = {} ) {
|
|
|
108
97
|
|
|
109
98
|
// The goal is to move everything to server side generated engine styles
|
|
110
99
|
// This is temporary as we absorb more and more styles into the engine.
|
|
111
|
-
const extraRules = getCSSRules( styles
|
|
100
|
+
const extraRules = getCSSRules( styles );
|
|
112
101
|
extraRules.forEach( ( rule ) => {
|
|
113
|
-
if ( rule.selector !== 'self' ) {
|
|
114
|
-
throw "This style can't be added as inline style";
|
|
115
|
-
}
|
|
116
102
|
output[ rule.key ] = rule.value;
|
|
117
103
|
} );
|
|
118
104
|
|
|
@@ -120,24 +106,25 @@ export function getInlineStyles( styles = {} ) {
|
|
|
120
106
|
}
|
|
121
107
|
|
|
122
108
|
function compileElementsStyles( selector, elements = {} ) {
|
|
123
|
-
return
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
elementStyles
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
109
|
+
return Object.entries( elements )
|
|
110
|
+
.map( ( [ element, styles ] ) => {
|
|
111
|
+
const elementStyles = getInlineStyles( styles );
|
|
112
|
+
if ( ! isEmpty( elementStyles ) ) {
|
|
113
|
+
// The .editor-styles-wrapper selector is required on elements styles. As it is
|
|
114
|
+
// added to all other editor styles, not providing it causes reset and global
|
|
115
|
+
// styles to override element styles because of higher specificity.
|
|
116
|
+
return [
|
|
117
|
+
`.editor-styles-wrapper .${ selector } ${ ELEMENTS[ element ] }{`,
|
|
118
|
+
...Object.entries( elementStyles ).map(
|
|
119
|
+
( [ cssProperty, value ] ) =>
|
|
120
|
+
`\t${ kebabCase( cssProperty ) }: ${ value };`
|
|
121
|
+
),
|
|
122
|
+
'}',
|
|
123
|
+
].join( '\n' );
|
|
124
|
+
}
|
|
125
|
+
return '';
|
|
126
|
+
} )
|
|
127
|
+
.join( '\n' );
|
|
141
128
|
}
|
|
142
129
|
|
|
143
130
|
/**
|
|
@@ -235,8 +222,7 @@ export function addSaveProps(
|
|
|
235
222
|
}
|
|
236
223
|
|
|
237
224
|
let { style } = attributes;
|
|
238
|
-
|
|
239
|
-
forEach( skipPaths, ( path, indicator ) => {
|
|
225
|
+
Object.entries( skipPaths ).forEach( ( [ indicator, path ] ) => {
|
|
240
226
|
const skipSerialization = getBlockSupport( blockType, indicator );
|
|
241
227
|
|
|
242
228
|
if ( skipSerialization === true ) {
|
package/src/hooks/typography.js
CHANGED
|
@@ -130,6 +130,7 @@ export function TypographyPanel( props ) {
|
|
|
130
130
|
{ ! isFontSizeDisabled && (
|
|
131
131
|
<ToolsPanelItem
|
|
132
132
|
hasValue={ () => hasFontSizeValue( props ) }
|
|
133
|
+
/* translators: Ensure translation is distinct from "Letter case" */
|
|
133
134
|
label={ __( 'Font size' ) }
|
|
134
135
|
onDeselect={ () => resetFontSize( props ) }
|
|
135
136
|
isShownByDefault={ defaultControls?.fontSize }
|
|
@@ -205,6 +206,7 @@ export function TypographyPanel( props ) {
|
|
|
205
206
|
<ToolsPanelItem
|
|
206
207
|
className="single-column"
|
|
207
208
|
hasValue={ () => hasTextTransformValue( props ) }
|
|
209
|
+
/* translators: Ensure translation is distinct from "Font size" */
|
|
208
210
|
label={ __( 'Letter case' ) }
|
|
209
211
|
onDeselect={ () => resetTextTransform( props ) }
|
|
210
212
|
isShownByDefault={ defaultControls?.textTransform }
|
package/src/style.scss
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
@import "./autocompleters/style.scss";
|
|
2
2
|
@import "./components/block-alignment-control/style.scss";
|
|
3
|
-
@import "./components/block-alignment-matrix-control/style.scss";
|
|
4
3
|
@import "./components/block-icon/style.scss";
|
|
5
4
|
@import "./components/block-inspector/style.scss";
|
|
6
5
|
@import "./components/block-list/style.scss";
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = ToolsPanelColorDropdown;
|
|
9
|
-
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
|
|
16
|
-
var _components = require("@wordpress/components");
|
|
17
|
-
|
|
18
|
-
var _control = _interopRequireDefault(require("./control"));
|
|
19
|
-
|
|
20
|
-
var _useMultipleOriginColorsAndGradients = _interopRequireDefault(require("./use-multiple-origin-colors-and-gradients"));
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* External dependencies
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* WordPress dependencies
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Internal dependencies
|
|
32
|
-
*/
|
|
33
|
-
function ToolsPanelColorDropdown(_ref) {
|
|
34
|
-
var _settings$gradientVal;
|
|
35
|
-
|
|
36
|
-
let {
|
|
37
|
-
settings,
|
|
38
|
-
enableAlpha,
|
|
39
|
-
...otherProps
|
|
40
|
-
} = _ref;
|
|
41
|
-
const colorGradientSettings = (0, _useMultipleOriginColorsAndGradients.default)();
|
|
42
|
-
const controlSettings = { ...colorGradientSettings,
|
|
43
|
-
clearable: false,
|
|
44
|
-
enableAlpha,
|
|
45
|
-
label: settings.label,
|
|
46
|
-
onColorChange: settings.onColorChange,
|
|
47
|
-
onGradientChange: settings.onGradientChange,
|
|
48
|
-
colorValue: settings.colorValue,
|
|
49
|
-
gradientValue: settings.gradientValue
|
|
50
|
-
};
|
|
51
|
-
const selectedColor = (_settings$gradientVal = settings.gradientValue) !== null && _settings$gradientVal !== void 0 ? _settings$gradientVal : settings.colorValue;
|
|
52
|
-
return (0, _element.createElement)(_components.__experimentalToolsPanelItem, (0, _extends2.default)({
|
|
53
|
-
hasValue: settings.hasValue,
|
|
54
|
-
label: settings.label,
|
|
55
|
-
onDeselect: settings.onDeselect,
|
|
56
|
-
isShownByDefault: settings.isShownByDefault,
|
|
57
|
-
resetAllFilter: settings.resetAllFilter
|
|
58
|
-
}, otherProps, {
|
|
59
|
-
className: "block-editor-tools-panel-color-gradient-settings__item"
|
|
60
|
-
}), (0, _element.createElement)(_components.Dropdown, {
|
|
61
|
-
className: "block-editor-tools-panel-color-dropdown",
|
|
62
|
-
contentClassName: "block-editor-panel-color-gradient-settings__dropdown-content",
|
|
63
|
-
renderToggle: _ref2 => {
|
|
64
|
-
let {
|
|
65
|
-
isOpen,
|
|
66
|
-
onToggle
|
|
67
|
-
} = _ref2;
|
|
68
|
-
return (0, _element.createElement)(_components.Button, {
|
|
69
|
-
onClick: onToggle,
|
|
70
|
-
"aria-expanded": isOpen,
|
|
71
|
-
className: (0, _classnames.default)('block-editor-panel-color-gradient-settings__dropdown', {
|
|
72
|
-
'is-open': isOpen
|
|
73
|
-
})
|
|
74
|
-
}, (0, _element.createElement)(_components.__experimentalHStack, {
|
|
75
|
-
justify: "flex-start"
|
|
76
|
-
}, (0, _element.createElement)(_components.ColorIndicator, {
|
|
77
|
-
className: "block-editor-panel-color-gradient-settings__color-indicator",
|
|
78
|
-
colorValue: selectedColor
|
|
79
|
-
}), (0, _element.createElement)(_components.FlexItem, null, settings.label)));
|
|
80
|
-
},
|
|
81
|
-
renderContent: () => (0, _element.createElement)(_control.default, (0, _extends2.default)({
|
|
82
|
-
showTitle: false,
|
|
83
|
-
__experimentalHasMultipleOrigins: true,
|
|
84
|
-
__experimentalIsRenderedInSidebar: true,
|
|
85
|
-
enableAlpha: true
|
|
86
|
-
}, controlSettings))
|
|
87
|
-
}));
|
|
88
|
-
}
|
|
89
|
-
//# sourceMappingURL=tools-panel-color-dropdown.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/colors-gradients/tools-panel-color-dropdown.js"],"names":["ToolsPanelColorDropdown","settings","enableAlpha","otherProps","colorGradientSettings","controlSettings","clearable","label","onColorChange","onGradientChange","colorValue","gradientValue","selectedColor","hasValue","onDeselect","isShownByDefault","resetAllFilter","isOpen","onToggle"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AAYA;;AACA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;AAIe,SAASA,uBAAT,OAIX;AAAA;;AAAA,MAJ6C;AAChDC,IAAAA,QADgD;AAEhDC,IAAAA,WAFgD;AAGhD,OAAGC;AAH6C,GAI7C;AACH,QAAMC,qBAAqB,GAAG,mDAA9B;AACA,QAAMC,eAAe,GAAG,EACvB,GAAGD,qBADoB;AAEvBE,IAAAA,SAAS,EAAE,KAFY;AAGvBJ,IAAAA,WAHuB;AAIvBK,IAAAA,KAAK,EAAEN,QAAQ,CAACM,KAJO;AAKvBC,IAAAA,aAAa,EAAEP,QAAQ,CAACO,aALD;AAMvBC,IAAAA,gBAAgB,EAAER,QAAQ,CAACQ,gBANJ;AAOvBC,IAAAA,UAAU,EAAET,QAAQ,CAACS,UAPE;AAQvBC,IAAAA,aAAa,EAAEV,QAAQ,CAACU;AARD,GAAxB;AAUA,QAAMC,aAAa,4BAAGX,QAAQ,CAACU,aAAZ,yEAA6BV,QAAQ,CAACS,UAAzD;AAEA,SACC,4BAAC,wCAAD;AACC,IAAA,QAAQ,EAAGT,QAAQ,CAACY,QADrB;AAEC,IAAA,KAAK,EAAGZ,QAAQ,CAACM,KAFlB;AAGC,IAAA,UAAU,EAAGN,QAAQ,CAACa,UAHvB;AAIC,IAAA,gBAAgB,EAAGb,QAAQ,CAACc,gBAJ7B;AAKC,IAAA,cAAc,EAAGd,QAAQ,CAACe;AAL3B,KAMMb,UANN;AAOC,IAAA,SAAS,EAAC;AAPX,MASC,4BAAC,oBAAD;AACC,IAAA,SAAS,EAAC,yCADX;AAEC,IAAA,gBAAgB,EAAC,8DAFlB;AAGC,IAAA,YAAY,EAAG;AAAA,UAAE;AAAEc,QAAAA,MAAF;AAAUC,QAAAA;AAAV,OAAF;AAAA,aACd,4BAAC,kBAAD;AACC,QAAA,OAAO,EAAGA,QADX;AAEC,yBAAgBD,MAFjB;AAGC,QAAA,SAAS,EAAG,yBACX,sDADW,EAEX;AAAE,qBAAWA;AAAb,SAFW;AAHb,SAQC,4BAAC,gCAAD;AAAQ,QAAA,OAAO,EAAC;AAAhB,SACC,4BAAC,0BAAD;AACC,QAAA,SAAS,EAAC,6DADX;AAEC,QAAA,UAAU,EAAGL;AAFd,QADD,EAKC,4BAAC,oBAAD,QAAYX,QAAQ,CAACM,KAArB,CALD,CARD,CADc;AAAA,KAHhB;AAqBC,IAAA,aAAa,EAAG,MACf,4BAAC,gBAAD;AACC,MAAA,SAAS,EAAG,KADb;AAEC,MAAA,gCAAgC,MAFjC;AAGC,MAAA,iCAAiC,MAHlC;AAIC,MAAA,WAAW;AAJZ,OAKMF,eALN;AAtBF,IATD,CADD;AA2CA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tColorIndicator,\n\tDropdown,\n\tFlexItem,\n\t__experimentalHStack as HStack,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ColorGradientControl from './control';\nimport useMultipleOriginColorsAndGradients from './use-multiple-origin-colors-and-gradients';\n\nexport default function ToolsPanelColorDropdown( {\n\tsettings,\n\tenableAlpha,\n\t...otherProps\n} ) {\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\tconst controlSettings = {\n\t\t...colorGradientSettings,\n\t\tclearable: false,\n\t\tenableAlpha,\n\t\tlabel: settings.label,\n\t\tonColorChange: settings.onColorChange,\n\t\tonGradientChange: settings.onGradientChange,\n\t\tcolorValue: settings.colorValue,\n\t\tgradientValue: settings.gradientValue,\n\t};\n\tconst selectedColor = settings.gradientValue ?? settings.colorValue;\n\n\treturn (\n\t\t<ToolsPanelItem\n\t\t\thasValue={ settings.hasValue }\n\t\t\tlabel={ settings.label }\n\t\t\tonDeselect={ settings.onDeselect }\n\t\t\tisShownByDefault={ settings.isShownByDefault }\n\t\t\tresetAllFilter={ settings.resetAllFilter }\n\t\t\t{ ...otherProps }\n\t\t\tclassName=\"block-editor-tools-panel-color-gradient-settings__item\"\n\t\t>\n\t\t\t<Dropdown\n\t\t\t\tclassName=\"block-editor-tools-panel-color-dropdown\"\n\t\t\t\tcontentClassName=\"block-editor-panel-color-gradient-settings__dropdown-content\"\n\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'block-editor-panel-color-gradient-settings__dropdown',\n\t\t\t\t\t\t\t{ 'is-open': isOpen }\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\t\tclassName=\"block-editor-panel-color-gradient-settings__color-indicator\"\n\t\t\t\t\t\t\t\tcolorValue={ selectedColor }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<FlexItem>{ settings.label }</FlexItem>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\trenderContent={ () => (\n\t\t\t\t\t<ColorGradientControl\n\t\t\t\t\t\tshowTitle={ false }\n\t\t\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t\t{ ...controlSettings }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t/>\n\t\t</ToolsPanelItem>\n\t);\n}\n"]}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { createElement } from "@wordpress/element";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* External dependencies
|
|
6
|
-
*/
|
|
7
|
-
import classnames from 'classnames';
|
|
8
|
-
/**
|
|
9
|
-
* WordPress dependencies
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { Button, ColorIndicator, Dropdown, FlexItem, __experimentalHStack as HStack, __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import ColorGradientControl from './control';
|
|
18
|
-
import useMultipleOriginColorsAndGradients from './use-multiple-origin-colors-and-gradients';
|
|
19
|
-
export default function ToolsPanelColorDropdown(_ref) {
|
|
20
|
-
var _settings$gradientVal;
|
|
21
|
-
|
|
22
|
-
let {
|
|
23
|
-
settings,
|
|
24
|
-
enableAlpha,
|
|
25
|
-
...otherProps
|
|
26
|
-
} = _ref;
|
|
27
|
-
const colorGradientSettings = useMultipleOriginColorsAndGradients();
|
|
28
|
-
const controlSettings = { ...colorGradientSettings,
|
|
29
|
-
clearable: false,
|
|
30
|
-
enableAlpha,
|
|
31
|
-
label: settings.label,
|
|
32
|
-
onColorChange: settings.onColorChange,
|
|
33
|
-
onGradientChange: settings.onGradientChange,
|
|
34
|
-
colorValue: settings.colorValue,
|
|
35
|
-
gradientValue: settings.gradientValue
|
|
36
|
-
};
|
|
37
|
-
const selectedColor = (_settings$gradientVal = settings.gradientValue) !== null && _settings$gradientVal !== void 0 ? _settings$gradientVal : settings.colorValue;
|
|
38
|
-
return createElement(ToolsPanelItem, _extends({
|
|
39
|
-
hasValue: settings.hasValue,
|
|
40
|
-
label: settings.label,
|
|
41
|
-
onDeselect: settings.onDeselect,
|
|
42
|
-
isShownByDefault: settings.isShownByDefault,
|
|
43
|
-
resetAllFilter: settings.resetAllFilter
|
|
44
|
-
}, otherProps, {
|
|
45
|
-
className: "block-editor-tools-panel-color-gradient-settings__item"
|
|
46
|
-
}), createElement(Dropdown, {
|
|
47
|
-
className: "block-editor-tools-panel-color-dropdown",
|
|
48
|
-
contentClassName: "block-editor-panel-color-gradient-settings__dropdown-content",
|
|
49
|
-
renderToggle: _ref2 => {
|
|
50
|
-
let {
|
|
51
|
-
isOpen,
|
|
52
|
-
onToggle
|
|
53
|
-
} = _ref2;
|
|
54
|
-
return createElement(Button, {
|
|
55
|
-
onClick: onToggle,
|
|
56
|
-
"aria-expanded": isOpen,
|
|
57
|
-
className: classnames('block-editor-panel-color-gradient-settings__dropdown', {
|
|
58
|
-
'is-open': isOpen
|
|
59
|
-
})
|
|
60
|
-
}, createElement(HStack, {
|
|
61
|
-
justify: "flex-start"
|
|
62
|
-
}, createElement(ColorIndicator, {
|
|
63
|
-
className: "block-editor-panel-color-gradient-settings__color-indicator",
|
|
64
|
-
colorValue: selectedColor
|
|
65
|
-
}), createElement(FlexItem, null, settings.label)));
|
|
66
|
-
},
|
|
67
|
-
renderContent: () => createElement(ColorGradientControl, _extends({
|
|
68
|
-
showTitle: false,
|
|
69
|
-
__experimentalHasMultipleOrigins: true,
|
|
70
|
-
__experimentalIsRenderedInSidebar: true,
|
|
71
|
-
enableAlpha: true
|
|
72
|
-
}, controlSettings))
|
|
73
|
-
}));
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=tools-panel-color-dropdown.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/colors-gradients/tools-panel-color-dropdown.js"],"names":["classnames","Button","ColorIndicator","Dropdown","FlexItem","__experimentalHStack","HStack","__experimentalToolsPanelItem","ToolsPanelItem","ColorGradientControl","useMultipleOriginColorsAndGradients","ToolsPanelColorDropdown","settings","enableAlpha","otherProps","colorGradientSettings","controlSettings","clearable","label","onColorChange","onGradientChange","colorValue","gradientValue","selectedColor","hasValue","onDeselect","isShownByDefault","resetAllFilter","isOpen","onToggle"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,MADD,EAECC,cAFD,EAGCC,QAHD,EAICC,QAJD,EAKCC,oBAAoB,IAAIC,MALzB,EAMCC,4BAA4B,IAAIC,cANjC,QAOO,uBAPP;AASA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,WAAjC;AACA,OAAOC,mCAAP,MAAgD,4CAAhD;AAEA,eAAe,SAASC,uBAAT,OAIX;AAAA;;AAAA,MAJ6C;AAChDC,IAAAA,QADgD;AAEhDC,IAAAA,WAFgD;AAGhD,OAAGC;AAH6C,GAI7C;AACH,QAAMC,qBAAqB,GAAGL,mCAAmC,EAAjE;AACA,QAAMM,eAAe,GAAG,EACvB,GAAGD,qBADoB;AAEvBE,IAAAA,SAAS,EAAE,KAFY;AAGvBJ,IAAAA,WAHuB;AAIvBK,IAAAA,KAAK,EAAEN,QAAQ,CAACM,KAJO;AAKvBC,IAAAA,aAAa,EAAEP,QAAQ,CAACO,aALD;AAMvBC,IAAAA,gBAAgB,EAAER,QAAQ,CAACQ,gBANJ;AAOvBC,IAAAA,UAAU,EAAET,QAAQ,CAACS,UAPE;AAQvBC,IAAAA,aAAa,EAAEV,QAAQ,CAACU;AARD,GAAxB;AAUA,QAAMC,aAAa,4BAAGX,QAAQ,CAACU,aAAZ,yEAA6BV,QAAQ,CAACS,UAAzD;AAEA,SACC,cAAC,cAAD;AACC,IAAA,QAAQ,EAAGT,QAAQ,CAACY,QADrB;AAEC,IAAA,KAAK,EAAGZ,QAAQ,CAACM,KAFlB;AAGC,IAAA,UAAU,EAAGN,QAAQ,CAACa,UAHvB;AAIC,IAAA,gBAAgB,EAAGb,QAAQ,CAACc,gBAJ7B;AAKC,IAAA,cAAc,EAAGd,QAAQ,CAACe;AAL3B,KAMMb,UANN;AAOC,IAAA,SAAS,EAAC;AAPX,MASC,cAAC,QAAD;AACC,IAAA,SAAS,EAAC,yCADX;AAEC,IAAA,gBAAgB,EAAC,8DAFlB;AAGC,IAAA,YAAY,EAAG;AAAA,UAAE;AAAEc,QAAAA,MAAF;AAAUC,QAAAA;AAAV,OAAF;AAAA,aACd,cAAC,MAAD;AACC,QAAA,OAAO,EAAGA,QADX;AAEC,yBAAgBD,MAFjB;AAGC,QAAA,SAAS,EAAG5B,UAAU,CACrB,sDADqB,EAErB;AAAE,qBAAW4B;AAAb,SAFqB;AAHvB,SAQC,cAAC,MAAD;AAAQ,QAAA,OAAO,EAAC;AAAhB,SACC,cAAC,cAAD;AACC,QAAA,SAAS,EAAC,6DADX;AAEC,QAAA,UAAU,EAAGL;AAFd,QADD,EAKC,cAAC,QAAD,QAAYX,QAAQ,CAACM,KAArB,CALD,CARD,CADc;AAAA,KAHhB;AAqBC,IAAA,aAAa,EAAG,MACf,cAAC,oBAAD;AACC,MAAA,SAAS,EAAG,KADb;AAEC,MAAA,gCAAgC,MAFjC;AAGC,MAAA,iCAAiC,MAHlC;AAIC,MAAA,WAAW;AAJZ,OAKMF,eALN;AAtBF,IATD,CADD;AA2CA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tColorIndicator,\n\tDropdown,\n\tFlexItem,\n\t__experimentalHStack as HStack,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ColorGradientControl from './control';\nimport useMultipleOriginColorsAndGradients from './use-multiple-origin-colors-and-gradients';\n\nexport default function ToolsPanelColorDropdown( {\n\tsettings,\n\tenableAlpha,\n\t...otherProps\n} ) {\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\tconst controlSettings = {\n\t\t...colorGradientSettings,\n\t\tclearable: false,\n\t\tenableAlpha,\n\t\tlabel: settings.label,\n\t\tonColorChange: settings.onColorChange,\n\t\tonGradientChange: settings.onGradientChange,\n\t\tcolorValue: settings.colorValue,\n\t\tgradientValue: settings.gradientValue,\n\t};\n\tconst selectedColor = settings.gradientValue ?? settings.colorValue;\n\n\treturn (\n\t\t<ToolsPanelItem\n\t\t\thasValue={ settings.hasValue }\n\t\t\tlabel={ settings.label }\n\t\t\tonDeselect={ settings.onDeselect }\n\t\t\tisShownByDefault={ settings.isShownByDefault }\n\t\t\tresetAllFilter={ settings.resetAllFilter }\n\t\t\t{ ...otherProps }\n\t\t\tclassName=\"block-editor-tools-panel-color-gradient-settings__item\"\n\t\t>\n\t\t\t<Dropdown\n\t\t\t\tclassName=\"block-editor-tools-panel-color-dropdown\"\n\t\t\t\tcontentClassName=\"block-editor-panel-color-gradient-settings__dropdown-content\"\n\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'block-editor-panel-color-gradient-settings__dropdown',\n\t\t\t\t\t\t\t{ 'is-open': isOpen }\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\t\tclassName=\"block-editor-panel-color-gradient-settings__color-indicator\"\n\t\t\t\t\t\t\t\tcolorValue={ selectedColor }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<FlexItem>{ settings.label }</FlexItem>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\trenderContent={ () => (\n\t\t\t\t\t<ColorGradientControl\n\t\t\t\t\t\tshowTitle={ false }\n\t\t\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t\t{ ...controlSettings }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t/>\n\t\t</ToolsPanelItem>\n\t);\n}\n"]}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import {
|
|
10
|
-
Button,
|
|
11
|
-
ColorIndicator,
|
|
12
|
-
Dropdown,
|
|
13
|
-
FlexItem,
|
|
14
|
-
__experimentalHStack as HStack,
|
|
15
|
-
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
16
|
-
} from '@wordpress/components';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Internal dependencies
|
|
20
|
-
*/
|
|
21
|
-
import ColorGradientControl from './control';
|
|
22
|
-
import useMultipleOriginColorsAndGradients from './use-multiple-origin-colors-and-gradients';
|
|
23
|
-
|
|
24
|
-
export default function ToolsPanelColorDropdown( {
|
|
25
|
-
settings,
|
|
26
|
-
enableAlpha,
|
|
27
|
-
...otherProps
|
|
28
|
-
} ) {
|
|
29
|
-
const colorGradientSettings = useMultipleOriginColorsAndGradients();
|
|
30
|
-
const controlSettings = {
|
|
31
|
-
...colorGradientSettings,
|
|
32
|
-
clearable: false,
|
|
33
|
-
enableAlpha,
|
|
34
|
-
label: settings.label,
|
|
35
|
-
onColorChange: settings.onColorChange,
|
|
36
|
-
onGradientChange: settings.onGradientChange,
|
|
37
|
-
colorValue: settings.colorValue,
|
|
38
|
-
gradientValue: settings.gradientValue,
|
|
39
|
-
};
|
|
40
|
-
const selectedColor = settings.gradientValue ?? settings.colorValue;
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<ToolsPanelItem
|
|
44
|
-
hasValue={ settings.hasValue }
|
|
45
|
-
label={ settings.label }
|
|
46
|
-
onDeselect={ settings.onDeselect }
|
|
47
|
-
isShownByDefault={ settings.isShownByDefault }
|
|
48
|
-
resetAllFilter={ settings.resetAllFilter }
|
|
49
|
-
{ ...otherProps }
|
|
50
|
-
className="block-editor-tools-panel-color-gradient-settings__item"
|
|
51
|
-
>
|
|
52
|
-
<Dropdown
|
|
53
|
-
className="block-editor-tools-panel-color-dropdown"
|
|
54
|
-
contentClassName="block-editor-panel-color-gradient-settings__dropdown-content"
|
|
55
|
-
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
56
|
-
<Button
|
|
57
|
-
onClick={ onToggle }
|
|
58
|
-
aria-expanded={ isOpen }
|
|
59
|
-
className={ classnames(
|
|
60
|
-
'block-editor-panel-color-gradient-settings__dropdown',
|
|
61
|
-
{ 'is-open': isOpen }
|
|
62
|
-
) }
|
|
63
|
-
>
|
|
64
|
-
<HStack justify="flex-start">
|
|
65
|
-
<ColorIndicator
|
|
66
|
-
className="block-editor-panel-color-gradient-settings__color-indicator"
|
|
67
|
-
colorValue={ selectedColor }
|
|
68
|
-
/>
|
|
69
|
-
<FlexItem>{ settings.label }</FlexItem>
|
|
70
|
-
</HStack>
|
|
71
|
-
</Button>
|
|
72
|
-
) }
|
|
73
|
-
renderContent={ () => (
|
|
74
|
-
<ColorGradientControl
|
|
75
|
-
showTitle={ false }
|
|
76
|
-
__experimentalHasMultipleOrigins
|
|
77
|
-
__experimentalIsRenderedInSidebar
|
|
78
|
-
enableAlpha
|
|
79
|
-
{ ...controlSettings }
|
|
80
|
-
/>
|
|
81
|
-
) }
|
|
82
|
-
/>
|
|
83
|
-
</ToolsPanelItem>
|
|
84
|
-
);
|
|
85
|
-
}
|