@elementor/editor-canvas 3.35.0-397 → 3.35.0-399
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 +22 -49
- package/dist/index.mjs +22 -49
- package/package.json +18 -18
- package/src/mcp/mcp-description.ts +0 -5
- package/src/mcp/resources/widgets-schema-resource.ts +5 -32
- package/src/mcp/tools/build-composition/prompt.ts +15 -17
- package/src/mcp/tools/build-composition/schema.ts +1 -1
- package/src/mcp/utils/validate-input.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -98,14 +98,6 @@ var import_editor_styles = require("@elementor/editor-styles");
|
|
|
98
98
|
var WIDGET_SCHEMA_URI = "elementor://widgets/schema/{widgetType}";
|
|
99
99
|
var STYLE_SCHEMA_URI = "elementor://styles/schema/{category}";
|
|
100
100
|
var BEST_PRACTICES_URI = "elementor://styles/best-practices";
|
|
101
|
-
var checkIfUserHasPro = () => {
|
|
102
|
-
const extendedWindow = window;
|
|
103
|
-
const hasPro = extendedWindow.elementor?.helpers?.hasPro;
|
|
104
|
-
if (typeof hasPro === "function") {
|
|
105
|
-
return hasPro();
|
|
106
|
-
}
|
|
107
|
-
return false;
|
|
108
|
-
};
|
|
109
101
|
var initWidgetsSchemaResource = (reg) => {
|
|
110
102
|
const { mcpServer } = reg;
|
|
111
103
|
mcpServer.resource("styles-best-practices", BEST_PRACTICES_URI, async () => {
|
|
@@ -115,9 +107,9 @@ var initWidgetsSchemaResource = (reg) => {
|
|
|
115
107
|
uri: BEST_PRACTICES_URI,
|
|
116
108
|
text: `# Styling best practices
|
|
117
109
|
Prefer using "em" and "rem" values for text-related sizes, padding and spacing. Use percentages for dynamic sizing relative to parent containers.
|
|
118
|
-
This flexboxes are by default "flex" with "stretch" alignment. To ensure proper layout, define the "justify-content" and "align-items" as in the schema
|
|
110
|
+
This flexboxes are by default "flex" with "stretch" alignment. To ensure proper layout, define the "justify-content" and "align-items" as in the schema.
|
|
119
111
|
|
|
120
|
-
When applicable for styles, apply style PropValues using the ${STYLE_SCHEMA_URI}.
|
|
112
|
+
When applicable for styles, apply style PropValues using the ${STYLE_SCHEMA_URI}.
|
|
121
113
|
The css string must follow standard CSS syntax, with properties and values separated by semicolons, no selectors, or nesting rules allowed.`
|
|
122
114
|
}
|
|
123
115
|
]
|
|
@@ -127,11 +119,7 @@ The css string must follow standard CSS syntax, with properties and values separ
|
|
|
127
119
|
"styles-schema",
|
|
128
120
|
new import_editor_mcp.ResourceTemplate(STYLE_SCHEMA_URI, {
|
|
129
121
|
list: () => {
|
|
130
|
-
const isPro = checkIfUserHasPro();
|
|
131
122
|
const categories = [...Object.keys((0, import_editor_styles.getStylesSchema)())];
|
|
132
|
-
if (!isPro) {
|
|
133
|
-
categories.push("custom_css");
|
|
134
|
-
}
|
|
135
123
|
return {
|
|
136
124
|
resources: categories.map((category) => ({
|
|
137
125
|
uri: `elementor://styles/schema/${category}`,
|
|
@@ -145,16 +133,6 @@ The css string must follow standard CSS syntax, with properties and values separ
|
|
|
145
133
|
},
|
|
146
134
|
async (uri, variables) => {
|
|
147
135
|
const category = typeof variables.category === "string" ? variables.category : variables.category?.[0];
|
|
148
|
-
if (category === "custom_css" && checkIfUserHasPro()) {
|
|
149
|
-
return {
|
|
150
|
-
contents: [
|
|
151
|
-
{
|
|
152
|
-
uri: uri.toString(),
|
|
153
|
-
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"
|
|
154
|
-
}
|
|
155
|
-
]
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
136
|
const stylesSchema = (0, import_editor_styles.getStylesSchema)()[category];
|
|
159
137
|
if (!stylesSchema) {
|
|
160
138
|
throw new Error(`No styles schema found for category: ${category}`);
|
|
@@ -165,7 +143,9 @@ The css string must follow standard CSS syntax, with properties and values separ
|
|
|
165
143
|
{
|
|
166
144
|
uri: uri.toString(),
|
|
167
145
|
mimeType: "application/json",
|
|
168
|
-
text: JSON.stringify(
|
|
146
|
+
text: JSON.stringify(
|
|
147
|
+
import_editor_props.Schema.enrichWithIntention(asJson, 'Desired CSS in format "property: value;"')
|
|
148
|
+
)
|
|
169
149
|
}
|
|
170
150
|
]
|
|
171
151
|
};
|
|
@@ -2229,7 +2209,7 @@ var validateInput = {
|
|
|
2229
2209
|
validateStyles(values) {
|
|
2230
2210
|
const styleSchema = (0, import_editor_styles6.getStylesSchema)();
|
|
2231
2211
|
const customCssValue = values.custom_css;
|
|
2232
|
-
const result = this.validateProps(styleSchema, values, ["custom_css"]);
|
|
2212
|
+
const result = this.validateProps(styleSchema, values, ["custom_css", "$intention"]);
|
|
2233
2213
|
const appendInvalidCustomCssErr = () => {
|
|
2234
2214
|
result.valid = false;
|
|
2235
2215
|
result.errors = result.errors || [];
|
|
@@ -2310,9 +2290,6 @@ Prefer this tool over any other tool for building HTML structure, unless you are
|
|
|
2310
2290
|
Layout properties, such as margin, padding, align, etc. must be applied using the [${STYLE_SCHEMA_URI}] PropValues.
|
|
2311
2291
|
7. Some elements allow nesting of other elements, and most of the DO NOT. The allowed elements that can have nested children are "e-tabs", "e-div-block", and "e-flexbox".
|
|
2312
2292
|
8. Make sure that non-container elements do NOT have any nested elements.
|
|
2313
|
-
9. **CRITICAL - CUSTOM CSS USAGE**: ALWAYS Prefer using style schema. Custom CSS is ONLY FOR UNSUPPRTED schema styles.
|
|
2314
|
-
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.
|
|
2315
|
-
Use custom_css only for style attributes that ARE NOT SUPPORTED via the style schema AFTER YOU CHECK THE [${STYLE_SCHEMA_URI}].
|
|
2316
2293
|
|
|
2317
2294
|
# DESIGN VECTORS - Concrete Implementation Guidance
|
|
2318
2295
|
|
|
@@ -2447,9 +2424,6 @@ background:
|
|
|
2447
2424
|
"unit": { "$$type": "string", "value": "px" }
|
|
2448
2425
|
}
|
|
2449
2426
|
},
|
|
2450
|
-
},
|
|
2451
|
-
"button1": {
|
|
2452
|
-
"custom_css": "background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 12px 24px;"
|
|
2453
2427
|
}
|
|
2454
2428
|
}
|
|
2455
2429
|
}
|
|
@@ -2469,16 +2443,23 @@ background:
|
|
|
2469
2443
|
},
|
|
2470
2444
|
"stylesConfig": {
|
|
2471
2445
|
"hero-section": {
|
|
2472
|
-
"
|
|
2446
|
+
"display": { "$$type": "string", "value": "flex" },
|
|
2447
|
+
"flex-direction": { "$$type": "string", "value": "column" },
|
|
2448
|
+
"align-items": { "$$type": "string", "value": "flex-start" },
|
|
2449
|
+
"background": {
|
|
2450
|
+
"$$type": "color",
|
|
2451
|
+
"value": "#f0ebe6",
|
|
2452
|
+
"$intention": "background: #f0ebe6",
|
|
2453
|
+
}
|
|
2473
2454
|
},
|
|
2474
2455
|
"hero-title": {
|
|
2475
|
-
"
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2456
|
+
"font-size": {
|
|
2457
|
+
"$$type": "size",
|
|
2458
|
+
"value": {
|
|
2459
|
+
"size": { "$$type": "number", "value": 72 },
|
|
2460
|
+
"unit": { "$$type": "string", "value": "px" }
|
|
2461
|
+
}
|
|
2462
|
+
},
|
|
2482
2463
|
}
|
|
2483
2464
|
}
|
|
2484
2465
|
}
|
|
@@ -2549,9 +2530,6 @@ A Heading and a button inside a flexbox
|
|
|
2549
2530
|
},
|
|
2550
2531
|
},
|
|
2551
2532
|
stylesConfig: {
|
|
2552
|
-
"flex1": {
|
|
2553
|
-
"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;"
|
|
2554
|
-
},
|
|
2555
2533
|
"heading1": {
|
|
2556
2534
|
"font-size": {
|
|
2557
2535
|
"$$type": "size",
|
|
@@ -2604,7 +2582,7 @@ var inputSchema = {
|
|
|
2604
2582
|
stylesConfig: import_schema.z.record(
|
|
2605
2583
|
import_schema.z.string().describe("The configuration id"),
|
|
2606
2584
|
import_schema.z.record(
|
|
2607
|
-
import_schema.z.string().describe("StyleSchema property name
|
|
2585
|
+
import_schema.z.string().describe("StyleSchema property name"),
|
|
2608
2586
|
import_schema.z.any().describe(`The PropValue for the style property. MANDATORY, refer to [${STYLE_SCHEMA_URI}]`)
|
|
2609
2587
|
)
|
|
2610
2588
|
).describe(
|
|
@@ -3151,8 +3129,6 @@ The tool accepts both the structure, the styling and the configuration of each e
|
|
|
3151
3129
|
- Second step: decide which elements to create, and their configuration and styles.
|
|
3152
3130
|
Retrieve the used elements configuration schema from the resource [${ELEMENT_SCHEMA_URI}]
|
|
3153
3131
|
- 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.
|
|
3154
|
-
For background and complicated layered styles, you can use "custom_css" property, which is supported only for ELEMENTOR PRO users ONLY.
|
|
3155
|
-
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.
|
|
3156
3132
|
|
|
3157
3133
|
## Workflow for build-compositions tool
|
|
3158
3134
|
1. **Parse user requirements** - Undestand what needs to be built (structure, content, styling).
|
|
@@ -3174,10 +3150,7 @@ The tool accepts both the structure, the styling and the configuration of each e
|
|
|
3174
3150
|
|
|
3175
3151
|
6. **Create stylesConfig** - For each configuration-id:
|
|
3176
3152
|
- Use style schema PropValues from [${STYLE_SCHEMA_URI}]
|
|
3177
|
-
- **Priority**: Use style schema PropValues over custom_css
|
|
3178
3153
|
- **Use global variables** for colors, sizes, fonts where applicable
|
|
3179
|
-
- **custom_css (PRO Users Only)**: The property appears only for PRO user. The purpose of custom_css is to support new CSS features not yet available in the style schema.
|
|
3180
|
-
The schema supports multiple layers of background, gradients, filters. Prefer NOT USING custom_css.
|
|
3181
3154
|
- **Important**: Global classes are applied AFTER building the composition. Once built, apply classes using the "apply-global-class" tool - after completion of building the composition.
|
|
3182
3155
|
|
|
3183
3156
|
7. **Validate** - Ensure:
|
package/dist/index.mjs
CHANGED
|
@@ -47,14 +47,6 @@ import { getStylesSchema } from "@elementor/editor-styles";
|
|
|
47
47
|
var WIDGET_SCHEMA_URI = "elementor://widgets/schema/{widgetType}";
|
|
48
48
|
var STYLE_SCHEMA_URI = "elementor://styles/schema/{category}";
|
|
49
49
|
var BEST_PRACTICES_URI = "elementor://styles/best-practices";
|
|
50
|
-
var checkIfUserHasPro = () => {
|
|
51
|
-
const extendedWindow = window;
|
|
52
|
-
const hasPro = extendedWindow.elementor?.helpers?.hasPro;
|
|
53
|
-
if (typeof hasPro === "function") {
|
|
54
|
-
return hasPro();
|
|
55
|
-
}
|
|
56
|
-
return false;
|
|
57
|
-
};
|
|
58
50
|
var initWidgetsSchemaResource = (reg) => {
|
|
59
51
|
const { mcpServer } = reg;
|
|
60
52
|
mcpServer.resource("styles-best-practices", BEST_PRACTICES_URI, async () => {
|
|
@@ -64,9 +56,9 @@ var initWidgetsSchemaResource = (reg) => {
|
|
|
64
56
|
uri: BEST_PRACTICES_URI,
|
|
65
57
|
text: `# Styling best practices
|
|
66
58
|
Prefer using "em" and "rem" values for text-related sizes, padding and spacing. Use percentages for dynamic sizing relative to parent containers.
|
|
67
|
-
This flexboxes are by default "flex" with "stretch" alignment. To ensure proper layout, define the "justify-content" and "align-items" as in the schema
|
|
59
|
+
This flexboxes are by default "flex" with "stretch" alignment. To ensure proper layout, define the "justify-content" and "align-items" as in the schema.
|
|
68
60
|
|
|
69
|
-
When applicable for styles, apply style PropValues using the ${STYLE_SCHEMA_URI}.
|
|
61
|
+
When applicable for styles, apply style PropValues using the ${STYLE_SCHEMA_URI}.
|
|
70
62
|
The css string must follow standard CSS syntax, with properties and values separated by semicolons, no selectors, or nesting rules allowed.`
|
|
71
63
|
}
|
|
72
64
|
]
|
|
@@ -76,11 +68,7 @@ The css string must follow standard CSS syntax, with properties and values separ
|
|
|
76
68
|
"styles-schema",
|
|
77
69
|
new ResourceTemplate(STYLE_SCHEMA_URI, {
|
|
78
70
|
list: () => {
|
|
79
|
-
const isPro = checkIfUserHasPro();
|
|
80
71
|
const categories = [...Object.keys(getStylesSchema())];
|
|
81
|
-
if (!isPro) {
|
|
82
|
-
categories.push("custom_css");
|
|
83
|
-
}
|
|
84
72
|
return {
|
|
85
73
|
resources: categories.map((category) => ({
|
|
86
74
|
uri: `elementor://styles/schema/${category}`,
|
|
@@ -94,16 +82,6 @@ The css string must follow standard CSS syntax, with properties and values separ
|
|
|
94
82
|
},
|
|
95
83
|
async (uri, variables) => {
|
|
96
84
|
const category = typeof variables.category === "string" ? variables.category : variables.category?.[0];
|
|
97
|
-
if (category === "custom_css" && checkIfUserHasPro()) {
|
|
98
|
-
return {
|
|
99
|
-
contents: [
|
|
100
|
-
{
|
|
101
|
-
uri: uri.toString(),
|
|
102
|
-
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"
|
|
103
|
-
}
|
|
104
|
-
]
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
85
|
const stylesSchema = getStylesSchema()[category];
|
|
108
86
|
if (!stylesSchema) {
|
|
109
87
|
throw new Error(`No styles schema found for category: ${category}`);
|
|
@@ -114,7 +92,9 @@ The css string must follow standard CSS syntax, with properties and values separ
|
|
|
114
92
|
{
|
|
115
93
|
uri: uri.toString(),
|
|
116
94
|
mimeType: "application/json",
|
|
117
|
-
text: JSON.stringify(
|
|
95
|
+
text: JSON.stringify(
|
|
96
|
+
Schema.enrichWithIntention(asJson, 'Desired CSS in format "property: value;"')
|
|
97
|
+
)
|
|
118
98
|
}
|
|
119
99
|
]
|
|
120
100
|
};
|
|
@@ -2203,7 +2183,7 @@ var validateInput = {
|
|
|
2203
2183
|
validateStyles(values) {
|
|
2204
2184
|
const styleSchema = getStylesSchema4();
|
|
2205
2185
|
const customCssValue = values.custom_css;
|
|
2206
|
-
const result = this.validateProps(styleSchema, values, ["custom_css"]);
|
|
2186
|
+
const result = this.validateProps(styleSchema, values, ["custom_css", "$intention"]);
|
|
2207
2187
|
const appendInvalidCustomCssErr = () => {
|
|
2208
2188
|
result.valid = false;
|
|
2209
2189
|
result.errors = result.errors || [];
|
|
@@ -2284,9 +2264,6 @@ Prefer this tool over any other tool for building HTML structure, unless you are
|
|
|
2284
2264
|
Layout properties, such as margin, padding, align, etc. must be applied using the [${STYLE_SCHEMA_URI}] PropValues.
|
|
2285
2265
|
7. Some elements allow nesting of other elements, and most of the DO NOT. The allowed elements that can have nested children are "e-tabs", "e-div-block", and "e-flexbox".
|
|
2286
2266
|
8. Make sure that non-container elements do NOT have any nested elements.
|
|
2287
|
-
9. **CRITICAL - CUSTOM CSS USAGE**: ALWAYS Prefer using style schema. Custom CSS is ONLY FOR UNSUPPRTED schema styles.
|
|
2288
|
-
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.
|
|
2289
|
-
Use custom_css only for style attributes that ARE NOT SUPPORTED via the style schema AFTER YOU CHECK THE [${STYLE_SCHEMA_URI}].
|
|
2290
2267
|
|
|
2291
2268
|
# DESIGN VECTORS - Concrete Implementation Guidance
|
|
2292
2269
|
|
|
@@ -2421,9 +2398,6 @@ background:
|
|
|
2421
2398
|
"unit": { "$$type": "string", "value": "px" }
|
|
2422
2399
|
}
|
|
2423
2400
|
},
|
|
2424
|
-
},
|
|
2425
|
-
"button1": {
|
|
2426
|
-
"custom_css": "background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 12px 24px;"
|
|
2427
2401
|
}
|
|
2428
2402
|
}
|
|
2429
2403
|
}
|
|
@@ -2443,16 +2417,23 @@ background:
|
|
|
2443
2417
|
},
|
|
2444
2418
|
"stylesConfig": {
|
|
2445
2419
|
"hero-section": {
|
|
2446
|
-
"
|
|
2420
|
+
"display": { "$$type": "string", "value": "flex" },
|
|
2421
|
+
"flex-direction": { "$$type": "string", "value": "column" },
|
|
2422
|
+
"align-items": { "$$type": "string", "value": "flex-start" },
|
|
2423
|
+
"background": {
|
|
2424
|
+
"$$type": "color",
|
|
2425
|
+
"value": "#f0ebe6",
|
|
2426
|
+
"$intention": "background: #f0ebe6",
|
|
2427
|
+
}
|
|
2447
2428
|
},
|
|
2448
2429
|
"hero-title": {
|
|
2449
|
-
"
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2430
|
+
"font-size": {
|
|
2431
|
+
"$$type": "size",
|
|
2432
|
+
"value": {
|
|
2433
|
+
"size": { "$$type": "number", "value": 72 },
|
|
2434
|
+
"unit": { "$$type": "string", "value": "px" }
|
|
2435
|
+
}
|
|
2436
|
+
},
|
|
2456
2437
|
}
|
|
2457
2438
|
}
|
|
2458
2439
|
}
|
|
@@ -2523,9 +2504,6 @@ A Heading and a button inside a flexbox
|
|
|
2523
2504
|
},
|
|
2524
2505
|
},
|
|
2525
2506
|
stylesConfig: {
|
|
2526
|
-
"flex1": {
|
|
2527
|
-
"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;"
|
|
2528
|
-
},
|
|
2529
2507
|
"heading1": {
|
|
2530
2508
|
"font-size": {
|
|
2531
2509
|
"$$type": "size",
|
|
@@ -2578,7 +2556,7 @@ var inputSchema = {
|
|
|
2578
2556
|
stylesConfig: z.record(
|
|
2579
2557
|
z.string().describe("The configuration id"),
|
|
2580
2558
|
z.record(
|
|
2581
|
-
z.string().describe("StyleSchema property name
|
|
2559
|
+
z.string().describe("StyleSchema property name"),
|
|
2582
2560
|
z.any().describe(`The PropValue for the style property. MANDATORY, refer to [${STYLE_SCHEMA_URI}]`)
|
|
2583
2561
|
)
|
|
2584
2562
|
).describe(
|
|
@@ -3125,8 +3103,6 @@ The tool accepts both the structure, the styling and the configuration of each e
|
|
|
3125
3103
|
- Second step: decide which elements to create, and their configuration and styles.
|
|
3126
3104
|
Retrieve the used elements configuration schema from the resource [${ELEMENT_SCHEMA_URI}]
|
|
3127
3105
|
- 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.
|
|
3128
|
-
For background and complicated layered styles, you can use "custom_css" property, which is supported only for ELEMENTOR PRO users ONLY.
|
|
3129
|
-
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.
|
|
3130
3106
|
|
|
3131
3107
|
## Workflow for build-compositions tool
|
|
3132
3108
|
1. **Parse user requirements** - Undestand what needs to be built (structure, content, styling).
|
|
@@ -3148,10 +3124,7 @@ The tool accepts both the structure, the styling and the configuration of each e
|
|
|
3148
3124
|
|
|
3149
3125
|
6. **Create stylesConfig** - For each configuration-id:
|
|
3150
3126
|
- Use style schema PropValues from [${STYLE_SCHEMA_URI}]
|
|
3151
|
-
- **Priority**: Use style schema PropValues over custom_css
|
|
3152
3127
|
- **Use global variables** for colors, sizes, fonts where applicable
|
|
3153
|
-
- **custom_css (PRO Users Only)**: The property appears only for PRO user. The purpose of custom_css is to support new CSS features not yet available in the style schema.
|
|
3154
|
-
The schema supports multiple layers of background, gradients, filters. Prefer NOT USING custom_css.
|
|
3155
3128
|
- **Important**: Global classes are applied AFTER building the composition. Once built, apply classes using the "apply-global-class" tool - after completion of building the composition.
|
|
3156
3129
|
|
|
3157
3130
|
7. **Validate** - Ensure:
|
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-399",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -37,24 +37,24 @@
|
|
|
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-mcp": "3.35.0-
|
|
46
|
-
"@elementor/editor-notifications": "3.35.0-
|
|
47
|
-
"@elementor/editor-props": "3.35.0-
|
|
48
|
-
"@elementor/editor-responsive": "3.35.0-
|
|
49
|
-
"@elementor/editor-styles": "3.35.0-
|
|
50
|
-
"@elementor/editor-styles-repository": "3.35.0-
|
|
51
|
-
"@elementor/editor-ui": "3.35.0-
|
|
52
|
-
"@elementor/editor-v1-adapters": "3.35.0-
|
|
53
|
-
"@elementor/schema": "3.35.0-
|
|
54
|
-
"@elementor/twing": "3.35.0-
|
|
40
|
+
"@elementor/editor": "3.35.0-399",
|
|
41
|
+
"@elementor/editor-controls": "3.35.0-399",
|
|
42
|
+
"@elementor/editor-documents": "3.35.0-399",
|
|
43
|
+
"@elementor/editor-elements": "3.35.0-399",
|
|
44
|
+
"@elementor/editor-interactions": "3.35.0-399",
|
|
45
|
+
"@elementor/editor-mcp": "3.35.0-399",
|
|
46
|
+
"@elementor/editor-notifications": "3.35.0-399",
|
|
47
|
+
"@elementor/editor-props": "3.35.0-399",
|
|
48
|
+
"@elementor/editor-responsive": "3.35.0-399",
|
|
49
|
+
"@elementor/editor-styles": "3.35.0-399",
|
|
50
|
+
"@elementor/editor-styles-repository": "3.35.0-399",
|
|
51
|
+
"@elementor/editor-ui": "3.35.0-399",
|
|
52
|
+
"@elementor/editor-v1-adapters": "3.35.0-399",
|
|
53
|
+
"@elementor/schema": "3.35.0-399",
|
|
54
|
+
"@elementor/twing": "3.35.0-399",
|
|
55
55
|
"@elementor/ui": "1.36.17",
|
|
56
|
-
"@elementor/utils": "3.35.0-
|
|
57
|
-
"@elementor/wp-media": "3.35.0-
|
|
56
|
+
"@elementor/utils": "3.35.0-399",
|
|
57
|
+
"@elementor/wp-media": "3.35.0-399",
|
|
58
58
|
"@floating-ui/react": "^0.27.5",
|
|
59
59
|
"@wordpress/i18n": "^5.13.0"
|
|
60
60
|
},
|
|
@@ -39,8 +39,6 @@ The tool accepts both the structure, the styling and the configuration of each e
|
|
|
39
39
|
- Second step: decide which elements to create, and their configuration and styles.
|
|
40
40
|
Retrieve the used elements configuration schema from the resource [${ ELEMENT_SCHEMA_URI }]
|
|
41
41
|
- 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.
|
|
42
|
-
For background and complicated layered styles, you can use "custom_css" property, which is supported only for ELEMENTOR PRO users ONLY.
|
|
43
|
-
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.
|
|
44
42
|
|
|
45
43
|
## Workflow for build-compositions tool
|
|
46
44
|
1. **Parse user requirements** - Undestand what needs to be built (structure, content, styling).
|
|
@@ -62,10 +60,7 @@ The tool accepts both the structure, the styling and the configuration of each e
|
|
|
62
60
|
|
|
63
61
|
6. **Create stylesConfig** - For each configuration-id:
|
|
64
62
|
- Use style schema PropValues from [${ STYLE_SCHEMA_URI }]
|
|
65
|
-
- **Priority**: Use style schema PropValues over custom_css
|
|
66
63
|
- **Use global variables** for colors, sizes, fonts where applicable
|
|
67
|
-
- **custom_css (PRO Users Only)**: The property appears only for PRO user. The purpose of custom_css is to support new CSS features not yet available in the style schema.
|
|
68
|
-
The schema supports multiple layers of background, gradients, filters. Prefer NOT USING custom_css.
|
|
69
64
|
- **Important**: Global classes are applied AFTER building the composition. Once built, apply classes using the "apply-global-class" tool - after completion of building the composition.
|
|
70
65
|
|
|
71
66
|
7. **Validate** - Ensure:
|
|
@@ -15,21 +15,6 @@ export const WIDGET_SCHEMA_URI = 'elementor://widgets/schema/{widgetType}';
|
|
|
15
15
|
export const STYLE_SCHEMA_URI = 'elementor://styles/schema/{category}';
|
|
16
16
|
export const BEST_PRACTICES_URI = 'elementor://styles/best-practices';
|
|
17
17
|
|
|
18
|
-
const checkIfUserHasPro = () => {
|
|
19
|
-
const extendedWindow = window as Window & {
|
|
20
|
-
elementor?: {
|
|
21
|
-
helpers?: {
|
|
22
|
-
hasPro?: () => boolean;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
const hasPro = extendedWindow.elementor?.helpers?.hasPro;
|
|
27
|
-
if ( typeof hasPro === 'function' ) {
|
|
28
|
-
return hasPro();
|
|
29
|
-
}
|
|
30
|
-
return false;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
18
|
export const initWidgetsSchemaResource = ( reg: MCPRegistryEntry ) => {
|
|
34
19
|
const { mcpServer } = reg;
|
|
35
20
|
|
|
@@ -40,9 +25,9 @@ export const initWidgetsSchemaResource = ( reg: MCPRegistryEntry ) => {
|
|
|
40
25
|
uri: BEST_PRACTICES_URI,
|
|
41
26
|
text: `# Styling best practices
|
|
42
27
|
Prefer using "em" and "rem" values for text-related sizes, padding and spacing. Use percentages for dynamic sizing relative to parent containers.
|
|
43
|
-
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
|
+
This flexboxes are by default "flex" with "stretch" alignment. To ensure proper layout, define the "justify-content" and "align-items" as in the schema.
|
|
44
29
|
|
|
45
|
-
When applicable for styles, apply style PropValues using the ${ STYLE_SCHEMA_URI }.
|
|
30
|
+
When applicable for styles, apply style PropValues using the ${ STYLE_SCHEMA_URI }.
|
|
46
31
|
The css string must follow standard CSS syntax, with properties and values separated by semicolons, no selectors, or nesting rules allowed.`,
|
|
47
32
|
},
|
|
48
33
|
],
|
|
@@ -53,11 +38,7 @@ The css string must follow standard CSS syntax, with properties and values separ
|
|
|
53
38
|
'styles-schema',
|
|
54
39
|
new ResourceTemplate( STYLE_SCHEMA_URI, {
|
|
55
40
|
list: () => {
|
|
56
|
-
const isPro = checkIfUserHasPro();
|
|
57
41
|
const categories = [ ...Object.keys( getStylesSchema() ) ];
|
|
58
|
-
if ( ! isPro ) {
|
|
59
|
-
categories.push( 'custom_css' );
|
|
60
|
-
}
|
|
61
42
|
return {
|
|
62
43
|
resources: categories.map( ( category ) => ( {
|
|
63
44
|
uri: `elementor://styles/schema/${ category }`,
|
|
@@ -71,16 +52,6 @@ The css string must follow standard CSS syntax, with properties and values separ
|
|
|
71
52
|
},
|
|
72
53
|
async ( uri, variables ) => {
|
|
73
54
|
const category = typeof variables.category === 'string' ? variables.category : variables.category?.[ 0 ];
|
|
74
|
-
if ( category === 'custom_css' && checkIfUserHasPro() ) {
|
|
75
|
-
return {
|
|
76
|
-
contents: [
|
|
77
|
-
{
|
|
78
|
-
uri: uri.toString(),
|
|
79
|
-
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',
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
55
|
const stylesSchema = getStylesSchema()[ category ];
|
|
85
56
|
if ( ! stylesSchema ) {
|
|
86
57
|
throw new Error( `No styles schema found for category: ${ category }` );
|
|
@@ -91,7 +62,9 @@ The css string must follow standard CSS syntax, with properties and values separ
|
|
|
91
62
|
{
|
|
92
63
|
uri: uri.toString(),
|
|
93
64
|
mimeType: 'application/json',
|
|
94
|
-
text: JSON.stringify(
|
|
65
|
+
text: JSON.stringify(
|
|
66
|
+
Schema.enrichWithIntention( asJson, 'Desired CSS in format "property: value;"' )
|
|
67
|
+
),
|
|
95
68
|
},
|
|
96
69
|
],
|
|
97
70
|
};
|
|
@@ -58,9 +58,6 @@ Prefer this tool over any other tool for building HTML structure, unless you are
|
|
|
58
58
|
Layout properties, such as margin, padding, align, etc. must be applied using the [${ STYLE_SCHEMA_URI }] PropValues.
|
|
59
59
|
7. Some elements allow nesting of other elements, and most of the DO NOT. The allowed elements that can have nested children are "e-tabs", "e-div-block", and "e-flexbox".
|
|
60
60
|
8. Make sure that non-container elements do NOT have any nested elements.
|
|
61
|
-
9. **CRITICAL - CUSTOM CSS USAGE**: ALWAYS Prefer using style schema. Custom CSS is ONLY FOR UNSUPPRTED schema styles.
|
|
62
|
-
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.
|
|
63
|
-
Use custom_css only for style attributes that ARE NOT SUPPORTED via the style schema AFTER YOU CHECK THE [${ STYLE_SCHEMA_URI }].
|
|
64
61
|
|
|
65
62
|
# DESIGN VECTORS - Concrete Implementation Guidance
|
|
66
63
|
|
|
@@ -195,9 +192,6 @@ background:
|
|
|
195
192
|
"unit": { "$$type": "string", "value": "px" }
|
|
196
193
|
}
|
|
197
194
|
},
|
|
198
|
-
},
|
|
199
|
-
"button1": {
|
|
200
|
-
"custom_css": "background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 12px 24px;"
|
|
201
195
|
}
|
|
202
196
|
}
|
|
203
197
|
}
|
|
@@ -217,16 +211,23 @@ background:
|
|
|
217
211
|
},
|
|
218
212
|
"stylesConfig": {
|
|
219
213
|
"hero-section": {
|
|
220
|
-
"
|
|
214
|
+
"display": { "$$type": "string", "value": "flex" },
|
|
215
|
+
"flex-direction": { "$$type": "string", "value": "column" },
|
|
216
|
+
"align-items": { "$$type": "string", "value": "flex-start" },
|
|
217
|
+
"background": {
|
|
218
|
+
"$$type": "color",
|
|
219
|
+
"value": "#f0ebe6",
|
|
220
|
+
"$intention": "background: #f0ebe6",
|
|
221
|
+
}
|
|
221
222
|
},
|
|
222
223
|
"hero-title": {
|
|
223
|
-
"
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
224
|
+
"font-size": {
|
|
225
|
+
"$$type": "size",
|
|
226
|
+
"value": {
|
|
227
|
+
"size": { "$$type": "number", "value": 72 },
|
|
228
|
+
"unit": { "$$type": "string", "value": "px" }
|
|
229
|
+
}
|
|
230
|
+
},
|
|
230
231
|
}
|
|
231
232
|
}
|
|
232
233
|
}
|
|
@@ -298,9 +299,6 @@ A Heading and a button inside a flexbox
|
|
|
298
299
|
},
|
|
299
300
|
},
|
|
300
301
|
stylesConfig: {
|
|
301
|
-
"flex1": {
|
|
302
|
-
"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;"
|
|
303
|
-
},
|
|
304
302
|
"heading1": {
|
|
305
303
|
"font-size": {
|
|
306
304
|
"$$type": "size",
|
|
@@ -17,7 +17,7 @@ export const inputSchema = {
|
|
|
17
17
|
.record(
|
|
18
18
|
z.string().describe( 'The configuration id' ),
|
|
19
19
|
z.record(
|
|
20
|
-
z.string().describe( 'StyleSchema property name
|
|
20
|
+
z.string().describe( 'StyleSchema property name' ),
|
|
21
21
|
z.any().describe( `The PropValue for the style property. MANDATORY, refer to [${ STYLE_SCHEMA_URI }]` )
|
|
22
22
|
)
|
|
23
23
|
)
|
|
@@ -66,7 +66,7 @@ export const validateInput = {
|
|
|
66
66
|
validateStyles( values: Record< string, unknown > ): ValidationResult {
|
|
67
67
|
const styleSchema = getStylesSchema();
|
|
68
68
|
const customCssValue = values.custom_css;
|
|
69
|
-
const result = this.validateProps( styleSchema, values, [ 'custom_css' ] );
|
|
69
|
+
const result = this.validateProps( styleSchema, values, [ 'custom_css', '$intention' ] );
|
|
70
70
|
const appendInvalidCustomCssErr = () => {
|
|
71
71
|
result.valid = false;
|
|
72
72
|
result.errors = result.errors || [];
|