@elementor/editor-global-classes 4.3.0-1022 → 4.3.0-1031

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
@@ -2831,15 +2831,22 @@ var initManageClassesTool = (reg) => {
2831
2831
  const { addTool } = reg;
2832
2832
  addTool({
2833
2833
  name: TOOL_NAME,
2834
- description: "Manage V4 global CSS classes on the active kit. Create, update, or delete a single class using raw CSS declarations.",
2834
+ description: "Manage V4 global CSS classes on the active kit. Bulk create, update, or delete using raw CSS declarations (up to 50 operations). Duplicate labels are auto-renamed with a DUP_ prefix.",
2835
2835
  schema: {
2836
2836
  action: z.enum(["create", "update", "delete"]),
2837
2837
  id: z.string().optional().describe("Class id \u2014 required for update/delete. Get from the global-classes resource."),
2838
2838
  label: z.string().optional().describe("Class label (lowercase, dash-separated) \u2014 required for create/update."),
2839
- css: z.record(z.string()).optional().describe("Raw CSS declarations (property \u2192 value) \u2014 required for create/update.")
2839
+ css: z.string().optional().describe(
2840
+ 'Plain CSS string. Supports &:hover/&:focus/&:active nesting and @media(--breakpoint) blocks. In patch mode: "prop: null" removes that prop; "all: null" wipes the variant.'
2841
+ ),
2842
+ mode: z.enum(["patch", "replace"]).optional().describe(
2843
+ "Merge strategy for update \u2014 patch (default): merge incoming props with existing; replace: discard all existing variants for the affected breakpoints."
2844
+ )
2840
2845
  },
2841
2846
  outputSchema: {
2842
- status: z.enum(["ok"]).describe("Operation status")
2847
+ status: z.enum(["ok"]).describe("Operation status"),
2848
+ id: z.string().optional().describe("ID of the affected class \u2014 use for subsequent update/delete calls."),
2849
+ label: z.string().optional().describe("Final label of the class after any auto-rename.")
2843
2850
  },
2844
2851
  requiredResources: [
2845
2852
  {
@@ -2851,19 +2858,19 @@ var initManageClassesTool = (reg) => {
2851
2858
  handler: async (params) => {
2852
2859
  const { data } = await httpService2().post(MCP_PROXY_URL, {
2853
2860
  tool: TOOL_NAME,
2854
- input: params
2861
+ input: { operations: [params] }
2855
2862
  });
2856
- const payload = data.data;
2863
+ const result = data.data.results?.[0];
2857
2864
  const { create, update, delete: del } = globalClassesStylesProvider.actions;
2858
2865
  switch (params.action) {
2859
2866
  case "create":
2860
- if (payload.class && create) {
2861
- create(payload.class.label, payload.class.variants, payload.class.id);
2867
+ if (result && create) {
2868
+ create(result.label, result.variants, result.id);
2862
2869
  }
2863
2870
  break;
2864
2871
  case "update":
2865
- if (payload.class && update) {
2866
- update(payload.class);
2872
+ if (result && update) {
2873
+ update(result);
2867
2874
  }
2868
2875
  break;
2869
2876
  case "delete":
@@ -2874,7 +2881,11 @@ var initManageClassesTool = (reg) => {
2874
2881
  }
2875
2882
  dispatch7(slice.actions.reset({ context: "frontend" }));
2876
2883
  window.dispatchEvent(new CustomEvent("classes:updated", { detail: { context: "frontend" } }));
2877
- return { status: "ok" };
2884
+ return {
2885
+ status: "ok",
2886
+ id: result?.id,
2887
+ label: result?.label
2888
+ };
2878
2889
  }
2879
2890
  });
2880
2891
  };