@elementor/editor-canvas 4.3.0-1000 → 4.3.0-1002
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.js +11 -11
- package/dist/index.mjs +11 -11
- package/package.json +20 -20
- package/src/mcp/resources/__tests__/available-widgets-resource.test.ts +22 -13
- package/src/mcp/resources/__tests__/widgets-schema-resource.test.ts +11 -6
- package/src/mcp/resources/available-widgets-resource.ts +13 -10
- package/src/mcp/resources/widgets-schema-resource.ts +8 -5
package/dist/index.js
CHANGED
|
@@ -81,10 +81,10 @@ var BEST_PRACTICES_FULL_URI = `${CANVAS_SERVER_NAME}_${BEST_PRACTICES_URI}`;
|
|
|
81
81
|
var MCP_PROXY_URL = "elementor/v1/mcp-proxy";
|
|
82
82
|
var listWidgetTypes = async () => {
|
|
83
83
|
const { data } = await (0, import_http_client.httpService)().post(MCP_PROXY_URL, {
|
|
84
|
-
tool: "list-
|
|
85
|
-
input: {}
|
|
84
|
+
tool: "list-widget-schemas",
|
|
85
|
+
input: { summary: true }
|
|
86
86
|
});
|
|
87
|
-
return (data.data ?? []).map((widget) => widget.type);
|
|
87
|
+
return (data.data?.widgets ?? []).map((widget) => widget.type);
|
|
88
88
|
};
|
|
89
89
|
var fetchWidgetSchema = async (widgetType) => {
|
|
90
90
|
const { data } = await (0, import_http_client.httpService)().post(MCP_PROXY_URL, {
|
|
@@ -3968,15 +3968,15 @@ var import_http_client3 = require("@elementor/http-client");
|
|
|
3968
3968
|
var MCP_PROXY_URL2 = "elementor/v1/mcp-proxy";
|
|
3969
3969
|
var AVAILABLE_WIDGETS_URI = "elementor://context/available-widgets";
|
|
3970
3970
|
var AVAILABLE_WIDGETS_URI_V4 = "elementor://context/available-widgets/v4";
|
|
3971
|
-
var fetchWidgets = async (
|
|
3971
|
+
var fetchWidgets = async () => {
|
|
3972
3972
|
const { data } = await (0, import_http_client3.httpService)().post(MCP_PROXY_URL2, {
|
|
3973
|
-
tool: "list-
|
|
3974
|
-
input:
|
|
3973
|
+
tool: "list-widget-schemas",
|
|
3974
|
+
input: { summary: true }
|
|
3975
3975
|
});
|
|
3976
|
-
return data.data ?? [];
|
|
3976
|
+
return data.data?.widgets ?? [];
|
|
3977
3977
|
};
|
|
3978
|
-
var buildContents = async (uri
|
|
3979
|
-
const widgets = await fetchWidgets(
|
|
3978
|
+
var buildContents = async (uri) => {
|
|
3979
|
+
const widgets = await fetchWidgets();
|
|
3980
3980
|
return {
|
|
3981
3981
|
contents: [
|
|
3982
3982
|
{
|
|
@@ -3995,13 +3995,13 @@ var initAvailableWidgetsResource = (reg) => {
|
|
|
3995
3995
|
{
|
|
3996
3996
|
description: "All registered v4 version widgets"
|
|
3997
3997
|
},
|
|
3998
|
-
async () => buildContents(AVAILABLE_WIDGETS_URI_V4
|
|
3998
|
+
async () => buildContents(AVAILABLE_WIDGETS_URI_V4)
|
|
3999
3999
|
);
|
|
4000
4000
|
resource(
|
|
4001
4001
|
"available-widgets",
|
|
4002
4002
|
AVAILABLE_WIDGETS_URI,
|
|
4003
4003
|
{
|
|
4004
|
-
description: "All registered widget types with
|
|
4004
|
+
description: "All registered v4 widget types with description."
|
|
4005
4005
|
},
|
|
4006
4006
|
async () => buildContents(AVAILABLE_WIDGETS_URI)
|
|
4007
4007
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -12,10 +12,10 @@ var BEST_PRACTICES_FULL_URI = `${CANVAS_SERVER_NAME}_${BEST_PRACTICES_URI}`;
|
|
|
12
12
|
var MCP_PROXY_URL = "elementor/v1/mcp-proxy";
|
|
13
13
|
var listWidgetTypes = async () => {
|
|
14
14
|
const { data } = await httpService().post(MCP_PROXY_URL, {
|
|
15
|
-
tool: "list-
|
|
16
|
-
input: {}
|
|
15
|
+
tool: "list-widget-schemas",
|
|
16
|
+
input: { summary: true }
|
|
17
17
|
});
|
|
18
|
-
return (data.data ?? []).map((widget) => widget.type);
|
|
18
|
+
return (data.data?.widgets ?? []).map((widget) => widget.type);
|
|
19
19
|
};
|
|
20
20
|
var fetchWidgetSchema = async (widgetType) => {
|
|
21
21
|
const { data } = await httpService().post(MCP_PROXY_URL, {
|
|
@@ -3929,15 +3929,15 @@ import { httpService as httpService3 } from "@elementor/http-client";
|
|
|
3929
3929
|
var MCP_PROXY_URL2 = "elementor/v1/mcp-proxy";
|
|
3930
3930
|
var AVAILABLE_WIDGETS_URI = "elementor://context/available-widgets";
|
|
3931
3931
|
var AVAILABLE_WIDGETS_URI_V4 = "elementor://context/available-widgets/v4";
|
|
3932
|
-
var fetchWidgets = async (
|
|
3932
|
+
var fetchWidgets = async () => {
|
|
3933
3933
|
const { data } = await httpService3().post(MCP_PROXY_URL2, {
|
|
3934
|
-
tool: "list-
|
|
3935
|
-
input:
|
|
3934
|
+
tool: "list-widget-schemas",
|
|
3935
|
+
input: { summary: true }
|
|
3936
3936
|
});
|
|
3937
|
-
return data.data ?? [];
|
|
3937
|
+
return data.data?.widgets ?? [];
|
|
3938
3938
|
};
|
|
3939
|
-
var buildContents = async (uri
|
|
3940
|
-
const widgets = await fetchWidgets(
|
|
3939
|
+
var buildContents = async (uri) => {
|
|
3940
|
+
const widgets = await fetchWidgets();
|
|
3941
3941
|
return {
|
|
3942
3942
|
contents: [
|
|
3943
3943
|
{
|
|
@@ -3956,13 +3956,13 @@ var initAvailableWidgetsResource = (reg) => {
|
|
|
3956
3956
|
{
|
|
3957
3957
|
description: "All registered v4 version widgets"
|
|
3958
3958
|
},
|
|
3959
|
-
async () => buildContents(AVAILABLE_WIDGETS_URI_V4
|
|
3959
|
+
async () => buildContents(AVAILABLE_WIDGETS_URI_V4)
|
|
3960
3960
|
);
|
|
3961
3961
|
resource(
|
|
3962
3962
|
"available-widgets",
|
|
3963
3963
|
AVAILABLE_WIDGETS_URI,
|
|
3964
3964
|
{
|
|
3965
|
-
description: "All registered widget types with
|
|
3965
|
+
description: "All registered v4 widget types with description."
|
|
3966
3966
|
},
|
|
3967
3967
|
async () => buildContents(AVAILABLE_WIDGETS_URI)
|
|
3968
3968
|
);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-canvas",
|
|
3
3
|
"description": "Elementor Editor Canvas",
|
|
4
|
-
"version": "4.3.0-
|
|
4
|
+
"version": "4.3.0-1002",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -37,26 +37,26 @@
|
|
|
37
37
|
"react-dom": "^18.3.1"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@elementor/editor": "4.3.0-
|
|
41
|
-
"@elementor/editor-controls": "4.3.0-
|
|
42
|
-
"@elementor/editor-documents": "4.3.0-
|
|
43
|
-
"@elementor/editor-elements": "4.3.0-
|
|
44
|
-
"@elementor/editor-interactions": "4.3.0-
|
|
45
|
-
"@elementor/editor-mcp": "4.3.0-
|
|
46
|
-
"@elementor/editor-notifications": "4.3.0-
|
|
47
|
-
"@elementor/editor-props": "4.3.0-
|
|
48
|
-
"@elementor/editor-responsive": "4.3.0-
|
|
49
|
-
"@elementor/editor-styles": "4.3.0-
|
|
50
|
-
"@elementor/editor-styles-repository": "4.3.0-
|
|
51
|
-
"@elementor/editor-ui": "4.3.0-
|
|
52
|
-
"@elementor/editor-v1-adapters": "4.3.0-
|
|
53
|
-
"@elementor/events": "4.3.0-
|
|
54
|
-
"@elementor/http-client": "4.3.0-
|
|
55
|
-
"@elementor/schema": "4.3.0-
|
|
56
|
-
"@elementor/twing": "4.3.0-
|
|
40
|
+
"@elementor/editor": "4.3.0-1002",
|
|
41
|
+
"@elementor/editor-controls": "4.3.0-1002",
|
|
42
|
+
"@elementor/editor-documents": "4.3.0-1002",
|
|
43
|
+
"@elementor/editor-elements": "4.3.0-1002",
|
|
44
|
+
"@elementor/editor-interactions": "4.3.0-1002",
|
|
45
|
+
"@elementor/editor-mcp": "4.3.0-1002",
|
|
46
|
+
"@elementor/editor-notifications": "4.3.0-1002",
|
|
47
|
+
"@elementor/editor-props": "4.3.0-1002",
|
|
48
|
+
"@elementor/editor-responsive": "4.3.0-1002",
|
|
49
|
+
"@elementor/editor-styles": "4.3.0-1002",
|
|
50
|
+
"@elementor/editor-styles-repository": "4.3.0-1002",
|
|
51
|
+
"@elementor/editor-ui": "4.3.0-1002",
|
|
52
|
+
"@elementor/editor-v1-adapters": "4.3.0-1002",
|
|
53
|
+
"@elementor/events": "4.3.0-1002",
|
|
54
|
+
"@elementor/http-client": "4.3.0-1002",
|
|
55
|
+
"@elementor/schema": "4.3.0-1002",
|
|
56
|
+
"@elementor/twing": "4.3.0-1002",
|
|
57
57
|
"@elementor/ui": "1.37.5",
|
|
58
|
-
"@elementor/utils": "4.3.0-
|
|
59
|
-
"@elementor/wp-media": "4.3.0-
|
|
58
|
+
"@elementor/utils": "4.3.0-1002",
|
|
59
|
+
"@elementor/wp-media": "4.3.0-1002",
|
|
60
60
|
"@floating-ui/react": "^0.27.5",
|
|
61
61
|
"@wordpress/i18n": "^5.13.0",
|
|
62
62
|
"dompurify": "^3.2.6"
|
|
@@ -28,14 +28,16 @@ describe( 'available-widgets-resource', () => {
|
|
|
28
28
|
jest.clearAllMocks();
|
|
29
29
|
} );
|
|
30
30
|
|
|
31
|
-
it( 'fetches all widgets via list-
|
|
31
|
+
it( 'fetches all widgets via list-widget-schemas with summary=true', async () => {
|
|
32
32
|
// Arrange
|
|
33
33
|
const post = jest.fn().mockResolvedValue( {
|
|
34
34
|
data: {
|
|
35
|
-
data:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
data: {
|
|
36
|
+
widgets: [
|
|
37
|
+
{ type: 'e-heading', description: 'A heading widget' },
|
|
38
|
+
{ type: 'e-button', description: 'A button widget' },
|
|
39
|
+
],
|
|
40
|
+
},
|
|
39
41
|
},
|
|
40
42
|
} );
|
|
41
43
|
mockedHttpService.mockReturnValue( { post } as never );
|
|
@@ -45,16 +47,21 @@ describe( 'available-widgets-resource', () => {
|
|
|
45
47
|
const result = await allHandler();
|
|
46
48
|
|
|
47
49
|
// Assert
|
|
48
|
-
expect( post ).toHaveBeenCalledWith( 'elementor/v1/mcp-proxy', {
|
|
50
|
+
expect( post ).toHaveBeenCalledWith( 'elementor/v1/mcp-proxy', {
|
|
51
|
+
tool: 'list-widget-schemas',
|
|
52
|
+
input: { summary: true },
|
|
53
|
+
} );
|
|
49
54
|
expect( JSON.parse( result.contents[ 0 ].text ) ).toEqual( [
|
|
50
|
-
{ type: 'e-heading',
|
|
51
|
-
{ type: '
|
|
55
|
+
{ type: 'e-heading', description: 'A heading widget' },
|
|
56
|
+
{ type: 'e-button', description: 'A button widget' },
|
|
52
57
|
] );
|
|
53
58
|
} );
|
|
54
59
|
|
|
55
|
-
it( 'fetches
|
|
60
|
+
it( 'fetches v4 widgets via list-widget-schemas with summary=true', async () => {
|
|
56
61
|
// Arrange
|
|
57
|
-
const post = jest.fn().mockResolvedValue( {
|
|
62
|
+
const post = jest.fn().mockResolvedValue( {
|
|
63
|
+
data: { data: { widgets: [ { type: 'e-heading', description: 'A heading widget' } ] } },
|
|
64
|
+
} );
|
|
58
65
|
mockedHttpService.mockReturnValue( { post } as never );
|
|
59
66
|
const { v4Handler } = captureHandlers();
|
|
60
67
|
|
|
@@ -63,10 +70,12 @@ describe( 'available-widgets-resource', () => {
|
|
|
63
70
|
|
|
64
71
|
// Assert
|
|
65
72
|
expect( post ).toHaveBeenCalledWith( 'elementor/v1/mcp-proxy', {
|
|
66
|
-
tool: 'list-
|
|
67
|
-
input: {
|
|
73
|
+
tool: 'list-widget-schemas',
|
|
74
|
+
input: { summary: true },
|
|
68
75
|
} );
|
|
69
|
-
expect( JSON.parse( result.contents[ 0 ].text ) ).toEqual( [
|
|
76
|
+
expect( JSON.parse( result.contents[ 0 ].text ) ).toEqual( [
|
|
77
|
+
{ type: 'e-heading', description: 'A heading widget' },
|
|
78
|
+
] );
|
|
70
79
|
} );
|
|
71
80
|
|
|
72
81
|
it( 'exposes the expected resource URIs', () => {
|
|
@@ -40,14 +40,16 @@ describe( 'widgets-schema-resource', () => {
|
|
|
40
40
|
jest.clearAllMocks();
|
|
41
41
|
} );
|
|
42
42
|
|
|
43
|
-
it( 'lists widget types fetched from the server via
|
|
43
|
+
it( 'lists widget types fetched from the server via list-widget-schemas with summary=true', async () => {
|
|
44
44
|
// Arrange
|
|
45
45
|
const post = jest.fn().mockResolvedValue( {
|
|
46
46
|
data: {
|
|
47
|
-
data:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
data: {
|
|
48
|
+
widgets: [
|
|
49
|
+
{ type: 'e-heading', description: 'A heading widget' },
|
|
50
|
+
{ type: 'e-button', description: 'A button widget' },
|
|
51
|
+
],
|
|
52
|
+
},
|
|
51
53
|
},
|
|
52
54
|
} );
|
|
53
55
|
mockedHttpService.mockReturnValue( { post } as never );
|
|
@@ -57,7 +59,10 @@ describe( 'widgets-schema-resource', () => {
|
|
|
57
59
|
const result = await list();
|
|
58
60
|
|
|
59
61
|
// Assert
|
|
60
|
-
expect( post ).toHaveBeenCalledWith( 'elementor/v1/mcp-proxy', {
|
|
62
|
+
expect( post ).toHaveBeenCalledWith( 'elementor/v1/mcp-proxy', {
|
|
63
|
+
tool: 'list-widget-schemas',
|
|
64
|
+
input: { summary: true },
|
|
65
|
+
} );
|
|
61
66
|
expect( result.resources ).toEqual( [
|
|
62
67
|
{ uri: 'elementor://widgets/schema/e-heading', name: 'Widget schema for e-heading' },
|
|
63
68
|
{ uri: 'elementor://widgets/schema/e-button', name: 'Widget schema for e-button' },
|
|
@@ -8,21 +8,24 @@ export const AVAILABLE_WIDGETS_URI_V4 = 'elementor://context/available-widgets/v
|
|
|
8
8
|
|
|
9
9
|
type WidgetSummary = {
|
|
10
10
|
type: string;
|
|
11
|
-
version: 'v3' | 'v4';
|
|
12
11
|
description?: string;
|
|
13
12
|
};
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
type WidgetSummaryResponse = {
|
|
15
|
+
widgets: WidgetSummary[];
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const fetchWidgets = async (): Promise< WidgetSummary[] > => {
|
|
19
|
+
const { data } = await httpService().post< HttpResponse< WidgetSummaryResponse > >( MCP_PROXY_URL, {
|
|
20
|
+
tool: 'list-widget-schemas',
|
|
21
|
+
input: { summary: true },
|
|
19
22
|
} );
|
|
20
23
|
|
|
21
|
-
return data.data ?? [];
|
|
24
|
+
return data.data?.widgets ?? [];
|
|
22
25
|
};
|
|
23
26
|
|
|
24
|
-
const buildContents = async ( uri: string
|
|
25
|
-
const widgets = await fetchWidgets(
|
|
27
|
+
const buildContents = async ( uri: string ) => {
|
|
28
|
+
const widgets = await fetchWidgets();
|
|
26
29
|
|
|
27
30
|
return {
|
|
28
31
|
contents: [
|
|
@@ -44,14 +47,14 @@ export const initAvailableWidgetsResource = ( reg: MCPRegistryEntry ) => {
|
|
|
44
47
|
{
|
|
45
48
|
description: 'All registered v4 version widgets',
|
|
46
49
|
},
|
|
47
|
-
async () => buildContents( AVAILABLE_WIDGETS_URI_V4
|
|
50
|
+
async () => buildContents( AVAILABLE_WIDGETS_URI_V4 )
|
|
48
51
|
);
|
|
49
52
|
|
|
50
53
|
resource(
|
|
51
54
|
'available-widgets',
|
|
52
55
|
AVAILABLE_WIDGETS_URI,
|
|
53
56
|
{
|
|
54
|
-
description: 'All registered widget types with
|
|
57
|
+
description: 'All registered v4 widget types with description.',
|
|
55
58
|
},
|
|
56
59
|
async () => buildContents( AVAILABLE_WIDGETS_URI )
|
|
57
60
|
);
|
|
@@ -13,17 +13,20 @@ const MCP_PROXY_URL = 'elementor/v1/mcp-proxy';
|
|
|
13
13
|
|
|
14
14
|
type WidgetSummary = {
|
|
15
15
|
type: string;
|
|
16
|
-
version: 'v3' | 'v4';
|
|
17
16
|
description?: string;
|
|
18
17
|
};
|
|
19
18
|
|
|
19
|
+
type WidgetSummaryResponse = {
|
|
20
|
+
widgets: WidgetSummary[];
|
|
21
|
+
};
|
|
22
|
+
|
|
20
23
|
const listWidgetTypes = async (): Promise< string[] > => {
|
|
21
|
-
const { data } = await httpService().post< HttpResponse<
|
|
22
|
-
tool: 'list-
|
|
23
|
-
input: {},
|
|
24
|
+
const { data } = await httpService().post< HttpResponse< WidgetSummaryResponse > >( MCP_PROXY_URL, {
|
|
25
|
+
tool: 'list-widget-schemas',
|
|
26
|
+
input: { summary: true },
|
|
24
27
|
} );
|
|
25
28
|
|
|
26
|
-
return ( data.data ?? [] ).map( ( widget ) => widget.type );
|
|
29
|
+
return ( data.data?.widgets ?? [] ).map( ( widget ) => widget.type );
|
|
27
30
|
};
|
|
28
31
|
|
|
29
32
|
const fetchWidgetSchema = async ( widgetType: string ): Promise< Record< string, unknown > > => {
|