@elementor/editor-global-classes 4.3.0-1023 → 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.js CHANGED
@@ -2798,15 +2798,22 @@ var initManageClassesTool = (reg) => {
2798
2798
  const { addTool } = reg;
2799
2799
  addTool({
2800
2800
  name: TOOL_NAME,
2801
- description: "Manage V4 global CSS classes on the active kit. Create, update, or delete a single class using raw CSS declarations.",
2801
+ 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.",
2802
2802
  schema: {
2803
2803
  action: import_schema.z.enum(["create", "update", "delete"]),
2804
2804
  id: import_schema.z.string().optional().describe("Class id \u2014 required for update/delete. Get from the global-classes resource."),
2805
2805
  label: import_schema.z.string().optional().describe("Class label (lowercase, dash-separated) \u2014 required for create/update."),
2806
- css: import_schema.z.record(import_schema.z.string()).optional().describe("Raw CSS declarations (property \u2192 value) \u2014 required for create/update.")
2806
+ css: import_schema.z.string().optional().describe(
2807
+ '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.'
2808
+ ),
2809
+ mode: import_schema.z.enum(["patch", "replace"]).optional().describe(
2810
+ "Merge strategy for update \u2014 patch (default): merge incoming props with existing; replace: discard all existing variants for the affected breakpoints."
2811
+ )
2807
2812
  },
2808
2813
  outputSchema: {
2809
- status: import_schema.z.enum(["ok"]).describe("Operation status")
2814
+ status: import_schema.z.enum(["ok"]).describe("Operation status"),
2815
+ id: import_schema.z.string().optional().describe("ID of the affected class \u2014 use for subsequent update/delete calls."),
2816
+ label: import_schema.z.string().optional().describe("Final label of the class after any auto-rename.")
2810
2817
  },
2811
2818
  requiredResources: [
2812
2819
  {
@@ -2818,19 +2825,19 @@ var initManageClassesTool = (reg) => {
2818
2825
  handler: async (params) => {
2819
2826
  const { data } = await (0, import_http_client2.httpService)().post(MCP_PROXY_URL, {
2820
2827
  tool: TOOL_NAME,
2821
- input: params
2828
+ input: { operations: [params] }
2822
2829
  });
2823
- const payload = data.data;
2830
+ const result = data.data.results?.[0];
2824
2831
  const { create, update, delete: del } = globalClassesStylesProvider.actions;
2825
2832
  switch (params.action) {
2826
2833
  case "create":
2827
- if (payload.class && create) {
2828
- create(payload.class.label, payload.class.variants, payload.class.id);
2834
+ if (result && create) {
2835
+ create(result.label, result.variants, result.id);
2829
2836
  }
2830
2837
  break;
2831
2838
  case "update":
2832
- if (payload.class && update) {
2833
- update(payload.class);
2839
+ if (result && update) {
2840
+ update(result);
2834
2841
  }
2835
2842
  break;
2836
2843
  case "delete":
@@ -2841,7 +2848,11 @@ var initManageClassesTool = (reg) => {
2841
2848
  }
2842
2849
  (0, import_store30.__dispatch)(slice.actions.reset({ context: "frontend" }));
2843
2850
  window.dispatchEvent(new CustomEvent("classes:updated", { detail: { context: "frontend" } }));
2844
- return { status: "ok" };
2851
+ return {
2852
+ status: "ok",
2853
+ id: result?.id,
2854
+ label: result?.label
2855
+ };
2845
2856
  }
2846
2857
  });
2847
2858
  };