@elementor/editor-global-classes 3.33.0-301 → 3.33.0-302

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/editor-global-classes",
3
- "version": "3.33.0-301",
3
+ "version": "3.33.0-302",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -39,24 +39,24 @@
39
39
  "dev": "tsup --config=../../tsup.dev.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@elementor/editor": "3.33.0-301",
43
- "@elementor/editor-current-user": "3.33.0-301",
44
- "@elementor/editor-documents": "3.33.0-301",
45
- "@elementor/editor-editing-panel": "3.33.0-301",
46
- "@elementor/editor-panels": "3.33.0-301",
47
- "@elementor/editor-props": "3.33.0-301",
48
- "@elementor/editor-styles": "3.33.0-301",
49
- "@elementor/editor-styles-repository": "3.33.0-301",
50
- "@elementor/editor-ui": "3.33.0-301",
51
- "@elementor/schema": "3.33.0-301",
52
- "@elementor/editor-mcp": "3.33.0-301",
53
- "@elementor/editor-v1-adapters": "3.33.0-301",
54
- "@elementor/http-client": "3.33.0-301",
42
+ "@elementor/editor": "3.33.0-302",
43
+ "@elementor/editor-current-user": "3.33.0-302",
44
+ "@elementor/editor-documents": "3.33.0-302",
45
+ "@elementor/editor-editing-panel": "3.33.0-302",
46
+ "@elementor/editor-panels": "3.33.0-302",
47
+ "@elementor/editor-props": "3.33.0-302",
48
+ "@elementor/editor-styles": "3.33.0-302",
49
+ "@elementor/editor-styles-repository": "3.33.0-302",
50
+ "@elementor/editor-ui": "3.33.0-302",
51
+ "@elementor/schema": "3.33.0-302",
52
+ "@elementor/editor-mcp": "3.33.0-302",
53
+ "@elementor/editor-v1-adapters": "3.33.0-302",
54
+ "@elementor/http-client": "3.33.0-302",
55
55
  "@elementor/icons": "^1.61.0",
56
- "@elementor/query": "3.33.0-301",
57
- "@elementor/store": "3.33.0-301",
56
+ "@elementor/query": "3.33.0-302",
57
+ "@elementor/store": "3.33.0-302",
58
58
  "@elementor/ui": "1.36.17",
59
- "@elementor/utils": "3.33.0-301",
59
+ "@elementor/utils": "3.33.0-302",
60
60
  "@wordpress/i18n": "^5.13.0"
61
61
  },
62
62
  "peerDependencies": {
@@ -33,7 +33,11 @@ export const globalClassesStylesProvider = createStylesProvider( {
33
33
  subscribe: ( cb ) => subscribeWithStates( cb ),
34
34
  capabilities: getCapabilities(),
35
35
  actions: {
36
- all: () => selectOrderedClasses( getState() ),
36
+ all: () => {
37
+ const selectAllClasses = selectOrderedClasses( getState() );
38
+ localStorage.setItem( 'elementor-global-classes', JSON.stringify( selectAllClasses ) );
39
+ return selectAllClasses;
40
+ },
37
41
  get: ( id ) => selectClass( getState(), id ),
38
42
  resolveCssName: ( id: string ) => {
39
43
  return selectClass( getState(), id )?.label ?? id;
@@ -0,0 +1,20 @@
1
+ import { getMCPByDomain } from '@elementor/editor-mcp';
2
+
3
+ export const GLOBAL_CLASSES_URI = 'elementor://classes';
4
+
5
+ export const initClassesResource = () => {
6
+ const { mcpServer } = getMCPByDomain( 'classes' );
7
+
8
+ mcpServer.resource(
9
+ 'global-classes',
10
+ GLOBAL_CLASSES_URI,
11
+ {
12
+ description: 'Global classes list.',
13
+ },
14
+ async () => {
15
+ return {
16
+ contents: [ { uri: GLOBAL_CLASSES_URI, text: localStorage[ 'elementor-global-classes' ] ?? {} } ],
17
+ };
18
+ }
19
+ );
20
+ };
@@ -1,13 +1,15 @@
1
1
  import { getMCPByDomain } from '@elementor/editor-mcp';
2
2
 
3
+ import { initClassesResource } from './classes-resource';
3
4
  import initMcpApplyUnapplyGlobalClasses from './mcp-apply-unapply-global-classes';
4
5
  import initMcpApplyGetGlobalClassUsages from './mcp-get-global-class-usages';
5
6
 
6
7
  export const initMcpIntegration = () => {
7
- const reg = getMCPByDomain( 'element_classes' );
8
+ const reg = getMCPByDomain( 'classes' );
8
9
  reg.setMCPDescription(
9
10
  'Tools for managing and applying Global CSS classes to elements within the Elementor editor.'
10
11
  );
11
12
  initMcpApplyUnapplyGlobalClasses( reg );
12
13
  initMcpApplyGetGlobalClassUsages( reg );
14
+ initClassesResource();
13
15
  };
@@ -19,6 +19,15 @@ export default function initMcpApplyUnapplyGlobalClasses( server: MCPRegistryEnt
19
19
  z.object( {
20
20
  id: z.string().describe( 'The ID of the class' ),
21
21
  label: z.string().describe( 'The label of the class' ),
22
+ variants: z.array(
23
+ z.object( {
24
+ meta: z.object( {
25
+ breakpoint: z.string().optional(),
26
+ state: z.string().optional(),
27
+ } ),
28
+ props: z.record( z.any() ),
29
+ } )
30
+ ),
22
31
  } )
23
32
  ),
24
33
  },
@@ -27,10 +36,27 @@ export default function initMcpApplyUnapplyGlobalClasses( server: MCPRegistryEnt
27
36
  if ( ! globalClassesProvider ) {
28
37
  throw new Error( 'Global classes provider not found' );
29
38
  }
30
- const result: { id: string; label: string }[] = [];
39
+ const result: {
40
+ id: string;
41
+ label: string;
42
+ variants: {
43
+ meta: { breakpoint?: string | undefined; state?: string | undefined };
44
+ props: Record< string, unknown >;
45
+ }[];
46
+ }[] = [];
31
47
  globalClassesProvider.actions.all().forEach( ( style ) => {
32
- const { id, label } = style;
33
- result.push( { id, label } );
48
+ const { id, label, variants } = style;
49
+ result.push( {
50
+ id,
51
+ label,
52
+ variants: variants.map( ( variant ) => ( {
53
+ meta: {
54
+ breakpoint: variant.meta.breakpoint as string | undefined,
55
+ state: variant.meta.state as string | undefined,
56
+ },
57
+ props: variant.props as Record< string, unknown >,
58
+ } ) ),
59
+ } );
34
60
  } );
35
61
  return { appliedClasses: result };
36
62
  },