@elementor/editor-editing-panel 1.45.0 → 1.46.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 +42 -0
- package/dist/index.d.mts +11 -4
- package/dist/index.d.ts +11 -4
- package/dist/index.js +702 -688
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +587 -573
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -13
- package/src/components/css-classes/css-class-menu.tsx +6 -8
- package/src/components/css-classes/css-class-selector.tsx +17 -11
- package/src/components/settings-tab.tsx +25 -2
- package/src/components/style-indicator.tsx +19 -15
- package/src/components/style-sections/border-section/border-field.tsx +4 -6
- package/src/components/style-sections/effects-section/effects-section.tsx +6 -0
- package/src/components/style-sections/layout-section/flex-order-field.tsx +1 -3
- package/src/components/style-sections/layout-section/flex-size-field.tsx +7 -10
- package/src/components/style-sections/layout-section/layout-section.tsx +2 -2
- package/src/components/style-sections/layout-section/opacity-control-field.tsx +25 -0
- package/src/components/style-sections/layout-section/utils/rotated-icon.tsx +1 -1
- package/src/components/style-sections/position-section/position-section.tsx +6 -6
- package/src/components/style-sections/size-section/object-position-field.tsx +2 -24
- package/src/components/style-sections/size-section/size-section.tsx +1 -1
- package/src/components/style-sections/typography-section/text-stroke-field.tsx +4 -6
- package/src/components/style-sections/typography-section/typography-section.tsx +4 -2
- package/src/controls-registry/controls-registry.tsx +30 -10
- package/src/controls-registry/styles-field.tsx +1 -3
- package/src/dynamics/components/dynamic-selection-control.tsx +10 -18
- package/src/dynamics/components/dynamic-selection.tsx +58 -77
- package/src/dynamics/hooks/use-prop-dynamic-action.tsx +1 -1
- package/src/hooks/use-styles-field.ts +9 -3
- package/src/hooks/use-styles-fields.ts +4 -4
- package/src/index.ts +1 -0
- package/src/popover-action.tsx +3 -5
- package/src/provider-colors-registry.ts +20 -0
- package/src/styles-inheritance/components/infotip/label-chip.tsx +4 -5
- package/src/styles-inheritance/components/styles-inheritance-indicator.tsx +32 -40
- package/src/styles-inheritance/components/styles-inheritance-infotip.tsx +1 -5
- package/src/styles-inheritance/components/styles-inheritance-section-indicators.tsx +29 -44
- package/src/styles-inheritance/hooks/use-normalized-inheritance-chain-items.tsx +1 -17
- package/src/styles-inheritance/types.ts +0 -2
- package/src/styles-inheritance/utils.ts +17 -1
- package/src/utils/get-styles-provider-color.ts +28 -0
|
@@ -5,7 +5,7 @@ import { type StyleDefinitionVariant } from '@elementor/editor-styles';
|
|
|
5
5
|
import { ELEMENTS_BASE_STYLES_PROVIDER_KEY } from '@elementor/editor-styles-repository';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
|
|
8
|
-
import { type
|
|
8
|
+
import { type SnapshotPropValue } from '../types';
|
|
9
9
|
|
|
10
10
|
const MAXIMUM_ITEMS = 2;
|
|
11
11
|
|
|
@@ -15,7 +15,6 @@ type NormalizedItem = {
|
|
|
15
15
|
breakpoint?: StyleDefinitionVariant[ 'meta' ][ 'breakpoint' ];
|
|
16
16
|
displayLabel: string;
|
|
17
17
|
value: ReactNode | string;
|
|
18
|
-
chipColor: ChipColors;
|
|
19
18
|
};
|
|
20
19
|
|
|
21
20
|
export const useNormalizedInheritanceChainItems = (
|
|
@@ -74,7 +73,6 @@ export const normalizeInheritanceItem = async (
|
|
|
74
73
|
breakpoint: breakpoint ?? DEFAULT_BREAKPOINT,
|
|
75
74
|
displayLabel,
|
|
76
75
|
value: await getTransformedValue( item, bind, resolve ),
|
|
77
|
-
chipColor: getChipColor( item ),
|
|
78
76
|
};
|
|
79
77
|
};
|
|
80
78
|
|
|
@@ -105,17 +103,3 @@ const getTransformedValue = async (
|
|
|
105
103
|
return '';
|
|
106
104
|
}
|
|
107
105
|
};
|
|
108
|
-
|
|
109
|
-
const getChipColor = ( item: SnapshotPropValue ) => {
|
|
110
|
-
const { provider = '', style } = item;
|
|
111
|
-
|
|
112
|
-
if ( provider === ELEMENTS_BASE_STYLES_PROVIDER_KEY ) {
|
|
113
|
-
return 'default';
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if ( style?.label === 'local' ) {
|
|
117
|
-
return 'accent';
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return 'global';
|
|
121
|
-
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type BreakpointId } from '@elementor/editor-responsive';
|
|
2
|
-
import { type StyleDefinitionState } from '@elementor/editor-styles';
|
|
2
|
+
import { type StyleDefinitionState, type StyleDefinitionVariant } from '@elementor/editor-styles';
|
|
3
|
+
|
|
4
|
+
import { type SnapshotPropValue } from './types';
|
|
3
5
|
|
|
4
6
|
export const DEFAULT_STATE = 'normal';
|
|
5
7
|
|
|
@@ -8,3 +10,17 @@ const DEFAULT_BREAKPOINT = 'desktop';
|
|
|
8
10
|
export const getStateKey = ( state: StyleDefinitionState ) => state ?? DEFAULT_STATE;
|
|
9
11
|
|
|
10
12
|
export const getBreakpointKey = ( breakpoint: BreakpointId | null ): BreakpointId => breakpoint ?? DEFAULT_BREAKPOINT;
|
|
13
|
+
|
|
14
|
+
export const getValueFromInheritanceChain = (
|
|
15
|
+
inheritanceChain: SnapshotPropValue[],
|
|
16
|
+
styleId: string,
|
|
17
|
+
meta: StyleDefinitionVariant[ 'meta' ]
|
|
18
|
+
) =>
|
|
19
|
+
inheritanceChain.find(
|
|
20
|
+
( {
|
|
21
|
+
style,
|
|
22
|
+
variant: {
|
|
23
|
+
meta: { breakpoint, state },
|
|
24
|
+
},
|
|
25
|
+
} ) => style.id === styleId && breakpoint === meta.breakpoint && state === meta.state
|
|
26
|
+
);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ELEMENTS_BASE_STYLES_PROVIDER_KEY, isElementsStylesProvider } from '@elementor/editor-styles-repository';
|
|
2
|
+
import { type ChipProps, type Theme } from '@elementor/ui';
|
|
3
|
+
|
|
4
|
+
import { getStyleProviderColors } from '../provider-colors-registry';
|
|
5
|
+
|
|
6
|
+
export const getStylesProviderColorName = ( provider: string ): ChipProps[ 'color' ] => {
|
|
7
|
+
if ( ! provider || provider === ELEMENTS_BASE_STYLES_PROVIDER_KEY ) {
|
|
8
|
+
return 'default';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if ( isElementsStylesProvider( provider ) ) {
|
|
12
|
+
return 'accent';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return getStyleProviderColors( provider ).name;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const getStylesProviderThemeColor = ( provider: string ): ( ( theme: Theme ) => string ) | null => {
|
|
19
|
+
if ( ! provider || provider === ELEMENTS_BASE_STYLES_PROVIDER_KEY ) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if ( isElementsStylesProvider( provider ) ) {
|
|
24
|
+
return ( theme: Theme ) => theme.palette.accent.main;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return getStyleProviderColors( provider ).getThemeColor;
|
|
28
|
+
};
|