@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.js
CHANGED
|
@@ -2316,7 +2316,7 @@ var import_store36 = require("@elementor/store");
|
|
|
2316
2316
|
var import_i18n16 = require("@wordpress/i18n");
|
|
2317
2317
|
var NON_ATOMIC_ELEMENT_ALERT = {
|
|
2318
2318
|
type: "default",
|
|
2319
|
-
message: (0, import_i18n16.__)("
|
|
2319
|
+
message: (0, import_i18n16.__)("This widget isn't compatible with components. Use atomic elements instead.", "elementor"),
|
|
2320
2320
|
id: "non-atomic-element-blocked"
|
|
2321
2321
|
};
|
|
2322
2322
|
function initNonAtomicNestingPrevention() {
|
|
@@ -2564,7 +2564,7 @@ function CreateComponentForm() {
|
|
|
2564
2564
|
(0, import_editor_notifications2.notify)({
|
|
2565
2565
|
type: "default",
|
|
2566
2566
|
message: (0, import_i18n18.__)(
|
|
2567
|
-
"
|
|
2567
|
+
"Components require atomic elements only. Remove widgets to create this component.",
|
|
2568
2568
|
"elementor"
|
|
2569
2569
|
),
|
|
2570
2570
|
id: "non-atomic-element-save-blocked"
|
|
@@ -3772,6 +3772,9 @@ var InputSchema = {
|
|
|
3772
3772
|
elementId: import_schema6.z.string().describe("The id of the child element that you want to override its settings"),
|
|
3773
3773
|
propKey: import_schema6.z.string().describe(
|
|
3774
3774
|
'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.'
|
|
3775
|
+
),
|
|
3776
|
+
label: import_schema6.z.string().describe(
|
|
3777
|
+
'A unique, user-friendly display name for this property (e.g., "Hero Headline", "CTA Button Text"). Must be unique within the same component.'
|
|
3775
3778
|
)
|
|
3776
3779
|
})
|
|
3777
3780
|
)
|
|
@@ -3831,7 +3834,7 @@ function enrichOverridableProps(input, rootElement) {
|
|
|
3831
3834
|
const enrichedProps = {};
|
|
3832
3835
|
const defaultGroupId = (0, import_utils9.generateUniqueId)("group");
|
|
3833
3836
|
Object.entries(input.props).forEach(([, prop]) => {
|
|
3834
|
-
const { elementId, propKey } = prop;
|
|
3837
|
+
const { elementId, propKey, label } = prop;
|
|
3835
3838
|
const element = findElementById(rootElement, elementId);
|
|
3836
3839
|
if (!element) {
|
|
3837
3840
|
throw new Error(`Element with ID "${elementId}" not found in component`);
|
|
@@ -3852,7 +3855,6 @@ function enrichOverridableProps(input, rootElement) {
|
|
|
3852
3855
|
}
|
|
3853
3856
|
const overrideKey = (0, import_utils9.generateUniqueId)("prop");
|
|
3854
3857
|
const originValue = element.settings?.[propKey] ? element.settings[propKey] : elementType.propsSchema[propKey].default ?? null;
|
|
3855
|
-
const label = generateLabel(propKey);
|
|
3856
3858
|
enrichedProps[overrideKey] = {
|
|
3857
3859
|
overrideKey,
|
|
3858
3860
|
label,
|
|
@@ -3907,10 +3909,6 @@ function findElementById(root, targetId) {
|
|
|
3907
3909
|
}
|
|
3908
3910
|
return null;
|
|
3909
3911
|
}
|
|
3910
|
-
function generateLabel(propKey) {
|
|
3911
|
-
const uniqueId = (0, import_utils9.generateUniqueId)("prop");
|
|
3912
|
-
return `${uniqueId} - ${propKey}`;
|
|
3913
|
-
}
|
|
3914
3912
|
function getValidElementTypes() {
|
|
3915
3913
|
const types = (0, import_editor_elements15.getWidgetsCache)();
|
|
3916
3914
|
if (!types) {
|
|
@@ -3973,7 +3971,8 @@ Skip that step ONLY if the user explicitly requests to not make any properties c
|
|
|
3973
3971
|
|
|
3974
3972
|
3. **Build the overridable_props Object**
|
|
3975
3973
|
- For each property you want to make overridable, add an entry:
|
|
3976
|
-
\`{ "elementId": "<child-element-id>", "propKey": "<property-key>" }\`
|
|
3974
|
+
\`{ "elementId": "<child-element-id>", "propKey": "<property-key>", "label": "<user-friendly-name>" }\`
|
|
3975
|
+
- The label must be unique within the component and should be meaningful to the user (e.g., "Hero Headline", "CTA Button Text")
|
|
3977
3976
|
- Group all entries under the "props" object
|
|
3978
3977
|
|
|
3979
3978
|
## Step 3: Execute the Tool
|
|
@@ -4010,7 +4009,8 @@ Structure:
|
|
|
4010
4009
|
"props": {
|
|
4011
4010
|
"<unique-key>": {
|
|
4012
4011
|
"elementId": "<child-element-id>",
|
|
4013
|
-
"propKey": "<property-key>"
|
|
4012
|
+
"propKey": "<property-key>",
|
|
4013
|
+
"label": "<user-friendly-name>"
|
|
4014
4014
|
}
|
|
4015
4015
|
}
|
|
4016
4016
|
}
|
|
@@ -4020,7 +4020,7 @@ To populate this correctly:
|
|
|
4020
4020
|
1. Use [${import_editor_canvas8.DOCUMENT_STRUCTURE_URI}] to find child element IDs and their widgetType
|
|
4021
4021
|
2. Use [${import_editor_canvas8.WIDGET_SCHEMA_URI}] to find the atomic_props_schema for each child element's widgetType
|
|
4022
4022
|
3. Only include properties you want to be customizable in component instances
|
|
4023
|
-
4.
|
|
4023
|
+
4. Provide a unique, user-friendly label for each property (e.g., "Hero Headline", "CTA Button Text")`
|
|
4024
4024
|
);
|
|
4025
4025
|
saveAsComponentPrompt.example(`
|
|
4026
4026
|
Basic component without overridable properties:
|
|
@@ -4040,15 +4040,18 @@ Component with overridable properties:
|
|
|
4040
4040
|
"props": {
|
|
4041
4041
|
"heading-text": {
|
|
4042
4042
|
"elementId": "heading-123",
|
|
4043
|
-
"propKey": "text"
|
|
4043
|
+
"propKey": "text",
|
|
4044
|
+
"label": "Card Title"
|
|
4044
4045
|
},
|
|
4045
4046
|
"button-text": {
|
|
4046
4047
|
"elementId": "button-456",
|
|
4047
|
-
"propKey": "text"
|
|
4048
|
+
"propKey": "text",
|
|
4049
|
+
"label": "Button Text"
|
|
4048
4050
|
},
|
|
4049
4051
|
"button-link": {
|
|
4050
4052
|
"elementId": "button-456",
|
|
4051
|
-
"propKey": "url"
|
|
4053
|
+
"propKey": "url",
|
|
4054
|
+
"label": "Button Link"
|
|
4052
4055
|
}
|
|
4053
4056
|
}
|
|
4054
4057
|
}
|
|
@@ -4102,7 +4105,7 @@ var import_i18n25 = require("@wordpress/i18n");
|
|
|
4102
4105
|
var COMPONENT_TYPE = "e-component";
|
|
4103
4106
|
var COMPONENT_CIRCULAR_NESTING_ALERT = {
|
|
4104
4107
|
type: "default",
|
|
4105
|
-
message: (0, import_i18n25.__)("
|
|
4108
|
+
message: (0, import_i18n25.__)("Can't add this component - components that contain each other can't be nested.", "elementor"),
|
|
4106
4109
|
id: "circular-component-nesting-blocked"
|
|
4107
4110
|
};
|
|
4108
4111
|
function initCircularNestingPrevention() {
|