@elementor/editor-global-classes 3.32.0-39 → 3.32.0-41
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 +13 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/global-classes-styles-provider.ts +24 -3
- package/src/save-global-classes.ts +1 -22
package/dist/index.mjs
CHANGED
|
@@ -269,7 +269,7 @@ var globalClassesStylesProvider = createStylesProvider({
|
|
|
269
269
|
singular: __("class", "elementor"),
|
|
270
270
|
plural: __("classes", "elementor")
|
|
271
271
|
},
|
|
272
|
-
subscribe: (cb) =>
|
|
272
|
+
subscribe: (cb) => subscribeWithStates(cb),
|
|
273
273
|
capabilities: getCapabilities(),
|
|
274
274
|
actions: {
|
|
275
275
|
all: () => selectOrderedClasses(getState()),
|
|
@@ -326,6 +326,16 @@ var globalClassesStylesProvider = createStylesProvider({
|
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
328
|
});
|
|
329
|
+
var subscribeWithStates = (cb) => {
|
|
330
|
+
let previousState = selectData(getState());
|
|
331
|
+
return subscribeWithSelector(
|
|
332
|
+
(state) => state.globalClasses,
|
|
333
|
+
(currentState) => {
|
|
334
|
+
cb(previousState.items, currentState.data.items);
|
|
335
|
+
previousState = currentState.data;
|
|
336
|
+
}
|
|
337
|
+
);
|
|
338
|
+
};
|
|
329
339
|
|
|
330
340
|
// src/hooks/use-prefetch-css-class-usage.ts
|
|
331
341
|
import { useQueryClient } from "@elementor/query";
|
|
@@ -572,6 +582,7 @@ var useFilters = () => {
|
|
|
572
582
|
|
|
573
583
|
// src/save-global-classes.ts
|
|
574
584
|
import { __dispatch as dispatch2, __getState as getState2 } from "@elementor/store";
|
|
585
|
+
import { hash } from "@elementor/utils";
|
|
575
586
|
async function saveGlobalClasses({ context: context2 }) {
|
|
576
587
|
const state = selectData(getState2());
|
|
577
588
|
if (context2 === "preview") {
|
|
@@ -600,18 +611,6 @@ function calculateChanges(state, initialData) {
|
|
|
600
611
|
})
|
|
601
612
|
};
|
|
602
613
|
}
|
|
603
|
-
function hash(obj) {
|
|
604
|
-
return JSON.stringify(
|
|
605
|
-
obj,
|
|
606
|
-
(_, value) => isPlainObject(value) ? Object.keys(value).sort().reduce((result, key) => {
|
|
607
|
-
result[key] = value[key];
|
|
608
|
-
return result;
|
|
609
|
-
}, {}) : value
|
|
610
|
-
);
|
|
611
|
-
}
|
|
612
|
-
function isPlainObject(value) {
|
|
613
|
-
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
614
|
-
}
|
|
615
614
|
|
|
616
615
|
// src/components/search-and-filter/components/filter/active-filters.tsx
|
|
617
616
|
import * as React4 from "react";
|