@elementor/editor-global-classes 3.35.0-352 → 3.35.0-354
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 +22 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -20
- package/src/mcp-integration/classes-resource.ts +6 -4
- package/src/mcp-integration/mcp-apply-unapply-global-classes.ts +14 -2
- package/src/store.ts +4 -1
package/dist/index.js
CHANGED
|
@@ -210,7 +210,9 @@ var slice = (0, import_store.__createSlice)({
|
|
|
210
210
|
let customCss = ("custom_css" in payload ? payload.custom_css : variant?.custom_css) ?? null;
|
|
211
211
|
customCss = customCss?.raw ? customCss : null;
|
|
212
212
|
if (variant) {
|
|
213
|
-
|
|
213
|
+
const variantProps = JSON.parse(JSON.stringify(variant.props));
|
|
214
|
+
const payloadProps = JSON.parse(JSON.stringify(payload.props));
|
|
215
|
+
variant.props = mergeProps(variantProps, payloadProps);
|
|
214
216
|
variant.custom_css = customCss;
|
|
215
217
|
style.variants = getNonEmptyVariants(style);
|
|
216
218
|
} else {
|
|
@@ -530,8 +532,8 @@ var subscribeWithStates = (cb) => {
|
|
|
530
532
|
// src/mcp-integration/classes-resource.ts
|
|
531
533
|
var GLOBAL_CLASSES_URI = "elementor://global-classes";
|
|
532
534
|
var initClassesResource = () => {
|
|
533
|
-
const { mcpServer } = (0, import_editor_mcp.getMCPByDomain)("canvas");
|
|
534
|
-
|
|
535
|
+
const { mcpServer, resource, waitForReady } = (0, import_editor_mcp.getMCPByDomain)("canvas");
|
|
536
|
+
resource(
|
|
535
537
|
"global-classes",
|
|
536
538
|
GLOBAL_CLASSES_URI,
|
|
537
539
|
{
|
|
@@ -543,8 +545,10 @@ var initClassesResource = () => {
|
|
|
543
545
|
};
|
|
544
546
|
}
|
|
545
547
|
);
|
|
546
|
-
|
|
547
|
-
|
|
548
|
+
waitForReady().then(() => {
|
|
549
|
+
globalClassesStylesProvider.subscribe(() => {
|
|
550
|
+
mcpServer.sendResourceListChanged();
|
|
551
|
+
});
|
|
548
552
|
});
|
|
549
553
|
};
|
|
550
554
|
|
|
@@ -2320,6 +2324,9 @@ function initMcpApplyUnapplyGlobalClasses(server) {
|
|
|
2320
2324
|
classId: import_schema.z.string().describe("The ID of the class to apply"),
|
|
2321
2325
|
elementId: import_schema.z.string().describe("The ID of the element to which the class will be applied")
|
|
2322
2326
|
},
|
|
2327
|
+
outputSchema: {
|
|
2328
|
+
result: import_schema.z.string().describe("Result message indicating the success of the apply operation")
|
|
2329
|
+
},
|
|
2323
2330
|
name: "apply-global-class",
|
|
2324
2331
|
description: `Apply a global class to the current element
|
|
2325
2332
|
|
|
@@ -2335,7 +2342,10 @@ function initMcpApplyUnapplyGlobalClasses(server) {
|
|
|
2335
2342
|
const { classId, elementId } = params;
|
|
2336
2343
|
const appliedClasses = (0, import_editor_editing_panel.doGetAppliedClasses)(elementId);
|
|
2337
2344
|
(0, import_editor_editing_panel.doApplyClasses)(elementId, [...appliedClasses, classId]);
|
|
2338
|
-
return
|
|
2345
|
+
return {
|
|
2346
|
+
llm_instructions: "Please check the element-configuration, find DUPLICATES in the style schema that are in the class, and remove them",
|
|
2347
|
+
result: `Class ${classId} applied to element ${elementId} successfully.`
|
|
2348
|
+
};
|
|
2339
2349
|
}
|
|
2340
2350
|
});
|
|
2341
2351
|
server.addTool({
|
|
@@ -2344,6 +2354,9 @@ function initMcpApplyUnapplyGlobalClasses(server) {
|
|
|
2344
2354
|
classId: import_schema.z.string().describe("The ID of the class to unapply"),
|
|
2345
2355
|
elementId: import_schema.z.string().describe("The ID of the element from which the class will be unapplied")
|
|
2346
2356
|
},
|
|
2357
|
+
outputSchema: {
|
|
2358
|
+
result: import_schema.z.string().describe("Result message indicating the success of the unapply operation")
|
|
2359
|
+
},
|
|
2347
2360
|
description: `Unapply a (global) class from the current element
|
|
2348
2361
|
|
|
2349
2362
|
## When to use this tool:
|
|
@@ -2365,7 +2378,9 @@ If the user want to unapply a class by it's name and not ID, retreive the id fro
|
|
|
2365
2378
|
if (!ok) {
|
|
2366
2379
|
throw new Error(`Class ${classId} is not applied to element ${elementId}, cannot unapply it.`);
|
|
2367
2380
|
}
|
|
2368
|
-
return
|
|
2381
|
+
return {
|
|
2382
|
+
result: `Class ${classId} unapplied from element ${elementId} successfully.`
|
|
2383
|
+
};
|
|
2369
2384
|
}
|
|
2370
2385
|
});
|
|
2371
2386
|
}
|