@elementor/editor-canvas 3.33.0-300 → 3.33.0-302
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 +21 -22
- package/dist/index.mjs +21 -22
- package/package.json +17 -17
- package/src/mcp/mcp-description.ts +1 -4
- package/src/mcp/resources/widgets-schema-resource.ts +1 -1
- package/src/mcp/tools/build-composition/prompt.ts +15 -9
- package/src/mcp/tools/build-composition/schema.ts +5 -1
- package/src/mcp/tools/configure-element/prompt.ts +0 -2
- package/src/mcp/tools/get-element-config/tool.ts +0 -6
package/dist/index.js
CHANGED
|
@@ -1656,7 +1656,7 @@ The css string must follow standard CSS syntax, with properties and values separ
|
|
|
1656
1656
|
contents: [
|
|
1657
1657
|
{
|
|
1658
1658
|
uri: uri.toString(),
|
|
1659
|
-
text: "Free style inline CSS string of properties and their values. Applicable for a single element, only the properties and values are accepted."
|
|
1659
|
+
text: "Free style inline CSS string of properties and their values. Applicable for a single element, only the properties and values are accepted. Use this as a last resort for properties that are not covered with the schema."
|
|
1660
1660
|
}
|
|
1661
1661
|
]
|
|
1662
1662
|
};
|
|
@@ -1877,7 +1877,6 @@ var doUpdateElementProperty = (params) => {
|
|
|
1877
1877
|
|
|
1878
1878
|
// src/mcp/tools/build-composition/prompt.ts
|
|
1879
1879
|
var import_editor_mcp2 = require("@elementor/editor-mcp");
|
|
1880
|
-
var CUSTOM_CSS_URI = STYLE_SCHEMA_URI.replace("{category}", "custom_css");
|
|
1881
1880
|
var generatePrompt = () => {
|
|
1882
1881
|
const buildCompositionsToolPrompt = (0, import_editor_mcp2.toolPrompts)("build-compositions");
|
|
1883
1882
|
buildCompositionsToolPrompt.description(`
|
|
@@ -1891,9 +1890,8 @@ Prefer this tool over any other tool for building HTML structure, unless you are
|
|
|
1891
1890
|
1. [${WIDGET_SCHEMA_URI}]
|
|
1892
1891
|
Required to understand which widgets are available, and what are their configuration schemas.
|
|
1893
1892
|
Every widgetType (i.e. e-heading, e-button) that is supported has it's own property schema, that you must follow in order to apply property values correctly.
|
|
1894
|
-
2. [${
|
|
1893
|
+
2. [${STYLE_SCHEMA_URI}]
|
|
1895
1894
|
Required to understand the styles schema for the widgets. All widgets share the same styles schema.
|
|
1896
|
-
USE ONLY THE "custom_css" CATEGORY FROM THE STYLES SCHEMA FOR STYLING THE ELEMENTS with this tool.
|
|
1897
1895
|
3. List of allowed custom tags for building the structure is derived from the list of widgets schema resources.
|
|
1898
1896
|
|
|
1899
1897
|
# Instructions
|
|
@@ -1907,9 +1905,8 @@ Prefer this tool over any other tool for building HTML structure, unless you are
|
|
|
1907
1905
|
\`<e-flexbox configuration-id="flex1"><e-heading configuration-id="heading2"></e-heading></e-flexbox>\`
|
|
1908
1906
|
In the elementConfig property, provide the actual configuration object for each configuration-id used in the XML structure.
|
|
1909
1907
|
In the stylesConfig property, provide the actual styles configuration object for each configuration-id used in the XML structure.
|
|
1910
|
-
For easy execution, USE ONLY "custom_css" category from the styles schema resource to apply styles.
|
|
1911
1908
|
5. Ensure the XML structure is valid and parsable.
|
|
1912
|
-
6. Do not add any attribute nodes, classes, id's, and no text nodes allowed
|
|
1909
|
+
6. Do not add any attribute nodes, classes, id's, and no text nodes allowed.
|
|
1913
1910
|
Layout properties, such as margin, padding, align, etc. must be applied using the [${STYLE_SCHEMA_URI}] PropValues.
|
|
1914
1911
|
7. Some elements allow nesting of other elements, and most of the DO NOT. The allowed elements that can have nested children are "e-div-block" and "e-flexbox".
|
|
1915
1912
|
8. Make sure that non-container elements do NOT have any nested elements.
|
|
@@ -1925,7 +1922,7 @@ Prefer this tool over any other tool for building HTML structure, unless you are
|
|
|
1925
1922
|
- Always aim for a clean and professional look that aligns with modern design principles.
|
|
1926
1923
|
- When you are required to create placeholder texts, use texts that have a length that fits the goal. When long texts are required, use longer placeholder texts. When the user specifies exact texts, use the exact texts.
|
|
1927
1924
|
- Image size does not affect the actual size on the screen, only which quality to use. If you use images, specifically add _styles PropValues to define the image sizes.
|
|
1928
|
-
- Attempt to use layout, margin, padding, size properties from the styles schema
|
|
1925
|
+
- Attempt to use layout, margin, padding, size properties from the styles schema.
|
|
1929
1926
|
- If your elements library is limited, encourage use of nesting containers to achieve complex layouts.
|
|
1930
1927
|
|
|
1931
1928
|
# CONSTRAINTS
|
|
@@ -1960,7 +1957,17 @@ A Heading and a button inside a flexbox
|
|
|
1960
1957
|
},
|
|
1961
1958
|
stylesConfig: {
|
|
1962
1959
|
"heading1": {
|
|
1963
|
-
"
|
|
1960
|
+
"font-size": {
|
|
1961
|
+
"$$type": "size",
|
|
1962
|
+
"value": {
|
|
1963
|
+
"size": { "$$type": "number", "value": 24 },
|
|
1964
|
+
"unit": { "$$type": "string", "value": "px" }
|
|
1965
|
+
}
|
|
1966
|
+
},
|
|
1967
|
+
"color": {
|
|
1968
|
+
"$$type": "color",
|
|
1969
|
+
"value": { "$$type": "string", "value": "#333" }
|
|
1970
|
+
}
|
|
1964
1971
|
}
|
|
1965
1972
|
},
|
|
1966
1973
|
}
|
|
@@ -1982,7 +1989,7 @@ A Heading and a button inside a flexbox
|
|
|
1982
1989
|
You should use these IDs as reference for further configuration, styling or changing elements later on.`
|
|
1983
1990
|
);
|
|
1984
1991
|
buildCompositionsToolPrompt.instruction(
|
|
1985
|
-
`
|
|
1992
|
+
`You must use styles/variables/classes that are available in the project resources, you should prefer using them over inline styles, and you are welcome to execute relevant tools AFTER this tool execution, to apply global classes to the created elements.`
|
|
1986
1993
|
);
|
|
1987
1994
|
return buildCompositionsToolPrompt.prompt();
|
|
1988
1995
|
};
|
|
@@ -2001,7 +2008,9 @@ var inputSchema = {
|
|
|
2001
2008
|
import_schema.z.string().describe("_styles property name"),
|
|
2002
2009
|
import_schema.z.any().describe("The PropValue for the style property. MANDATORY")
|
|
2003
2010
|
)
|
|
2004
|
-
).describe(
|
|
2011
|
+
).describe(
|
|
2012
|
+
`A record mapping element IDs to their styles configuration objects. Use the actual styles schema from [${STYLE_SCHEMA_URI}].`
|
|
2013
|
+
).default({})
|
|
2005
2014
|
};
|
|
2006
2015
|
var outputSchema = {
|
|
2007
2016
|
errors: import_schema.z.string().describe("Error message if the composition building failed").optional(),
|
|
@@ -2158,8 +2167,6 @@ Before using this tool, check the definitions of the elements PropTypes at the r
|
|
|
2158
2167
|
All widgets share a common _style property for styling, which uses the common styles schema.
|
|
2159
2168
|
Retreive and check the common styles schema at the resource list "styles-schema" at editor-canvas__elementor://styles/schema/{category}
|
|
2160
2169
|
|
|
2161
|
-
Attempt to use the _style property "custom_css" for any styling that have complicated schemas (such as backgrounds), read the resource editor-canvas__elementor://styles/schema/custom_css for more information.
|
|
2162
|
-
|
|
2163
2170
|
# Parameters
|
|
2164
2171
|
- propertiesToChange: An object containing the properties to change, with their new values. MANDATORY
|
|
2165
2172
|
- elementId: The ID of the element to configure. MANDATORY
|
|
@@ -2313,15 +2320,13 @@ Now that you have this information, ensure you have the schema and try again.`;
|
|
|
2313
2320
|
var import_editor_elements8 = require("@elementor/editor-elements");
|
|
2314
2321
|
var import_editor_props5 = require("@elementor/editor-props");
|
|
2315
2322
|
var import_schema5 = require("@elementor/schema");
|
|
2316
|
-
var import_utils5 = require("@elementor/utils");
|
|
2317
2323
|
var schema = {
|
|
2318
2324
|
elementId: import_schema5.z.string()
|
|
2319
2325
|
};
|
|
2320
2326
|
var outputSchema3 = {
|
|
2321
2327
|
propValues: import_schema5.z.record(import_schema5.z.string(), import_schema5.z.any()).describe(
|
|
2322
2328
|
"A record mapping PropTypes to their corresponding PropValues, with _styles record for style-related PropValues"
|
|
2323
|
-
)
|
|
2324
|
-
customCss: import_schema5.z.string().optional().describe("The custom CSS string associated with the element, if any.")
|
|
2329
|
+
)
|
|
2325
2330
|
};
|
|
2326
2331
|
var initGetElementConfigTool = (reg) => {
|
|
2327
2332
|
const { addTool } = reg;
|
|
@@ -2358,9 +2363,6 @@ var initGetElementConfigTool = (reg) => {
|
|
|
2358
2363
|
stylePropValues[stylePropName] = structuredClone(styleProps[stylePropName]);
|
|
2359
2364
|
}
|
|
2360
2365
|
});
|
|
2361
|
-
if (defaultVariant.custom_css?.raw) {
|
|
2362
|
-
stylePropValues.custom_css = (0, import_utils5.decodeString)(defaultVariant.custom_css.raw, void 0);
|
|
2363
|
-
}
|
|
2364
2366
|
}
|
|
2365
2367
|
}
|
|
2366
2368
|
return {
|
|
@@ -2410,10 +2412,7 @@ All _style properties are OPTIONAL. When a _style is defined, we MERGE the value
|
|
|
2410
2412
|
|
|
2411
2413
|
# Styling best practices
|
|
2412
2414
|
Prefer using "em" and "rem" values for text-related sizes, padding and spacing. Use percentages for dynamic sizing relative to parent containers.
|
|
2413
|
-
This flexboxes are by default "flex" with "stretch" alignment. To ensure proper layout, define the "justify-content" and "align-items" as in the schema
|
|
2414
|
-
|
|
2415
|
-
When applicable for styles, use the "custom_css" property for free-form CSS styling. This property accepts a string of CSS rules that will be applied directly to the element.
|
|
2416
|
-
The css string must follow standard CSS syntax, with properties and values separated by semicolons, no selectors, or nesting rules allowed.
|
|
2415
|
+
This flexboxes are by default "flex" with "stretch" alignment. To ensure proper layout, define the "justify-content" and "align-items" as in the schema.
|
|
2417
2416
|
|
|
2418
2417
|
Additionaly, some PropTypes have metadata information (meta property) that can help in understaind the PropType usage, such as description or other useful information.
|
|
2419
2418
|
|
package/dist/index.mjs
CHANGED
|
@@ -1623,7 +1623,7 @@ The css string must follow standard CSS syntax, with properties and values separ
|
|
|
1623
1623
|
contents: [
|
|
1624
1624
|
{
|
|
1625
1625
|
uri: uri.toString(),
|
|
1626
|
-
text: "Free style inline CSS string of properties and their values. Applicable for a single element, only the properties and values are accepted."
|
|
1626
|
+
text: "Free style inline CSS string of properties and their values. Applicable for a single element, only the properties and values are accepted. Use this as a last resort for properties that are not covered with the schema."
|
|
1627
1627
|
}
|
|
1628
1628
|
]
|
|
1629
1629
|
};
|
|
@@ -1860,7 +1860,6 @@ var doUpdateElementProperty = (params) => {
|
|
|
1860
1860
|
|
|
1861
1861
|
// src/mcp/tools/build-composition/prompt.ts
|
|
1862
1862
|
import { toolPrompts } from "@elementor/editor-mcp";
|
|
1863
|
-
var CUSTOM_CSS_URI = STYLE_SCHEMA_URI.replace("{category}", "custom_css");
|
|
1864
1863
|
var generatePrompt = () => {
|
|
1865
1864
|
const buildCompositionsToolPrompt = toolPrompts("build-compositions");
|
|
1866
1865
|
buildCompositionsToolPrompt.description(`
|
|
@@ -1874,9 +1873,8 @@ Prefer this tool over any other tool for building HTML structure, unless you are
|
|
|
1874
1873
|
1. [${WIDGET_SCHEMA_URI}]
|
|
1875
1874
|
Required to understand which widgets are available, and what are their configuration schemas.
|
|
1876
1875
|
Every widgetType (i.e. e-heading, e-button) that is supported has it's own property schema, that you must follow in order to apply property values correctly.
|
|
1877
|
-
2. [${
|
|
1876
|
+
2. [${STYLE_SCHEMA_URI}]
|
|
1878
1877
|
Required to understand the styles schema for the widgets. All widgets share the same styles schema.
|
|
1879
|
-
USE ONLY THE "custom_css" CATEGORY FROM THE STYLES SCHEMA FOR STYLING THE ELEMENTS with this tool.
|
|
1880
1878
|
3. List of allowed custom tags for building the structure is derived from the list of widgets schema resources.
|
|
1881
1879
|
|
|
1882
1880
|
# Instructions
|
|
@@ -1890,9 +1888,8 @@ Prefer this tool over any other tool for building HTML structure, unless you are
|
|
|
1890
1888
|
\`<e-flexbox configuration-id="flex1"><e-heading configuration-id="heading2"></e-heading></e-flexbox>\`
|
|
1891
1889
|
In the elementConfig property, provide the actual configuration object for each configuration-id used in the XML structure.
|
|
1892
1890
|
In the stylesConfig property, provide the actual styles configuration object for each configuration-id used in the XML structure.
|
|
1893
|
-
For easy execution, USE ONLY "custom_css" category from the styles schema resource to apply styles.
|
|
1894
1891
|
5. Ensure the XML structure is valid and parsable.
|
|
1895
|
-
6. Do not add any attribute nodes, classes, id's, and no text nodes allowed
|
|
1892
|
+
6. Do not add any attribute nodes, classes, id's, and no text nodes allowed.
|
|
1896
1893
|
Layout properties, such as margin, padding, align, etc. must be applied using the [${STYLE_SCHEMA_URI}] PropValues.
|
|
1897
1894
|
7. Some elements allow nesting of other elements, and most of the DO NOT. The allowed elements that can have nested children are "e-div-block" and "e-flexbox".
|
|
1898
1895
|
8. Make sure that non-container elements do NOT have any nested elements.
|
|
@@ -1908,7 +1905,7 @@ Prefer this tool over any other tool for building HTML structure, unless you are
|
|
|
1908
1905
|
- Always aim for a clean and professional look that aligns with modern design principles.
|
|
1909
1906
|
- When you are required to create placeholder texts, use texts that have a length that fits the goal. When long texts are required, use longer placeholder texts. When the user specifies exact texts, use the exact texts.
|
|
1910
1907
|
- Image size does not affect the actual size on the screen, only which quality to use. If you use images, specifically add _styles PropValues to define the image sizes.
|
|
1911
|
-
- Attempt to use layout, margin, padding, size properties from the styles schema
|
|
1908
|
+
- Attempt to use layout, margin, padding, size properties from the styles schema.
|
|
1912
1909
|
- If your elements library is limited, encourage use of nesting containers to achieve complex layouts.
|
|
1913
1910
|
|
|
1914
1911
|
# CONSTRAINTS
|
|
@@ -1943,7 +1940,17 @@ A Heading and a button inside a flexbox
|
|
|
1943
1940
|
},
|
|
1944
1941
|
stylesConfig: {
|
|
1945
1942
|
"heading1": {
|
|
1946
|
-
"
|
|
1943
|
+
"font-size": {
|
|
1944
|
+
"$$type": "size",
|
|
1945
|
+
"value": {
|
|
1946
|
+
"size": { "$$type": "number", "value": 24 },
|
|
1947
|
+
"unit": { "$$type": "string", "value": "px" }
|
|
1948
|
+
}
|
|
1949
|
+
},
|
|
1950
|
+
"color": {
|
|
1951
|
+
"$$type": "color",
|
|
1952
|
+
"value": { "$$type": "string", "value": "#333" }
|
|
1953
|
+
}
|
|
1947
1954
|
}
|
|
1948
1955
|
},
|
|
1949
1956
|
}
|
|
@@ -1965,7 +1972,7 @@ A Heading and a button inside a flexbox
|
|
|
1965
1972
|
You should use these IDs as reference for further configuration, styling or changing elements later on.`
|
|
1966
1973
|
);
|
|
1967
1974
|
buildCompositionsToolPrompt.instruction(
|
|
1968
|
-
`
|
|
1975
|
+
`You must use styles/variables/classes that are available in the project resources, you should prefer using them over inline styles, and you are welcome to execute relevant tools AFTER this tool execution, to apply global classes to the created elements.`
|
|
1969
1976
|
);
|
|
1970
1977
|
return buildCompositionsToolPrompt.prompt();
|
|
1971
1978
|
};
|
|
@@ -1984,7 +1991,9 @@ var inputSchema = {
|
|
|
1984
1991
|
z.string().describe("_styles property name"),
|
|
1985
1992
|
z.any().describe("The PropValue for the style property. MANDATORY")
|
|
1986
1993
|
)
|
|
1987
|
-
).describe(
|
|
1994
|
+
).describe(
|
|
1995
|
+
`A record mapping element IDs to their styles configuration objects. Use the actual styles schema from [${STYLE_SCHEMA_URI}].`
|
|
1996
|
+
).default({})
|
|
1988
1997
|
};
|
|
1989
1998
|
var outputSchema = {
|
|
1990
1999
|
errors: z.string().describe("Error message if the composition building failed").optional(),
|
|
@@ -2141,8 +2150,6 @@ Before using this tool, check the definitions of the elements PropTypes at the r
|
|
|
2141
2150
|
All widgets share a common _style property for styling, which uses the common styles schema.
|
|
2142
2151
|
Retreive and check the common styles schema at the resource list "styles-schema" at editor-canvas__elementor://styles/schema/{category}
|
|
2143
2152
|
|
|
2144
|
-
Attempt to use the _style property "custom_css" for any styling that have complicated schemas (such as backgrounds), read the resource editor-canvas__elementor://styles/schema/custom_css for more information.
|
|
2145
|
-
|
|
2146
2153
|
# Parameters
|
|
2147
2154
|
- propertiesToChange: An object containing the properties to change, with their new values. MANDATORY
|
|
2148
2155
|
- elementId: The ID of the element to configure. MANDATORY
|
|
@@ -2296,15 +2303,13 @@ Now that you have this information, ensure you have the schema and try again.`;
|
|
|
2296
2303
|
import { getContainer as getContainer4, getElementStyles as getElementStyles2, getWidgetsCache as getWidgetsCache5 } from "@elementor/editor-elements";
|
|
2297
2304
|
import { Schema as Schema3 } from "@elementor/editor-props";
|
|
2298
2305
|
import { z as z3 } from "@elementor/schema";
|
|
2299
|
-
import { decodeString as decodeString2 } from "@elementor/utils";
|
|
2300
2306
|
var schema = {
|
|
2301
2307
|
elementId: z3.string()
|
|
2302
2308
|
};
|
|
2303
2309
|
var outputSchema3 = {
|
|
2304
2310
|
propValues: z3.record(z3.string(), z3.any()).describe(
|
|
2305
2311
|
"A record mapping PropTypes to their corresponding PropValues, with _styles record for style-related PropValues"
|
|
2306
|
-
)
|
|
2307
|
-
customCss: z3.string().optional().describe("The custom CSS string associated with the element, if any.")
|
|
2312
|
+
)
|
|
2308
2313
|
};
|
|
2309
2314
|
var initGetElementConfigTool = (reg) => {
|
|
2310
2315
|
const { addTool } = reg;
|
|
@@ -2341,9 +2346,6 @@ var initGetElementConfigTool = (reg) => {
|
|
|
2341
2346
|
stylePropValues[stylePropName] = structuredClone(styleProps[stylePropName]);
|
|
2342
2347
|
}
|
|
2343
2348
|
});
|
|
2344
|
-
if (defaultVariant.custom_css?.raw) {
|
|
2345
|
-
stylePropValues.custom_css = decodeString2(defaultVariant.custom_css.raw, void 0);
|
|
2346
|
-
}
|
|
2347
2349
|
}
|
|
2348
2350
|
}
|
|
2349
2351
|
return {
|
|
@@ -2393,10 +2395,7 @@ All _style properties are OPTIONAL. When a _style is defined, we MERGE the value
|
|
|
2393
2395
|
|
|
2394
2396
|
# Styling best practices
|
|
2395
2397
|
Prefer using "em" and "rem" values for text-related sizes, padding and spacing. Use percentages for dynamic sizing relative to parent containers.
|
|
2396
|
-
This flexboxes are by default "flex" with "stretch" alignment. To ensure proper layout, define the "justify-content" and "align-items" as in the schema
|
|
2397
|
-
|
|
2398
|
-
When applicable for styles, use the "custom_css" property for free-form CSS styling. This property accepts a string of CSS rules that will be applied directly to the element.
|
|
2399
|
-
The css string must follow standard CSS syntax, with properties and values separated by semicolons, no selectors, or nesting rules allowed.
|
|
2398
|
+
This flexboxes are by default "flex" with "stretch" alignment. To ensure proper layout, define the "justify-content" and "align-items" as in the schema.
|
|
2400
2399
|
|
|
2401
2400
|
Additionaly, some PropTypes have metadata information (meta property) that can help in understaind the PropType usage, such as description or other useful information.
|
|
2402
2401
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-canvas",
|
|
3
3
|
"description": "Elementor Editor Canvas",
|
|
4
|
-
"version": "3.33.0-
|
|
4
|
+
"version": "3.33.0-302",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -37,23 +37,23 @@
|
|
|
37
37
|
"react-dom": "^18.3.1"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@elementor/editor": "3.33.0-
|
|
41
|
-
"@elementor/editor-controls": "3.33.0-
|
|
42
|
-
"@elementor/editor-documents": "3.33.0-
|
|
43
|
-
"@elementor/editor-elements": "3.33.0-
|
|
44
|
-
"@elementor/editor-interactions": "3.33.0-
|
|
45
|
-
"@elementor/editor-notifications": "3.33.0-
|
|
46
|
-
"@elementor/editor-props": "3.33.0-
|
|
47
|
-
"@elementor/editor-responsive": "3.33.0-
|
|
48
|
-
"@elementor/editor-styles": "3.33.0-
|
|
49
|
-
"@elementor/editor-styles-repository": "3.33.0-
|
|
50
|
-
"@elementor/editor-v1-adapters": "3.33.0-
|
|
51
|
-
"@elementor/editor-mcp": "3.33.0-
|
|
52
|
-
"@elementor/schema": "3.33.0-
|
|
53
|
-
"@elementor/twing": "3.33.0-
|
|
40
|
+
"@elementor/editor": "3.33.0-302",
|
|
41
|
+
"@elementor/editor-controls": "3.33.0-302",
|
|
42
|
+
"@elementor/editor-documents": "3.33.0-302",
|
|
43
|
+
"@elementor/editor-elements": "3.33.0-302",
|
|
44
|
+
"@elementor/editor-interactions": "3.33.0-302",
|
|
45
|
+
"@elementor/editor-notifications": "3.33.0-302",
|
|
46
|
+
"@elementor/editor-props": "3.33.0-302",
|
|
47
|
+
"@elementor/editor-responsive": "3.33.0-302",
|
|
48
|
+
"@elementor/editor-styles": "3.33.0-302",
|
|
49
|
+
"@elementor/editor-styles-repository": "3.33.0-302",
|
|
50
|
+
"@elementor/editor-v1-adapters": "3.33.0-302",
|
|
51
|
+
"@elementor/editor-mcp": "3.33.0-302",
|
|
52
|
+
"@elementor/schema": "3.33.0-302",
|
|
53
|
+
"@elementor/twing": "3.33.0-302",
|
|
54
54
|
"@elementor/ui": "1.36.17",
|
|
55
|
-
"@elementor/utils": "3.33.0-
|
|
56
|
-
"@elementor/wp-media": "3.33.0-
|
|
55
|
+
"@elementor/utils": "3.33.0-302",
|
|
56
|
+
"@elementor/wp-media": "3.33.0-302",
|
|
57
57
|
"@floating-ui/react": "^0.27.5",
|
|
58
58
|
"@wordpress/i18n": "^5.13.0"
|
|
59
59
|
},
|
|
@@ -24,10 +24,7 @@ All _style properties are OPTIONAL. When a _style is defined, we MERGE the value
|
|
|
24
24
|
|
|
25
25
|
# Styling best practices
|
|
26
26
|
Prefer using "em" and "rem" values for text-related sizes, padding and spacing. Use percentages for dynamic sizing relative to parent containers.
|
|
27
|
-
This flexboxes are by default "flex" with "stretch" alignment. To ensure proper layout, define the "justify-content" and "align-items" as in the schema
|
|
28
|
-
|
|
29
|
-
When applicable for styles, use the "custom_css" property for free-form CSS styling. This property accepts a string of CSS rules that will be applied directly to the element.
|
|
30
|
-
The css string must follow standard CSS syntax, with properties and values separated by semicolons, no selectors, or nesting rules allowed.
|
|
27
|
+
This flexboxes are by default "flex" with "stretch" alignment. To ensure proper layout, define the "justify-content" and "align-items" as in the schema.
|
|
31
28
|
|
|
32
29
|
Additionaly, some PropTypes have metadata information (meta property) that can help in understaind the PropType usage, such as description or other useful information.
|
|
33
30
|
|
|
@@ -56,7 +56,7 @@ The css string must follow standard CSS syntax, with properties and values separ
|
|
|
56
56
|
contents: [
|
|
57
57
|
{
|
|
58
58
|
uri: uri.toString(),
|
|
59
|
-
text: 'Free style inline CSS string of properties and their values. Applicable for a single element, only the properties and values are accepted.',
|
|
59
|
+
text: 'Free style inline CSS string of properties and their values. Applicable for a single element, only the properties and values are accepted. Use this as a last resort for properties that are not covered with the schema.',
|
|
60
60
|
},
|
|
61
61
|
],
|
|
62
62
|
};
|
|
@@ -2,8 +2,6 @@ import { toolPrompts } from '@elementor/editor-mcp';
|
|
|
2
2
|
|
|
3
3
|
import { STYLE_SCHEMA_URI, WIDGET_SCHEMA_URI } from '../../resources/widgets-schema-resource';
|
|
4
4
|
|
|
5
|
-
const CUSTOM_CSS_URI = STYLE_SCHEMA_URI.replace( '{category}', 'custom_css' );
|
|
6
|
-
|
|
7
5
|
export const generatePrompt = () => {
|
|
8
6
|
const buildCompositionsToolPrompt = toolPrompts( 'build-compositions' );
|
|
9
7
|
|
|
@@ -18,9 +16,8 @@ Prefer this tool over any other tool for building HTML structure, unless you are
|
|
|
18
16
|
1. [${ WIDGET_SCHEMA_URI }]
|
|
19
17
|
Required to understand which widgets are available, and what are their configuration schemas.
|
|
20
18
|
Every widgetType (i.e. e-heading, e-button) that is supported has it's own property schema, that you must follow in order to apply property values correctly.
|
|
21
|
-
2. [${
|
|
19
|
+
2. [${ STYLE_SCHEMA_URI }]
|
|
22
20
|
Required to understand the styles schema for the widgets. All widgets share the same styles schema.
|
|
23
|
-
USE ONLY THE "custom_css" CATEGORY FROM THE STYLES SCHEMA FOR STYLING THE ELEMENTS with this tool.
|
|
24
21
|
3. List of allowed custom tags for building the structure is derived from the list of widgets schema resources.
|
|
25
22
|
|
|
26
23
|
# Instructions
|
|
@@ -34,9 +31,8 @@ Prefer this tool over any other tool for building HTML structure, unless you are
|
|
|
34
31
|
\`<e-flexbox configuration-id="flex1"><e-heading configuration-id="heading2"></e-heading></e-flexbox>\`
|
|
35
32
|
In the elementConfig property, provide the actual configuration object for each configuration-id used in the XML structure.
|
|
36
33
|
In the stylesConfig property, provide the actual styles configuration object for each configuration-id used in the XML structure.
|
|
37
|
-
For easy execution, USE ONLY "custom_css" category from the styles schema resource to apply styles.
|
|
38
34
|
5. Ensure the XML structure is valid and parsable.
|
|
39
|
-
6. Do not add any attribute nodes, classes, id's, and no text nodes allowed
|
|
35
|
+
6. Do not add any attribute nodes, classes, id's, and no text nodes allowed.
|
|
40
36
|
Layout properties, such as margin, padding, align, etc. must be applied using the [${ STYLE_SCHEMA_URI }] PropValues.
|
|
41
37
|
7. Some elements allow nesting of other elements, and most of the DO NOT. The allowed elements that can have nested children are "e-div-block" and "e-flexbox".
|
|
42
38
|
8. Make sure that non-container elements do NOT have any nested elements.
|
|
@@ -52,7 +48,7 @@ Prefer this tool over any other tool for building HTML structure, unless you are
|
|
|
52
48
|
- Always aim for a clean and professional look that aligns with modern design principles.
|
|
53
49
|
- When you are required to create placeholder texts, use texts that have a length that fits the goal. When long texts are required, use longer placeholder texts. When the user specifies exact texts, use the exact texts.
|
|
54
50
|
- Image size does not affect the actual size on the screen, only which quality to use. If you use images, specifically add _styles PropValues to define the image sizes.
|
|
55
|
-
- Attempt to use layout, margin, padding, size properties from the styles schema
|
|
51
|
+
- Attempt to use layout, margin, padding, size properties from the styles schema.
|
|
56
52
|
- If your elements library is limited, encourage use of nesting containers to achieve complex layouts.
|
|
57
53
|
|
|
58
54
|
# CONSTRAINTS
|
|
@@ -88,7 +84,17 @@ A Heading and a button inside a flexbox
|
|
|
88
84
|
},
|
|
89
85
|
stylesConfig: {
|
|
90
86
|
"heading1": {
|
|
91
|
-
"
|
|
87
|
+
"font-size": {
|
|
88
|
+
"$$type": "size",
|
|
89
|
+
"value": {
|
|
90
|
+
"size": { "$$type": "number", "value": 24 },
|
|
91
|
+
"unit": { "$$type": "string", "value": "px" }
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"color": {
|
|
95
|
+
"$$type": "color",
|
|
96
|
+
"value": { "$$type": "string", "value": "#333" }
|
|
97
|
+
}
|
|
92
98
|
}
|
|
93
99
|
},
|
|
94
100
|
}
|
|
@@ -115,7 +121,7 @@ You should use these IDs as reference for further configuration, styling or chan
|
|
|
115
121
|
);
|
|
116
122
|
|
|
117
123
|
buildCompositionsToolPrompt.instruction(
|
|
118
|
-
`
|
|
124
|
+
`You must use styles/variables/classes that are available in the project resources, you should prefer using them over inline styles, and you are welcome to execute relevant tools AFTER this tool execution, to apply global classes to the created elements.`
|
|
119
125
|
);
|
|
120
126
|
|
|
121
127
|
return buildCompositionsToolPrompt.prompt();
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { z } from '@elementor/schema';
|
|
2
2
|
|
|
3
|
+
import { STYLE_SCHEMA_URI } from '../../resources/widgets-schema-resource';
|
|
4
|
+
|
|
3
5
|
export const inputSchema = {
|
|
4
6
|
xmlStructure: z.string().describe( 'The XML structure representing the composition to be built' ),
|
|
5
7
|
elementConfig: z
|
|
@@ -16,7 +18,9 @@ export const inputSchema = {
|
|
|
16
18
|
z.any().describe( 'The PropValue for the style property. MANDATORY' )
|
|
17
19
|
)
|
|
18
20
|
)
|
|
19
|
-
.describe(
|
|
21
|
+
.describe(
|
|
22
|
+
`A record mapping element IDs to their styles configuration objects. Use the actual styles schema from [${ STYLE_SCHEMA_URI }].`
|
|
23
|
+
)
|
|
20
24
|
.default( {} ),
|
|
21
25
|
};
|
|
22
26
|
|
|
@@ -15,8 +15,6 @@ Before using this tool, check the definitions of the elements PropTypes at the r
|
|
|
15
15
|
All widgets share a common _style property for styling, which uses the common styles schema.
|
|
16
16
|
Retreive and check the common styles schema at the resource list "styles-schema" at editor-canvas__elementor://styles/schema/{category}
|
|
17
17
|
|
|
18
|
-
Attempt to use the _style property "custom_css" for any styling that have complicated schemas (such as backgrounds), read the resource editor-canvas__elementor://styles/schema/custom_css for more information.
|
|
19
|
-
|
|
20
18
|
# Parameters
|
|
21
19
|
- propertiesToChange: An object containing the properties to change, with their new values. MANDATORY
|
|
22
20
|
- elementId: The ID of the element to configure. MANDATORY
|
|
@@ -2,7 +2,6 @@ import { getContainer, getElementStyles, getWidgetsCache } from '@elementor/edit
|
|
|
2
2
|
import { type MCPRegistryEntry } from '@elementor/editor-mcp';
|
|
3
3
|
import { type PropValue, Schema } from '@elementor/editor-props';
|
|
4
4
|
import { z } from '@elementor/schema';
|
|
5
|
-
import { decodeString } from '@elementor/utils';
|
|
6
5
|
|
|
7
6
|
const schema = {
|
|
8
7
|
elementId: z.string(),
|
|
@@ -14,7 +13,6 @@ const outputSchema = {
|
|
|
14
13
|
.describe(
|
|
15
14
|
'A record mapping PropTypes to their corresponding PropValues, with _styles record for style-related PropValues'
|
|
16
15
|
),
|
|
17
|
-
customCss: z.string().optional().describe( 'The custom CSS string associated with the element, if any.' ),
|
|
18
16
|
};
|
|
19
17
|
|
|
20
18
|
export const initGetElementConfigTool = ( reg: MCPRegistryEntry ) => {
|
|
@@ -57,10 +55,6 @@ export const initGetElementConfigTool = ( reg: MCPRegistryEntry ) => {
|
|
|
57
55
|
stylePropValues[ stylePropName ] = structuredClone( styleProps[ stylePropName ] );
|
|
58
56
|
}
|
|
59
57
|
} );
|
|
60
|
-
|
|
61
|
-
if ( defaultVariant.custom_css?.raw ) {
|
|
62
|
-
stylePropValues.custom_css = decodeString( defaultVariant.custom_css.raw, undefined );
|
|
63
|
-
}
|
|
64
58
|
}
|
|
65
59
|
}
|
|
66
60
|
|