@elementor/editor-variables 4.3.0-1001 → 4.3.0-1002

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.mjs CHANGED
@@ -617,6 +617,18 @@ var handleWatermark = (operation, newWatermark) => {
617
617
  }
618
618
  storage.watermark(newWatermark);
619
619
  };
620
+ var applyLocalMutation = (action, variableWithId, watermark) => {
621
+ const { id: variableId, ...variable } = variableWithId;
622
+ handleWatermark(OP_RW, watermark);
623
+ if (action === "create") {
624
+ storage.add(variableId, variable);
625
+ } else {
626
+ storage.update(variableId, variable);
627
+ }
628
+ styleVariablesRepository.update({
629
+ [variableId]: variable
630
+ });
631
+ };
620
632
 
621
633
  // src/transformers/utils/resolve-css-variable.ts
622
634
  var resolveCssVariable = (id, variable) => {
@@ -3961,10 +3973,14 @@ var initManageVariableTool = (reg) => {
3961
3973
  ],
3962
3974
  isDestructive: true,
3963
3975
  handler: async (params) => {
3964
- await httpService3().post(MCP_PROXY_URL2, {
3976
+ const { data } = await httpService3().post(MCP_PROXY_URL2, {
3965
3977
  tool: TOOL_NAME,
3966
3978
  input: params
3967
3979
  });
3980
+ const payload = data.data;
3981
+ if (payload.variable && typeof payload.watermark === "number") {
3982
+ applyLocalMutation(params.action, payload.variable, payload.watermark);
3983
+ }
3968
3984
  return { status: "ok" };
3969
3985
  }
3970
3986
  });