@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/dist/index.js CHANGED
@@ -299,7 +299,11 @@ var globalClassesStylesProvider = (0, import_editor_styles_repository.createStyl
299
299
  subscribe: (cb) => subscribeWithStates(cb),
300
300
  capabilities: getCapabilities(),
301
301
  actions: {
302
- all: () => selectOrderedClasses((0, import_store2.__getState)()),
302
+ all: () => {
303
+ const selectAllClasses = selectOrderedClasses((0, import_store2.__getState)());
304
+ localStorage.setItem("elementor-global-classes", JSON.stringify(selectAllClasses));
305
+ return selectAllClasses;
306
+ },
303
307
  get: (id2) => selectClass((0, import_store2.__getState)(), id2),
304
308
  resolveCssName: (id2) => {
305
309
  return selectClass((0, import_store2.__getState)(), id2)?.label ?? id2;
@@ -2040,7 +2044,26 @@ function PopulateStore() {
2040
2044
  }
2041
2045
 
2042
2046
  // src/mcp-integration/index.ts
2047
+ var import_editor_mcp2 = require("@elementor/editor-mcp");
2048
+
2049
+ // src/mcp-integration/classes-resource.ts
2043
2050
  var import_editor_mcp = require("@elementor/editor-mcp");
2051
+ var GLOBAL_CLASSES_URI = "elementor://classes";
2052
+ var initClassesResource = () => {
2053
+ const { mcpServer } = (0, import_editor_mcp.getMCPByDomain)("classes");
2054
+ mcpServer.resource(
2055
+ "global-classes",
2056
+ GLOBAL_CLASSES_URI,
2057
+ {
2058
+ description: "Global classes list."
2059
+ },
2060
+ async () => {
2061
+ return {
2062
+ contents: [{ uri: GLOBAL_CLASSES_URI, text: localStorage["elementor-global-classes"] ?? {} }]
2063
+ };
2064
+ }
2065
+ );
2066
+ };
2044
2067
 
2045
2068
  // src/mcp-integration/mcp-apply-unapply-global-classes.ts
2046
2069
  var import_editor_editing_panel = require("@elementor/editor-editing-panel");
@@ -2061,7 +2084,16 @@ function initMcpApplyUnapplyGlobalClasses(server) {
2061
2084
  appliedClasses: import_schema.z.array(
2062
2085
  import_schema.z.object({
2063
2086
  id: import_schema.z.string().describe("The ID of the class"),
2064
- label: import_schema.z.string().describe("The label of the class")
2087
+ label: import_schema.z.string().describe("The label of the class"),
2088
+ variants: import_schema.z.array(
2089
+ import_schema.z.object({
2090
+ meta: import_schema.z.object({
2091
+ breakpoint: import_schema.z.string().optional(),
2092
+ state: import_schema.z.string().optional()
2093
+ }),
2094
+ props: import_schema.z.record(import_schema.z.any())
2095
+ })
2096
+ )
2065
2097
  })
2066
2098
  )
2067
2099
  },
@@ -2072,8 +2104,18 @@ function initMcpApplyUnapplyGlobalClasses(server) {
2072
2104
  }
2073
2105
  const result = [];
2074
2106
  globalClassesProvider.actions.all().forEach((style) => {
2075
- const { id: id2, label } = style;
2076
- result.push({ id: id2, label });
2107
+ const { id: id2, label, variants } = style;
2108
+ result.push({
2109
+ id: id2,
2110
+ label,
2111
+ variants: variants.map((variant) => ({
2112
+ meta: {
2113
+ breakpoint: variant.meta.breakpoint,
2114
+ state: variant.meta.state
2115
+ },
2116
+ props: variant.props
2117
+ }))
2118
+ });
2077
2119
  });
2078
2120
  return { appliedClasses: result };
2079
2121
  }
@@ -2197,12 +2239,13 @@ function initMcpApplyGetGlobalClassUsages(reg) {
2197
2239
 
2198
2240
  // src/mcp-integration/index.ts
2199
2241
  var initMcpIntegration = () => {
2200
- const reg = (0, import_editor_mcp.getMCPByDomain)("element_classes");
2242
+ const reg = (0, import_editor_mcp2.getMCPByDomain)("classes");
2201
2243
  reg.setMCPDescription(
2202
2244
  "Tools for managing and applying Global CSS classes to elements within the Elementor editor."
2203
2245
  );
2204
2246
  initMcpApplyUnapplyGlobalClasses(reg);
2205
2247
  initMcpApplyGetGlobalClassUsages(reg);
2248
+ initClassesResource();
2206
2249
  };
2207
2250
 
2208
2251
  // src/sync-with-document.tsx