@elementor/editor-global-classes 3.32.0-39 → 3.32.0-40

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
@@ -289,7 +289,7 @@ var globalClassesStylesProvider = (0, import_editor_styles_repository.createStyl
289
289
  singular: (0, import_i18n.__)("class", "elementor"),
290
290
  plural: (0, import_i18n.__)("classes", "elementor")
291
291
  },
292
- subscribe: (cb) => (0, import_store2.__subscribeWithSelector)((state) => state.globalClasses, cb),
292
+ subscribe: (cb) => subscribeWithStates(cb),
293
293
  capabilities: getCapabilities(),
294
294
  actions: {
295
295
  all: () => selectOrderedClasses((0, import_store2.__getState)()),
@@ -346,6 +346,16 @@ var globalClassesStylesProvider = (0, import_editor_styles_repository.createStyl
346
346
  }
347
347
  }
348
348
  });
349
+ var subscribeWithStates = (cb) => {
350
+ let previousState = selectData((0, import_store2.__getState)());
351
+ return (0, import_store2.__subscribeWithSelector)(
352
+ (state) => state.globalClasses,
353
+ (currentState) => {
354
+ cb(previousState.items, currentState.data.items);
355
+ previousState = currentState.data;
356
+ }
357
+ );
358
+ };
349
359
 
350
360
  // src/hooks/use-prefetch-css-class-usage.ts
351
361
  var import_query = require("@elementor/query");
@@ -575,6 +585,7 @@ var useFilters = () => {
575
585
 
576
586
  // src/save-global-classes.ts
577
587
  var import_store10 = require("@elementor/store");
588
+ var import_utils4 = require("@elementor/utils");
578
589
  async function saveGlobalClasses({ context: context2 }) {
579
590
  const state = selectData((0, import_store10.__getState)());
580
591
  if (context2 === "preview") {
@@ -599,22 +610,10 @@ function calculateChanges(state, initialData) {
599
610
  added: stateIds.filter((id2) => !initialDataIds.includes(id2)),
600
611
  deleted: initialDataIds.filter((id2) => !stateIds.includes(id2)),
601
612
  modified: stateIds.filter((id2) => {
602
- return id2 in initialData.items && hash(state.items[id2]) !== hash(initialData.items[id2]);
613
+ return id2 in initialData.items && (0, import_utils4.hash)(state.items[id2]) !== (0, import_utils4.hash)(initialData.items[id2]);
603
614
  })
604
615
  };
605
616
  }
606
- function hash(obj) {
607
- return JSON.stringify(
608
- obj,
609
- (_, value) => isPlainObject(value) ? Object.keys(value).sort().reduce((result, key) => {
610
- result[key] = value[key];
611
- return result;
612
- }, {}) : value
613
- );
614
- }
615
- function isPlainObject(value) {
616
- return !!value && typeof value === "object" && !Array.isArray(value);
617
- }
618
617
 
619
618
  // src/components/search-and-filter/components/filter/active-filters.tsx
620
619
  var React4 = __toESM(require("react"));