@elementor/editor-elements 3.35.0-326 → 3.35.0-327
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 +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.js +0 -609
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +0 -608
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/src/index.ts +0 -2
- package/src/mcp/elements-tool.ts +0 -345
- package/src/mcp/handlers/common-style-utils.ts +0 -23
- package/src/mcp/handlers/create-element.ts +0 -96
- package/src/mcp/handlers/create-style.ts +0 -42
- package/src/mcp/handlers/delete-element.ts +0 -17
- package/src/mcp/handlers/delete-style.ts +0 -22
- package/src/mcp/handlers/deselect-element.ts +0 -21
- package/src/mcp/handlers/duplicate-element.ts +0 -22
- package/src/mcp/handlers/get-element-props.ts +0 -28
- package/src/mcp/handlers/get-element-schema.ts +0 -17
- package/src/mcp/handlers/get-selected.ts +0 -5
- package/src/mcp/handlers/get-styles.ts +0 -26
- package/src/mcp/handlers/list-available-types.ts +0 -27
- package/src/mcp/handlers/move-element.ts +0 -30
- package/src/mcp/handlers/select-element.ts +0 -25
- package/src/mcp/handlers/update-props.ts +0 -22
- package/src/mcp/handlers/update-styles.ts +0 -45
- package/src/mcp/index.ts +0 -9
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { getWidgetsCache } from '../../sync/get-widgets-cache';
|
|
2
|
-
|
|
3
|
-
export type AvailableElementType = {
|
|
4
|
-
type: string;
|
|
5
|
-
title: string;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export function handleListAvailableTypes(): AvailableElementType[] {
|
|
9
|
-
const widgetsCache = getWidgetsCache();
|
|
10
|
-
|
|
11
|
-
if ( ! widgetsCache ) {
|
|
12
|
-
return [];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const availableTypes: AvailableElementType[] = [];
|
|
16
|
-
|
|
17
|
-
Object.entries( widgetsCache ).forEach( ( [ type, config ] ) => {
|
|
18
|
-
if ( config?.atomic_controls && config?.atomic_props_schema ) {
|
|
19
|
-
availableTypes.push( {
|
|
20
|
-
type,
|
|
21
|
-
title: config.title || type,
|
|
22
|
-
} );
|
|
23
|
-
}
|
|
24
|
-
} );
|
|
25
|
-
|
|
26
|
-
return availableTypes;
|
|
27
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { getContainer } from '../../sync/get-container';
|
|
2
|
-
import { moveElement } from '../../sync/move-element';
|
|
3
|
-
|
|
4
|
-
export function handleMoveElement( {
|
|
5
|
-
elementId,
|
|
6
|
-
targetContainerId,
|
|
7
|
-
}: {
|
|
8
|
-
elementId: string;
|
|
9
|
-
targetContainerId: string;
|
|
10
|
-
} ): { success: boolean } {
|
|
11
|
-
const container = getContainer( elementId );
|
|
12
|
-
|
|
13
|
-
if ( ! container ) {
|
|
14
|
-
throw new Error( `Element with ID "${ elementId }" not found` );
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const targetContainer = getContainer( targetContainerId );
|
|
18
|
-
|
|
19
|
-
if ( ! targetContainer ) {
|
|
20
|
-
throw new Error( `Target container with ID "${ targetContainerId }" not found` );
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
moveElement( {
|
|
24
|
-
elementId,
|
|
25
|
-
targetContainerId,
|
|
26
|
-
options: { useHistory: true },
|
|
27
|
-
} );
|
|
28
|
-
|
|
29
|
-
return { success: true };
|
|
30
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { getContainer, selectElement } from '../../sync/get-container';
|
|
2
|
-
|
|
3
|
-
export function handleSelectElement( elementId: string ): { success: boolean } {
|
|
4
|
-
const container = getContainer( elementId );
|
|
5
|
-
|
|
6
|
-
if ( ! container ) {
|
|
7
|
-
throw new Error( `Element with ID "${ elementId }" not found` );
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
selectElement( elementId );
|
|
11
|
-
|
|
12
|
-
return { success: true };
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function handleSelectMultipleElements( elementIds: string[] ): { success: boolean } {
|
|
16
|
-
elementIds.forEach( ( elementId ) => {
|
|
17
|
-
const container = getContainer( elementId );
|
|
18
|
-
|
|
19
|
-
if ( container ) {
|
|
20
|
-
selectElement( elementId );
|
|
21
|
-
}
|
|
22
|
-
} );
|
|
23
|
-
|
|
24
|
-
return { success: true };
|
|
25
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type Props } from '@elementor/editor-props';
|
|
2
|
-
|
|
3
|
-
import { getContainer } from '../../sync/get-container';
|
|
4
|
-
import { updateElementSettings } from '../../sync/update-element-settings';
|
|
5
|
-
|
|
6
|
-
export function handleUpdateProps( { elementId, props }: { elementId: string; props: Record< string, unknown > } ): {
|
|
7
|
-
success: boolean;
|
|
8
|
-
} {
|
|
9
|
-
const container = getContainer( elementId );
|
|
10
|
-
|
|
11
|
-
if ( ! container ) {
|
|
12
|
-
throw new Error( `Element with ID "${ elementId }" not found` );
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
updateElementSettings( {
|
|
16
|
-
id: elementId,
|
|
17
|
-
props: props as Props,
|
|
18
|
-
withHistory: true,
|
|
19
|
-
} );
|
|
20
|
-
|
|
21
|
-
return { success: true };
|
|
22
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { type Props } from '@elementor/editor-props';
|
|
2
|
-
import { type StyleDefinitionState } from '@elementor/editor-styles';
|
|
3
|
-
|
|
4
|
-
import { updateElementStyle } from '../../styles/update-element-style';
|
|
5
|
-
import { getElementStyles } from '../../sync/get-element-styles';
|
|
6
|
-
import { resolveBreakpointId } from './common-style-utils';
|
|
7
|
-
|
|
8
|
-
export function handleUpdateStyles( {
|
|
9
|
-
elementId,
|
|
10
|
-
styleId,
|
|
11
|
-
styles,
|
|
12
|
-
breakpoint = 'desktop',
|
|
13
|
-
state = null,
|
|
14
|
-
}: {
|
|
15
|
-
elementId: string;
|
|
16
|
-
styleId?: string;
|
|
17
|
-
styles: Props;
|
|
18
|
-
breakpoint?: string | null;
|
|
19
|
-
state?: string | null;
|
|
20
|
-
} ): { success: boolean } {
|
|
21
|
-
const resolvedBreakpoint = resolveBreakpointId( breakpoint );
|
|
22
|
-
|
|
23
|
-
const resolvedState: StyleDefinitionState =
|
|
24
|
-
state === null || state === undefined ? null : ( state as StyleDefinitionState );
|
|
25
|
-
const elementStyles = getElementStyles( elementId );
|
|
26
|
-
|
|
27
|
-
if ( ! elementStyles ) {
|
|
28
|
-
throw new Error( `Element with ID "${ elementId }" has no styles. Create a style first.` );
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const resolvedStyleId = styleId || Object.keys( elementStyles )[ 0 ];
|
|
32
|
-
|
|
33
|
-
if ( ! resolvedStyleId ) {
|
|
34
|
-
throw new Error( `Element with ID "${ elementId }" has no styles. Create a style first.` );
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
updateElementStyle( {
|
|
38
|
-
elementId,
|
|
39
|
-
styleId: resolvedStyleId,
|
|
40
|
-
meta: { breakpoint: resolvedBreakpoint, state: resolvedState },
|
|
41
|
-
props: styles,
|
|
42
|
-
} );
|
|
43
|
-
|
|
44
|
-
return { success: true };
|
|
45
|
-
}
|
package/src/mcp/index.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { getMCPByDomain } from '@elementor/editor-mcp';
|
|
2
|
-
|
|
3
|
-
import { initElementsTool } from './elements-tool';
|
|
4
|
-
|
|
5
|
-
export function initMcp() {
|
|
6
|
-
const { setMCPDescription } = getMCPByDomain( 'elements' );
|
|
7
|
-
setMCPDescription( 'Tools for managing atomic elements in Elementor v4 editor' );
|
|
8
|
-
initElementsTool();
|
|
9
|
-
}
|