@elementor/editor-canvas 3.35.0-340 → 3.35.0-342
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +66 -62
- package/dist/index.d.ts +66 -62
- package/dist/index.js +757 -364
- package/dist/index.mjs +680 -293
- package/package.json +17 -17
- package/src/index.ts +12 -9
- package/src/mcp/canvas-mcp.ts +2 -0
- package/src/mcp/mcp-description.ts +67 -24
- package/src/mcp/resources/breakpoints-resource.ts +47 -0
- package/src/mcp/resources/widgets-schema-resource.ts +10 -7
- package/src/mcp/tools/build-composition/prompt.ts +222 -20
- package/src/mcp/tools/build-composition/schema.ts +7 -4
- package/src/mcp/tools/build-composition/tool.ts +23 -24
- package/src/mcp/tools/configure-element/prompt.ts +23 -20
- package/src/mcp/tools/configure-element/schema.ts +15 -7
- package/src/mcp/tools/configure-element/tool.ts +62 -18
- package/src/mcp/tools/get-element-config/tool.ts +15 -7
- package/src/mcp/utils/do-update-element-property.ts +16 -16
- package/src/mcp/utils/validate-input.ts +100 -0
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.35.0-
|
|
4
|
+
"version": "3.35.0-342",
|
|
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.35.0-
|
|
41
|
-
"@elementor/editor-controls": "3.35.0-
|
|
42
|
-
"@elementor/editor-documents": "3.35.0-
|
|
43
|
-
"@elementor/editor-elements": "3.35.0-
|
|
44
|
-
"@elementor/editor-interactions": "3.35.0-
|
|
45
|
-
"@elementor/editor-notifications": "3.35.0-
|
|
46
|
-
"@elementor/editor-props": "3.35.0-
|
|
47
|
-
"@elementor/editor-responsive": "3.35.0-
|
|
48
|
-
"@elementor/editor-styles": "3.35.0-
|
|
49
|
-
"@elementor/editor-styles-repository": "3.35.0-
|
|
50
|
-
"@elementor/editor-v1-adapters": "3.35.0-
|
|
51
|
-
"@elementor/editor-mcp": "3.35.0-
|
|
52
|
-
"@elementor/schema": "3.35.0-
|
|
53
|
-
"@elementor/twing": "3.35.0-
|
|
40
|
+
"@elementor/editor": "3.35.0-342",
|
|
41
|
+
"@elementor/editor-controls": "3.35.0-342",
|
|
42
|
+
"@elementor/editor-documents": "3.35.0-342",
|
|
43
|
+
"@elementor/editor-elements": "3.35.0-342",
|
|
44
|
+
"@elementor/editor-interactions": "3.35.0-342",
|
|
45
|
+
"@elementor/editor-notifications": "3.35.0-342",
|
|
46
|
+
"@elementor/editor-props": "3.35.0-342",
|
|
47
|
+
"@elementor/editor-responsive": "3.35.0-342",
|
|
48
|
+
"@elementor/editor-styles": "3.35.0-342",
|
|
49
|
+
"@elementor/editor-styles-repository": "3.35.0-342",
|
|
50
|
+
"@elementor/editor-v1-adapters": "3.35.0-342",
|
|
51
|
+
"@elementor/editor-mcp": "3.35.0-342",
|
|
52
|
+
"@elementor/schema": "3.35.0-342",
|
|
53
|
+
"@elementor/twing": "3.35.0-342",
|
|
54
54
|
"@elementor/ui": "1.36.17",
|
|
55
|
-
"@elementor/utils": "3.35.0-
|
|
56
|
-
"@elementor/wp-media": "3.35.0-
|
|
55
|
+
"@elementor/utils": "3.35.0-342",
|
|
56
|
+
"@elementor/wp-media": "3.35.0-342",
|
|
57
57
|
"@floating-ui/react": "^0.27.5",
|
|
58
58
|
"@wordpress/i18n": "^5.13.0"
|
|
59
59
|
},
|
package/src/index.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
export { BREAKPOINTS_SCHEMA_URI } from './mcp/resources/breakpoints-resource';
|
|
2
|
+
export { STYLE_SCHEMA_URI } from './mcp/resources/widgets-schema-resource';
|
|
3
|
+
|
|
1
4
|
export { init } from './init';
|
|
2
5
|
|
|
3
|
-
export { styleTransformersRegistry } from './style-transformers-registry';
|
|
4
|
-
export { settingsTransformersRegistry } from './settings-transformers-registry';
|
|
5
|
-
export { createTransformer } from './transformers/create-transformer';
|
|
6
|
-
export { createTransformersRegistry } from './transformers/create-transformers-registry';
|
|
7
|
-
export { type AnyTransformer } from './transformers/types';
|
|
8
|
-
export { createPropsResolver, type PropsResolver } from './renderers/create-props-resolver';
|
|
9
|
-
export { startDragElementFromPanel, endDragElementFromPanel } from './sync/drag-element-from-panel';
|
|
10
|
-
export { registerElementType } from './legacy/init-legacy-views';
|
|
11
6
|
export {
|
|
12
7
|
createTemplatedElementView,
|
|
13
8
|
type CreateTemplatedElementTypeOptions,
|
|
14
9
|
} from './legacy/create-templated-element-type';
|
|
15
|
-
export {
|
|
10
|
+
export { registerElementType } from './legacy/init-legacy-views';
|
|
16
11
|
export * from './legacy/types';
|
|
12
|
+
export { createPropsResolver, type PropsResolver } from './renderers/create-props-resolver';
|
|
13
|
+
export { settingsTransformersRegistry } from './settings-transformers-registry';
|
|
14
|
+
export { styleTransformersRegistry } from './style-transformers-registry';
|
|
15
|
+
export { endDragElementFromPanel, startDragElementFromPanel } from './sync/drag-element-from-panel';
|
|
16
|
+
export { getCanvasIframeDocument } from './sync/get-canvas-iframe-document';
|
|
17
|
+
export { createTransformer } from './transformers/create-transformer';
|
|
18
|
+
export { createTransformersRegistry } from './transformers/create-transformers-registry';
|
|
19
|
+
export { type AnyTransformer } from './transformers/types';
|
package/src/mcp/canvas-mcp.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type MCPRegistryEntry } from '@elementor/editor-mcp';
|
|
2
2
|
|
|
3
|
+
import { initBreakpointsResource } from './resources/breakpoints-resource';
|
|
3
4
|
import { initWidgetsSchemaResource } from './resources/widgets-schema-resource';
|
|
4
5
|
import { initBuildCompositionsTool } from './tools/build-composition/tool';
|
|
5
6
|
import { initConfigureElementTool } from './tools/configure-element/tool';
|
|
@@ -14,4 +15,5 @@ export const initCanvasMcp = ( reg: MCPRegistryEntry ) => {
|
|
|
14
15
|
initBuildCompositionsTool( reg );
|
|
15
16
|
initGetElementConfigTool( reg );
|
|
16
17
|
initConfigureElementTool( reg );
|
|
18
|
+
initBreakpointsResource( reg );
|
|
17
19
|
};
|
|
@@ -1,40 +1,83 @@
|
|
|
1
1
|
import { STYLE_SCHEMA_URI, WIDGET_SCHEMA_URI } from './resources/widgets-schema-resource';
|
|
2
2
|
|
|
3
|
-
export const mcpDescription = `Canvas MCP
|
|
3
|
+
export const mcpDescription = `Canvas MCP
|
|
4
|
+
This MCP enables everything related to creation, configuration, and styling of elements on the Elementor canvas.
|
|
4
5
|
|
|
5
|
-
#
|
|
6
|
+
# Design Systems in Elementor
|
|
7
|
+
- Elementor presents global classes. Each global class is a a set of styles that can be applied to multiple elements. This allows for consistent styling across the design.
|
|
8
|
+
- Elementor also presents global variables, which can be colors, sizes or fonts. These variables can be used in any element's styles, or global classes, allowing for easy updates and consistency across the design.
|
|
9
|
+
- All data is stored in a PropValue structure, which is a wrapper for elementor values. The PropValues are derived from an internal "PropType" schema, which defines the structure and types of the values.
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
# PropValues structure and usage
|
|
12
|
+
\`\`\`json
|
|
13
|
+
{
|
|
14
|
+
$$type: 'the-prop-type-schema-kind',
|
|
15
|
+
value: 'the-actual-value-as-defined-for-the-propType'
|
|
16
|
+
}
|
|
17
|
+
\`\`\`
|
|
18
|
+
The "value" property can be an object, string, number, boolean, array, etc. The $$type defines the kind of value, and the value is the actual value.
|
|
19
|
+
It is critical to provide the correct $$type for each value, as it defines how Elementor will interpret the value or reject it.
|
|
20
|
+
|
|
21
|
+
All widgets properties and configuration is built from sets of PropValues, which can be retreived from the resource [${ WIDGET_SCHEMA_URI }].
|
|
22
|
+
All styles are SHARED ACCROSS widgets, containers and components, and are defined in a common styles schema, retreivable from the resource [${ STYLE_SCHEMA_URI }].
|
|
23
|
+
The style schema also defines the global classes.
|
|
24
|
+
|
|
25
|
+
To understand the configuration options for an element, refer to the PropType schema for that specific element. For example: "e-heading" configuration schema is available at the resource [${ WIDGET_SCHEMA_URI }/e-heading]
|
|
26
|
+
|
|
27
|
+
# Modifying elements and styles
|
|
28
|
+
When configuring an element, elementor does a MERGE PROPERTIES operation, which means that only the properties you provide will be updated, and the rest will remain as is.
|
|
29
|
+
For deleting a property, the value must be set to null, instead of a PropValue. When adding a configuration, no need to provide the full configuration, only the properties you want to add or update.
|
|
30
|
+
The same rule applies to styles as well and modifications to global classes.
|
|
31
|
+
|
|
32
|
+
# Building full compositions
|
|
33
|
+
The "build-composition" tool allows creating multiple elements in a single operation.
|
|
34
|
+
The tool accepts both the structure, the styling and the configuration of each element to be created.
|
|
9
35
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
36
|
+
- First step: Retreive the available widgets by listing the [${ WIDGET_SCHEMA_URI }] dynamic resource.
|
|
37
|
+
- Second step: decide which elements to create, and their configuration and styles.
|
|
38
|
+
Retrieve the used elements configuration schema from the resource [${ WIDGET_SCHEMA_URI }/element-name]
|
|
39
|
+
- Third step: define the styles for each element, using the common styles schema from the resource [${ STYLE_SCHEMA_URI }]. List the resource to see all available style properties.
|
|
40
|
+
For background and complicated layered styles, you can use "custom_css" property, which is supported only for ELEMENTOR PRO users ONLY.
|
|
41
|
+
The custom css is intented to deal with yet unsupported CSS features that ARE NOT PART OF THE STYLE SCHEMA, to enable PRO users to support new CSS features.
|
|
14
42
|
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
- Use the "build-composition" tool to create a NEW ELEMENTS in a composition on the page. You can use this tool to also create a new single element.
|
|
19
|
-
- Use the "configure-element" tool to update the configuration of an EXISTING element on the page.
|
|
43
|
+
# Configuring Elements / Adding Style to Elements
|
|
44
|
+
An element configuration can be retrieved using the "get-element-configuration-values" tool.
|
|
45
|
+
Updating an element requires only the UPDATED properties (including in the styles), as Elementor does a MERGE/PATCH operation.
|
|
20
46
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
All
|
|
47
|
+
<note>
|
|
48
|
+
for PropValue with array as value:
|
|
49
|
+
All array types that can receive union types, are typed as mixed array.
|
|
50
|
+
</note>
|
|
24
51
|
|
|
25
52
|
# Styling best practices
|
|
26
53
|
Prefer using "em" and "rem" values for text-related sizes, padding and spacing. Use percentages for dynamic sizing relative to parent containers.
|
|
27
54
|
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
55
|
|
|
29
|
-
|
|
56
|
+
# Examples:
|
|
30
57
|
|
|
31
|
-
|
|
32
|
-
{
|
|
33
|
-
$$type: 'as-defined-for-propValue',
|
|
34
|
-
value: null
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
Example of "image" PropValue structure:
|
|
58
|
+
## e-image PropValue structure:
|
|
38
59
|
{$$type:'image',value:{src:{$$type:'image-src',value:{url:{$$type:'url',value:'https://example.com/image.jpg'}}},size:{$$type:'string',value:'full'}}}
|
|
39
60
|
|
|
61
|
+
Widgets' sizes MUST be defined using the style schema. Images, for example, have a "size" property, but it DOES NOT AFFECT THE VISUAL size, but rather the image size/resolution to load.
|
|
62
|
+
|
|
63
|
+
# Working with Global Classes and Variables
|
|
64
|
+
- To get the list of available global classes, use the resource at uri elementor://global-classes
|
|
65
|
+
- To get the list of available global variables, use the resource at uri elementor://global-variables
|
|
66
|
+
- Before creating a global variable or class, refer to the list and see if it already exists.
|
|
67
|
+
- Naming conventions:
|
|
68
|
+
- Global classes and global variables should have meaningful names that reflect their purpose and usage.
|
|
69
|
+
- Avoid generic names like "style1" or "classA"; instead, use descriptive names like "primary-button" or "heading-level-1".
|
|
70
|
+
- Avoid names that reflect colors or values, use only purpose-based names.
|
|
71
|
+
|
|
72
|
+
# Advanced operations
|
|
73
|
+
You are encouraged to run multiple times multiple tools to achieve the desired result.
|
|
74
|
+
|
|
75
|
+
An Example scenario of creating fully styled composition:
|
|
76
|
+
1. Get the list of availble widgets using dynamic resource [${ WIDGET_SCHEMA_URI }]
|
|
77
|
+
2. For each element to create, retreive its configuration schema from [${ WIDGET_SCHEMA_URI }/element-name]
|
|
78
|
+
3. Get the list of available global classes using the always up-to-date resource
|
|
79
|
+
4. Get the list of available global variables using the dynamic resource
|
|
80
|
+
5. Build a composition using the "build-composition" tool, providing the structure, configuration and styles for each element. You may want to style the elements later.
|
|
81
|
+
6. Check you work: as you have the created IDs from the build-composition response, you can retreive each element configuration using the "get-element-configuration-values" tool.
|
|
82
|
+
7. If needed, update styles using the "configure-element" tool, providing only the styles or widget's properties to update.
|
|
40
83
|
`;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type MCPRegistryEntry } from '@elementor/editor-mcp';
|
|
2
|
+
import { type ExtendedWindow } from '@elementor/editor-responsive';
|
|
3
|
+
import { v1ReadyEvent } from '@elementor/editor-v1-adapters';
|
|
4
|
+
|
|
5
|
+
export const BREAKPOINTS_SCHEMA_URI = 'elementor://breakpoints/list';
|
|
6
|
+
|
|
7
|
+
export const initBreakpointsResource = ( reg: MCPRegistryEntry ) => {
|
|
8
|
+
const { mcpServer } = reg;
|
|
9
|
+
|
|
10
|
+
const getBreakpointsList = () => {
|
|
11
|
+
const { breakpoints } = ( window as unknown as ExtendedWindow ).elementor?.config?.responsive || {};
|
|
12
|
+
if ( ! breakpoints ) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
return Object.values( breakpoints )
|
|
16
|
+
.filter( ( bp ) => bp.is_enabled )
|
|
17
|
+
.map( ( bp ) => {
|
|
18
|
+
const { direction: constraint, label, value } = bp;
|
|
19
|
+
return {
|
|
20
|
+
label,
|
|
21
|
+
constraint,
|
|
22
|
+
value,
|
|
23
|
+
};
|
|
24
|
+
} );
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const buildResourceResponse = () => ( {
|
|
28
|
+
contents: [
|
|
29
|
+
{
|
|
30
|
+
uri: BREAKPOINTS_SCHEMA_URI,
|
|
31
|
+
mimeType: 'application/json',
|
|
32
|
+
text: JSON.stringify( getBreakpointsList() ),
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
} );
|
|
36
|
+
|
|
37
|
+
mcpServer.resource( 'breakpoints ', BREAKPOINTS_SCHEMA_URI, () => {
|
|
38
|
+
return buildResourceResponse();
|
|
39
|
+
} );
|
|
40
|
+
|
|
41
|
+
window.addEventListener( v1ReadyEvent().name, () => {
|
|
42
|
+
mcpServer.server.sendResourceUpdated( {
|
|
43
|
+
uri: BREAKPOINTS_SCHEMA_URI,
|
|
44
|
+
...buildResourceResponse(),
|
|
45
|
+
} );
|
|
46
|
+
} );
|
|
47
|
+
};
|
|
@@ -26,7 +26,7 @@ export const initWidgetsSchemaResource = ( reg: MCPRegistryEntry ) => {
|
|
|
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
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, or in custom_css, depends on your needs.
|
|
28
28
|
|
|
29
|
-
When applicable for styles,
|
|
29
|
+
When applicable for styles, apply style PropValues using the ${ STYLE_SCHEMA_URI }. Custom css is for Elementor PRO users and intended to support only new CSS features not yet available in the UI.
|
|
30
30
|
The css string must follow standard CSS syntax, with properties and values separated by semicolons, no selectors, or nesting rules allowed.`,
|
|
31
31
|
},
|
|
32
32
|
],
|
|
@@ -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. Use this as a last resort for properties that are not covered with the schema.',
|
|
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. Do not use selectors, only the CSS content',
|
|
60
60
|
},
|
|
61
61
|
],
|
|
62
62
|
};
|
|
@@ -65,12 +65,12 @@ The css string must follow standard CSS syntax, with properties and values separ
|
|
|
65
65
|
if ( ! stylesSchema ) {
|
|
66
66
|
throw new Error( `No styles schema found for category: ${ category }` );
|
|
67
67
|
}
|
|
68
|
-
const
|
|
69
|
-
const asJson = Schema.propTypeToJsonSchema( cleanedupPropSchema as PropType );
|
|
68
|
+
const asJson = Schema.propTypeToJsonSchema( stylesSchema as PropType );
|
|
70
69
|
return {
|
|
71
70
|
contents: [
|
|
72
71
|
{
|
|
73
72
|
uri: uri.toString(),
|
|
73
|
+
mimeType: 'application/json',
|
|
74
74
|
text: JSON.stringify( asJson ),
|
|
75
75
|
},
|
|
76
76
|
],
|
|
@@ -104,9 +104,8 @@ The css string must follow standard CSS syntax, with properties and values separ
|
|
|
104
104
|
if ( ! propSchema ) {
|
|
105
105
|
throw new Error( `No prop schema found for element type: ${ widgetType }` );
|
|
106
106
|
}
|
|
107
|
-
const cleanedupPropSchema = cleanupPropSchema( propSchema );
|
|
108
107
|
const asJson = Object.fromEntries(
|
|
109
|
-
Object.entries(
|
|
108
|
+
Object.entries( propSchema ).map( ( [ key, propType ] ) => [
|
|
110
109
|
key,
|
|
111
110
|
Schema.propTypeToJsonSchema( propType ),
|
|
112
111
|
] )
|
|
@@ -120,7 +119,11 @@ The css string must follow standard CSS syntax, with properties and values separ
|
|
|
120
119
|
contents: [
|
|
121
120
|
{
|
|
122
121
|
uri: uri.toString(),
|
|
123
|
-
|
|
122
|
+
mimeType: 'application/json',
|
|
123
|
+
text: JSON.stringify( {
|
|
124
|
+
type: 'object',
|
|
125
|
+
properties: asJson,
|
|
126
|
+
} ),
|
|
124
127
|
},
|
|
125
128
|
],
|
|
126
129
|
};
|
|
@@ -6,12 +6,6 @@ export const generatePrompt = () => {
|
|
|
6
6
|
const buildCompositionsToolPrompt = toolPrompts( 'build-compositions' );
|
|
7
7
|
|
|
8
8
|
buildCompositionsToolPrompt.description( `
|
|
9
|
-
Build entire elementor widget comositions representing complex structures of nested elements.
|
|
10
|
-
|
|
11
|
-
# When to use this tool
|
|
12
|
-
Always prefer this tool when the user requires to build a composition of elements, such as cards, heros, or inspired from other pages or HTML compositions.
|
|
13
|
-
Prefer this tool over any other tool for building HTML structure, unless you are specified to use a different tool.
|
|
14
|
-
|
|
15
9
|
# **CRITICAL - REQUIRED RESOURCES (Must read before using this tool)**
|
|
16
10
|
1. [${ WIDGET_SCHEMA_URI }]
|
|
17
11
|
Required to understand which widgets are available, and what are their configuration schemas.
|
|
@@ -20,6 +14,16 @@ Prefer this tool over any other tool for building HTML structure, unless you are
|
|
|
20
14
|
Required to understand the styles schema for the widgets. All widgets share the same styles schema.
|
|
21
15
|
3. List of allowed custom tags for building the structure is derived from the list of widgets schema resources.
|
|
22
16
|
|
|
17
|
+
# DESIGN QUALITY IMPERATIVE
|
|
18
|
+
You are generating designs for real users who expect distinctive, intentional aesthetics - NOT generic AI output.
|
|
19
|
+
**The Core Challenge**: Large language models naturally converge toward statistically common design patterns during generation. This creates predictable, uninspired results that users describe as "AI slop": safe color schemes, default typography hierarchies, minimal contrast, and timid spacing.
|
|
20
|
+
**Your Mission**: Actively resist distributional convergence by making intentional, distinctive design choices across all aesthetic dimensions. Every design decision should have a clear purpose tied to visual hierarchy, brand personality, or user experience goals.
|
|
21
|
+
When in doubt between "safe" and "distinctive," choose distinctive - users can always request refinements, but they cannot salvage generic foundations.
|
|
22
|
+
|
|
23
|
+
# When to use this tool
|
|
24
|
+
Always prefer this tool when the user requires to build a composition of elements, such as cards, heros, or inspired from other pages or HTML compositions.
|
|
25
|
+
Prefer this tool over any other tool for building HTML structure, unless you are specified to use a different tool.
|
|
26
|
+
|
|
23
27
|
# Instructions
|
|
24
28
|
1. Understand the user requirements carefully.
|
|
25
29
|
2. Build a valid XML structure using only the allowed custom tags provided. For example, if you
|
|
@@ -36,20 +40,185 @@ Prefer this tool over any other tool for building HTML structure, unless you are
|
|
|
36
40
|
Layout properties, such as margin, padding, align, etc. must be applied using the [${ STYLE_SCHEMA_URI }] PropValues.
|
|
37
41
|
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".
|
|
38
42
|
8. Make sure that non-container elements do NOT have any nested elements.
|
|
39
|
-
9.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
9. **CRITICAL - CUSTOM CSS PRIORITY**: Prefer using style schema. Custom CSS is ONLY FOR UNSUPPRTED schema styles.
|
|
44
|
+
ALWAYS PRIORITIZE using the style schema PropValues for styling elements as they provide better user experience in the editor, and UI features for the end-users.
|
|
45
|
+
- Use custom_css only for style attributes that ARE NOT SUPPORTED via the style schema.
|
|
46
|
+
|
|
47
|
+
# DESIGN VECTORS - Concrete Implementation Guidance
|
|
48
|
+
|
|
49
|
+
## 1. Typography & Visual Hierarchy
|
|
50
|
+
|
|
51
|
+
**Avoid Distributional Defaults:**
|
|
52
|
+
- NO generic sans-serifs as primary typefaces (Inter, Roboto, Arial, Helvetica)
|
|
53
|
+
- NO timid size ratios (1.2x, 1.5x scaling)
|
|
54
|
+
- NO uniform font weights (everything at 400 or 600)
|
|
55
|
+
|
|
56
|
+
**Intentional Alternatives:**
|
|
57
|
+
- **For Technical/Modern**: Consider monospace headlines (JetBrains Mono, SF Mono) paired with clean body text
|
|
58
|
+
- **For Editorial/Elegant**: Consider serif headlines (Playfair Display, Crimson Text) with sans-serif body
|
|
59
|
+
- **For Playful/Creative**: Consider display fonts with character, paired with highly legible body text
|
|
60
|
+
|
|
61
|
+
**Scale & Contrast Implementation:**
|
|
62
|
+
- Headline-to-body size ratios: 3x minimum (e.g., 48px headline vs 16px body)
|
|
63
|
+
- Use extreme weight contrasts: pair weight-100 or 200 with weight-800 or 900
|
|
64
|
+
- Line height contrasts: tight headlines (1.1) vs. generous body (1.7)
|
|
65
|
+
- Letter spacing: compressed headlines (-0.02em to -0.05em) vs. open small text (0.03em+)
|
|
66
|
+
|
|
67
|
+
**Hierarchy Mapping:**
|
|
68
|
+
/* Intentional hierarchy example */
|
|
69
|
+
H1: font-size: 3.5rem; font-weight: 900; line-height: 1.1; letter-spacing: -0.03em;
|
|
70
|
+
H2: font-size: 2rem; font-weight: 200; line-height: 1.2;
|
|
71
|
+
Body: font-size: 1rem; font-weight: 400; line-height: 1.7;
|
|
72
|
+
Caption: font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
|
|
73
|
+
|
|
74
|
+
## 2. Color & Theme Strategy
|
|
75
|
+
|
|
76
|
+
**Avoid Distributional Defaults:**
|
|
77
|
+
- NO purple gradients or blue-purple color schemes (massively overrepresented in AI output)
|
|
78
|
+
- NO evenly-distributed color palettes (3-4 colors used equally)
|
|
79
|
+
- NO timid pastels or all-neutral schemes
|
|
80
|
+
- NO #333333, #666666, #999999 grays
|
|
81
|
+
|
|
82
|
+
**Intentional Alternatives:**
|
|
83
|
+
- **Commit to a Dominant Color**: Choose ONE primary brand color that appears in 60-70% of colored elements
|
|
84
|
+
- **Sharp Accent Strategy**: Use 1-2 high-contrast accent colors sparingly (10-15% of colored elements)
|
|
85
|
+
- **Neutrals with Personality**: Replace pure grays with warm (#3d3228, #f5f1ed) or cool (#2a2f3d, #f0f2f5) tinted neutrals
|
|
86
|
+
|
|
87
|
+
**Color Psychology Mapping:**
|
|
88
|
+
- Energy/Action → Warm reds, oranges, yellows (NOT purple/blue)
|
|
89
|
+
- Trust/Calm → Deep teals, forest greens (NOT generic blue)
|
|
90
|
+
- Luxury/Premium → Deep burgundy, emerald, charcoal with gold accents
|
|
91
|
+
- Playful/Creative → Unexpected combinations (coral + mint, mustard + navy)
|
|
92
|
+
|
|
93
|
+
**Implementation:**
|
|
94
|
+
/* Intentional color system example */
|
|
95
|
+
--brand-primary: #d84315; /* Dominant: Deep orange */
|
|
96
|
+
--brand-accent: #00bfa5; /* Accent: Teal (complementary) */
|
|
97
|
+
--neutral-dark: #2d2622; /* Warm dark brown, not #333 */
|
|
98
|
+
--neutral-light: #faf8f6; /* Warm off-white, not pure white */
|
|
99
|
+
--background: linear-gradient(135deg, #faf8f6 0%, #f0ebe6 100%); /* Subtle warmth */
|
|
100
|
+
|
|
101
|
+
## 3. Spatial Design & White Space
|
|
102
|
+
|
|
103
|
+
**Avoid Distributional Defaults:**
|
|
104
|
+
- NO uniform spacing (everything 16px or 24px)
|
|
105
|
+
- NO cramped layouts that maximize content density
|
|
106
|
+
- NO default container widths (1200px, 1440px)
|
|
107
|
+
|
|
108
|
+
**Intentional Alternatives:**
|
|
109
|
+
- **Breathing Room**: Use generous white space as a design element (80-120px vertical spacing between sections)
|
|
110
|
+
- **Asymmetric Spacing**: Vary padding dramatically (small: 12px, medium: 48px, large: 96px)
|
|
111
|
+
- **Content Width Strategy**:
|
|
112
|
+
- Reading content: max 65-75 characters (600-700px)
|
|
113
|
+
- Hero sections: asymmetric layouts, not centered blocks
|
|
114
|
+
- Cards/components: vary sizes intentionally, not uniform grids
|
|
115
|
+
|
|
116
|
+
**Implementation:**
|
|
117
|
+
/* Intentional spacing scale */
|
|
118
|
+
--space-xs: 0.5rem; /* 8px */
|
|
119
|
+
--space-sm: 1rem; /* 16px */
|
|
120
|
+
--space-md: 3rem; /* 48px */
|
|
121
|
+
--space-lg: 6rem; /* 96px */
|
|
122
|
+
--space-xl: 10rem; /* 160px */
|
|
123
|
+
|
|
124
|
+
/* Use in combinations: */
|
|
125
|
+
padding: var(--space-lg) var(--space-md); /* Not uniform padding */
|
|
126
|
+
margin-bottom: var(--space-xl); /* Generous section breaks */
|
|
127
|
+
|
|
128
|
+
## 4. Backgrounds & Atmospheric Depth
|
|
129
|
+
|
|
130
|
+
**Avoid Distributional Defaults:**
|
|
131
|
+
- NO solid white or light gray backgrounds
|
|
132
|
+
- NO single-color backgrounds
|
|
133
|
+
- NO generic gradient overlays
|
|
134
|
+
|
|
135
|
+
**Intentional Alternatives:**
|
|
136
|
+
- **Layered Gradients**: Combine 2-3 subtle gradients for depth
|
|
137
|
+
- **Geometric Patterns**: SVG patterns, mesh gradients, or subtle noise textures
|
|
138
|
+
- **Strategic Contrast**: Alternate between light and dark sections for rhythm
|
|
139
|
+
|
|
140
|
+
**Implementation:**
|
|
141
|
+
/* Intentional background example */
|
|
142
|
+
background:
|
|
143
|
+
radial-gradient(circle at 20% 30%, rgba(216, 67, 21, 0.08) 0%, transparent 50%),
|
|
144
|
+
radial-gradient(circle at 80% 70%, rgba(0, 191, 165, 0.06) 0%, transparent 50%),
|
|
145
|
+
linear-gradient(135deg, #faf8f6 0%, #f0ebe6 100%);
|
|
146
|
+
|
|
147
|
+
## 5. Visual Hierarchy Principles
|
|
148
|
+
|
|
149
|
+
**Clear Priority System:**
|
|
150
|
+
1. **Primary Focus (1 element)**: Largest, highest contrast, most visual weight
|
|
151
|
+
2. **Secondary Elements (2-3 elements)**: 40-60% of primary size, reduced contrast
|
|
152
|
+
3. **Tertiary/Support (everything else)**: Minimal visual weight, muted colors
|
|
153
|
+
|
|
154
|
+
**Contrast Techniques:**
|
|
155
|
+
- Size: 3x+ differences between hierarchy levels
|
|
156
|
+
- Weight: 300+ difference in font-weight values
|
|
157
|
+
- Color: Primary gets brand color, secondary gets neutral, tertiary gets muted
|
|
158
|
+
- Space: Primary gets 2x+ surrounding white space vs. secondary
|
|
159
|
+
|
|
160
|
+
## 6. EXAMPLES - Intentional vs. Generic Design
|
|
161
|
+
|
|
162
|
+
### ❌ GENERIC (Distributional Convergence)
|
|
163
|
+
|
|
164
|
+
{
|
|
165
|
+
"xmlStructure": "<e-flexbox configuration-id=\"flex1\"><e-heading configuration-id=\"heading1\"></e-heading><e-button configuration-id=\"button1\"></e-button></e-flexbox>",
|
|
166
|
+
"elementConfig": {
|
|
167
|
+
"heading1": {
|
|
168
|
+
"title": { "$$type": "string", "value": "Welcome to Our Site" }
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"stylesConfig": {
|
|
172
|
+
"heading1": {
|
|
173
|
+
"font-size": {
|
|
174
|
+
"$$type": "size",
|
|
175
|
+
"value": {
|
|
176
|
+
"size": { "$$type": "number", "value": 24 },
|
|
177
|
+
"unit": { "$$type": "string", "value": "px" }
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
"button1": {
|
|
182
|
+
"custom_css": "background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 12px 24px;"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
**Why Generic**: 24px default size, #333 safe gray, 600 weight (middle-ground), purple gradient (AI cliché), uniform 12/24px padding
|
|
188
|
+
|
|
189
|
+
### ✅ INTENTIONAL (Resisting Convergence)
|
|
190
|
+
{
|
|
191
|
+
"xmlStructure": "<e-flexbox configuration-id=\"hero-section\"><e-heading configuration-id=\"hero-title\"></e-heading><e-text configuration-id=\"hero-subtitle\"></e-text><e-button configuration-id=\"hero-cta\"></e-button></e-flexbox>",
|
|
192
|
+
"elementConfig": {
|
|
193
|
+
"hero-title": {
|
|
194
|
+
"title": { "$$type": "string", "value": "Transform Your Workflow" }
|
|
195
|
+
},
|
|
196
|
+
"hero-subtitle": {
|
|
197
|
+
"content": { "$$type": "string", "value": "Built for teams who refuse to compromise on quality" }
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
"stylesConfig": {
|
|
201
|
+
"hero-section": {
|
|
202
|
+
"custom_css": "display: flex; flex-direction: column; align-items: flex-start; gap: 3rem; background: radial-gradient(circle at 30% 20%, rgba(216, 67, 21, 0.1) 0%, transparent 60%), linear-gradient(135deg, #faf8f6 0%, #f0ebe6 100%); padding: 10rem 3rem;"
|
|
203
|
+
},
|
|
204
|
+
"hero-title": {
|
|
205
|
+
"custom_css": "font-size: 4.5rem; font-weight: 900; line-height: 1.05; letter-spacing: -0.04em; color: #2d2622; max-width: 700px;"
|
|
206
|
+
},
|
|
207
|
+
"hero-subtitle": {
|
|
208
|
+
"custom_css": "font-size: 1.25rem; font-weight: 200; line-height: 1.7; letter-spacing: 0.01em; color: #5a534d; max-width: 600px;"
|
|
209
|
+
},
|
|
210
|
+
"hero-cta": {
|
|
211
|
+
"custom_css": "background: #d84315; color: #ffffff; padding: 1.25rem 3rem; font-size: 1rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; border-radius: 2px; box-shadow: 0 4px 16px rgba(216, 67, 21, 0.25); transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;"
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
**Why Intentional**:
|
|
218
|
+
- Typography: 4.5rem headline (3.6x body), weight 900 vs 200 contrast, tight leading
|
|
219
|
+
- Color: Warm orange primary (#d84315), warm neutrals (#2d2622, #5a534d) NOT #333/#666
|
|
220
|
+
- Spacing: 10rem vertical padding (generous), 3rem gap, asymmetric alignment
|
|
221
|
+
- Background: Layered gradients with subtle brand color accent
|
|
53
222
|
|
|
54
223
|
# CONSTRAINTS
|
|
55
224
|
When a tool execution fails, retry up to 10 more times, read the error message carefully, and adjust the XML structure or the configurations accordingly.
|
|
@@ -60,6 +229,28 @@ NO LINKS ALLOWED. Never apply links to elements, even if they appear in the Prop
|
|
|
60
229
|
elementConfig values must align with the widget's PropType schema, available at the resource [${ WIDGET_SCHEMA_URI }].
|
|
61
230
|
stylesConfig values must align with the common styles PropType schema, available at the resource [${ STYLE_SCHEMA_URI }].
|
|
62
231
|
|
|
232
|
+
# DESIGN QUALITY CONSTRAINTS
|
|
233
|
+
|
|
234
|
+
**Typography Constraints:**
|
|
235
|
+
- NEVER use Inter, Roboto, Arial, or Helvetica as primary display fonts
|
|
236
|
+
- NEVER use font-size ratios smaller than 2.5x between headlines and body
|
|
237
|
+
- NEVER use font-weight values between 500-700 for headlines (go lighter or heavier)
|
|
238
|
+
|
|
239
|
+
**Color Constraints:**
|
|
240
|
+
- NEVER use purple gradients or blue-purple color schemes
|
|
241
|
+
- NEVER use pure grays (#333, #666, #999) - use tinted neutrals instead
|
|
242
|
+
- NEVER distribute colors evenly - commit to ONE dominant color
|
|
243
|
+
- NEVER use more than 3 core colors (1 dominant, 1-2 accents)
|
|
244
|
+
|
|
245
|
+
**Spacing Constraints:**
|
|
246
|
+
- NEVER use uniform spacing across all elements
|
|
247
|
+
- NEVER use section padding less than 4rem (64px) for hero/major sections
|
|
248
|
+
- NEVER center everything - use asymmetric layouts for visual interest
|
|
249
|
+
|
|
250
|
+
**Background Constraints:**
|
|
251
|
+
- NEVER use solid white (#ffffff) or light gray (#f5f5f5) backgrounds without texture/gradients
|
|
252
|
+
- ALWAYS layer at least 2 gradient or color elements for atmospheric depth
|
|
253
|
+
|
|
63
254
|
# Parameters
|
|
64
255
|
All parameters are MANDATORY.
|
|
65
256
|
- xmlStructure
|
|
@@ -68,6 +259,14 @@ All parameters are MANDATORY.
|
|
|
68
259
|
|
|
69
260
|
If unsure about the configuration of a specific property, read the schema resources carefully.
|
|
70
261
|
|
|
262
|
+
# About our widgets
|
|
263
|
+
Most widgets are self-explanatory by their name. Here is some additional information.
|
|
264
|
+
SVG elements are bound to internal content upload. Avoid usage, unless you have tools to upload SVG content.
|
|
265
|
+
e-div-block - By default is ceneterd aligned and vertically stacked. To modify this, apply style configuration.
|
|
266
|
+
e-flexbox - By default is a flex container with row direction. To modify this, apply style configuration.
|
|
267
|
+
|
|
268
|
+
When working with containers, do not forget to apply style schema for controlling the layout.
|
|
269
|
+
|
|
71
270
|
|
|
72
271
|
` );
|
|
73
272
|
|
|
@@ -83,6 +282,9 @@ A Heading and a button inside a flexbox
|
|
|
83
282
|
},
|
|
84
283
|
},
|
|
85
284
|
stylesConfig: {
|
|
285
|
+
"flex1": {
|
|
286
|
+
"custom_css": "background: radial-gradient(circle at 20% 30%, rgba(216, 67, 21, 0.08) 0%, transparent 50%), radial-gradient(circle at 80% 70%, rgba(0, 191, 165, 0.06) 0%, transparent 50%), linear-gradient(135deg, #faf8f6 0%, #f0ebe6 100%); display: flex; flex-direction: column; align-items: center; padding: 80px 32px; gap: 48px;"
|
|
287
|
+
},
|
|
86
288
|
"heading1": {
|
|
87
289
|
"font-size": {
|
|
88
290
|
"$$type": "size",
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import { z } from '@elementor/schema';
|
|
2
2
|
|
|
3
|
-
import { STYLE_SCHEMA_URI } from '../../resources/widgets-schema-resource';
|
|
3
|
+
import { STYLE_SCHEMA_URI, WIDGET_SCHEMA_URI } from '../../resources/widgets-schema-resource';
|
|
4
4
|
|
|
5
5
|
export const inputSchema = {
|
|
6
6
|
xmlStructure: z.string().describe( 'The XML structure representing the composition to be built' ),
|
|
7
7
|
elementConfig: z
|
|
8
8
|
.record(
|
|
9
9
|
z.string().describe( 'The configuration id' ),
|
|
10
|
-
z.record(
|
|
10
|
+
z.record(
|
|
11
|
+
z.string().describe( 'property name' ),
|
|
12
|
+
z.any().describe( `The PropValue for the property, refer to ${ WIDGET_SCHEMA_URI }` )
|
|
13
|
+
)
|
|
11
14
|
)
|
|
12
15
|
.describe( 'A record mapping element IDs to their configuration objects. REQUIRED' ),
|
|
13
16
|
stylesConfig: z
|
|
14
17
|
.record(
|
|
15
18
|
z.string().describe( 'The configuration id' ),
|
|
16
19
|
z.record(
|
|
17
|
-
z.string().describe( '
|
|
18
|
-
z.any().describe(
|
|
20
|
+
z.string().describe( 'StyleSchema property name' ),
|
|
21
|
+
z.any().describe( `The PropValue for the style property. MANDATORY, refer to [${ STYLE_SCHEMA_URI }]` )
|
|
19
22
|
)
|
|
20
23
|
)
|
|
21
24
|
.describe(
|