@elementor/editor-variables 4.3.0-1001 → 4.3.0-1003
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 +17 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/mcp/manage-variable-tool.ts +15 -1
- package/src/service.ts +20 -0
package/dist/index.js
CHANGED
|
@@ -660,6 +660,18 @@ var handleWatermark = (operation, newWatermark) => {
|
|
|
660
660
|
}
|
|
661
661
|
storage.watermark(newWatermark);
|
|
662
662
|
};
|
|
663
|
+
var applyLocalMutation = (action, variableWithId, watermark) => {
|
|
664
|
+
const { id: variableId, ...variable } = variableWithId;
|
|
665
|
+
handleWatermark(OP_RW, watermark);
|
|
666
|
+
if (action === "create") {
|
|
667
|
+
storage.add(variableId, variable);
|
|
668
|
+
} else {
|
|
669
|
+
storage.update(variableId, variable);
|
|
670
|
+
}
|
|
671
|
+
styleVariablesRepository.update({
|
|
672
|
+
[variableId]: variable
|
|
673
|
+
});
|
|
674
|
+
};
|
|
663
675
|
|
|
664
676
|
// src/transformers/utils/resolve-css-variable.ts
|
|
665
677
|
var resolveCssVariable = (id, variable) => {
|
|
@@ -3981,10 +3993,14 @@ var initManageVariableTool = (reg) => {
|
|
|
3981
3993
|
],
|
|
3982
3994
|
isDestructive: true,
|
|
3983
3995
|
handler: async (params) => {
|
|
3984
|
-
await (0, import_http_client3.httpService)().post(MCP_PROXY_URL2, {
|
|
3996
|
+
const { data } = await (0, import_http_client3.httpService)().post(MCP_PROXY_URL2, {
|
|
3985
3997
|
tool: TOOL_NAME,
|
|
3986
3998
|
input: params
|
|
3987
3999
|
});
|
|
4000
|
+
const payload = data.data;
|
|
4001
|
+
if (payload.variable && typeof payload.watermark === "number") {
|
|
4002
|
+
applyLocalMutation(params.action, payload.variable, payload.watermark);
|
|
4003
|
+
}
|
|
3988
4004
|
return { status: "ok" };
|
|
3989
4005
|
}
|
|
3990
4006
|
});
|