@elementor/editor-canvas 4.3.0-997 → 4.3.0-999

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 CHANGED
@@ -2466,11 +2466,11 @@ function getVal2(val) {
2466
2466
  var transformOriginTransformer = createTransformer((value) => {
2467
2467
  const x = getVal2(value.x);
2468
2468
  const y = getVal2(value.y);
2469
- const z5 = getVal2(value.z);
2470
- if (x === DEFAULT_XY && y === DEFAULT_XY && z5 === DEFAULT_Z) {
2469
+ const z4 = getVal2(value.z);
2470
+ if (x === DEFAULT_XY && y === DEFAULT_XY && z4 === DEFAULT_Z) {
2471
2471
  return null;
2472
2472
  }
2473
- return `${x} ${y} ${z5}`;
2473
+ return `${x} ${y} ${z4}`;
2474
2474
  });
2475
2475
 
2476
2476
  // src/transformers/styles/transform-rotate-transformer.ts
@@ -5109,62 +5109,21 @@ Provide styling as raw CSS via the "style" parameter (a flat map of CSS property
5109
5109
  }`;
5110
5110
  }
5111
5111
 
5112
- // src/mcp/tools/create-element/tool.ts
5113
- var import_editor_documents3 = require("@elementor/editor-documents");
5114
- var import_http_client7 = require("@elementor/http-client");
5115
- var import_schema4 = require("@elementor/schema");
5116
- var MCP_PROXY_URL6 = "elementor/v1/mcp-proxy";
5117
- var initCreateElementTool = (reg) => {
5118
- const { addTool } = reg;
5119
- addTool({
5120
- name: "create-element",
5121
- description: "Insert a new element into the current Elementor document via the server-side MCP ability. The document is saved as a draft. Reload the editor after calling this tool to see the result.",
5122
- schema: {
5123
- elementType: import_schema4.z.string().describe("Registry identifier of the element to create, e.g. 'e-heading', 'e-flexbox'."),
5124
- parentId: import_schema4.z.string().optional().describe("ID of the parent container. Omit or pass 'document' to insert at the document root.")
5125
- },
5126
- outputSchema: {
5127
- elementId: import_schema4.z.string(),
5128
- previewUrl: import_schema4.z.string(),
5129
- version: import_schema4.z.string()
5130
- },
5131
- handler: async ({ elementType, parentId }) => {
5132
- const document2 = (0, import_editor_documents3.getCurrentDocument)();
5133
- if (!document2?.id) {
5134
- throw new Error("No active document found.");
5135
- }
5136
- const { data } = await (0, import_http_client7.httpService)().post(MCP_PROXY_URL6, {
5137
- tool: "create-element",
5138
- input: {
5139
- parent_id: parentId ?? "document",
5140
- element: { type: elementType },
5141
- post_id: document2.id
5142
- }
5143
- });
5144
- return {
5145
- elementId: data.data.element_id,
5146
- previewUrl: data.data.preview_url,
5147
- version: data.data.version
5148
- };
5149
- }
5150
- });
5151
- };
5152
-
5153
5112
  // src/mcp/tools/get-element-config/tool.ts
5154
5113
  var import_editor_elements15 = require("@elementor/editor-elements");
5155
5114
  var import_editor_props8 = require("@elementor/editor-props");
5156
- var import_schema5 = require("@elementor/schema");
5115
+ var import_schema4 = require("@elementor/schema");
5157
5116
  var schema = {
5158
- elementId: import_schema5.z.string()
5117
+ elementId: import_schema4.z.string()
5159
5118
  };
5160
5119
  var outputSchema2 = {
5161
- properties: import_schema5.z.record(import_schema5.z.string(), import_schema5.z.any()).describe("A record mapping PropTypes to their corresponding PropValues"),
5162
- style: import_schema5.z.record(import_schema5.z.string(), import_schema5.z.any()).describe("A record mapping StyleSchema properties to their corresponding PropValues"),
5163
- childElements: import_schema5.z.array(
5164
- import_schema5.z.object({
5165
- id: import_schema5.z.string(),
5166
- elementType: import_schema5.z.string(),
5167
- childElements: import_schema5.z.array(import_schema5.z.any()).describe("An array of child element IDs, when applicable, same structure recursively")
5120
+ properties: import_schema4.z.record(import_schema4.z.string(), import_schema4.z.any()).describe("A record mapping PropTypes to their corresponding PropValues"),
5121
+ style: import_schema4.z.record(import_schema4.z.string(), import_schema4.z.any()).describe("A record mapping StyleSchema properties to their corresponding PropValues"),
5122
+ childElements: import_schema4.z.array(
5123
+ import_schema4.z.object({
5124
+ id: import_schema4.z.string(),
5125
+ elementType: import_schema4.z.string(),
5126
+ childElements: import_schema4.z.array(import_schema4.z.any()).describe("An array of child element IDs, when applicable, same structure recursively")
5168
5127
  })
5169
5128
  ).describe("An array of child element IDs, when applicable, with recursive structure")
5170
5129
  };
@@ -5256,7 +5215,6 @@ var initCanvasMcp = (reg) => {
5256
5215
  initBestPracticesResource(reg);
5257
5216
  initGetElementConfigTool(reg);
5258
5217
  initConfigureElementTool(reg);
5259
- initCreateElementTool(reg);
5260
5218
  initBuildCompositionTool(reg);
5261
5219
  initBreakpointsResource(reg);
5262
5220
  };
package/dist/index.mjs CHANGED
@@ -2418,11 +2418,11 @@ function getVal2(val) {
2418
2418
  var transformOriginTransformer = createTransformer((value) => {
2419
2419
  const x = getVal2(value.x);
2420
2420
  const y = getVal2(value.y);
2421
- const z5 = getVal2(value.z);
2422
- if (x === DEFAULT_XY && y === DEFAULT_XY && z5 === DEFAULT_Z) {
2421
+ const z4 = getVal2(value.z);
2422
+ if (x === DEFAULT_XY && y === DEFAULT_XY && z4 === DEFAULT_Z) {
2423
2423
  return null;
2424
2424
  }
2425
- return `${x} ${y} ${z5}`;
2425
+ return `${x} ${y} ${z4}`;
2426
2426
  });
2427
2427
 
2428
2428
  // src/transformers/styles/transform-rotate-transformer.ts
@@ -5081,62 +5081,21 @@ Provide styling as raw CSS via the "style" parameter (a flat map of CSS property
5081
5081
  }`;
5082
5082
  }
5083
5083
 
5084
- // src/mcp/tools/create-element/tool.ts
5085
- import { getCurrentDocument as getCurrentDocument2 } from "@elementor/editor-documents";
5086
- import { httpService as httpService7 } from "@elementor/http-client";
5087
- import { z as z3 } from "@elementor/schema";
5088
- var MCP_PROXY_URL6 = "elementor/v1/mcp-proxy";
5089
- var initCreateElementTool = (reg) => {
5090
- const { addTool } = reg;
5091
- addTool({
5092
- name: "create-element",
5093
- description: "Insert a new element into the current Elementor document via the server-side MCP ability. The document is saved as a draft. Reload the editor after calling this tool to see the result.",
5094
- schema: {
5095
- elementType: z3.string().describe("Registry identifier of the element to create, e.g. 'e-heading', 'e-flexbox'."),
5096
- parentId: z3.string().optional().describe("ID of the parent container. Omit or pass 'document' to insert at the document root.")
5097
- },
5098
- outputSchema: {
5099
- elementId: z3.string(),
5100
- previewUrl: z3.string(),
5101
- version: z3.string()
5102
- },
5103
- handler: async ({ elementType, parentId }) => {
5104
- const document2 = getCurrentDocument2();
5105
- if (!document2?.id) {
5106
- throw new Error("No active document found.");
5107
- }
5108
- const { data } = await httpService7().post(MCP_PROXY_URL6, {
5109
- tool: "create-element",
5110
- input: {
5111
- parent_id: parentId ?? "document",
5112
- element: { type: elementType },
5113
- post_id: document2.id
5114
- }
5115
- });
5116
- return {
5117
- elementId: data.data.element_id,
5118
- previewUrl: data.data.preview_url,
5119
- version: data.data.version
5120
- };
5121
- }
5122
- });
5123
- };
5124
-
5125
5084
  // src/mcp/tools/get-element-config/tool.ts
5126
5085
  import { getContainer as getContainer6, getElementStyles as getElementStyles2, getWidgetsCache as getWidgetsCache7 } from "@elementor/editor-elements";
5127
5086
  import { Schema as Schema3 } from "@elementor/editor-props";
5128
- import { z as z4 } from "@elementor/schema";
5087
+ import { z as z3 } from "@elementor/schema";
5129
5088
  var schema = {
5130
- elementId: z4.string()
5089
+ elementId: z3.string()
5131
5090
  };
5132
5091
  var outputSchema2 = {
5133
- properties: z4.record(z4.string(), z4.any()).describe("A record mapping PropTypes to their corresponding PropValues"),
5134
- style: z4.record(z4.string(), z4.any()).describe("A record mapping StyleSchema properties to their corresponding PropValues"),
5135
- childElements: z4.array(
5136
- z4.object({
5137
- id: z4.string(),
5138
- elementType: z4.string(),
5139
- childElements: z4.array(z4.any()).describe("An array of child element IDs, when applicable, same structure recursively")
5092
+ properties: z3.record(z3.string(), z3.any()).describe("A record mapping PropTypes to their corresponding PropValues"),
5093
+ style: z3.record(z3.string(), z3.any()).describe("A record mapping StyleSchema properties to their corresponding PropValues"),
5094
+ childElements: z3.array(
5095
+ z3.object({
5096
+ id: z3.string(),
5097
+ elementType: z3.string(),
5098
+ childElements: z3.array(z3.any()).describe("An array of child element IDs, when applicable, same structure recursively")
5140
5099
  })
5141
5100
  ).describe("An array of child element IDs, when applicable, with recursive structure")
5142
5101
  };
@@ -5228,7 +5187,6 @@ var initCanvasMcp = (reg) => {
5228
5187
  initBestPracticesResource(reg);
5229
5188
  initGetElementConfigTool(reg);
5230
5189
  initConfigureElementTool(reg);
5231
- initCreateElementTool(reg);
5232
5190
  initBuildCompositionTool(reg);
5233
5191
  initBreakpointsResource(reg);
5234
5192
  };
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-997",
4
+ "version": "4.3.0-999",
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-997",
41
- "@elementor/editor-controls": "4.3.0-997",
42
- "@elementor/editor-documents": "4.3.0-997",
43
- "@elementor/editor-elements": "4.3.0-997",
44
- "@elementor/editor-interactions": "4.3.0-997",
45
- "@elementor/editor-mcp": "4.3.0-997",
46
- "@elementor/editor-notifications": "4.3.0-997",
47
- "@elementor/editor-props": "4.3.0-997",
48
- "@elementor/editor-responsive": "4.3.0-997",
49
- "@elementor/editor-styles": "4.3.0-997",
50
- "@elementor/editor-styles-repository": "4.3.0-997",
51
- "@elementor/editor-ui": "4.3.0-997",
52
- "@elementor/editor-v1-adapters": "4.3.0-997",
53
- "@elementor/events": "4.3.0-997",
54
- "@elementor/http-client": "4.3.0-997",
55
- "@elementor/schema": "4.3.0-997",
56
- "@elementor/twing": "4.3.0-997",
40
+ "@elementor/editor": "4.3.0-999",
41
+ "@elementor/editor-controls": "4.3.0-999",
42
+ "@elementor/editor-documents": "4.3.0-999",
43
+ "@elementor/editor-elements": "4.3.0-999",
44
+ "@elementor/editor-interactions": "4.3.0-999",
45
+ "@elementor/editor-mcp": "4.3.0-999",
46
+ "@elementor/editor-notifications": "4.3.0-999",
47
+ "@elementor/editor-props": "4.3.0-999",
48
+ "@elementor/editor-responsive": "4.3.0-999",
49
+ "@elementor/editor-styles": "4.3.0-999",
50
+ "@elementor/editor-styles-repository": "4.3.0-999",
51
+ "@elementor/editor-ui": "4.3.0-999",
52
+ "@elementor/editor-v1-adapters": "4.3.0-999",
53
+ "@elementor/events": "4.3.0-999",
54
+ "@elementor/http-client": "4.3.0-999",
55
+ "@elementor/schema": "4.3.0-999",
56
+ "@elementor/twing": "4.3.0-999",
57
57
  "@elementor/ui": "1.37.5",
58
- "@elementor/utils": "4.3.0-997",
59
- "@elementor/wp-media": "4.3.0-997",
58
+ "@elementor/utils": "4.3.0-999",
59
+ "@elementor/wp-media": "4.3.0-999",
60
60
  "@floating-ui/react": "^0.27.5",
61
61
  "@wordpress/i18n": "^5.13.0",
62
62
  "dompurify": "^3.2.6"
@@ -12,7 +12,6 @@ import { initSelectedElementResource } from './resources/selected-element-resour
12
12
  import { initWidgetsSchemaResource } from './resources/widgets-schema-resource';
13
13
  import { initBuildCompositionTool } from './tools/build-composition/tool';
14
14
  import { initConfigureElementTool } from './tools/configure-element/tool';
15
- import { initCreateElementTool } from './tools/create-element/tool';
16
15
  import { initGetElementConfigTool } from './tools/get-element-config/tool';
17
16
  import { getDynamicTagNamesByCategories } from './utils/resolve-dynamic-tag';
18
17
 
@@ -31,7 +30,6 @@ export const initCanvasMcp = ( reg: MCPRegistryEntry ) => {
31
30
  initBestPracticesResource( reg );
32
31
  initGetElementConfigTool( reg );
33
32
  initConfigureElementTool( reg );
34
- initCreateElementTool( reg );
35
33
  initBuildCompositionTool( reg );
36
34
  initBreakpointsResource( reg );
37
35
  };
@@ -1,61 +0,0 @@
1
- import { getCurrentDocument } from '@elementor/editor-documents';
2
- import { type MCPRegistryEntry } from '@elementor/editor-mcp';
3
- import { type HttpResponse, httpService } from '@elementor/http-client';
4
- import { z } from '@elementor/schema';
5
-
6
- const MCP_PROXY_URL = 'elementor/v1/mcp-proxy';
7
-
8
- type CreateElementResponse = {
9
- success: boolean;
10
- post_id: number;
11
- element_id: string;
12
- version: string;
13
- preview_url: string;
14
- };
15
-
16
- export const initCreateElementTool = ( reg: MCPRegistryEntry ) => {
17
- const { addTool } = reg;
18
-
19
- addTool( {
20
- name: 'create-element',
21
- description:
22
- 'Insert a new element into the current Elementor document via the server-side MCP ability. ' +
23
- 'The document is saved as a draft. Reload the editor after calling this tool to see the result.',
24
- schema: {
25
- elementType: z
26
- .string()
27
- .describe( "Registry identifier of the element to create, e.g. 'e-heading', 'e-flexbox'." ),
28
- parentId: z
29
- .string()
30
- .optional()
31
- .describe( "ID of the parent container. Omit or pass 'document' to insert at the document root." ),
32
- },
33
- outputSchema: {
34
- elementId: z.string(),
35
- previewUrl: z.string(),
36
- version: z.string(),
37
- },
38
- handler: async ( { elementType, parentId } ) => {
39
- const document = getCurrentDocument();
40
-
41
- if ( ! document?.id ) {
42
- throw new Error( 'No active document found.' );
43
- }
44
-
45
- const { data } = await httpService().post< HttpResponse< CreateElementResponse > >( MCP_PROXY_URL, {
46
- tool: 'create-element',
47
- input: {
48
- parent_id: parentId ?? 'document',
49
- element: { type: elementType },
50
- post_id: document.id,
51
- },
52
- } );
53
-
54
- return {
55
- elementId: data.data.element_id,
56
- previewUrl: data.data.preview_url,
57
- version: data.data.version,
58
- };
59
- },
60
- } );
61
- };