@elementor/editor-components 3.35.0-406 → 3.35.0-408
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 +18 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -22
- package/src/components/create-component-form/create-component-form.tsx +1 -1
- package/src/mcp/save-as-component-tool.ts +18 -15
- package/src/prevent-circular-nesting.ts +1 -1
- package/src/prevent-non-atomic-nesting.ts +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2326,7 +2326,7 @@ import { __getStore as getStore2 } from "@elementor/store";
|
|
|
2326
2326
|
import { __ as __16 } from "@wordpress/i18n";
|
|
2327
2327
|
var NON_ATOMIC_ELEMENT_ALERT = {
|
|
2328
2328
|
type: "default",
|
|
2329
|
-
message: __16("
|
|
2329
|
+
message: __16("This widget isn't compatible with components. Use atomic elements instead.", "elementor"),
|
|
2330
2330
|
id: "non-atomic-element-blocked"
|
|
2331
2331
|
};
|
|
2332
2332
|
function initNonAtomicNestingPrevention() {
|
|
@@ -2574,7 +2574,7 @@ function CreateComponentForm() {
|
|
|
2574
2574
|
notify2({
|
|
2575
2575
|
type: "default",
|
|
2576
2576
|
message: __18(
|
|
2577
|
-
"
|
|
2577
|
+
"Components require atomic elements only. Remove widgets to create this component.",
|
|
2578
2578
|
"elementor"
|
|
2579
2579
|
),
|
|
2580
2580
|
id: "non-atomic-element-save-blocked"
|
|
@@ -3786,6 +3786,9 @@ var InputSchema = {
|
|
|
3786
3786
|
elementId: z6.string().describe("The id of the child element that you want to override its settings"),
|
|
3787
3787
|
propKey: z6.string().describe(
|
|
3788
3788
|
'The property key of the child element that you want to override its settings (e.g., "text", "url", "tag"). To get the available propKeys for an element, use the "get-element-type-config" tool.'
|
|
3789
|
+
),
|
|
3790
|
+
label: z6.string().describe(
|
|
3791
|
+
'A unique, user-friendly display name for this property (e.g., "Hero Headline", "CTA Button Text"). Must be unique within the same component.'
|
|
3789
3792
|
)
|
|
3790
3793
|
})
|
|
3791
3794
|
)
|
|
@@ -3845,7 +3848,7 @@ function enrichOverridableProps(input, rootElement) {
|
|
|
3845
3848
|
const enrichedProps = {};
|
|
3846
3849
|
const defaultGroupId = generateUniqueId6("group");
|
|
3847
3850
|
Object.entries(input.props).forEach(([, prop]) => {
|
|
3848
|
-
const { elementId, propKey } = prop;
|
|
3851
|
+
const { elementId, propKey, label } = prop;
|
|
3849
3852
|
const element = findElementById(rootElement, elementId);
|
|
3850
3853
|
if (!element) {
|
|
3851
3854
|
throw new Error(`Element with ID "${elementId}" not found in component`);
|
|
@@ -3866,7 +3869,6 @@ function enrichOverridableProps(input, rootElement) {
|
|
|
3866
3869
|
}
|
|
3867
3870
|
const overrideKey = generateUniqueId6("prop");
|
|
3868
3871
|
const originValue = element.settings?.[propKey] ? element.settings[propKey] : elementType.propsSchema[propKey].default ?? null;
|
|
3869
|
-
const label = generateLabel(propKey);
|
|
3870
3872
|
enrichedProps[overrideKey] = {
|
|
3871
3873
|
overrideKey,
|
|
3872
3874
|
label,
|
|
@@ -3921,10 +3923,6 @@ function findElementById(root, targetId) {
|
|
|
3921
3923
|
}
|
|
3922
3924
|
return null;
|
|
3923
3925
|
}
|
|
3924
|
-
function generateLabel(propKey) {
|
|
3925
|
-
const uniqueId = generateUniqueId6("prop");
|
|
3926
|
-
return `${uniqueId} - ${propKey}`;
|
|
3927
|
-
}
|
|
3928
3926
|
function getValidElementTypes() {
|
|
3929
3927
|
const types = getWidgetsCache4();
|
|
3930
3928
|
if (!types) {
|
|
@@ -3987,7 +3985,8 @@ Skip that step ONLY if the user explicitly requests to not make any properties c
|
|
|
3987
3985
|
|
|
3988
3986
|
3. **Build the overridable_props Object**
|
|
3989
3987
|
- For each property you want to make overridable, add an entry:
|
|
3990
|
-
\`{ "elementId": "<child-element-id>", "propKey": "<property-key>" }\`
|
|
3988
|
+
\`{ "elementId": "<child-element-id>", "propKey": "<property-key>", "label": "<user-friendly-name>" }\`
|
|
3989
|
+
- The label must be unique within the component and should be meaningful to the user (e.g., "Hero Headline", "CTA Button Text")
|
|
3991
3990
|
- Group all entries under the "props" object
|
|
3992
3991
|
|
|
3993
3992
|
## Step 3: Execute the Tool
|
|
@@ -4024,7 +4023,8 @@ Structure:
|
|
|
4024
4023
|
"props": {
|
|
4025
4024
|
"<unique-key>": {
|
|
4026
4025
|
"elementId": "<child-element-id>",
|
|
4027
|
-
"propKey": "<property-key>"
|
|
4026
|
+
"propKey": "<property-key>",
|
|
4027
|
+
"label": "<user-friendly-name>"
|
|
4028
4028
|
}
|
|
4029
4029
|
}
|
|
4030
4030
|
}
|
|
@@ -4034,7 +4034,7 @@ To populate this correctly:
|
|
|
4034
4034
|
1. Use [${DOCUMENT_STRUCTURE_URI}] to find child element IDs and their widgetType
|
|
4035
4035
|
2. Use [${WIDGET_SCHEMA_URI}] to find the atomic_props_schema for each child element's widgetType
|
|
4036
4036
|
3. Only include properties you want to be customizable in component instances
|
|
4037
|
-
4.
|
|
4037
|
+
4. Provide a unique, user-friendly label for each property (e.g., "Hero Headline", "CTA Button Text")`
|
|
4038
4038
|
);
|
|
4039
4039
|
saveAsComponentPrompt.example(`
|
|
4040
4040
|
Basic component without overridable properties:
|
|
@@ -4054,15 +4054,18 @@ Component with overridable properties:
|
|
|
4054
4054
|
"props": {
|
|
4055
4055
|
"heading-text": {
|
|
4056
4056
|
"elementId": "heading-123",
|
|
4057
|
-
"propKey": "text"
|
|
4057
|
+
"propKey": "text",
|
|
4058
|
+
"label": "Card Title"
|
|
4058
4059
|
},
|
|
4059
4060
|
"button-text": {
|
|
4060
4061
|
"elementId": "button-456",
|
|
4061
|
-
"propKey": "text"
|
|
4062
|
+
"propKey": "text",
|
|
4063
|
+
"label": "Button Text"
|
|
4062
4064
|
},
|
|
4063
4065
|
"button-link": {
|
|
4064
4066
|
"elementId": "button-456",
|
|
4065
|
-
"propKey": "url"
|
|
4067
|
+
"propKey": "url",
|
|
4068
|
+
"label": "Button Link"
|
|
4066
4069
|
}
|
|
4067
4070
|
}
|
|
4068
4071
|
}
|
|
@@ -4116,7 +4119,7 @@ import { __ as __25 } from "@wordpress/i18n";
|
|
|
4116
4119
|
var COMPONENT_TYPE = "e-component";
|
|
4117
4120
|
var COMPONENT_CIRCULAR_NESTING_ALERT = {
|
|
4118
4121
|
type: "default",
|
|
4119
|
-
message: __25("
|
|
4122
|
+
message: __25("Can't add this component - components that contain each other can't be nested.", "elementor"),
|
|
4120
4123
|
id: "circular-component-nesting-blocked"
|
|
4121
4124
|
};
|
|
4122
4125
|
function initCircularNestingPrevention() {
|