@elementor/editor-editing-panel 4.3.0-1041 → 4.3.0-1043
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/dist/index.d.mts +86 -11
- package/dist/index.d.ts +86 -11
- package/dist/index.js +1120 -1005
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1006 -902
- package/dist/index.mjs.map +1 -1
- package/package.json +24 -24
- package/src/components/css-classes/css-class-menu.tsx +29 -30
- package/src/components/style-sections-definition.ts +119 -0
- package/src/components/style-sections.tsx +22 -0
- package/src/components/style-states/pseudo-state-menu-items.tsx +44 -0
- package/src/components/style-states/pseudo-states.ts +17 -0
- package/src/components/style-states/use-pseudo-states.ts +18 -0
- package/src/components/style-tab.tsx +8 -123
- package/src/contexts/styles-inheritance-context.tsx +11 -1
- package/src/hooks/use-default-style-tag-from-preview.ts +14 -0
- package/src/index.ts +20 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "4.3.0-
|
|
3
|
+
"version": "4.3.0-1043",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -39,31 +39,31 @@
|
|
|
39
39
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@elementor/editor": "4.3.0-
|
|
43
|
-
"@elementor/editor-canvas": "4.3.0-
|
|
44
|
-
"@elementor/editor-controls": "4.3.0-
|
|
45
|
-
"@elementor/editor-documents": "4.3.0-
|
|
46
|
-
"@elementor/editor-elements": "4.3.0-
|
|
47
|
-
"@elementor/editor-interactions": "4.3.0-
|
|
48
|
-
"@elementor/editor-notifications": "4.3.0-
|
|
49
|
-
"@elementor/editor-panels": "4.3.0-
|
|
50
|
-
"@elementor/editor-props": "4.3.0-
|
|
51
|
-
"@elementor/editor-responsive": "4.3.0-
|
|
52
|
-
"@elementor/editor-styles": "4.3.0-
|
|
53
|
-
"@elementor/editor-styles-repository": "4.3.0-
|
|
54
|
-
"@elementor/editor-ui": "4.3.0-
|
|
55
|
-
"@elementor/editor-v1-adapters": "4.3.0-
|
|
56
|
-
"@elementor/http-client": "4.3.0-
|
|
42
|
+
"@elementor/editor": "4.3.0-1043",
|
|
43
|
+
"@elementor/editor-canvas": "4.3.0-1043",
|
|
44
|
+
"@elementor/editor-controls": "4.3.0-1043",
|
|
45
|
+
"@elementor/editor-documents": "4.3.0-1043",
|
|
46
|
+
"@elementor/editor-elements": "4.3.0-1043",
|
|
47
|
+
"@elementor/editor-interactions": "4.3.0-1043",
|
|
48
|
+
"@elementor/editor-notifications": "4.3.0-1043",
|
|
49
|
+
"@elementor/editor-panels": "4.3.0-1043",
|
|
50
|
+
"@elementor/editor-props": "4.3.0-1043",
|
|
51
|
+
"@elementor/editor-responsive": "4.3.0-1043",
|
|
52
|
+
"@elementor/editor-styles": "4.3.0-1043",
|
|
53
|
+
"@elementor/editor-styles-repository": "4.3.0-1043",
|
|
54
|
+
"@elementor/editor-ui": "4.3.0-1043",
|
|
55
|
+
"@elementor/editor-v1-adapters": "4.3.0-1043",
|
|
56
|
+
"@elementor/http-client": "4.3.0-1043",
|
|
57
57
|
"@elementor/icons": "~1.75.1",
|
|
58
|
-
"@elementor/editor-variables": "4.3.0-
|
|
59
|
-
"@elementor/locations": "4.3.0-
|
|
60
|
-
"@elementor/menus": "4.3.0-
|
|
61
|
-
"@elementor/query": "4.3.0-
|
|
62
|
-
"@elementor/schema": "4.3.0-
|
|
63
|
-
"@elementor/session": "4.3.0-
|
|
58
|
+
"@elementor/editor-variables": "4.3.0-1043",
|
|
59
|
+
"@elementor/locations": "4.3.0-1043",
|
|
60
|
+
"@elementor/menus": "4.3.0-1043",
|
|
61
|
+
"@elementor/query": "4.3.0-1043",
|
|
62
|
+
"@elementor/schema": "4.3.0-1043",
|
|
63
|
+
"@elementor/session": "4.3.0-1043",
|
|
64
64
|
"@elementor/ui": "1.37.5",
|
|
65
|
-
"@elementor/utils": "4.3.0-
|
|
66
|
-
"@elementor/wp-media": "4.3.0-
|
|
65
|
+
"@elementor/utils": "4.3.0-1043",
|
|
66
|
+
"@elementor/wp-media": "4.3.0-1043",
|
|
67
67
|
"@wordpress/i18n": "^5.13.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
@@ -16,37 +16,12 @@ import { type StyleDefinitionStateWithNormal } from '../../styles-inheritance/ty
|
|
|
16
16
|
import { getTempStylesProviderThemeColor } from '../../utils/get-styles-provider-color';
|
|
17
17
|
import { trackStyles } from '../../utils/tracking/subscribe';
|
|
18
18
|
import { StyleIndicator } from '../style-indicator';
|
|
19
|
+
import { usePseudoStates } from '../style-states/use-pseudo-states';
|
|
19
20
|
import { useCssClass } from './css-class-context';
|
|
20
21
|
import { DuplicateClassMenuItem } from './duplicate-class-menu-item';
|
|
21
22
|
import { LocalClassSubMenu } from './local-class-sub-menu';
|
|
22
23
|
import { useUndoableUnapplyClass } from './use-apply-and-unapply-class';
|
|
23
24
|
|
|
24
|
-
type State = {
|
|
25
|
-
key: StyleDefinitionStateWithNormal;
|
|
26
|
-
value: StyleDefinitionState | null;
|
|
27
|
-
label: string;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const DEFAULT_PSEUDO_STATES: State[] = [
|
|
31
|
-
{ key: 'normal', value: null, label: __( 'normal', 'elementor' ) },
|
|
32
|
-
{ key: 'hover', value: 'hover', label: __( 'hover', 'elementor' ) },
|
|
33
|
-
{ key: 'focus', value: 'focus', label: __( 'focus', 'elementor' ) },
|
|
34
|
-
{ key: 'active', value: 'active', label: __( 'active', 'elementor' ) },
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
function usePseudoStates(): State[] {
|
|
38
|
-
const { elementType } = useElement();
|
|
39
|
-
const { pseudoStates = [] } = elementType;
|
|
40
|
-
|
|
41
|
-
const additionalStates: State[] = pseudoStates.map( ( { name, value } ) => ( {
|
|
42
|
-
key: value as StyleDefinitionStateWithNormal,
|
|
43
|
-
value: value as StyleDefinitionState,
|
|
44
|
-
label: name,
|
|
45
|
-
} ) );
|
|
46
|
-
|
|
47
|
-
return [ ...DEFAULT_PSEUDO_STATES, ...additionalStates ];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
25
|
type CssClassMenuProps = {
|
|
51
26
|
popupState: PopupState;
|
|
52
27
|
anchorEl: HTMLElement | null;
|
|
@@ -81,8 +56,19 @@ export function CssClassMenu( { popupState, anchorEl, fixed }: CssClassMenuProps
|
|
|
81
56
|
>
|
|
82
57
|
{ isLocalStyle && <LocalClassSubMenu popupState={ popupState } /> }
|
|
83
58
|
{ /* It has to be an array since MUI menu doesn't accept a Fragment as a child, and wrapping the items with an HTML element disrupts keyboard navigation */ }
|
|
84
|
-
{ getMenuItemsByProvider( {
|
|
85
|
-
|
|
59
|
+
{ getMenuItemsByProvider( {
|
|
60
|
+
provider,
|
|
61
|
+
closeMenu: popupState.close,
|
|
62
|
+
fixed,
|
|
63
|
+
} ) }
|
|
64
|
+
<MenuSubheader
|
|
65
|
+
sx={ {
|
|
66
|
+
typography: 'caption',
|
|
67
|
+
color: 'text.secondary',
|
|
68
|
+
pb: 0.5,
|
|
69
|
+
pt: 1,
|
|
70
|
+
} }
|
|
71
|
+
>
|
|
86
72
|
{ __( 'States', 'elementor' ) }
|
|
87
73
|
</MenuSubheader>
|
|
88
74
|
{ pseudoStates.map( ( state ) => {
|
|
@@ -113,7 +99,14 @@ function ClassStatesMenu( { closeMenu }: { closeMenu: () => void } ) {
|
|
|
113
99
|
return (
|
|
114
100
|
<>
|
|
115
101
|
<Divider />
|
|
116
|
-
<MenuSubheader
|
|
102
|
+
<MenuSubheader
|
|
103
|
+
sx={ {
|
|
104
|
+
typography: 'caption',
|
|
105
|
+
color: 'text.secondary',
|
|
106
|
+
pb: 0.5,
|
|
107
|
+
pt: 1,
|
|
108
|
+
} }
|
|
109
|
+
>
|
|
117
110
|
{ customTitle }
|
|
118
111
|
</MenuSubheader>
|
|
119
112
|
{ elementStates.map( ( state ) => {
|
|
@@ -201,7 +194,13 @@ function getMenuItemsByProvider( {
|
|
|
201
194
|
actions.unshift(
|
|
202
195
|
<MenuSubheader
|
|
203
196
|
key="provider-label"
|
|
204
|
-
sx={ {
|
|
197
|
+
sx={ {
|
|
198
|
+
typography: 'caption',
|
|
199
|
+
color: 'text.secondary',
|
|
200
|
+
pb: 0.5,
|
|
201
|
+
pt: 1,
|
|
202
|
+
textTransform: 'capitalize',
|
|
203
|
+
} }
|
|
205
204
|
>
|
|
206
205
|
{ providerInstance?.labels?.singular }
|
|
207
206
|
</MenuSubheader>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import { __ } from '@wordpress/i18n';
|
|
3
|
+
|
|
4
|
+
import { BackgroundSection } from './style-sections/background-section/background-section';
|
|
5
|
+
import { BorderSection } from './style-sections/border-section/border-section';
|
|
6
|
+
import { EffectsSection } from './style-sections/effects-section/effects-section';
|
|
7
|
+
import { LayoutSection } from './style-sections/layout-section/layout-section';
|
|
8
|
+
import { PositionSection } from './style-sections/position-section/position-section';
|
|
9
|
+
import { SizeSection } from './style-sections/size-section/size-section';
|
|
10
|
+
import { SpacingSection } from './style-sections/spacing-section/spacing-section';
|
|
11
|
+
import { TypographySection } from './style-sections/typography-section/typography-section';
|
|
12
|
+
|
|
13
|
+
export type StyleSectionDefinition = {
|
|
14
|
+
name: string;
|
|
15
|
+
title: string;
|
|
16
|
+
component: () => React.JSX.Element;
|
|
17
|
+
fields: string[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const STYLE_SECTIONS: StyleSectionDefinition[] = [
|
|
21
|
+
{
|
|
22
|
+
name: 'Layout',
|
|
23
|
+
title: __( 'Layout', 'elementor' ),
|
|
24
|
+
component: LayoutSection,
|
|
25
|
+
fields: [
|
|
26
|
+
'display',
|
|
27
|
+
'flex-direction',
|
|
28
|
+
'flex-wrap',
|
|
29
|
+
'justify-content',
|
|
30
|
+
'align-items',
|
|
31
|
+
'align-content',
|
|
32
|
+
'align-self',
|
|
33
|
+
'gap',
|
|
34
|
+
'order',
|
|
35
|
+
'grid-column',
|
|
36
|
+
'grid-row',
|
|
37
|
+
'grid-auto-rows',
|
|
38
|
+
'grid-auto-columns',
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'Spacing',
|
|
43
|
+
title: __( 'Spacing', 'elementor' ),
|
|
44
|
+
component: SpacingSection,
|
|
45
|
+
fields: [ 'margin', 'padding' ],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'Size',
|
|
49
|
+
title: __( 'Size', 'elementor' ),
|
|
50
|
+
component: SizeSection,
|
|
51
|
+
fields: [
|
|
52
|
+
'width',
|
|
53
|
+
'min-width',
|
|
54
|
+
'max-width',
|
|
55
|
+
'height',
|
|
56
|
+
'min-height',
|
|
57
|
+
'max-height',
|
|
58
|
+
'overflow',
|
|
59
|
+
'aspect-ratio',
|
|
60
|
+
'object-fit',
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'Position',
|
|
65
|
+
title: __( 'Position', 'elementor' ),
|
|
66
|
+
component: PositionSection,
|
|
67
|
+
fields: [ 'position', 'z-index', 'scroll-margin-top' ],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'Typography',
|
|
71
|
+
title: __( 'Typography', 'elementor' ),
|
|
72
|
+
component: TypographySection,
|
|
73
|
+
fields: [
|
|
74
|
+
'font-family',
|
|
75
|
+
'font-weight',
|
|
76
|
+
'font-size',
|
|
77
|
+
'text-align',
|
|
78
|
+
'color',
|
|
79
|
+
'line-height',
|
|
80
|
+
'letter-spacing',
|
|
81
|
+
'word-spacing',
|
|
82
|
+
'column-count',
|
|
83
|
+
'text-decoration',
|
|
84
|
+
'text-transform',
|
|
85
|
+
'direction',
|
|
86
|
+
'font-style',
|
|
87
|
+
'stroke',
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'Background',
|
|
92
|
+
title: __( 'Background', 'elementor' ),
|
|
93
|
+
component: BackgroundSection,
|
|
94
|
+
fields: [ 'background' ],
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'Border',
|
|
98
|
+
title: __( 'Border', 'elementor' ),
|
|
99
|
+
component: BorderSection,
|
|
100
|
+
fields: [ 'border-radius', 'border-width', 'border-color', 'border-style' ],
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: 'Effects',
|
|
104
|
+
title: __( 'Effects', 'elementor' ),
|
|
105
|
+
component: EffectsSection,
|
|
106
|
+
fields: [
|
|
107
|
+
'mix-blend-mode',
|
|
108
|
+
'box-shadow',
|
|
109
|
+
'opacity',
|
|
110
|
+
'transform',
|
|
111
|
+
'filter',
|
|
112
|
+
'backdrop-filter',
|
|
113
|
+
'transform-origin',
|
|
114
|
+
'transition',
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
];
|
|
118
|
+
|
|
119
|
+
export const STYLE_SECTION_NAMES = STYLE_SECTIONS.map( ( section ) => section.name );
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { STYLE_SECTIONS } from './style-sections-definition';
|
|
4
|
+
import { StyleTabSection } from './style-tab-section';
|
|
5
|
+
|
|
6
|
+
export const StyleSections = () => {
|
|
7
|
+
return (
|
|
8
|
+
<>
|
|
9
|
+
{ STYLE_SECTIONS.map( ( section ) => (
|
|
10
|
+
<StyleTabSection
|
|
11
|
+
key={ section.name }
|
|
12
|
+
section={ {
|
|
13
|
+
component: section.component,
|
|
14
|
+
name: section.name,
|
|
15
|
+
title: section.title,
|
|
16
|
+
} }
|
|
17
|
+
fields={ section.fields }
|
|
18
|
+
/>
|
|
19
|
+
) ) }
|
|
20
|
+
</>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type StyleDefinitionState } from '@elementor/editor-styles';
|
|
3
|
+
import { MenuListItem } from '@elementor/editor-ui';
|
|
4
|
+
import { MenuSubheader } from '@elementor/ui';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
|
|
7
|
+
import { type PseudoStateOption } from './pseudo-states';
|
|
8
|
+
|
|
9
|
+
type PseudoStateMenuItemsProps = {
|
|
10
|
+
states: PseudoStateOption[];
|
|
11
|
+
activeState: StyleDefinitionState | null;
|
|
12
|
+
onSelectState: ( state: StyleDefinitionState | null ) => void;
|
|
13
|
+
onClose?: () => void;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function PseudoStateMenuItems( { states, activeState, onSelectState, onClose }: PseudoStateMenuItemsProps ) {
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<MenuSubheader
|
|
20
|
+
sx={ {
|
|
21
|
+
typography: 'caption',
|
|
22
|
+
color: 'text.secondary',
|
|
23
|
+
pb: 0.5,
|
|
24
|
+
pt: 1,
|
|
25
|
+
} }
|
|
26
|
+
>
|
|
27
|
+
{ __( 'States', 'elementor' ) }
|
|
28
|
+
</MenuSubheader>
|
|
29
|
+
{ states.map( ( state ) => (
|
|
30
|
+
<MenuListItem
|
|
31
|
+
key={ state.key }
|
|
32
|
+
selected={ state.value === activeState }
|
|
33
|
+
sx={ { textTransform: 'capitalize' } }
|
|
34
|
+
onClick={ () => {
|
|
35
|
+
onSelectState( state.value );
|
|
36
|
+
onClose?.();
|
|
37
|
+
} }
|
|
38
|
+
>
|
|
39
|
+
{ state.label }
|
|
40
|
+
</MenuListItem>
|
|
41
|
+
) ) }
|
|
42
|
+
</>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type StyleDefinitionState } from '@elementor/editor-styles';
|
|
2
|
+
import { __ } from '@wordpress/i18n';
|
|
3
|
+
|
|
4
|
+
import { type StyleDefinitionStateWithNormal } from '../../styles-inheritance/types';
|
|
5
|
+
|
|
6
|
+
export type PseudoStateOption = {
|
|
7
|
+
key: StyleDefinitionStateWithNormal;
|
|
8
|
+
value: StyleDefinitionState | null;
|
|
9
|
+
label: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const DEFAULT_PSEUDO_STATES: PseudoStateOption[] = [
|
|
13
|
+
{ key: 'normal', value: null, label: __( 'normal', 'elementor' ) },
|
|
14
|
+
{ key: 'hover', value: 'hover', label: __( 'hover', 'elementor' ) },
|
|
15
|
+
{ key: 'focus', value: 'focus', label: __( 'focus', 'elementor' ) },
|
|
16
|
+
{ key: 'active', value: 'active', label: __( 'active', 'elementor' ) },
|
|
17
|
+
];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type StyleDefinitionState } from '@elementor/editor-styles';
|
|
2
|
+
|
|
3
|
+
import { useElement } from '../../contexts/element-context';
|
|
4
|
+
import { type StyleDefinitionStateWithNormal } from '../../styles-inheritance/types';
|
|
5
|
+
import { DEFAULT_PSEUDO_STATES, type PseudoStateOption } from './pseudo-states';
|
|
6
|
+
|
|
7
|
+
export function usePseudoStates(): PseudoStateOption[] {
|
|
8
|
+
const { elementType } = useElement();
|
|
9
|
+
const { pseudoStates = [] } = elementType;
|
|
10
|
+
|
|
11
|
+
const additionalStates: PseudoStateOption[] = pseudoStates.map( ( { name, value } ) => ( {
|
|
12
|
+
key: value as StyleDefinitionStateWithNormal,
|
|
13
|
+
value: value as StyleDefinitionState,
|
|
14
|
+
label: name,
|
|
15
|
+
} ) );
|
|
16
|
+
|
|
17
|
+
return [ ...DEFAULT_PSEUDO_STATES, ...additionalStates ];
|
|
18
|
+
}
|
|
@@ -6,7 +6,6 @@ import { type StyleDefinitionID, type StyleDefinitionState } from '@elementor/ed
|
|
|
6
6
|
import { createLocation } from '@elementor/locations';
|
|
7
7
|
import { SessionStorageProvider } from '@elementor/session';
|
|
8
8
|
import { Box, Divider, Stack } from '@elementor/ui';
|
|
9
|
-
import { __ } from '@wordpress/i18n';
|
|
10
9
|
|
|
11
10
|
import { ClassesPropProvider } from '../contexts/classes-prop-context';
|
|
12
11
|
import { useElement } from '../contexts/element-context';
|
|
@@ -16,15 +15,7 @@ import { StyleInheritanceProvider } from '../contexts/styles-inheritance-context
|
|
|
16
15
|
import { useActiveStyleDefId } from '../hooks/use-active-style-def-id';
|
|
17
16
|
import { CssClassSelector } from './css-classes/css-class-selector';
|
|
18
17
|
import { SectionsList } from './sections-list';
|
|
19
|
-
import {
|
|
20
|
-
import { BorderSection } from './style-sections/border-section/border-section';
|
|
21
|
-
import { EffectsSection } from './style-sections/effects-section/effects-section';
|
|
22
|
-
import { LayoutSection } from './style-sections/layout-section/layout-section';
|
|
23
|
-
import { PositionSection } from './style-sections/position-section/position-section';
|
|
24
|
-
import { SizeSection } from './style-sections/size-section/size-section';
|
|
25
|
-
import { SpacingSection } from './style-sections/spacing-section/spacing-section';
|
|
26
|
-
import { TypographySection } from './style-sections/typography-section/typography-section';
|
|
27
|
-
import { StyleTabSection } from './style-tab-section';
|
|
18
|
+
import { StyleSections } from './style-sections';
|
|
28
19
|
|
|
29
20
|
const TABS_HEADER_HEIGHT = '37px';
|
|
30
21
|
|
|
@@ -66,118 +57,7 @@ export const StyleTab = () => {
|
|
|
66
57
|
<Divider />
|
|
67
58
|
</ClassesHeader>
|
|
68
59
|
<SectionsList>
|
|
69
|
-
<
|
|
70
|
-
section={ {
|
|
71
|
-
component: LayoutSection,
|
|
72
|
-
name: 'Layout',
|
|
73
|
-
title: __( 'Layout', 'elementor' ),
|
|
74
|
-
} }
|
|
75
|
-
fields={ [
|
|
76
|
-
'display',
|
|
77
|
-
'flex-direction',
|
|
78
|
-
'flex-wrap',
|
|
79
|
-
'justify-content',
|
|
80
|
-
'align-items',
|
|
81
|
-
'align-content',
|
|
82
|
-
'align-self',
|
|
83
|
-
'gap',
|
|
84
|
-
'order',
|
|
85
|
-
'grid-column',
|
|
86
|
-
'grid-row',
|
|
87
|
-
'grid-auto-rows',
|
|
88
|
-
'grid-auto-columns',
|
|
89
|
-
] }
|
|
90
|
-
/>
|
|
91
|
-
<StyleTabSection
|
|
92
|
-
section={ {
|
|
93
|
-
component: SpacingSection,
|
|
94
|
-
name: 'Spacing',
|
|
95
|
-
title: __( 'Spacing', 'elementor' ),
|
|
96
|
-
} }
|
|
97
|
-
fields={ [ 'margin', 'padding' ] }
|
|
98
|
-
/>
|
|
99
|
-
<StyleTabSection
|
|
100
|
-
section={ {
|
|
101
|
-
component: SizeSection,
|
|
102
|
-
name: 'Size',
|
|
103
|
-
title: __( 'Size', 'elementor' ),
|
|
104
|
-
} }
|
|
105
|
-
fields={ [
|
|
106
|
-
'width',
|
|
107
|
-
'min-width',
|
|
108
|
-
'max-width',
|
|
109
|
-
'height',
|
|
110
|
-
'min-height',
|
|
111
|
-
'max-height',
|
|
112
|
-
'overflow',
|
|
113
|
-
'aspect-ratio',
|
|
114
|
-
'object-fit',
|
|
115
|
-
] }
|
|
116
|
-
/>
|
|
117
|
-
<StyleTabSection
|
|
118
|
-
section={ {
|
|
119
|
-
component: PositionSection,
|
|
120
|
-
name: 'Position',
|
|
121
|
-
title: __( 'Position', 'elementor' ),
|
|
122
|
-
} }
|
|
123
|
-
fields={ [ 'position', 'z-index', 'scroll-margin-top' ] }
|
|
124
|
-
/>
|
|
125
|
-
<StyleTabSection
|
|
126
|
-
section={ {
|
|
127
|
-
component: TypographySection,
|
|
128
|
-
name: 'Typography',
|
|
129
|
-
title: __( 'Typography', 'elementor' ),
|
|
130
|
-
} }
|
|
131
|
-
fields={ [
|
|
132
|
-
'font-family',
|
|
133
|
-
'font-weight',
|
|
134
|
-
'font-size',
|
|
135
|
-
'text-align',
|
|
136
|
-
'color',
|
|
137
|
-
'line-height',
|
|
138
|
-
'letter-spacing',
|
|
139
|
-
'word-spacing',
|
|
140
|
-
'column-count',
|
|
141
|
-
'text-decoration',
|
|
142
|
-
'text-transform',
|
|
143
|
-
'direction',
|
|
144
|
-
'font-style',
|
|
145
|
-
'stroke',
|
|
146
|
-
] }
|
|
147
|
-
/>
|
|
148
|
-
<StyleTabSection
|
|
149
|
-
section={ {
|
|
150
|
-
component: BackgroundSection,
|
|
151
|
-
name: 'Background',
|
|
152
|
-
title: __( 'Background', 'elementor' ),
|
|
153
|
-
} }
|
|
154
|
-
fields={ [ 'background' ] }
|
|
155
|
-
/>
|
|
156
|
-
<StyleTabSection
|
|
157
|
-
section={ {
|
|
158
|
-
component: BorderSection,
|
|
159
|
-
name: 'Border',
|
|
160
|
-
title: __( 'Border', 'elementor' ),
|
|
161
|
-
} }
|
|
162
|
-
fields={ [ 'border-radius', 'border-width', 'border-color', 'border-style' ] }
|
|
163
|
-
/>
|
|
164
|
-
<StyleTabSection
|
|
165
|
-
section={ {
|
|
166
|
-
component: EffectsSection,
|
|
167
|
-
name: 'Effects',
|
|
168
|
-
title: __( 'Effects', 'elementor' ),
|
|
169
|
-
} }
|
|
170
|
-
fields={ [
|
|
171
|
-
'mix-blend-mode',
|
|
172
|
-
'box-shadow',
|
|
173
|
-
'opacity',
|
|
174
|
-
'transform',
|
|
175
|
-
'filter',
|
|
176
|
-
'backdrop-filter',
|
|
177
|
-
'transform-origin',
|
|
178
|
-
'transition',
|
|
179
|
-
] }
|
|
180
|
-
/>
|
|
60
|
+
<StyleSections />
|
|
181
61
|
<StyleTabSlot />
|
|
182
62
|
</SectionsList>
|
|
183
63
|
<Box sx={ { height: '150px' } } />
|
|
@@ -192,7 +72,12 @@ function ClassesHeader( { children }: { children: React.ReactNode } ) {
|
|
|
192
72
|
const scrollDirection = useScrollDirection();
|
|
193
73
|
|
|
194
74
|
return (
|
|
195
|
-
<Stack
|
|
75
|
+
<Stack
|
|
76
|
+
sx={ {
|
|
77
|
+
...stickyHeaderStyles,
|
|
78
|
+
top: scrollDirection === 'up' ? TABS_HEADER_HEIGHT : 0,
|
|
79
|
+
} }
|
|
80
|
+
>
|
|
196
81
|
{ children }
|
|
197
82
|
</Stack>
|
|
198
83
|
);
|
|
@@ -6,6 +6,7 @@ import { getBreakpointsTree } from '@elementor/editor-responsive';
|
|
|
6
6
|
import { getStylesSchema } from '@elementor/editor-styles';
|
|
7
7
|
import { stylesRepository } from '@elementor/editor-styles-repository';
|
|
8
8
|
|
|
9
|
+
import { useDefaultStyleTagFromPreview } from '../hooks/use-default-style-tag-from-preview';
|
|
9
10
|
import { useStylesRerender } from '../hooks/use-styles-rerender';
|
|
10
11
|
import { createStylesInheritance } from '../styles-inheritance/create-styles-inheritance';
|
|
11
12
|
import {
|
|
@@ -81,6 +82,7 @@ export function useInheritedValues( propKeys: string[] ): Record< string, PropVa
|
|
|
81
82
|
const useAppliedStyles = () => {
|
|
82
83
|
const currentClassesProp = useClassesProp();
|
|
83
84
|
const baseStyles = useBaseStyles();
|
|
85
|
+
const defaultTagStyleId = useDefaultTagStyleId();
|
|
84
86
|
|
|
85
87
|
useStylesRerender();
|
|
86
88
|
|
|
@@ -88,7 +90,9 @@ const useAppliedStyles = () => {
|
|
|
88
90
|
|
|
89
91
|
const appliedStyles = classesPropTypeUtil.extract( classesProp ) ?? [];
|
|
90
92
|
|
|
91
|
-
|
|
93
|
+
const applicableIds = [ ...baseStyles, ...appliedStyles, ...( defaultTagStyleId ? [ defaultTagStyleId ] : [] ) ];
|
|
94
|
+
|
|
95
|
+
return stylesRepository.all().filter( ( style ) => applicableIds.includes( style.id ) );
|
|
92
96
|
};
|
|
93
97
|
|
|
94
98
|
const useBaseStyles = () => {
|
|
@@ -98,3 +102,9 @@ const useBaseStyles = () => {
|
|
|
98
102
|
|
|
99
103
|
return Object.keys( widgetCache?.base_styles ?? {} );
|
|
100
104
|
};
|
|
105
|
+
|
|
106
|
+
const useDefaultTagStyleId = () => {
|
|
107
|
+
const { element } = useElement();
|
|
108
|
+
|
|
109
|
+
return useDefaultStyleTagFromPreview( element.id );
|
|
110
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getDefaultStyleTagFromPreviewElement } from '@elementor/editor-elements';
|
|
2
|
+
import { __privateUseListenTo as useListenTo, commandEndEvent, windowEvent } from '@elementor/editor-v1-adapters';
|
|
3
|
+
|
|
4
|
+
export function useDefaultStyleTagFromPreview( elementId: string ) {
|
|
5
|
+
return useListenTo(
|
|
6
|
+
[
|
|
7
|
+
windowEvent( 'elementor/preview/atomic-widget/render' ),
|
|
8
|
+
commandEndEvent( 'document/elements/settings' ),
|
|
9
|
+
commandEndEvent( 'document/elements/set-settings' ),
|
|
10
|
+
commandEndEvent( 'document/elements/select' ),
|
|
11
|
+
],
|
|
12
|
+
() => getDefaultStyleTagFromPreviewElement( elementId )
|
|
13
|
+
);
|
|
14
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {
|
|
2
|
+
CreatableAutocomplete,
|
|
3
|
+
type CreatableAutocompleteProps,
|
|
4
|
+
type Option,
|
|
5
|
+
type ValidationEvent,
|
|
6
|
+
type ValidationResult,
|
|
7
|
+
} from './components/creatable-autocomplete';
|
|
2
8
|
export { injectIntoCssClassConvert } from './components/css-classes/css-class-convert-local';
|
|
3
9
|
export { ControlLabel } from './components/control-label';
|
|
4
10
|
export { injectIntoClassSelectorActions } from './components/css-classes/css-class-selector';
|
|
@@ -6,15 +12,26 @@ export { CustomCssIndicator } from './components/custom-css-indicator';
|
|
|
6
12
|
export { injectIntoPanelHeaderTop } from './components/editing-panel';
|
|
7
13
|
export { EditingPanelTabs } from './components/editing-panel-tabs';
|
|
8
14
|
export { SectionContent } from './components/section-content';
|
|
15
|
+
export { SectionsList } from './components/sections-list';
|
|
9
16
|
export { SettingsControl } from './components/settings-control';
|
|
10
17
|
export { SettingsField } from './controls-registry/settings-field';
|
|
11
18
|
export { StyleIndicator } from './components/style-indicator';
|
|
12
19
|
export { injectIntoStyleTab } from './components/style-tab';
|
|
20
|
+
export { StyleSections } from './components/style-sections';
|
|
21
|
+
export {
|
|
22
|
+
STYLE_SECTION_NAMES,
|
|
23
|
+
STYLE_SECTIONS,
|
|
24
|
+
type StyleSectionDefinition,
|
|
25
|
+
} from './components/style-sections-definition';
|
|
26
|
+
export { DEFAULT_PSEUDO_STATES, type PseudoStateOption } from './components/style-states/pseudo-states';
|
|
27
|
+
export { PseudoStateMenuItems } from './components/style-states/pseudo-state-menu-items';
|
|
28
|
+
export { usePseudoStates } from './components/style-states/use-pseudo-states';
|
|
13
29
|
export { injectIntoGridFields } from './components/style-sections/layout-section/layout-section';
|
|
14
30
|
export { StyleTabSection } from './components/style-tab-section';
|
|
15
|
-
export { useClassesProp } from './contexts/classes-prop-context';
|
|
31
|
+
export { ClassesPropProvider, useClassesProp } from './contexts/classes-prop-context';
|
|
16
32
|
export { ElementProvider, useElement } from './contexts/element-context';
|
|
17
|
-
export { useStyle } from './contexts/style-context';
|
|
33
|
+
export { StyleProvider, useStyle } from './contexts/style-context';
|
|
34
|
+
export { StyleInheritanceProvider } from './contexts/styles-inheritance-context';
|
|
18
35
|
export { Control as BaseControl } from './controls-registry/control';
|
|
19
36
|
export { ControlTypeContainer } from './controls-registry/control-type-container';
|
|
20
37
|
export { controlsRegistry, type ControlType } from './controls-registry/controls-registry';
|