@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.mjs CHANGED
@@ -279,7 +279,11 @@ var globalClassesStylesProvider = createStylesProvider({
279
279
  subscribe: (cb) => subscribeWithStates(cb),
280
280
  capabilities: getCapabilities(),
281
281
  actions: {
282
- all: () => selectOrderedClasses(getState()),
282
+ all: () => {
283
+ const selectAllClasses = selectOrderedClasses(getState());
284
+ localStorage.setItem("elementor-global-classes", JSON.stringify(selectAllClasses));
285
+ return selectAllClasses;
286
+ },
283
287
  get: (id2) => selectClass(getState(), id2),
284
288
  resolveCssName: (id2) => {
285
289
  return selectClass(getState(), id2)?.label ?? id2;
@@ -2096,7 +2100,26 @@ function PopulateStore() {
2096
2100
  }
2097
2101
 
2098
2102
  // src/mcp-integration/index.ts
2103
+ import { getMCPByDomain as getMCPByDomain2 } from "@elementor/editor-mcp";
2104
+
2105
+ // src/mcp-integration/classes-resource.ts
2099
2106
  import { getMCPByDomain } from "@elementor/editor-mcp";
2107
+ var GLOBAL_CLASSES_URI = "elementor://classes";
2108
+ var initClassesResource = () => {
2109
+ const { mcpServer } = getMCPByDomain("classes");
2110
+ mcpServer.resource(
2111
+ "global-classes",
2112
+ GLOBAL_CLASSES_URI,
2113
+ {
2114
+ description: "Global classes list."
2115
+ },
2116
+ async () => {
2117
+ return {
2118
+ contents: [{ uri: GLOBAL_CLASSES_URI, text: localStorage["elementor-global-classes"] ?? {} }]
2119
+ };
2120
+ }
2121
+ );
2122
+ };
2100
2123
 
2101
2124
  // src/mcp-integration/mcp-apply-unapply-global-classes.ts
2102
2125
  import { doApplyClasses, doGetAppliedClasses, doUnapplyClass } from "@elementor/editor-editing-panel";
@@ -2117,7 +2140,16 @@ function initMcpApplyUnapplyGlobalClasses(server) {
2117
2140
  appliedClasses: z.array(
2118
2141
  z.object({
2119
2142
  id: z.string().describe("The ID of the class"),
2120
- label: z.string().describe("The label of the class")
2143
+ label: z.string().describe("The label of the class"),
2144
+ variants: z.array(
2145
+ z.object({
2146
+ meta: z.object({
2147
+ breakpoint: z.string().optional(),
2148
+ state: z.string().optional()
2149
+ }),
2150
+ props: z.record(z.any())
2151
+ })
2152
+ )
2121
2153
  })
2122
2154
  )
2123
2155
  },
@@ -2128,8 +2160,18 @@ function initMcpApplyUnapplyGlobalClasses(server) {
2128
2160
  }
2129
2161
  const result = [];
2130
2162
  globalClassesProvider.actions.all().forEach((style) => {
2131
- const { id: id2, label } = style;
2132
- result.push({ id: id2, label });
2163
+ const { id: id2, label, variants } = style;
2164
+ result.push({
2165
+ id: id2,
2166
+ label,
2167
+ variants: variants.map((variant) => ({
2168
+ meta: {
2169
+ breakpoint: variant.meta.breakpoint,
2170
+ state: variant.meta.state
2171
+ },
2172
+ props: variant.props
2173
+ }))
2174
+ });
2133
2175
  });
2134
2176
  return { appliedClasses: result };
2135
2177
  }
@@ -2253,12 +2295,13 @@ function initMcpApplyGetGlobalClassUsages(reg) {
2253
2295
 
2254
2296
  // src/mcp-integration/index.ts
2255
2297
  var initMcpIntegration = () => {
2256
- const reg = getMCPByDomain("element_classes");
2298
+ const reg = getMCPByDomain2("classes");
2257
2299
  reg.setMCPDescription(
2258
2300
  "Tools for managing and applying Global CSS classes to elements within the Elementor editor."
2259
2301
  );
2260
2302
  initMcpApplyUnapplyGlobalClasses(reg);
2261
2303
  initMcpApplyGetGlobalClassUsages(reg);
2304
+ initClassesResource();
2262
2305
  };
2263
2306
 
2264
2307
  // src/sync-with-document.tsx