@elementor/editor-variables 4.1.0-721 → 4.1.0-722
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 +21 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/init.ts +2 -1
- package/src/mcp/index.ts +13 -7
- package/src/mcp/manage-variable-tool.ts +4 -3
- package/src/mcp/variables-resource.ts +5 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-variables",
|
|
3
|
-
"version": "4.1.0-
|
|
3
|
+
"version": "4.1.0-722",
|
|
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.1.0-
|
|
43
|
-
"@elementor/editor-canvas": "4.1.0-
|
|
44
|
-
"@elementor/editor-controls": "4.1.0-
|
|
45
|
-
"@elementor/editor-current-user": "4.1.0-
|
|
46
|
-
"@elementor/editor-mcp": "4.1.0-
|
|
47
|
-
"@elementor/editor-panels": "4.1.0-
|
|
48
|
-
"@elementor/editor-props": "4.1.0-
|
|
49
|
-
"@elementor/editor-ui": "4.1.0-
|
|
50
|
-
"@elementor/editor-v1-adapters": "4.1.0-
|
|
51
|
-
"@elementor/menus": "4.1.0-
|
|
52
|
-
"@elementor/http-client": "4.1.0-
|
|
42
|
+
"@elementor/editor": "4.1.0-722",
|
|
43
|
+
"@elementor/editor-canvas": "4.1.0-722",
|
|
44
|
+
"@elementor/editor-controls": "4.1.0-722",
|
|
45
|
+
"@elementor/editor-current-user": "4.1.0-722",
|
|
46
|
+
"@elementor/editor-mcp": "4.1.0-722",
|
|
47
|
+
"@elementor/editor-panels": "4.1.0-722",
|
|
48
|
+
"@elementor/editor-props": "4.1.0-722",
|
|
49
|
+
"@elementor/editor-ui": "4.1.0-722",
|
|
50
|
+
"@elementor/editor-v1-adapters": "4.1.0-722",
|
|
51
|
+
"@elementor/menus": "4.1.0-722",
|
|
52
|
+
"@elementor/http-client": "4.1.0-722",
|
|
53
53
|
"@elementor/icons": "^1.72.0",
|
|
54
|
-
"@elementor/events": "4.1.0-
|
|
55
|
-
"@elementor/schema": "4.1.0-
|
|
54
|
+
"@elementor/events": "4.1.0-722",
|
|
55
|
+
"@elementor/schema": "4.1.0-722",
|
|
56
56
|
"@elementor/ui": "1.37.2",
|
|
57
|
-
"@elementor/utils": "4.1.0-
|
|
57
|
+
"@elementor/utils": "4.1.0-722",
|
|
58
58
|
"@wordpress/i18n": "^5.13.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
package/src/init.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { injectIntoLogic, injectIntoTop } from '@elementor/editor';
|
|
2
2
|
import { registerControlReplacement } from '@elementor/editor-controls';
|
|
3
|
+
import { getMCPByDomain } from '@elementor/editor-mcp';
|
|
3
4
|
import { __registerPanel as registerPanel } from '@elementor/editor-panels';
|
|
4
5
|
import { isTransformable, type PropValue } from '@elementor/editor-props';
|
|
5
6
|
import { controlActionsMenu } from '@elementor/menus';
|
|
@@ -45,7 +46,7 @@ export function init() {
|
|
|
45
46
|
} );
|
|
46
47
|
|
|
47
48
|
variablesService.init().then( () => {
|
|
48
|
-
initMcp();
|
|
49
|
+
initMcp( getMCPByDomain( 'variables' ), getMCPByDomain( 'canvas' ) );
|
|
49
50
|
} );
|
|
50
51
|
|
|
51
52
|
injectIntoTop( {
|
package/src/mcp/index.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type MCPRegistryEntry } from '@elementor/editor-mcp';
|
|
2
2
|
|
|
3
3
|
import { initManageVariableTool } from './manage-variable-tool';
|
|
4
4
|
import { initVariablesResource } from './variables-resource';
|
|
5
5
|
|
|
6
|
-
export function initMcp() {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
export function initMcp( reg: MCPRegistryEntry, canvasMcpEntry: MCPRegistryEntry ) {
|
|
7
|
+
const { setMCPDescription } = reg;
|
|
8
|
+
setMCPDescription(
|
|
9
|
+
`Everything related to V4 ( Atomic ) variables.
|
|
10
|
+
# Global variables
|
|
11
|
+
- Create/update/delete global variables
|
|
12
|
+
- Get list of global variables
|
|
13
|
+
- Get details of a global variable
|
|
14
|
+
`
|
|
15
|
+
);
|
|
16
|
+
initManageVariableTool( reg );
|
|
17
|
+
initVariablesResource( reg, canvasMcpEntry );
|
|
12
18
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type MCPRegistryEntry } from '@elementor/editor-mcp';
|
|
2
2
|
import { z } from '@elementor/schema';
|
|
3
3
|
|
|
4
4
|
import { service } from '../service';
|
|
5
5
|
import { GLOBAL_VARIABLES_URI } from './variables-resource';
|
|
6
6
|
|
|
7
|
-
export const initManageVariableTool = () => {
|
|
8
|
-
|
|
7
|
+
export const initManageVariableTool = ( reg: MCPRegistryEntry ) => {
|
|
8
|
+
const { addTool } = reg;
|
|
9
|
+
addTool( {
|
|
9
10
|
name: 'manage-global-variable',
|
|
10
11
|
schema: {
|
|
11
12
|
action: z.enum( [ 'create', 'update', 'delete' ] ).describe( 'Operation to perform' ),
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type MCPRegistryEntry } from '@elementor/editor-mcp';
|
|
2
2
|
|
|
3
3
|
import { service } from '../service';
|
|
4
4
|
import { type TVariable } from '../storage';
|
|
5
5
|
|
|
6
6
|
export const GLOBAL_VARIABLES_URI = 'elementor://global-variables';
|
|
7
7
|
|
|
8
|
-
export const initVariablesResource = () => {
|
|
9
|
-
const canvasMcpEntry = getMCPByDomain( 'canvas' );
|
|
10
|
-
const variablesMcpEntry = getMCPByDomain( 'variables' );
|
|
11
|
-
|
|
8
|
+
export const initVariablesResource = ( variablesMcpEntry: MCPRegistryEntry, canvasMcpEntry: MCPRegistryEntry ) => {
|
|
12
9
|
[ canvasMcpEntry, variablesMcpEntry ].forEach( ( entry ) => {
|
|
13
|
-
const {
|
|
14
|
-
|
|
10
|
+
const { resource, sendResourceUpdated } = entry;
|
|
11
|
+
resource(
|
|
15
12
|
'global-variables',
|
|
16
13
|
GLOBAL_VARIABLES_URI,
|
|
17
14
|
{
|
|
@@ -33,7 +30,7 @@ export const initVariablesResource = () => {
|
|
|
33
30
|
);
|
|
34
31
|
|
|
35
32
|
window.addEventListener( 'variables:updated', () => {
|
|
36
|
-
|
|
33
|
+
sendResourceUpdated( {
|
|
37
34
|
uri: GLOBAL_VARIABLES_URI,
|
|
38
35
|
} );
|
|
39
36
|
} );
|