@elementor/editor-components 3.35.0-407 → 3.35.0-409

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 CHANGED
@@ -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. Common propKeys: "text", "url", "tag", "size", "align", etc.`
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
  }