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

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/editor-variables",
3
- "version": "4.2.0-943",
3
+ "version": "4.2.0-944",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -39,22 +39,22 @@
39
39
  "dev": "tsup --config=../../tsup.dev.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@elementor/editor": "4.2.0-943",
43
- "@elementor/editor-canvas": "4.2.0-943",
44
- "@elementor/editor-controls": "4.2.0-943",
45
- "@elementor/editor-current-user": "4.2.0-943",
46
- "@elementor/editor-mcp": "4.2.0-943",
47
- "@elementor/editor-panels": "4.2.0-943",
48
- "@elementor/editor-props": "4.2.0-943",
49
- "@elementor/editor-ui": "4.2.0-943",
50
- "@elementor/editor-v1-adapters": "4.2.0-943",
51
- "@elementor/menus": "4.2.0-943",
52
- "@elementor/http-client": "4.2.0-943",
42
+ "@elementor/editor": "4.2.0-944",
43
+ "@elementor/editor-canvas": "4.2.0-944",
44
+ "@elementor/editor-controls": "4.2.0-944",
45
+ "@elementor/editor-current-user": "4.2.0-944",
46
+ "@elementor/editor-mcp": "4.2.0-944",
47
+ "@elementor/editor-panels": "4.2.0-944",
48
+ "@elementor/editor-props": "4.2.0-944",
49
+ "@elementor/editor-ui": "4.2.0-944",
50
+ "@elementor/editor-v1-adapters": "4.2.0-944",
51
+ "@elementor/menus": "4.2.0-944",
52
+ "@elementor/http-client": "4.2.0-944",
53
53
  "@elementor/icons": "~1.75.1",
54
- "@elementor/events": "4.2.0-943",
55
- "@elementor/schema": "4.2.0-943",
54
+ "@elementor/events": "4.2.0-944",
55
+ "@elementor/schema": "4.2.0-944",
56
56
  "@elementor/ui": "1.37.5",
57
- "@elementor/utils": "4.2.0-943",
57
+ "@elementor/utils": "4.2.0-944",
58
58
  "@wordpress/i18n": "^5.13.0"
59
59
  },
60
60
  "peerDependencies": {
package/src/mcp/index.ts CHANGED
@@ -4,6 +4,12 @@ import { initManageVariableTool } from './manage-variable-tool';
4
4
  import { initVariablesResource } from './variables-resource';
5
5
 
6
6
  export function initMcp( reg: MCPRegistryEntry, canvasMcpEntry: MCPRegistryEntry ) {
7
- initManageVariableTool( reg );
8
- initVariablesResource( reg, canvasMcpEntry );
7
+ window.addEventListener(
8
+ 'elementor/init',
9
+ () => {
10
+ initManageVariableTool( reg );
11
+ initVariablesResource( reg, canvasMcpEntry );
12
+ },
13
+ { once: true }
14
+ );
9
15
  }
@@ -47,6 +47,9 @@ function isFontAvailable( font: string ) {
47
47
 
48
48
  export const initManageVariableTool = ( reg: MCPRegistryEntry ) => {
49
49
  const { addTool, resource } = reg;
50
+ const RUNTIME_ALLOWED_VARIABLE_TYPES = isProActive()
51
+ ? ( [ VARIABLE_TYPES.COLOR, VARIABLE_TYPES.FONT, VARIABLE_TYPES.SIZE, VARIABLE_TYPES.CUSTOM_SIZE ] as const )
52
+ : ( [ VARIABLE_TYPES.COLOR, VARIABLE_TYPES.FONT ] as const );
50
53
 
51
54
  resource(
52
55
  'manage-global-variable-guide',
@@ -63,28 +66,21 @@ export const initManageVariableTool = ( reg: MCPRegistryEntry ) => {
63
66
 
64
67
  addTool( {
65
68
  name: 'manage-global-variable',
66
- description: 'Manage V4 global variables (color, font, size). Read the guide resource before use.',
69
+ description:
70
+ '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',
67
71
  schema: {
68
- action: z.enum( [ 'create', 'update', 'delete' ] ).describe( 'Operation to perform' ),
72
+ action: z.enum( [ 'create', 'update', 'delete' ] ),
69
73
  id: z
70
74
  .string()
71
75
  .optional()
72
76
  .describe( 'Variable id — required for update/delete. Get from the global-variables resource.' ),
73
- type: z
74
- .string()
75
- .optional()
76
- .describe(
77
- 'Variable type — 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.'
78
- ),
79
- label: z
80
- .string()
81
- .optional()
82
- .describe( 'Variable label (lowercase, dash-separated) — required for create/update.' ),
77
+ type: z.enum( RUNTIME_ALLOWED_VARIABLE_TYPES ),
78
+ label: z.string().describe( 'Variable label (lowercase, dash-separated) — required for create/update.' ),
83
79
  value: z
84
80
  .string()
85
81
  .optional()
86
82
  .describe(
87
- 'Plain CSS value — 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.'
83
+ 'Plain CSS value — 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.'
88
84
  ),
89
85
  },
90
86
  outputSchema: {