@elementor/editor-variables 4.2.0-943 → 4.2.0-945

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
@@ -3951,6 +3951,7 @@ function isFontAvailable(font) {
3951
3951
  }
3952
3952
  var initManageVariableTool = (reg) => {
3953
3953
  const { addTool, resource } = reg;
3954
+ const RUNTIME_ALLOWED_VARIABLE_TYPES = (0, import_utils4.isProActive)() ? [VARIABLE_TYPES.COLOR, VARIABLE_TYPES.FONT, VARIABLE_TYPES.SIZE, VARIABLE_TYPES.CUSTOM_SIZE] : [VARIABLE_TYPES.COLOR, VARIABLE_TYPES.FONT];
3954
3955
  resource(
3955
3956
  "manage-global-variable-guide",
3956
3957
  MANAGE_VARIABLES_GUIDE_URI,
@@ -3965,16 +3966,14 @@ var initManageVariableTool = (reg) => {
3965
3966
  );
3966
3967
  addTool({
3967
3968
  name: "manage-global-variable",
3968
- description: "Manage V4 global variables (color, font, size). Read the guide resource before use.",
3969
+ description: "Manage V4 global variables (color, font, size, custom-size). Read the guide resource before use. font = font-famliy, size = measured unit, custom-size = calculated values",
3969
3970
  schema: {
3970
- action: import_schema3.z.enum(["create", "update", "delete"]).describe("Operation to perform"),
3971
+ action: import_schema3.z.enum(["create", "update", "delete"]),
3971
3972
  id: import_schema3.z.string().optional().describe("Variable id \u2014 required for update/delete. Get from the global-variables resource."),
3972
- type: import_schema3.z.string().optional().describe(
3973
- 'Variable type \u2014 required for create. One of: "global-color-variable", "global-font-variable", "global-size-variable", "global-custom-size-variable" (size types require Elementor Pro). NEVER store px/rem values in a font variable.'
3974
- ),
3975
- label: import_schema3.z.string().optional().describe("Variable label (lowercase, dash-separated) \u2014 required for create/update."),
3973
+ type: import_schema3.z.enum(RUNTIME_ALLOWED_VARIABLE_TYPES),
3974
+ label: import_schema3.z.string().describe("Variable label (lowercase, dash-separated) \u2014 required for create/update."),
3976
3975
  value: import_schema3.z.string().optional().describe(
3977
- 'Plain CSS value \u2014 required for create/update. Color: hex/rgba/hsl. Font: family name only, never px/rem. Size: value with unit e.g. "16px", or "auto" (Pro). Do NOT pass JSON.'
3976
+ 'Plain CSS value \u2014 required for create/update. Color: hex/rgba/hsl. Font: family name only. Size: value with unit e.g. "16px", or "auto" (Pro). Do NOT pass JSON.'
3978
3977
  )
3979
3978
  },
3980
3979
  outputSchema: {
@@ -4047,8 +4046,14 @@ function getServiceActions(svc) {
4047
4046
 
4048
4047
  // src/mcp/index.ts
4049
4048
  function initMcp(reg, canvasMcpEntry) {
4050
- initManageVariableTool(reg);
4051
- initVariablesResource(reg, canvasMcpEntry);
4049
+ window.addEventListener(
4050
+ "elementor/init",
4051
+ () => {
4052
+ initManageVariableTool(reg);
4053
+ initVariablesResource(reg, canvasMcpEntry);
4054
+ },
4055
+ { once: true }
4056
+ );
4052
4057
  }
4053
4058
 
4054
4059
  // src/register-variable-types.tsx