@elementor/editor-canvas 4.2.0-841 → 4.2.0-843
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 +71 -33
- package/dist/index.mjs +69 -31
- package/package.json +18 -18
- package/src/init.tsx +7 -1
- package/src/mcp/canvas-mcp.ts +0 -9
- package/src/mcp/tools/build-composition/prompt.ts +2 -0
- package/src/mcp/tools/build-composition/tool.ts +17 -3
- package/src/mcp/tools/configure-element/prompt.ts +39 -14
- package/src/mcp/tools/configure-element/tool.ts +17 -3
package/dist/index.js
CHANGED
|
@@ -342,7 +342,7 @@ Variables from the user context ARE NOT SUPPORTED AND WILL RESOLVE IN ERROR.
|
|
|
342
342
|
|
|
343
343
|
// src/init.tsx
|
|
344
344
|
var import_editor = require("@elementor/editor");
|
|
345
|
-
var
|
|
345
|
+
var import_editor_mcp4 = require("@elementor/editor-mcp");
|
|
346
346
|
|
|
347
347
|
// src/components/classes-rename.tsx
|
|
348
348
|
var import_react = require("react");
|
|
@@ -4324,6 +4324,7 @@ function getCompositionTargetContainer(documentContainer, documentType) {
|
|
|
4324
4324
|
|
|
4325
4325
|
// src/mcp/tools/build-composition/prompt.ts
|
|
4326
4326
|
var import_editor_mcp2 = require("@elementor/editor-mcp");
|
|
4327
|
+
var BUILD_COMPOSITIONS_GUIDE_URI = "elementor://canvas/tools/build-compositions-guide";
|
|
4327
4328
|
var generatePrompt = () => {
|
|
4328
4329
|
const buildCompositionsToolPrompt = (0, import_editor_mcp2.toolPrompts)("build-compositions");
|
|
4329
4330
|
buildCompositionsToolPrompt.description(`
|
|
@@ -4505,12 +4506,25 @@ var outputSchema = {
|
|
|
4505
4506
|
|
|
4506
4507
|
// src/mcp/tools/build-composition/tool.ts
|
|
4507
4508
|
var initBuildCompositionsTool = (reg) => {
|
|
4508
|
-
const { addTool } = reg;
|
|
4509
|
+
const { addTool, resource } = reg;
|
|
4510
|
+
resource(
|
|
4511
|
+
"build-compositions-guide",
|
|
4512
|
+
BUILD_COMPOSITIONS_GUIDE_URI,
|
|
4513
|
+
{
|
|
4514
|
+
title: "Build Compositions Guide",
|
|
4515
|
+
description: "Detailed guide for using the build-compositions tool",
|
|
4516
|
+
mimeType: "text/plain"
|
|
4517
|
+
},
|
|
4518
|
+
async (uri) => ({
|
|
4519
|
+
contents: [{ uri: uri.href, mimeType: "text/plain", text: generatePrompt() }]
|
|
4520
|
+
})
|
|
4521
|
+
);
|
|
4509
4522
|
addTool({
|
|
4510
4523
|
name: "build-compositions",
|
|
4511
|
-
description:
|
|
4524
|
+
description: "Build V4 element compositions on the Elementor canvas. Read the guide resource before use.",
|
|
4512
4525
|
schema: inputSchema,
|
|
4513
4526
|
requiredResources: [
|
|
4527
|
+
{ description: "Build compositions guide", uri: BUILD_COMPOSITIONS_GUIDE_URI },
|
|
4514
4528
|
{ description: "Widgets schema", uri: WIDGET_SCHEMA_URI },
|
|
4515
4529
|
{ description: "Styles schema", uri: STYLE_SCHEMA_URI },
|
|
4516
4530
|
{ description: "Global Classes", uri: "elementor://global-classes" },
|
|
@@ -4638,7 +4652,12 @@ function assertCompositionXmlUsesV4WidgetsOnly(xmlStructure) {
|
|
|
4638
4652
|
var import_editor_elements15 = require("@elementor/editor-elements");
|
|
4639
4653
|
|
|
4640
4654
|
// src/mcp/tools/configure-element/prompt.ts
|
|
4641
|
-
var
|
|
4655
|
+
var import_editor_mcp3 = require("@elementor/editor-mcp");
|
|
4656
|
+
var CONFIGURE_ELEMENT_GUIDE_URI = "elementor://canvas/tools/configure-element-guide";
|
|
4657
|
+
var generatePrompt2 = () => {
|
|
4658
|
+
const configureElementToolPrompt = (0, import_editor_mcp3.toolPrompts)("configure-element");
|
|
4659
|
+
configureElementToolPrompt.description(`
|
|
4660
|
+
Configure an existing element on the page.
|
|
4642
4661
|
|
|
4643
4662
|
# **CRITICAL - REQUIRED INFORMATION (Must read before using this tool)**
|
|
4644
4663
|
1. [${WIDGET_SCHEMA_URI}]
|
|
@@ -4653,12 +4672,6 @@ Before using this tool, check the definitions of the elements PropTypes at the r
|
|
|
4653
4672
|
All widgets share a common _style property for styling, which uses the common styles schema.
|
|
4654
4673
|
Retrieve and check the common styles schema at the resource list "styles-schema" at editor-canvas__elementor://styles/schema/{category}
|
|
4655
4674
|
|
|
4656
|
-
# Parameters
|
|
4657
|
-
- propertiesToChange: An object containing the properties to change, with their new values. MANDATORY. When updating a style only, provide an empty object.
|
|
4658
|
-
- stylePropertiesToChange: An object containing the style properties to change, with their new values. OPTIONAL
|
|
4659
|
-
- elementId: The ID of the element to configure. MANDATORY
|
|
4660
|
-
- elementType: The type of the element to configure (i.e. e-heading, e-button). MANDATORY
|
|
4661
|
-
|
|
4662
4675
|
# When to use this tool
|
|
4663
4676
|
When a user requires to change anything in an element, such as updating text, colors, sizes, or other configurable properties.
|
|
4664
4677
|
This tool handles elements of type "widget".
|
|
@@ -4687,7 +4700,7 @@ You can use multiple property changes at once by providing multiple entries in t
|
|
|
4687
4700
|
Some properties are nested, use the root property name, then objects with nested values inside, as the complete schema suggests.
|
|
4688
4701
|
|
|
4689
4702
|
Make sure you have the "widget-schema-by-type" resource available to retrieve the PropType schema for the element type you are configuring.
|
|
4690
|
-
Make sure you have
|
|
4703
|
+
Make sure you have the "styles-schema" resources available to retrieve the common styles schema.
|
|
4691
4704
|
|
|
4692
4705
|
# How to configure elements
|
|
4693
4706
|
We use a dedicated PropType Schema for configuring elements, including styles. When you configure an element, you must use the EXACT PropType Value as defined in the schema.
|
|
@@ -4695,8 +4708,21 @@ For styleProperties, use the style schema provided, as it also uses the PropType
|
|
|
4695
4708
|
For all non-primitive types, provide the key property as defined in the schema as $$type in the generated object, as it is MANDATORY for parsing.
|
|
4696
4709
|
|
|
4697
4710
|
Use the EXACT "PROP-TYPE" Schema given, and ALWAYS include the "key" property from the original configuration for every property you are changing.
|
|
4698
|
-
|
|
4699
|
-
|
|
4711
|
+
`);
|
|
4712
|
+
configureElementToolPrompt.parameter("elementId", "The ID of the element to configure. MANDATORY.");
|
|
4713
|
+
configureElementToolPrompt.parameter(
|
|
4714
|
+
"elementType",
|
|
4715
|
+
"The type of the element to configure (i.e. e-heading, e-button). MANDATORY."
|
|
4716
|
+
);
|
|
4717
|
+
configureElementToolPrompt.parameter(
|
|
4718
|
+
"propertiesToChange",
|
|
4719
|
+
"An object containing the properties to change, with their new values. MANDATORY. When updating a style only, provide an empty object."
|
|
4720
|
+
);
|
|
4721
|
+
configureElementToolPrompt.parameter(
|
|
4722
|
+
"stylePropertiesToChange",
|
|
4723
|
+
"An object containing the style properties to change, with their new values. OPTIONAL."
|
|
4724
|
+
);
|
|
4725
|
+
configureElementToolPrompt.example(`
|
|
4700
4726
|
\`\`\`json
|
|
4701
4727
|
{
|
|
4702
4728
|
propertiesToChange: {
|
|
@@ -4712,7 +4738,7 @@ Use the EXACT "PROP-TYPE" Schema given, and ALWAYS include the "key" property fr
|
|
|
4712
4738
|
},
|
|
4713
4739
|
stylePropertiesToChange: {
|
|
4714
4740
|
'line-height': {
|
|
4715
|
-
$$type: 'size',
|
|
4741
|
+
$$type: 'size',
|
|
4716
4742
|
value: {
|
|
4717
4743
|
size: {
|
|
4718
4744
|
$$type: 'number',
|
|
@@ -4729,11 +4755,13 @@ Use the EXACT "PROP-TYPE" Schema given, and ALWAYS include the "key" property fr
|
|
|
4729
4755
|
elementType: 'element-type'
|
|
4730
4756
|
};
|
|
4731
4757
|
\`\`\`
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
The $$type property is MANDATORY for every value
|
|
4735
|
-
|
|
4736
|
-
|
|
4758
|
+
`);
|
|
4759
|
+
configureElementToolPrompt.instruction(
|
|
4760
|
+
"The $$type property is MANDATORY for every value; it is required to parse the value and apply application-level effects."
|
|
4761
|
+
);
|
|
4762
|
+
return configureElementToolPrompt.prompt();
|
|
4763
|
+
};
|
|
4764
|
+
var CONFIGURE_ELEMENT_GUIDE_TEXT = generatePrompt2();
|
|
4737
4765
|
|
|
4738
4766
|
// src/mcp/tools/configure-element/schema.ts
|
|
4739
4767
|
var import_schema3 = require("@elementor/schema");
|
|
@@ -4759,15 +4787,28 @@ var outputSchema2 = {
|
|
|
4759
4787
|
|
|
4760
4788
|
// src/mcp/tools/configure-element/tool.ts
|
|
4761
4789
|
var initConfigureElementTool = (reg) => {
|
|
4762
|
-
const { addTool } = reg;
|
|
4790
|
+
const { addTool, resource } = reg;
|
|
4791
|
+
resource(
|
|
4792
|
+
"configure-element-guide",
|
|
4793
|
+
CONFIGURE_ELEMENT_GUIDE_URI,
|
|
4794
|
+
{
|
|
4795
|
+
title: "Configure Element Guide",
|
|
4796
|
+
description: "Detailed guide for using the configure-element tool",
|
|
4797
|
+
mimeType: "text/plain"
|
|
4798
|
+
},
|
|
4799
|
+
async (uri) => ({
|
|
4800
|
+
contents: [{ uri: uri.href, mimeType: "text/plain", text: generatePrompt2() }]
|
|
4801
|
+
})
|
|
4802
|
+
);
|
|
4763
4803
|
addTool({
|
|
4764
4804
|
name: "configure-element",
|
|
4765
|
-
description:
|
|
4805
|
+
description: "Configure an existing V4 element's properties and styles. Read the guide resource before use.",
|
|
4766
4806
|
schema: inputSchema2,
|
|
4767
4807
|
outputSchema: outputSchema2,
|
|
4768
4808
|
requiredResources: [
|
|
4769
4809
|
{ description: "Widgets schema", uri: WIDGET_SCHEMA_URI },
|
|
4770
|
-
{ description: "Styles schema", uri: STYLE_SCHEMA_URI }
|
|
4810
|
+
{ description: "Styles schema", uri: STYLE_SCHEMA_URI },
|
|
4811
|
+
{ description: "Configure element guide", uri: CONFIGURE_ELEMENT_GUIDE_URI }
|
|
4771
4812
|
],
|
|
4772
4813
|
modelPreferences: {
|
|
4773
4814
|
hints: [{ name: "claude-sonnet-4-5" }],
|
|
@@ -4965,15 +5006,6 @@ var initGetElementConfigTool = (reg) => {
|
|
|
4965
5006
|
|
|
4966
5007
|
// src/mcp/canvas-mcp.ts
|
|
4967
5008
|
var initCanvasMcp = (reg) => {
|
|
4968
|
-
const { setMCPDescription } = reg;
|
|
4969
|
-
setMCPDescription(
|
|
4970
|
-
`Everything related to V4 ( Atomic ) canvas.
|
|
4971
|
-
# Canvas workflow for new compositions
|
|
4972
|
-
- Configure elements settings and styles
|
|
4973
|
-
- Build compositions/sections out of V4 atomic elements using context aware designs using the website resources
|
|
4974
|
-
- Get and retrieve element configuration values
|
|
4975
|
-
`
|
|
4976
|
-
);
|
|
4977
5009
|
initWidgetsSchemaResource(reg);
|
|
4978
5010
|
initAvailableWidgetsResource(reg);
|
|
4979
5011
|
initDocumentStructureResource(reg);
|
|
@@ -5467,8 +5499,14 @@ function init() {
|
|
|
5467
5499
|
component: ClassesRename
|
|
5468
5500
|
});
|
|
5469
5501
|
initCanvasMcp(
|
|
5470
|
-
(0,
|
|
5471
|
-
instructions:
|
|
5502
|
+
(0, import_editor_mcp4.getMCPByDomain)("canvas", {
|
|
5503
|
+
instructions: `Everything related to V4 ( Atomic ) canvas.
|
|
5504
|
+
# Canvas workflow for new compositions
|
|
5505
|
+
- Configure elements settings and styles
|
|
5506
|
+
- Build compositions/sections out of V4 atomic elements using context aware designs using the website resources
|
|
5507
|
+
- Get and retrieve element configuration values
|
|
5508
|
+
`,
|
|
5509
|
+
docs: mcpDescription
|
|
5472
5510
|
})
|
|
5473
5511
|
);
|
|
5474
5512
|
initTabsModelExtensions();
|
package/dist/index.mjs
CHANGED
|
@@ -4318,6 +4318,7 @@ function getCompositionTargetContainer(documentContainer, documentType) {
|
|
|
4318
4318
|
|
|
4319
4319
|
// src/mcp/tools/build-composition/prompt.ts
|
|
4320
4320
|
import { toolPrompts } from "@elementor/editor-mcp";
|
|
4321
|
+
var BUILD_COMPOSITIONS_GUIDE_URI = "elementor://canvas/tools/build-compositions-guide";
|
|
4321
4322
|
var generatePrompt = () => {
|
|
4322
4323
|
const buildCompositionsToolPrompt = toolPrompts("build-compositions");
|
|
4323
4324
|
buildCompositionsToolPrompt.description(`
|
|
@@ -4499,12 +4500,25 @@ var outputSchema = {
|
|
|
4499
4500
|
|
|
4500
4501
|
// src/mcp/tools/build-composition/tool.ts
|
|
4501
4502
|
var initBuildCompositionsTool = (reg) => {
|
|
4502
|
-
const { addTool } = reg;
|
|
4503
|
+
const { addTool, resource } = reg;
|
|
4504
|
+
resource(
|
|
4505
|
+
"build-compositions-guide",
|
|
4506
|
+
BUILD_COMPOSITIONS_GUIDE_URI,
|
|
4507
|
+
{
|
|
4508
|
+
title: "Build Compositions Guide",
|
|
4509
|
+
description: "Detailed guide for using the build-compositions tool",
|
|
4510
|
+
mimeType: "text/plain"
|
|
4511
|
+
},
|
|
4512
|
+
async (uri) => ({
|
|
4513
|
+
contents: [{ uri: uri.href, mimeType: "text/plain", text: generatePrompt() }]
|
|
4514
|
+
})
|
|
4515
|
+
);
|
|
4503
4516
|
addTool({
|
|
4504
4517
|
name: "build-compositions",
|
|
4505
|
-
description:
|
|
4518
|
+
description: "Build V4 element compositions on the Elementor canvas. Read the guide resource before use.",
|
|
4506
4519
|
schema: inputSchema,
|
|
4507
4520
|
requiredResources: [
|
|
4521
|
+
{ description: "Build compositions guide", uri: BUILD_COMPOSITIONS_GUIDE_URI },
|
|
4508
4522
|
{ description: "Widgets schema", uri: WIDGET_SCHEMA_URI },
|
|
4509
4523
|
{ description: "Styles schema", uri: STYLE_SCHEMA_URI },
|
|
4510
4524
|
{ description: "Global Classes", uri: "elementor://global-classes" },
|
|
@@ -4632,7 +4646,12 @@ function assertCompositionXmlUsesV4WidgetsOnly(xmlStructure) {
|
|
|
4632
4646
|
import { getWidgetsCache as getWidgetsCache10 } from "@elementor/editor-elements";
|
|
4633
4647
|
|
|
4634
4648
|
// src/mcp/tools/configure-element/prompt.ts
|
|
4635
|
-
|
|
4649
|
+
import { toolPrompts as toolPrompts2 } from "@elementor/editor-mcp";
|
|
4650
|
+
var CONFIGURE_ELEMENT_GUIDE_URI = "elementor://canvas/tools/configure-element-guide";
|
|
4651
|
+
var generatePrompt2 = () => {
|
|
4652
|
+
const configureElementToolPrompt = toolPrompts2("configure-element");
|
|
4653
|
+
configureElementToolPrompt.description(`
|
|
4654
|
+
Configure an existing element on the page.
|
|
4636
4655
|
|
|
4637
4656
|
# **CRITICAL - REQUIRED INFORMATION (Must read before using this tool)**
|
|
4638
4657
|
1. [${WIDGET_SCHEMA_URI}]
|
|
@@ -4647,12 +4666,6 @@ Before using this tool, check the definitions of the elements PropTypes at the r
|
|
|
4647
4666
|
All widgets share a common _style property for styling, which uses the common styles schema.
|
|
4648
4667
|
Retrieve and check the common styles schema at the resource list "styles-schema" at editor-canvas__elementor://styles/schema/{category}
|
|
4649
4668
|
|
|
4650
|
-
# Parameters
|
|
4651
|
-
- propertiesToChange: An object containing the properties to change, with their new values. MANDATORY. When updating a style only, provide an empty object.
|
|
4652
|
-
- stylePropertiesToChange: An object containing the style properties to change, with their new values. OPTIONAL
|
|
4653
|
-
- elementId: The ID of the element to configure. MANDATORY
|
|
4654
|
-
- elementType: The type of the element to configure (i.e. e-heading, e-button). MANDATORY
|
|
4655
|
-
|
|
4656
4669
|
# When to use this tool
|
|
4657
4670
|
When a user requires to change anything in an element, such as updating text, colors, sizes, or other configurable properties.
|
|
4658
4671
|
This tool handles elements of type "widget".
|
|
@@ -4681,7 +4694,7 @@ You can use multiple property changes at once by providing multiple entries in t
|
|
|
4681
4694
|
Some properties are nested, use the root property name, then objects with nested values inside, as the complete schema suggests.
|
|
4682
4695
|
|
|
4683
4696
|
Make sure you have the "widget-schema-by-type" resource available to retrieve the PropType schema for the element type you are configuring.
|
|
4684
|
-
Make sure you have
|
|
4697
|
+
Make sure you have the "styles-schema" resources available to retrieve the common styles schema.
|
|
4685
4698
|
|
|
4686
4699
|
# How to configure elements
|
|
4687
4700
|
We use a dedicated PropType Schema for configuring elements, including styles. When you configure an element, you must use the EXACT PropType Value as defined in the schema.
|
|
@@ -4689,8 +4702,21 @@ For styleProperties, use the style schema provided, as it also uses the PropType
|
|
|
4689
4702
|
For all non-primitive types, provide the key property as defined in the schema as $$type in the generated object, as it is MANDATORY for parsing.
|
|
4690
4703
|
|
|
4691
4704
|
Use the EXACT "PROP-TYPE" Schema given, and ALWAYS include the "key" property from the original configuration for every property you are changing.
|
|
4692
|
-
|
|
4693
|
-
|
|
4705
|
+
`);
|
|
4706
|
+
configureElementToolPrompt.parameter("elementId", "The ID of the element to configure. MANDATORY.");
|
|
4707
|
+
configureElementToolPrompt.parameter(
|
|
4708
|
+
"elementType",
|
|
4709
|
+
"The type of the element to configure (i.e. e-heading, e-button). MANDATORY."
|
|
4710
|
+
);
|
|
4711
|
+
configureElementToolPrompt.parameter(
|
|
4712
|
+
"propertiesToChange",
|
|
4713
|
+
"An object containing the properties to change, with their new values. MANDATORY. When updating a style only, provide an empty object."
|
|
4714
|
+
);
|
|
4715
|
+
configureElementToolPrompt.parameter(
|
|
4716
|
+
"stylePropertiesToChange",
|
|
4717
|
+
"An object containing the style properties to change, with their new values. OPTIONAL."
|
|
4718
|
+
);
|
|
4719
|
+
configureElementToolPrompt.example(`
|
|
4694
4720
|
\`\`\`json
|
|
4695
4721
|
{
|
|
4696
4722
|
propertiesToChange: {
|
|
@@ -4706,7 +4732,7 @@ Use the EXACT "PROP-TYPE" Schema given, and ALWAYS include the "key" property fr
|
|
|
4706
4732
|
},
|
|
4707
4733
|
stylePropertiesToChange: {
|
|
4708
4734
|
'line-height': {
|
|
4709
|
-
$$type: 'size',
|
|
4735
|
+
$$type: 'size',
|
|
4710
4736
|
value: {
|
|
4711
4737
|
size: {
|
|
4712
4738
|
$$type: 'number',
|
|
@@ -4723,11 +4749,13 @@ Use the EXACT "PROP-TYPE" Schema given, and ALWAYS include the "key" property fr
|
|
|
4723
4749
|
elementType: 'element-type'
|
|
4724
4750
|
};
|
|
4725
4751
|
\`\`\`
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
The $$type property is MANDATORY for every value
|
|
4729
|
-
|
|
4730
|
-
|
|
4752
|
+
`);
|
|
4753
|
+
configureElementToolPrompt.instruction(
|
|
4754
|
+
"The $$type property is MANDATORY for every value; it is required to parse the value and apply application-level effects."
|
|
4755
|
+
);
|
|
4756
|
+
return configureElementToolPrompt.prompt();
|
|
4757
|
+
};
|
|
4758
|
+
var CONFIGURE_ELEMENT_GUIDE_TEXT = generatePrompt2();
|
|
4731
4759
|
|
|
4732
4760
|
// src/mcp/tools/configure-element/schema.ts
|
|
4733
4761
|
import { z as z2 } from "@elementor/schema";
|
|
@@ -4753,15 +4781,28 @@ var outputSchema2 = {
|
|
|
4753
4781
|
|
|
4754
4782
|
// src/mcp/tools/configure-element/tool.ts
|
|
4755
4783
|
var initConfigureElementTool = (reg) => {
|
|
4756
|
-
const { addTool } = reg;
|
|
4784
|
+
const { addTool, resource } = reg;
|
|
4785
|
+
resource(
|
|
4786
|
+
"configure-element-guide",
|
|
4787
|
+
CONFIGURE_ELEMENT_GUIDE_URI,
|
|
4788
|
+
{
|
|
4789
|
+
title: "Configure Element Guide",
|
|
4790
|
+
description: "Detailed guide for using the configure-element tool",
|
|
4791
|
+
mimeType: "text/plain"
|
|
4792
|
+
},
|
|
4793
|
+
async (uri) => ({
|
|
4794
|
+
contents: [{ uri: uri.href, mimeType: "text/plain", text: generatePrompt2() }]
|
|
4795
|
+
})
|
|
4796
|
+
);
|
|
4757
4797
|
addTool({
|
|
4758
4798
|
name: "configure-element",
|
|
4759
|
-
description:
|
|
4799
|
+
description: "Configure an existing V4 element's properties and styles. Read the guide resource before use.",
|
|
4760
4800
|
schema: inputSchema2,
|
|
4761
4801
|
outputSchema: outputSchema2,
|
|
4762
4802
|
requiredResources: [
|
|
4763
4803
|
{ description: "Widgets schema", uri: WIDGET_SCHEMA_URI },
|
|
4764
|
-
{ description: "Styles schema", uri: STYLE_SCHEMA_URI }
|
|
4804
|
+
{ description: "Styles schema", uri: STYLE_SCHEMA_URI },
|
|
4805
|
+
{ description: "Configure element guide", uri: CONFIGURE_ELEMENT_GUIDE_URI }
|
|
4765
4806
|
],
|
|
4766
4807
|
modelPreferences: {
|
|
4767
4808
|
hints: [{ name: "claude-sonnet-4-5" }],
|
|
@@ -4959,15 +5000,6 @@ var initGetElementConfigTool = (reg) => {
|
|
|
4959
5000
|
|
|
4960
5001
|
// src/mcp/canvas-mcp.ts
|
|
4961
5002
|
var initCanvasMcp = (reg) => {
|
|
4962
|
-
const { setMCPDescription } = reg;
|
|
4963
|
-
setMCPDescription(
|
|
4964
|
-
`Everything related to V4 ( Atomic ) canvas.
|
|
4965
|
-
# Canvas workflow for new compositions
|
|
4966
|
-
- Configure elements settings and styles
|
|
4967
|
-
- Build compositions/sections out of V4 atomic elements using context aware designs using the website resources
|
|
4968
|
-
- Get and retrieve element configuration values
|
|
4969
|
-
`
|
|
4970
|
-
);
|
|
4971
5003
|
initWidgetsSchemaResource(reg);
|
|
4972
5004
|
initAvailableWidgetsResource(reg);
|
|
4973
5005
|
initDocumentStructureResource(reg);
|
|
@@ -5479,7 +5511,13 @@ function init() {
|
|
|
5479
5511
|
});
|
|
5480
5512
|
initCanvasMcp(
|
|
5481
5513
|
getMCPByDomain("canvas", {
|
|
5482
|
-
instructions:
|
|
5514
|
+
instructions: `Everything related to V4 ( Atomic ) canvas.
|
|
5515
|
+
# Canvas workflow for new compositions
|
|
5516
|
+
- Configure elements settings and styles
|
|
5517
|
+
- Build compositions/sections out of V4 atomic elements using context aware designs using the website resources
|
|
5518
|
+
- Get and retrieve element configuration values
|
|
5519
|
+
`,
|
|
5520
|
+
docs: mcpDescription
|
|
5483
5521
|
})
|
|
5484
5522
|
);
|
|
5485
5523
|
initTabsModelExtensions();
|
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.2.0-
|
|
4
|
+
"version": "4.2.0-843",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -37,25 +37,25 @@
|
|
|
37
37
|
"react-dom": "^18.3.1"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@elementor/editor": "4.2.0-
|
|
40
|
+
"@elementor/editor": "4.2.0-843",
|
|
41
41
|
"dompurify": "^3.2.6",
|
|
42
|
-
"@elementor/editor-controls": "4.2.0-
|
|
43
|
-
"@elementor/editor-documents": "4.2.0-
|
|
44
|
-
"@elementor/editor-elements": "4.2.0-
|
|
45
|
-
"@elementor/editor-interactions": "4.2.0-
|
|
46
|
-
"@elementor/editor-mcp": "4.2.0-
|
|
47
|
-
"@elementor/editor-notifications": "4.2.0-
|
|
48
|
-
"@elementor/editor-props": "4.2.0-
|
|
49
|
-
"@elementor/editor-responsive": "4.2.0-
|
|
50
|
-
"@elementor/editor-styles": "4.2.0-
|
|
51
|
-
"@elementor/editor-styles-repository": "4.2.0-
|
|
52
|
-
"@elementor/editor-ui": "4.2.0-
|
|
53
|
-
"@elementor/editor-v1-adapters": "4.2.0-
|
|
54
|
-
"@elementor/schema": "4.2.0-
|
|
55
|
-
"@elementor/twing": "4.2.0-
|
|
42
|
+
"@elementor/editor-controls": "4.2.0-843",
|
|
43
|
+
"@elementor/editor-documents": "4.2.0-843",
|
|
44
|
+
"@elementor/editor-elements": "4.2.0-843",
|
|
45
|
+
"@elementor/editor-interactions": "4.2.0-843",
|
|
46
|
+
"@elementor/editor-mcp": "4.2.0-843",
|
|
47
|
+
"@elementor/editor-notifications": "4.2.0-843",
|
|
48
|
+
"@elementor/editor-props": "4.2.0-843",
|
|
49
|
+
"@elementor/editor-responsive": "4.2.0-843",
|
|
50
|
+
"@elementor/editor-styles": "4.2.0-843",
|
|
51
|
+
"@elementor/editor-styles-repository": "4.2.0-843",
|
|
52
|
+
"@elementor/editor-ui": "4.2.0-843",
|
|
53
|
+
"@elementor/editor-v1-adapters": "4.2.0-843",
|
|
54
|
+
"@elementor/schema": "4.2.0-843",
|
|
55
|
+
"@elementor/twing": "4.2.0-843",
|
|
56
56
|
"@elementor/ui": "1.37.5",
|
|
57
|
-
"@elementor/utils": "4.2.0-
|
|
58
|
-
"@elementor/wp-media": "4.2.0-
|
|
57
|
+
"@elementor/utils": "4.2.0-843",
|
|
58
|
+
"@elementor/wp-media": "4.2.0-843",
|
|
59
59
|
"@floating-ui/react": "^0.27.5",
|
|
60
60
|
"@wordpress/i18n": "^5.13.0"
|
|
61
61
|
},
|
package/src/init.tsx
CHANGED
|
@@ -53,7 +53,13 @@ export function init() {
|
|
|
53
53
|
|
|
54
54
|
initCanvasMcp(
|
|
55
55
|
getMCPByDomain( 'canvas', {
|
|
56
|
-
instructions:
|
|
56
|
+
instructions: `Everything related to V4 ( Atomic ) canvas.
|
|
57
|
+
# Canvas workflow for new compositions
|
|
58
|
+
- Configure elements settings and styles
|
|
59
|
+
- Build compositions/sections out of V4 atomic elements using context aware designs using the website resources
|
|
60
|
+
- Get and retrieve element configuration values
|
|
61
|
+
`,
|
|
62
|
+
docs: mcpDescription,
|
|
57
63
|
} )
|
|
58
64
|
);
|
|
59
65
|
|
package/src/mcp/canvas-mcp.ts
CHANGED
|
@@ -12,15 +12,6 @@ import { initConfigureElementTool } from './tools/configure-element/tool';
|
|
|
12
12
|
import { initGetElementConfigTool } from './tools/get-element-config/tool';
|
|
13
13
|
|
|
14
14
|
export const initCanvasMcp = ( reg: MCPRegistryEntry ) => {
|
|
15
|
-
const { setMCPDescription } = reg;
|
|
16
|
-
setMCPDescription(
|
|
17
|
-
`Everything related to V4 ( Atomic ) canvas.
|
|
18
|
-
# Canvas workflow for new compositions
|
|
19
|
-
- Configure elements settings and styles
|
|
20
|
-
- Build compositions/sections out of V4 atomic elements using context aware designs using the website resources
|
|
21
|
-
- Get and retrieve element configuration values
|
|
22
|
-
`
|
|
23
|
-
);
|
|
24
15
|
initWidgetsSchemaResource( reg );
|
|
25
16
|
initAvailableWidgetsResource( reg );
|
|
26
17
|
initDocumentStructureResource( reg );
|
|
@@ -2,6 +2,8 @@ import { toolPrompts } from '@elementor/editor-mcp';
|
|
|
2
2
|
|
|
3
3
|
import { AVAILABLE_WIDGETS_URI } from '../../resources/available-widgets-resource';
|
|
4
4
|
|
|
5
|
+
export const BUILD_COMPOSITIONS_GUIDE_URI = 'elementor://canvas/tools/build-compositions-guide';
|
|
6
|
+
|
|
5
7
|
export const generatePrompt = () => {
|
|
6
8
|
const buildCompositionsToolPrompt = toolPrompts( 'build-compositions' );
|
|
7
9
|
|
|
@@ -13,17 +13,31 @@ import { AVAILABLE_WIDGETS_URI_V4 } from '../../resources/available-widgets-reso
|
|
|
13
13
|
import { BEST_PRACTICES_URI, STYLE_SCHEMA_URI, WIDGET_SCHEMA_URI } from '../../resources/widgets-schema-resource';
|
|
14
14
|
import { doUpdateElementProperty } from '../../utils/do-update-element-property';
|
|
15
15
|
import { getCompositionTargetContainer } from '../../utils/get-composition-target-container';
|
|
16
|
-
import { generatePrompt } from './prompt';
|
|
16
|
+
import { BUILD_COMPOSITIONS_GUIDE_URI, generatePrompt } from './prompt';
|
|
17
17
|
import { inputSchema as schema, outputSchema } from './schema';
|
|
18
18
|
|
|
19
19
|
export const initBuildCompositionsTool = ( reg: MCPRegistryEntry ) => {
|
|
20
|
-
const { addTool } = reg;
|
|
20
|
+
const { addTool, resource } = reg;
|
|
21
|
+
|
|
22
|
+
resource(
|
|
23
|
+
'build-compositions-guide',
|
|
24
|
+
BUILD_COMPOSITIONS_GUIDE_URI,
|
|
25
|
+
{
|
|
26
|
+
title: 'Build Compositions Guide',
|
|
27
|
+
description: 'Detailed guide for using the build-compositions tool',
|
|
28
|
+
mimeType: 'text/plain',
|
|
29
|
+
},
|
|
30
|
+
async ( uri: URL ) => ( {
|
|
31
|
+
contents: [ { uri: uri.href, mimeType: 'text/plain', text: generatePrompt() } ],
|
|
32
|
+
} )
|
|
33
|
+
);
|
|
21
34
|
|
|
22
35
|
addTool( {
|
|
23
36
|
name: 'build-compositions',
|
|
24
|
-
description:
|
|
37
|
+
description: 'Build V4 element compositions on the Elementor canvas. Read the guide resource before use.',
|
|
25
38
|
schema,
|
|
26
39
|
requiredResources: [
|
|
40
|
+
{ description: 'Build compositions guide', uri: BUILD_COMPOSITIONS_GUIDE_URI },
|
|
27
41
|
{ description: 'Widgets schema', uri: WIDGET_SCHEMA_URI },
|
|
28
42
|
{ description: 'Styles schema', uri: STYLE_SCHEMA_URI },
|
|
29
43
|
{ description: 'Global Classes', uri: 'elementor://global-classes' },
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
import { toolPrompts } from '@elementor/editor-mcp';
|
|
2
|
+
|
|
1
3
|
import { STYLE_SCHEMA_URI, WIDGET_SCHEMA_URI } from '../../resources/widgets-schema-resource';
|
|
2
4
|
|
|
3
|
-
export const
|
|
5
|
+
export const CONFIGURE_ELEMENT_GUIDE_URI = 'elementor://canvas/tools/configure-element-guide';
|
|
6
|
+
|
|
7
|
+
export const generatePrompt = () => {
|
|
8
|
+
const configureElementToolPrompt = toolPrompts( 'configure-element' );
|
|
9
|
+
|
|
10
|
+
configureElementToolPrompt.description( `
|
|
11
|
+
Configure an existing element on the page.
|
|
4
12
|
|
|
5
13
|
# **CRITICAL - REQUIRED INFORMATION (Must read before using this tool)**
|
|
6
14
|
1. [${ WIDGET_SCHEMA_URI }]
|
|
@@ -15,12 +23,6 @@ Before using this tool, check the definitions of the elements PropTypes at the r
|
|
|
15
23
|
All widgets share a common _style property for styling, which uses the common styles schema.
|
|
16
24
|
Retrieve and check the common styles schema at the resource list "styles-schema" at editor-canvas__elementor://styles/schema/{category}
|
|
17
25
|
|
|
18
|
-
# Parameters
|
|
19
|
-
- propertiesToChange: An object containing the properties to change, with their new values. MANDATORY. When updating a style only, provide an empty object.
|
|
20
|
-
- stylePropertiesToChange: An object containing the style properties to change, with their new values. OPTIONAL
|
|
21
|
-
- elementId: The ID of the element to configure. MANDATORY
|
|
22
|
-
- elementType: The type of the element to configure (i.e. e-heading, e-button). MANDATORY
|
|
23
|
-
|
|
24
26
|
# When to use this tool
|
|
25
27
|
When a user requires to change anything in an element, such as updating text, colors, sizes, or other configurable properties.
|
|
26
28
|
This tool handles elements of type "widget".
|
|
@@ -49,7 +51,7 @@ You can use multiple property changes at once by providing multiple entries in t
|
|
|
49
51
|
Some properties are nested, use the root property name, then objects with nested values inside, as the complete schema suggests.
|
|
50
52
|
|
|
51
53
|
Make sure you have the "widget-schema-by-type" resource available to retrieve the PropType schema for the element type you are configuring.
|
|
52
|
-
Make sure you have
|
|
54
|
+
Make sure you have the "styles-schema" resources available to retrieve the common styles schema.
|
|
53
55
|
|
|
54
56
|
# How to configure elements
|
|
55
57
|
We use a dedicated PropType Schema for configuring elements, including styles. When you configure an element, you must use the EXACT PropType Value as defined in the schema.
|
|
@@ -57,8 +59,26 @@ For styleProperties, use the style schema provided, as it also uses the PropType
|
|
|
57
59
|
For all non-primitive types, provide the key property as defined in the schema as $$type in the generated object, as it is MANDATORY for parsing.
|
|
58
60
|
|
|
59
61
|
Use the EXACT "PROP-TYPE" Schema given, and ALWAYS include the "key" property from the original configuration for every property you are changing.
|
|
62
|
+
` );
|
|
63
|
+
|
|
64
|
+
configureElementToolPrompt.parameter( 'elementId', 'The ID of the element to configure. MANDATORY.' );
|
|
65
|
+
|
|
66
|
+
configureElementToolPrompt.parameter(
|
|
67
|
+
'elementType',
|
|
68
|
+
'The type of the element to configure (i.e. e-heading, e-button). MANDATORY.'
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
configureElementToolPrompt.parameter(
|
|
72
|
+
'propertiesToChange',
|
|
73
|
+
'An object containing the properties to change, with their new values. MANDATORY. When updating a style only, provide an empty object.'
|
|
74
|
+
);
|
|
60
75
|
|
|
61
|
-
|
|
76
|
+
configureElementToolPrompt.parameter(
|
|
77
|
+
'stylePropertiesToChange',
|
|
78
|
+
'An object containing the style properties to change, with their new values. OPTIONAL.'
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
configureElementToolPrompt.example( `
|
|
62
82
|
\`\`\`json
|
|
63
83
|
{
|
|
64
84
|
propertiesToChange: {
|
|
@@ -74,7 +94,7 @@ Use the EXACT "PROP-TYPE" Schema given, and ALWAYS include the "key" property fr
|
|
|
74
94
|
},
|
|
75
95
|
stylePropertiesToChange: {
|
|
76
96
|
'line-height': {
|
|
77
|
-
$$type: 'size',
|
|
97
|
+
$$type: 'size',
|
|
78
98
|
value: {
|
|
79
99
|
size: {
|
|
80
100
|
$$type: 'number',
|
|
@@ -91,8 +111,13 @@ Use the EXACT "PROP-TYPE" Schema given, and ALWAYS include the "key" property fr
|
|
|
91
111
|
elementType: 'element-type'
|
|
92
112
|
};
|
|
93
113
|
\`\`\`
|
|
114
|
+
` );
|
|
94
115
|
|
|
95
|
-
|
|
96
|
-
The $$type property is MANDATORY for every value
|
|
97
|
-
|
|
98
|
-
|
|
116
|
+
configureElementToolPrompt.instruction(
|
|
117
|
+
'The $$type property is MANDATORY for every value; it is required to parse the value and apply application-level effects.'
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
return configureElementToolPrompt.prompt();
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const CONFIGURE_ELEMENT_GUIDE_TEXT = generatePrompt();
|
|
@@ -4,20 +4,34 @@ import { type MCPRegistryEntry } from '@elementor/editor-mcp';
|
|
|
4
4
|
import { STYLE_SCHEMA_URI, WIDGET_SCHEMA_URI } from '../../resources/widgets-schema-resource';
|
|
5
5
|
import { doUpdateElementProperty } from '../../utils/do-update-element-property';
|
|
6
6
|
import { validateInput } from '../../utils/validate-input';
|
|
7
|
-
import {
|
|
7
|
+
import { CONFIGURE_ELEMENT_GUIDE_URI, generatePrompt } from './prompt';
|
|
8
8
|
import { inputSchema as schema, outputSchema } from './schema';
|
|
9
9
|
|
|
10
10
|
export const initConfigureElementTool = ( reg: MCPRegistryEntry ) => {
|
|
11
|
-
const { addTool } = reg;
|
|
11
|
+
const { addTool, resource } = reg;
|
|
12
|
+
|
|
13
|
+
resource(
|
|
14
|
+
'configure-element-guide',
|
|
15
|
+
CONFIGURE_ELEMENT_GUIDE_URI,
|
|
16
|
+
{
|
|
17
|
+
title: 'Configure Element Guide',
|
|
18
|
+
description: 'Detailed guide for using the configure-element tool',
|
|
19
|
+
mimeType: 'text/plain',
|
|
20
|
+
},
|
|
21
|
+
async ( uri: URL ) => ( {
|
|
22
|
+
contents: [ { uri: uri.href, mimeType: 'text/plain', text: generatePrompt() } ],
|
|
23
|
+
} )
|
|
24
|
+
);
|
|
12
25
|
|
|
13
26
|
addTool( {
|
|
14
27
|
name: 'configure-element',
|
|
15
|
-
description:
|
|
28
|
+
description: "Configure an existing V4 element's properties and styles. Read the guide resource before use.",
|
|
16
29
|
schema,
|
|
17
30
|
outputSchema,
|
|
18
31
|
requiredResources: [
|
|
19
32
|
{ description: 'Widgets schema', uri: WIDGET_SCHEMA_URI },
|
|
20
33
|
{ description: 'Styles schema', uri: STYLE_SCHEMA_URI },
|
|
34
|
+
{ description: 'Configure element guide', uri: CONFIGURE_ELEMENT_GUIDE_URI },
|
|
21
35
|
],
|
|
22
36
|
modelPreferences: {
|
|
23
37
|
hints: [ { name: 'claude-sonnet-4-5' } ],
|