@elementor/editor-editing-panel 3.35.0-341 → 3.35.0-343
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 +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +304 -293
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -20
- package/src/components/collapsible-content.tsx +1 -2
- package/src/components/editing-panel.tsx +29 -16
- package/src/components/section.tsx +1 -1
- package/src/editing-panel-replacement-registry.tsx +30 -0
- package/src/index.ts +3 -1
- package/src/components/collapse-icon.tsx +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "3.35.0-
|
|
3
|
+
"version": "3.35.0-343",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -39,27 +39,27 @@
|
|
|
39
39
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@elementor/editor": "3.35.0-
|
|
43
|
-
"@elementor/editor-canvas": "3.35.0-
|
|
44
|
-
"@elementor/editor-controls": "3.35.0-
|
|
45
|
-
"@elementor/editor-documents": "3.35.0-
|
|
46
|
-
"@elementor/editor-elements": "3.35.0-
|
|
47
|
-
"@elementor/editor-interactions": "3.35.0-
|
|
48
|
-
"@elementor/editor-panels": "3.35.0-
|
|
49
|
-
"@elementor/editor-props": "3.35.0-
|
|
50
|
-
"@elementor/editor-responsive": "3.35.0-
|
|
51
|
-
"@elementor/editor-styles": "3.35.0-
|
|
52
|
-
"@elementor/editor-styles-repository": "3.35.0-
|
|
53
|
-
"@elementor/editor-ui": "3.35.0-
|
|
54
|
-
"@elementor/editor-v1-adapters": "3.35.0-
|
|
42
|
+
"@elementor/editor": "3.35.0-343",
|
|
43
|
+
"@elementor/editor-canvas": "3.35.0-343",
|
|
44
|
+
"@elementor/editor-controls": "3.35.0-343",
|
|
45
|
+
"@elementor/editor-documents": "3.35.0-343",
|
|
46
|
+
"@elementor/editor-elements": "3.35.0-343",
|
|
47
|
+
"@elementor/editor-interactions": "3.35.0-343",
|
|
48
|
+
"@elementor/editor-panels": "3.35.0-343",
|
|
49
|
+
"@elementor/editor-props": "3.35.0-343",
|
|
50
|
+
"@elementor/editor-responsive": "3.35.0-343",
|
|
51
|
+
"@elementor/editor-styles": "3.35.0-343",
|
|
52
|
+
"@elementor/editor-styles-repository": "3.35.0-343",
|
|
53
|
+
"@elementor/editor-ui": "3.35.0-343",
|
|
54
|
+
"@elementor/editor-v1-adapters": "3.35.0-343",
|
|
55
55
|
"@elementor/icons": "^1.62.0",
|
|
56
|
-
"@elementor/locations": "3.35.0-
|
|
57
|
-
"@elementor/menus": "3.35.0-
|
|
58
|
-
"@elementor/schema": "3.35.0-
|
|
59
|
-
"@elementor/session": "3.35.0-
|
|
56
|
+
"@elementor/locations": "3.35.0-343",
|
|
57
|
+
"@elementor/menus": "3.35.0-343",
|
|
58
|
+
"@elementor/schema": "3.35.0-343",
|
|
59
|
+
"@elementor/session": "3.35.0-343",
|
|
60
60
|
"@elementor/ui": "1.36.17",
|
|
61
|
-
"@elementor/utils": "3.35.0-
|
|
62
|
-
"@elementor/wp-media": "3.35.0-
|
|
61
|
+
"@elementor/utils": "3.35.0-343",
|
|
62
|
+
"@elementor/wp-media": "3.35.0-343",
|
|
63
63
|
"@wordpress/i18n": "^5.13.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type ReactNode, useState } from 'react';
|
|
3
|
+
import { CollapseIcon } from '@elementor/editor-ui';
|
|
3
4
|
import { Button, Collapse, Stack, styled } from '@elementor/ui';
|
|
4
5
|
import { __ } from '@wordpress/i18n';
|
|
5
6
|
|
|
6
|
-
import { CollapseIcon } from './collapse-icon';
|
|
7
|
-
|
|
8
7
|
type StaticItem< T = unknown > = T extends ( ...args: unknown[] ) => unknown ? never : T;
|
|
9
8
|
|
|
10
9
|
type CallbackItem< T > = ( isOpen: boolean ) => T;
|
|
@@ -12,6 +12,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
12
12
|
import { ElementProvider } from '../contexts/element-context';
|
|
13
13
|
import { getControlReplacements } from '../control-replacement';
|
|
14
14
|
import { controlActionsMenu } from '../controls-actions';
|
|
15
|
+
import { getEditingPanelReplacement } from '../editing-panel-replacement-registry';
|
|
15
16
|
import { EditorPanelErrorFallback } from './editing-panel-error-fallback';
|
|
16
17
|
import { EditingPanelTabs } from './editing-panel-tabs';
|
|
17
18
|
|
|
@@ -31,26 +32,38 @@ export const EditingPanel = () => {
|
|
|
31
32
|
/* translators: %s: Element type title. */
|
|
32
33
|
const panelTitle = __( 'Edit %s', 'elementor' ).replace( '%s', elementType.title );
|
|
33
34
|
|
|
35
|
+
const { component: ReplacementComponent } = getEditingPanelReplacement( element, elementType ) ?? {};
|
|
36
|
+
|
|
37
|
+
let panelContent = (
|
|
38
|
+
<>
|
|
39
|
+
<PanelHeader>
|
|
40
|
+
<PanelHeaderTitle>{ panelTitle }</PanelHeaderTitle>
|
|
41
|
+
<AtomIcon fontSize="small" sx={ { color: 'text.tertiary' } } />
|
|
42
|
+
</PanelHeader>
|
|
43
|
+
<PanelBody>
|
|
44
|
+
<EditingPanelTabs />
|
|
45
|
+
</PanelBody>
|
|
46
|
+
</>
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
if ( ReplacementComponent ) {
|
|
50
|
+
panelContent = <ReplacementComponent />;
|
|
51
|
+
}
|
|
52
|
+
|
|
34
53
|
return (
|
|
35
54
|
<ErrorBoundary fallback={ <EditorPanelErrorFallback /> }>
|
|
36
55
|
<SessionStorageProvider prefix={ 'elementor' }>
|
|
37
56
|
<ThemeProvider>
|
|
38
|
-
<
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<EditingPanelTabs />
|
|
49
|
-
</ElementProvider>
|
|
50
|
-
</ControlReplacementsProvider>
|
|
51
|
-
</ControlActionsProvider>
|
|
52
|
-
</PanelBody>
|
|
53
|
-
</Panel>
|
|
57
|
+
<ControlActionsProvider items={ menuItems }>
|
|
58
|
+
<ControlReplacementsProvider replacements={ controlReplacements }>
|
|
59
|
+
<ElementProvider element={ element } elementType={ elementType }>
|
|
60
|
+
<Panel>
|
|
61
|
+
<PanelHeaderTopSlot />
|
|
62
|
+
{ panelContent }
|
|
63
|
+
</Panel>
|
|
64
|
+
</ElementProvider>
|
|
65
|
+
</ControlReplacementsProvider>
|
|
66
|
+
</ControlActionsProvider>
|
|
54
67
|
</ThemeProvider>
|
|
55
68
|
</SessionStorageProvider>
|
|
56
69
|
</ErrorBoundary>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type PropsWithChildren, type ReactNode, useId, useRef } from 'react';
|
|
3
|
+
import { CollapseIcon } from '@elementor/editor-ui';
|
|
3
4
|
import { Collapse, Divider, ListItemButton, ListItemText, Stack } from '@elementor/ui';
|
|
4
5
|
|
|
5
6
|
import { SectionRefContext } from '../contexts/section-context';
|
|
6
7
|
import { useStateByElement } from '../hooks/use-state-by-element';
|
|
7
|
-
import { CollapseIcon } from './collapse-icon';
|
|
8
8
|
import { type CollapsibleValue, getCollapsibleValue } from './collapsible-content';
|
|
9
9
|
|
|
10
10
|
type Props = PropsWithChildren< {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ComponentType } from 'react';
|
|
2
|
+
import { type Element, type ElementType } from '@elementor/editor-elements';
|
|
3
|
+
|
|
4
|
+
type EditingPanelReplacement = {
|
|
5
|
+
condition: ( element: Element, elementType: ElementType ) => boolean;
|
|
6
|
+
component: ComponentType;
|
|
7
|
+
|
|
8
|
+
// ordered from lowest to highest
|
|
9
|
+
priority: number;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const registry = new Map< string, EditingPanelReplacement >();
|
|
13
|
+
|
|
14
|
+
const DEFAULT_PRIORITY = 10;
|
|
15
|
+
|
|
16
|
+
export const registerEditingPanelReplacement = ( {
|
|
17
|
+
id,
|
|
18
|
+
priority = DEFAULT_PRIORITY,
|
|
19
|
+
...props
|
|
20
|
+
}: Omit< EditingPanelReplacement, 'priority' > & { id: string; priority?: number } ) => {
|
|
21
|
+
registry.set( id, { ...props, priority } );
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const getEditingPanelReplacement = (
|
|
25
|
+
element: Element,
|
|
26
|
+
elementType: ElementType
|
|
27
|
+
): EditingPanelReplacement | null =>
|
|
28
|
+
Array.from( registry.values() )
|
|
29
|
+
.filter( ( { condition } ) => condition( element, elementType ) )
|
|
30
|
+
.sort( ( a, b ) => a.priority - b.priority )?.[ 0 ] ?? null;
|
package/src/index.ts
CHANGED
|
@@ -17,10 +17,11 @@ export { useSectionWidth } from './contexts/section-context';
|
|
|
17
17
|
export { useStyle } from './contexts/style-context';
|
|
18
18
|
export { registerControlReplacement } from './control-replacement';
|
|
19
19
|
export { controlActionsMenu } from './controls-actions';
|
|
20
|
-
export { controlsRegistry } from './controls-registry/controls-registry';
|
|
20
|
+
export { controlsRegistry, type ControlType } from './controls-registry/controls-registry';
|
|
21
21
|
export { StylesProviderCannotUpdatePropsError } from './errors';
|
|
22
22
|
export { createTopLevelObjectType } from './controls-registry/create-top-level-object-type';
|
|
23
23
|
export { useCustomCss } from './hooks/use-custom-css';
|
|
24
|
+
export { useStateByElement } from './hooks/use-state-by-element';
|
|
24
25
|
export { getSubtitle, getTitle, HISTORY_DEBOUNCE_WAIT } from './hooks/use-styles-fields';
|
|
25
26
|
export { useStylesRerender } from './hooks/use-styles-rerender';
|
|
26
27
|
export { init } from './init';
|
|
@@ -29,5 +30,6 @@ export type { PopoverActionProps } from './popover-action';
|
|
|
29
30
|
export { registerStyleProviderToColors } from './provider-colors-registry';
|
|
30
31
|
export { stylesInheritanceTransformersRegistry } from './styles-inheritance/styles-inheritance-transformers-registry';
|
|
31
32
|
export { registerFieldIndicator, FIELD_TYPE } from './field-indicators-registry';
|
|
33
|
+
export { registerEditingPanelReplacement } from './editing-panel-replacement-registry';
|
|
32
34
|
|
|
33
35
|
export { doApplyClasses, doGetAppliedClasses, doUnapplyClass } from './apply-unapply-actions';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ChevronDownIcon } from '@elementor/icons';
|
|
2
|
-
import { styled } from '@elementor/ui';
|
|
3
|
-
|
|
4
|
-
// TODO: Replace this with future Rotate component that will be implemented in elementor-ui
|
|
5
|
-
export const CollapseIcon = styled( ChevronDownIcon, {
|
|
6
|
-
shouldForwardProp: ( prop ) => prop !== 'open',
|
|
7
|
-
} )< { open: boolean } >( ( { theme, open } ) => ( {
|
|
8
|
-
transform: open ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
9
|
-
transition: theme.transitions.create( 'transform', {
|
|
10
|
-
duration: theme.transitions.duration.standard,
|
|
11
|
-
} ),
|
|
12
|
-
} ) );
|