@elementor/editor-global-classes 4.1.0-838 → 4.1.0-beta2
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.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +136 -94
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +133 -91
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -20
- package/src/components/class-manager/global-classes-list.tsx +3 -2
- package/src/components/global-styles-import-listener.tsx +21 -12
- package/src/components/open-panel-from-event.tsx +19 -0
- package/src/global-classes-styles-provider.ts +1 -1
- package/src/init.ts +15 -1
- package/src/mcp-integration/apply-global-class-guide-prompt.ts +39 -0
- package/src/mcp-integration/index.ts +0 -10
- package/src/mcp-integration/mcp-apply-unapply-global-classes.ts +28 -40
- package/src/mcp-integration/mcp-get-global-class-usages.ts +8 -11
- package/src/mcp-integration/mcp-manage-global-classes.ts +1 -9
- package/src/save-global-classes.tsx +4 -1
- package/src/store.ts +29 -0
- package/src/utils/create-labels-for-classes.ts +4 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { StyleDefinitionID } from '@elementor/editor-styles';
|
|
2
|
+
import { StyleDefinitionID, StyleDefinition } from '@elementor/editor-styles';
|
|
3
3
|
|
|
4
4
|
type ClassManagerPanelEmbeddedProps = {
|
|
5
5
|
onRequestClose: () => void | Promise<void>;
|
|
@@ -20,6 +20,6 @@ type GlobalClassIndexEntry = {
|
|
|
20
20
|
|
|
21
21
|
declare function addDocumentClasses(documentId: number): Promise<void>;
|
|
22
22
|
|
|
23
|
-
declare function createLabelsForClasses(entries: GlobalClassIndexEntry
|
|
23
|
+
declare function createLabelsForClasses(entries: Array<GlobalClassIndexEntry | StyleDefinition>): Record<StyleDefinitionID, string>;
|
|
24
24
|
|
|
25
25
|
export { ClassManagerPanelEmbedded, type ClassManagerPanelEmbeddedProps, GLOBAL_CLASSES_URI, type GlobalClassIndexEntry, addDocumentClasses, createLabelsForClasses, init, loadExistingClasses };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { StyleDefinitionID } from '@elementor/editor-styles';
|
|
2
|
+
import { StyleDefinitionID, StyleDefinition } from '@elementor/editor-styles';
|
|
3
3
|
|
|
4
4
|
type ClassManagerPanelEmbeddedProps = {
|
|
5
5
|
onRequestClose: () => void | Promise<void>;
|
|
@@ -20,6 +20,6 @@ type GlobalClassIndexEntry = {
|
|
|
20
20
|
|
|
21
21
|
declare function addDocumentClasses(documentId: number): Promise<void>;
|
|
22
22
|
|
|
23
|
-
declare function createLabelsForClasses(entries: GlobalClassIndexEntry
|
|
23
|
+
declare function createLabelsForClasses(entries: Array<GlobalClassIndexEntry | StyleDefinition>): Record<StyleDefinitionID, string>;
|
|
24
24
|
|
|
25
25
|
export { ClassManagerPanelEmbedded, type ClassManagerPanelEmbeddedProps, GLOBAL_CLASSES_URI, type GlobalClassIndexEntry, addDocumentClasses, createLabelsForClasses, init, loadExistingClasses };
|
package/dist/index.js
CHANGED
|
@@ -282,6 +282,20 @@ var slice = (0, import_store.__createSlice)({
|
|
|
282
282
|
state.classLabels[id2] = previewClassData.label;
|
|
283
283
|
}
|
|
284
284
|
});
|
|
285
|
+
},
|
|
286
|
+
setOrderWithoutHistory(state, { payload }) {
|
|
287
|
+
state.data.order = payload;
|
|
288
|
+
},
|
|
289
|
+
updateAfterTemplateImport(state, {
|
|
290
|
+
payload
|
|
291
|
+
}) {
|
|
292
|
+
state.initialData.frontend.items = { ...state.initialData.frontend.items, ...payload.addedItems };
|
|
293
|
+
state.initialData.frontend.order = [...state.initialData.frontend.order, ...payload.addedIdsOrder];
|
|
294
|
+
state.initialData.preview.items = { ...state.initialData.preview.items, ...payload.addedItems };
|
|
295
|
+
state.initialData.preview.order = [...state.initialData.preview.order, ...payload.addedIdsOrder];
|
|
296
|
+
state.data.items = { ...state.data.items, ...payload.addedItems };
|
|
297
|
+
state.data.order = [...state.data.order, ...payload.addedIdsOrder];
|
|
298
|
+
state.classLabels = { ...state.classLabels, ...payload.addedClassLabels };
|
|
285
299
|
}
|
|
286
300
|
}
|
|
287
301
|
});
|
|
@@ -844,10 +858,12 @@ function calculateChanges(state, initialData) {
|
|
|
844
858
|
const initialDataIds = Object.keys(initialData.items);
|
|
845
859
|
const { order: stateOrder } = state;
|
|
846
860
|
const { order: initialDataOrder } = initialData;
|
|
861
|
+
const stateOrderIdSet = new Set(stateOrder);
|
|
862
|
+
const deleted = initialDataOrder.filter((id2) => !stateOrderIdSet.has(id2));
|
|
847
863
|
const order = stateOrder.join(";") !== initialDataOrder.join(";");
|
|
848
864
|
return {
|
|
849
865
|
added: stateIds.filter((id2) => !initialDataIds.includes(id2)),
|
|
850
|
-
deleted
|
|
866
|
+
deleted,
|
|
851
867
|
modified: stateIds.filter((id2) => {
|
|
852
868
|
return id2 in initialData.items && (0, import_utils4.hash)(state.items[id2]) !== (0, import_utils4.hash)(initialData.items[id2]);
|
|
853
869
|
}),
|
|
@@ -2028,8 +2044,9 @@ var useFilteredCssClasses = () => {
|
|
|
2028
2044
|
[cssClasses]
|
|
2029
2045
|
);
|
|
2030
2046
|
const filteredClasses = (0, import_react8.useMemo)(() => {
|
|
2031
|
-
|
|
2032
|
-
|
|
2047
|
+
const normalizedSearch = searchValue.replace(/[^a-zA-Z0-9_-]/g, "").toLowerCase();
|
|
2048
|
+
if (normalizedSearch.length > 1) {
|
|
2049
|
+
return lowercaseLabels.filter((cssClass) => cssClass.lowerLabel.includes(normalizedSearch));
|
|
2033
2050
|
}
|
|
2034
2051
|
return cssClasses;
|
|
2035
2052
|
}, [searchValue, cssClasses, lowercaseLabels]);
|
|
@@ -2527,7 +2544,7 @@ async function fetchAndMergeClasses() {
|
|
|
2527
2544
|
}
|
|
2528
2545
|
|
|
2529
2546
|
// src/global-classes-styles-provider.ts
|
|
2530
|
-
var MAX_CLASSES =
|
|
2547
|
+
var MAX_CLASSES = 1e3;
|
|
2531
2548
|
var GLOBAL_CLASSES_PROVIDER_KEY = "global-classes";
|
|
2532
2549
|
var PREGENERATED_LINK_PATTERN = /^global-([0-9]+-)?(preview|frontend)-[a-zA-Z_-]+-css$/;
|
|
2533
2550
|
var globalClassesStylesProvider = (0, import_editor_styles_repository2.createStylesProvider)({
|
|
@@ -2666,7 +2683,7 @@ var initClassesResource = (classesMcpEntry, canvasMcpEntry) => {
|
|
|
2666
2683
|
// src/init.ts
|
|
2667
2684
|
var import_editor = require("@elementor/editor");
|
|
2668
2685
|
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
2669
|
-
var
|
|
2686
|
+
var import_editor_mcp2 = require("@elementor/editor-mcp");
|
|
2670
2687
|
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
2671
2688
|
var import_editor_styles_repository5 = require("@elementor/editor-styles-repository");
|
|
2672
2689
|
var import_editor_v1_adapters8 = require("@elementor/editor-v1-adapters");
|
|
@@ -2818,17 +2835,20 @@ var import_store28 = require("@elementor/store");
|
|
|
2818
2835
|
function GlobalStylesImportListener() {
|
|
2819
2836
|
const dispatch7 = (0, import_store28.__useDispatch)();
|
|
2820
2837
|
(0, import_react11.useEffect)(() => {
|
|
2821
|
-
const handleGlobalStylesImported = (event) => {
|
|
2822
|
-
const
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
preview: items,
|
|
2828
|
-
frontend: items
|
|
2829
|
-
})
|
|
2830
|
-
);
|
|
2838
|
+
const handleGlobalStylesImported = async (event) => {
|
|
2839
|
+
const customEvent = event;
|
|
2840
|
+
const globalClasses = customEvent.detail?.global_classes;
|
|
2841
|
+
if (!globalClasses?.added_items_order || !globalClasses?.added_items || globalClasses?.added_items_order?.length === 0) {
|
|
2842
|
+
loadCurrentDocumentClasses();
|
|
2843
|
+
return;
|
|
2831
2844
|
}
|
|
2845
|
+
dispatch7(
|
|
2846
|
+
slice.actions.updateAfterTemplateImport({
|
|
2847
|
+
addedItems: globalClasses.added_items,
|
|
2848
|
+
addedIdsOrder: globalClasses.added_items_order,
|
|
2849
|
+
addedClassLabels: createLabelsForClasses(Object.values(globalClasses.added_items))
|
|
2850
|
+
})
|
|
2851
|
+
);
|
|
2832
2852
|
};
|
|
2833
2853
|
window.addEventListener(import_editor_canvas.GLOBAL_STYLES_IMPORTED_EVENT, handleGlobalStylesImported);
|
|
2834
2854
|
return () => {
|
|
@@ -2838,16 +2858,29 @@ function GlobalStylesImportListener() {
|
|
|
2838
2858
|
return null;
|
|
2839
2859
|
}
|
|
2840
2860
|
|
|
2841
|
-
// src/components/open-panel-from-
|
|
2861
|
+
// src/components/open-panel-from-event.tsx
|
|
2842
2862
|
var import_react12 = require("react");
|
|
2863
|
+
var EVENT_OPEN_GLOBAL_CLASSES_MANAGER = "elementor/open-global-classes-manager";
|
|
2864
|
+
function OpenPanelFromEvent() {
|
|
2865
|
+
const { open } = usePanelActions();
|
|
2866
|
+
(0, import_react12.useEffect)(() => {
|
|
2867
|
+
const handler2 = () => open();
|
|
2868
|
+
window.addEventListener(EVENT_OPEN_GLOBAL_CLASSES_MANAGER, handler2);
|
|
2869
|
+
return () => window.removeEventListener(EVENT_OPEN_GLOBAL_CLASSES_MANAGER, handler2);
|
|
2870
|
+
}, [open]);
|
|
2871
|
+
return null;
|
|
2872
|
+
}
|
|
2873
|
+
|
|
2874
|
+
// src/components/open-panel-from-url.tsx
|
|
2875
|
+
var import_react13 = require("react");
|
|
2843
2876
|
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2844
2877
|
var ACTIVE_PANEL_PARAM = "active-panel";
|
|
2845
2878
|
var PANEL_ID = "global-classes-manager";
|
|
2846
2879
|
var DEFAULT_PANEL_ROUTE = "panel/elements";
|
|
2847
2880
|
function OpenPanelFromUrl() {
|
|
2848
2881
|
const { open } = usePanelActions();
|
|
2849
|
-
const hasOpened = (0,
|
|
2850
|
-
(0,
|
|
2882
|
+
const hasOpened = (0, import_react13.useRef)(false);
|
|
2883
|
+
(0, import_react13.useEffect)(() => {
|
|
2851
2884
|
const urlParams = new URLSearchParams(window.location.search);
|
|
2852
2885
|
const activePanel = urlParams.get(ACTIVE_PANEL_PARAM);
|
|
2853
2886
|
if (activePanel !== PANEL_ID) {
|
|
@@ -2868,10 +2901,10 @@ function OpenPanelFromUrl() {
|
|
|
2868
2901
|
}
|
|
2869
2902
|
|
|
2870
2903
|
// src/components/populate-store.tsx
|
|
2871
|
-
var
|
|
2904
|
+
var import_react14 = require("react");
|
|
2872
2905
|
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
2873
2906
|
function PopulateStore() {
|
|
2874
|
-
(0,
|
|
2907
|
+
(0, import_react14.useEffect)(() => {
|
|
2875
2908
|
loadCurrentDocumentClasses();
|
|
2876
2909
|
(0, import_editor_v1_adapters5.registerDataHook)("after", "editor/documents/attach-preview", async () => {
|
|
2877
2910
|
await loadCurrentDocumentClasses();
|
|
@@ -2883,24 +2916,15 @@ function PopulateStore() {
|
|
|
2883
2916
|
// src/mcp-integration/mcp-apply-unapply-global-classes.ts
|
|
2884
2917
|
var import_editor_editing_panel = require("@elementor/editor-editing-panel");
|
|
2885
2918
|
var import_schema = require("@elementor/schema");
|
|
2886
|
-
function initMcpApplyUnapplyGlobalClasses(server) {
|
|
2887
|
-
server.addTool({
|
|
2888
|
-
schema: {
|
|
2889
|
-
classId: import_schema.z.string().describe("The ID of the class to apply"),
|
|
2890
|
-
elementId: import_schema.z.string().describe("The ID of the element to which the class will be applied")
|
|
2891
|
-
},
|
|
2892
|
-
outputSchema: {
|
|
2893
|
-
result: import_schema.z.string().describe("Result message indicating the success of the apply operation"),
|
|
2894
|
-
llm_instructions: import_schema.z.string().describe("Instructions what to do next, Important to follow these instructions!")
|
|
2895
|
-
},
|
|
2896
|
-
name: "apply-global-class",
|
|
2897
|
-
modelPreferences: {
|
|
2898
|
-
intelligencePriority: 0.7,
|
|
2899
|
-
speedPriority: 0.8
|
|
2900
|
-
},
|
|
2901
|
-
description: `Apply a global class to an element, enabling consistent styling through your design system.
|
|
2902
2919
|
|
|
2903
|
-
|
|
2920
|
+
// src/mcp-integration/apply-global-class-guide-prompt.ts
|
|
2921
|
+
var import_editor_mcp = require("@elementor/editor-mcp");
|
|
2922
|
+
var APPLY_GLOBAL_CLASS_GUIDE_URI = "elementor://global-classes/tools/apply-global-class-guide";
|
|
2923
|
+
var generateApplyGlobalClassGuidePrompt = () => {
|
|
2924
|
+
const prompt = (0, import_editor_mcp.toolPrompts)("apply-global-class");
|
|
2925
|
+
prompt.description("Apply a global class to an element, enabling consistent styling through your design system.");
|
|
2926
|
+
prompt.instruction(
|
|
2927
|
+
`## When to use this tool:
|
|
2904
2928
|
**ALWAYS use this IMMEDIATELY AFTER building compositions** to apply the global classes you created beforehand:
|
|
2905
2929
|
- After using "build-compositions" tool, apply semantic classes to the created elements
|
|
2906
2930
|
- When applying consistent typography styles (heading-primary, text-body, etc.)
|
|
@@ -2909,18 +2933,59 @@ function initMcpApplyUnapplyGlobalClasses(server) {
|
|
|
2909
2933
|
|
|
2910
2934
|
**DO NOT use this tool** for:
|
|
2911
2935
|
- Elements that don't share styles with other elements (use inline styles instead)
|
|
2912
|
-
- Layout-specific properties (those should remain inline in stylesConfig)
|
|
2913
|
-
|
|
2914
|
-
|
|
2936
|
+
- Layout-specific properties (those should remain inline in stylesConfig)`
|
|
2937
|
+
);
|
|
2938
|
+
prompt.instruction(
|
|
2939
|
+
`## Prerequisites:
|
|
2915
2940
|
- **REQUIRED**: Get the list of available global classes from 'elementor://global-classes' resource
|
|
2916
2941
|
- **REQUIRED**: Get element IDs from the composition XML returned by "build-compositions" tool
|
|
2917
2942
|
- Ensure you have the most up-to-date list of classes applied to the element to avoid duplicates
|
|
2918
|
-
- Make sure you have the correct class ID that you want to apply
|
|
2919
|
-
|
|
2920
|
-
|
|
2943
|
+
- Make sure you have the correct class ID that you want to apply`
|
|
2944
|
+
);
|
|
2945
|
+
prompt.instruction(
|
|
2946
|
+
`## Best Practices:
|
|
2921
2947
|
1. Apply multiple classes to a single element if needed (typography + color + spacing)
|
|
2922
2948
|
2. After applying, the tool will remind you to remove duplicate inline styles from elementConfig
|
|
2923
|
-
3. Classes should describe purpose, not implementation (e.g., "heading-primary" not "big-red-text")
|
|
2949
|
+
3. Classes should describe purpose, not implementation (e.g., "heading-primary" not "big-red-text")`
|
|
2950
|
+
);
|
|
2951
|
+
return prompt.prompt();
|
|
2952
|
+
};
|
|
2953
|
+
|
|
2954
|
+
// src/mcp-integration/mcp-apply-unapply-global-classes.ts
|
|
2955
|
+
function initMcpApplyUnapplyGlobalClasses(server) {
|
|
2956
|
+
const { addTool, resource } = server;
|
|
2957
|
+
const applyGlobalClassGuideText = generateApplyGlobalClassGuidePrompt();
|
|
2958
|
+
resource(
|
|
2959
|
+
"apply-global-class-guide",
|
|
2960
|
+
APPLY_GLOBAL_CLASS_GUIDE_URI,
|
|
2961
|
+
{
|
|
2962
|
+
description: "Workflow, prerequisites, and best practices for apply-global-class",
|
|
2963
|
+
mimeType: "text/plain",
|
|
2964
|
+
title: "Apply global class tool guide"
|
|
2965
|
+
},
|
|
2966
|
+
async (uri) => ({
|
|
2967
|
+
contents: [{ mimeType: "text/plain", text: applyGlobalClassGuideText, uri: uri.href }]
|
|
2968
|
+
})
|
|
2969
|
+
);
|
|
2970
|
+
addTool({
|
|
2971
|
+
schema: {
|
|
2972
|
+
classId: import_schema.z.string().describe("The ID of the class to apply"),
|
|
2973
|
+
elementId: import_schema.z.string().describe("The ID of the element to which the class will be applied")
|
|
2974
|
+
},
|
|
2975
|
+
outputSchema: {
|
|
2976
|
+
result: import_schema.z.string().describe("Result message indicating the success of the apply operation"),
|
|
2977
|
+
llm_instructions: import_schema.z.string().describe("Instructions what to do next, Important to follow these instructions!")
|
|
2978
|
+
},
|
|
2979
|
+
name: "apply-global-class",
|
|
2980
|
+
modelPreferences: {
|
|
2981
|
+
intelligencePriority: 0.7,
|
|
2982
|
+
speedPriority: 0.8
|
|
2983
|
+
},
|
|
2984
|
+
description: `Apply a global class to an element for shared design-system styling. Read the full guide at [${APPLY_GLOBAL_CLASS_GUIDE_URI}].`,
|
|
2985
|
+
requiredResources: [
|
|
2986
|
+
{ description: "Apply global class tool guide", uri: APPLY_GLOBAL_CLASS_GUIDE_URI },
|
|
2987
|
+
{ description: "Global classes list", uri: GLOBAL_CLASSES_URI }
|
|
2988
|
+
],
|
|
2924
2989
|
handler: async (params) => {
|
|
2925
2990
|
const { classId, elementId } = params;
|
|
2926
2991
|
const appliedClasses = (0, import_editor_editing_panel.doGetAppliedClasses)(elementId);
|
|
@@ -2931,7 +2996,7 @@ function initMcpApplyUnapplyGlobalClasses(server) {
|
|
|
2931
2996
|
};
|
|
2932
2997
|
}
|
|
2933
2998
|
});
|
|
2934
|
-
|
|
2999
|
+
addTool({
|
|
2935
3000
|
name: "unapply-global-class",
|
|
2936
3001
|
schema: {
|
|
2937
3002
|
classId: import_schema.z.string().describe("The ID of the class to unapply"),
|
|
@@ -2944,21 +3009,8 @@ function initMcpApplyUnapplyGlobalClasses(server) {
|
|
|
2944
3009
|
intelligencePriority: 0.7,
|
|
2945
3010
|
speedPriority: 0.8
|
|
2946
3011
|
},
|
|
2947
|
-
description: `Unapply a
|
|
2948
|
-
|
|
2949
|
-
## When to use this tool:
|
|
2950
|
-
- When a user requests to unapply a global class or a class from an element in the Elementor editor.
|
|
2951
|
-
- When you need to remove a specific class from an element's applied classes.
|
|
2952
|
-
|
|
2953
|
-
## Prerequisites:
|
|
2954
|
-
- Ensure you have the most up-to-date list of classes applied to the element to avoid errors.
|
|
2955
|
-
The list is available at always up-to-date resource 'elementor://global-classes'.
|
|
2956
|
-
- Make sure you have the correct class ID that you want to unapply.
|
|
2957
|
-
|
|
2958
|
-
<note>
|
|
2959
|
-
If the user want to unapply a class by it's name and not ID, retrieve the id from the list, available at uri elementor://global-classes
|
|
2960
|
-
</note>
|
|
2961
|
-
`,
|
|
3012
|
+
description: `Unapply a global class from an element by class ID. Resolve class names to IDs via [${GLOBAL_CLASSES_URI}].`,
|
|
3013
|
+
requiredResources: [{ description: "Global classes list", uri: GLOBAL_CLASSES_URI }],
|
|
2962
3014
|
handler: async (params) => {
|
|
2963
3015
|
const { classId, elementId } = params;
|
|
2964
3016
|
const ok = (0, import_editor_editing_panel.doUnapplyClass)(elementId, classId);
|
|
@@ -2999,19 +3051,15 @@ function initMcpApplyGetGlobalClassUsages(reg) {
|
|
|
2999
3051
|
intelligencePriority: 0.6,
|
|
3000
3052
|
speedPriority: 0.8
|
|
3001
3053
|
},
|
|
3002
|
-
description: `Retrieve
|
|
3003
|
-
|
|
3004
|
-
## Prerequisites: CRITICAL
|
|
3005
|
-
- The list of global classes and their applid values is available at resource uri elementor://global-classes
|
|
3054
|
+
description: `Retrieve usages of global classes across all Elementor pages. Heavy operation \u2014 scans every page in the site.
|
|
3006
3055
|
|
|
3007
|
-
## When to use
|
|
3008
|
-
-
|
|
3009
|
-
-
|
|
3010
|
-
- Before deleting a global class, to ensure it is not in use in any other pages.
|
|
3056
|
+
## When to use:
|
|
3057
|
+
- Before deleting or radically changing a class \u2014 to understand cross-page side effects and decide whether to consult the user.
|
|
3058
|
+
- To identify unused global classes for cleanup.
|
|
3011
3059
|
|
|
3012
|
-
## When NOT to use
|
|
3013
|
-
-
|
|
3014
|
-
|
|
3060
|
+
## When NOT to use:
|
|
3061
|
+
- To list global classes themselves \u2014 use the global-classes resource instead (this tool returns usages, not the class list).`,
|
|
3062
|
+
requiredResources: [{ description: "Global classes list", uri: GLOBAL_CLASSES_URI }],
|
|
3015
3063
|
outputSchema: globalClassesUsageSchema,
|
|
3016
3064
|
handler: async () => {
|
|
3017
3065
|
const data = await fetchCssClassUsage();
|
|
@@ -3211,15 +3259,7 @@ var initManageGlobalClasses = (reg) => {
|
|
|
3211
3259
|
intelligencePriority: 0.85,
|
|
3212
3260
|
speedPriority: 0.6
|
|
3213
3261
|
},
|
|
3214
|
-
description: `
|
|
3215
|
-
|
|
3216
|
-
CREATE: Requires globalClassName, props. Use semantic naming (heading-primary, button-cta, text-muted). Check existing classes to avoid duplicates. ALWAYS create global classes BEFORE compositions for reusable styles.
|
|
3217
|
-
MODIFY: Requires classId, props. Get classId from [elementor://global-classes] resource.
|
|
3218
|
-
|
|
3219
|
-
Naming pattern: [element-type]-[purpose/variant]-[modifier]
|
|
3220
|
-
DO NOT create global classes for: one-off styles, layout-specific properties.
|
|
3221
|
-
|
|
3222
|
-
Use style schema at [elementor://styles/schema/{category}] for valid props. Errors include exact schema mismatch details.`,
|
|
3262
|
+
description: `Create or modify global classes for reusable design-system styling. Class names must reflect purpose (e.g. heading-primary, button-cta). Create classes BEFORE compositions. Do NOT create classes for one-off styles or layout-specific properties.`,
|
|
3223
3263
|
schema,
|
|
3224
3264
|
outputSchema,
|
|
3225
3265
|
handler
|
|
@@ -3309,16 +3349,6 @@ async function attemptDelete(opts) {
|
|
|
3309
3349
|
|
|
3310
3350
|
// src/mcp-integration/index.ts
|
|
3311
3351
|
var initMcpIntegration = (reg, canvasMcpEntry) => {
|
|
3312
|
-
const { setMCPDescription } = reg;
|
|
3313
|
-
setMCPDescription(
|
|
3314
|
-
`Everything related to V4 ( Atomic ) global classes.
|
|
3315
|
-
# Global classes
|
|
3316
|
-
- Create/update/delete global classes
|
|
3317
|
-
- Get list of global classes
|
|
3318
|
-
- Get details of a global class
|
|
3319
|
-
- Get details of a global class
|
|
3320
|
-
`
|
|
3321
|
-
);
|
|
3322
3352
|
initMcpApplyUnapplyGlobalClasses(reg);
|
|
3323
3353
|
initMcpApplyGetGlobalClassUsages(reg);
|
|
3324
3354
|
initManageGlobalClasses(reg);
|
|
@@ -3326,7 +3356,7 @@ var initMcpIntegration = (reg, canvasMcpEntry) => {
|
|
|
3326
3356
|
};
|
|
3327
3357
|
|
|
3328
3358
|
// src/sync-with-document.tsx
|
|
3329
|
-
var
|
|
3359
|
+
var import_react15 = require("react");
|
|
3330
3360
|
var import_editor_v1_adapters7 = require("@elementor/editor-v1-adapters");
|
|
3331
3361
|
|
|
3332
3362
|
// src/sync-with-document-save.ts
|
|
@@ -3391,7 +3421,7 @@ function isDirty() {
|
|
|
3391
3421
|
// src/sync-with-document.tsx
|
|
3392
3422
|
function SyncWithDocumentSave() {
|
|
3393
3423
|
const { open: openClassPanel } = usePanelActions();
|
|
3394
|
-
(0,
|
|
3424
|
+
(0, import_react15.useEffect)(() => {
|
|
3395
3425
|
const unsubscribe = (0, import_editor_v1_adapters7.__privateListenTo)((0, import_editor_v1_adapters7.v1ReadyEvent)(), () => {
|
|
3396
3426
|
const open = (0, import_editor_v1_adapters7.isExperimentActive)("e_editor_design_system_panel") ? () => {
|
|
3397
3427
|
window.dispatchEvent(new CustomEvent("elementor/open-global-classes-manager"));
|
|
@@ -3431,6 +3461,10 @@ function init() {
|
|
|
3431
3461
|
id: "global-classes-open-panel-from-url",
|
|
3432
3462
|
component: OpenPanelFromUrl
|
|
3433
3463
|
});
|
|
3464
|
+
(0, import_editor.injectIntoLogic)({
|
|
3465
|
+
id: "global-classes-open-panel-from-event",
|
|
3466
|
+
component: OpenPanelFromEvent
|
|
3467
|
+
});
|
|
3434
3468
|
}
|
|
3435
3469
|
(0, import_editor_editing_panel2.injectIntoCssClassConvert)({
|
|
3436
3470
|
id: "global-classes-convert-from-local-class",
|
|
@@ -3445,8 +3479,16 @@ function init() {
|
|
|
3445
3479
|
getThemeColor: (theme) => theme.palette.global.dark
|
|
3446
3480
|
});
|
|
3447
3481
|
initMcpIntegration(
|
|
3448
|
-
(0,
|
|
3449
|
-
|
|
3482
|
+
(0, import_editor_mcp2.getMCPByDomain)("classes", {
|
|
3483
|
+
instructions: "MCP server for management of Elementor global classes",
|
|
3484
|
+
docs: `Everything related to V4 ( Atomic ) global classes.
|
|
3485
|
+
# Global classes
|
|
3486
|
+
- Create/update/delete global classes
|
|
3487
|
+
- Get list of global classes
|
|
3488
|
+
- Get details of a global class
|
|
3489
|
+
`
|
|
3490
|
+
}),
|
|
3491
|
+
(0, import_editor_mcp2.getMCPByDomain)("canvas")
|
|
3450
3492
|
);
|
|
3451
3493
|
}
|
|
3452
3494
|
// Annotate the CommonJS export names for ESM import in node:
|