@elementor/editor-variables 4.1.0-721 → 4.1.0-723

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
@@ -45,6 +45,7 @@ module.exports = __toCommonJS(index_exports);
45
45
  // src/init.ts
46
46
  var import_editor = require("@elementor/editor");
47
47
  var import_editor_controls18 = require("@elementor/editor-controls");
48
+ var import_editor_mcp = require("@elementor/editor-mcp");
48
49
  var import_editor_panels2 = require("@elementor/editor-panels");
49
50
  var import_editor_props7 = require("@elementor/editor-props");
50
51
  var import_menus = require("@elementor/menus");
@@ -3750,22 +3751,15 @@ var trackOpenVariablePopover = (path, variableType) => {
3750
3751
  });
3751
3752
  };
3752
3753
 
3753
- // src/mcp/index.ts
3754
- var import_editor_mcp3 = require("@elementor/editor-mcp");
3755
-
3756
3754
  // src/mcp/manage-variable-tool.ts
3757
- var import_editor_mcp2 = require("@elementor/editor-mcp");
3758
3755
  var import_schema3 = require("@elementor/schema");
3759
3756
 
3760
3757
  // src/mcp/variables-resource.ts
3761
- var import_editor_mcp = require("@elementor/editor-mcp");
3762
3758
  var GLOBAL_VARIABLES_URI = "elementor://global-variables";
3763
- var initVariablesResource = () => {
3764
- const canvasMcpEntry = (0, import_editor_mcp.getMCPByDomain)("canvas");
3765
- const variablesMcpEntry = (0, import_editor_mcp.getMCPByDomain)("variables");
3759
+ var initVariablesResource = (variablesMcpEntry, canvasMcpEntry) => {
3766
3760
  [canvasMcpEntry, variablesMcpEntry].forEach((entry) => {
3767
- const { mcpServer } = entry;
3768
- mcpServer.resource(
3761
+ const { resource, sendResourceUpdated } = entry;
3762
+ resource(
3769
3763
  "global-variables",
3770
3764
  GLOBAL_VARIABLES_URI,
3771
3765
  {
@@ -3784,7 +3778,7 @@ var initVariablesResource = () => {
3784
3778
  }
3785
3779
  );
3786
3780
  window.addEventListener("variables:updated", () => {
3787
- mcpServer.server.sendResourceUpdated({
3781
+ sendResourceUpdated({
3788
3782
  uri: GLOBAL_VARIABLES_URI
3789
3783
  });
3790
3784
  });
@@ -3792,8 +3786,9 @@ var initVariablesResource = () => {
3792
3786
  };
3793
3787
 
3794
3788
  // src/mcp/manage-variable-tool.ts
3795
- var initManageVariableTool = () => {
3796
- (0, import_editor_mcp2.getMCPByDomain)("variables").addTool({
3789
+ var initManageVariableTool = (reg) => {
3790
+ const { addTool } = reg;
3791
+ addTool({
3797
3792
  name: "manage-global-variable",
3798
3793
  schema: {
3799
3794
  action: import_schema3.z.enum(["create", "update", "delete"]).describe("Operation to perform"),
@@ -3863,12 +3858,18 @@ function getServiceActions(svc) {
3863
3858
  }
3864
3859
 
3865
3860
  // src/mcp/index.ts
3866
- function initMcp() {
3867
- if (!(0, import_editor_mcp3.isAngieAvailable)()) {
3868
- return;
3869
- }
3870
- initManageVariableTool();
3871
- initVariablesResource();
3861
+ function initMcp(reg, canvasMcpEntry) {
3862
+ const { setMCPDescription } = reg;
3863
+ setMCPDescription(
3864
+ `Everything related to V4 ( Atomic ) variables.
3865
+ # Global variables
3866
+ - Create/update/delete global variables
3867
+ - Get list of global variables
3868
+ - Get details of a global variable
3869
+ `
3870
+ );
3871
+ initManageVariableTool(reg);
3872
+ initVariablesResource(reg, canvasMcpEntry);
3872
3873
  }
3873
3874
 
3874
3875
  // src/register-variable-types.tsx
@@ -4186,7 +4187,7 @@ function init() {
4186
4187
  useProps: usePropVariableAction
4187
4188
  });
4188
4189
  service.init().then(() => {
4189
- initMcp();
4190
+ initMcp((0, import_editor_mcp.getMCPByDomain)("variables"), (0, import_editor_mcp.getMCPByDomain)("canvas"));
4190
4191
  });
4191
4192
  (0, import_editor.injectIntoTop)({
4192
4193
  id: "canvas-style-variables-render",