@elementor/editor-global-classes 4.0.0-609 → 4.0.0-621

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
@@ -455,11 +455,7 @@ var globalClassesStylesProvider = (0, import_editor_styles_repository.createStyl
455
455
  subscribe: (cb) => subscribeWithStates(cb),
456
456
  capabilities: getCapabilities(),
457
457
  actions: {
458
- all: () => {
459
- const selectAllClasses = selectOrderedClasses((0, import_store4.__getState)());
460
- localStorage.setItem("elementor-global-classes", JSON.stringify(selectAllClasses));
461
- return selectAllClasses;
462
- },
458
+ all: () => selectOrderedClasses((0, import_store4.__getState)()),
463
459
  get: (id2) => selectClass((0, import_store4.__getState)(), id2),
464
460
  resolveCssName: (id2) => {
465
461
  return selectClass((0, import_store4.__getState)(), id2)?.label ?? id2;
@@ -531,6 +527,11 @@ var subscribeWithStates = (cb) => {
531
527
 
532
528
  // src/mcp-integration/classes-resource.ts
533
529
  var GLOBAL_CLASSES_URI = "elementor://global-classes";
530
+ var STORAGE_KEY = "elementor-global-classes";
531
+ var updateLocalStorageCache = () => {
532
+ const classes = globalClassesStylesProvider.actions.all();
533
+ localStorage.setItem(STORAGE_KEY, JSON.stringify(classes));
534
+ };
534
535
  var initClassesResource = () => {
535
536
  const canvasMcpEntry = (0, import_editor_mcp.getMCPByDomain)("canvas");
536
537
  const classesMcpEntry = (0, import_editor_mcp.getMCPByDomain)("classes");
@@ -544,12 +545,14 @@ var initClassesResource = () => {
544
545
  },
545
546
  async () => {
546
547
  return {
547
- contents: [{ uri: GLOBAL_CLASSES_URI, text: localStorage["elementor-global-classes"] ?? "{}" }]
548
+ contents: [{ uri: GLOBAL_CLASSES_URI, text: localStorage[STORAGE_KEY] ?? "[]" }]
548
549
  };
549
550
  }
550
551
  );
551
552
  waitForReady().then(() => {
553
+ updateLocalStorageCache();
552
554
  globalClassesStylesProvider.subscribe(() => {
555
+ updateLocalStorageCache();
553
556
  mcpServer.sendResourceListChanged();
554
557
  });
555
558
  });