@elementor/editor-styles-repository 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.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Props } from '@elementor/editor-props';
2
2
  import * as _elementor_editor_styles from '@elementor/editor-styles';
3
- import { StyleDefinition, StyleDefinitionID, StyleDefinitionVariant, CustomCss } from '@elementor/editor-styles';
3
+ import { StyleDefinitionID, StyleDefinition, StyleDefinitionVariant, CustomCss } from '@elementor/editor-styles';
4
4
 
5
5
  type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<T>;
6
6
  type Meta = Record<string, unknown>;
@@ -21,11 +21,12 @@ type UpdateCustomCssActionPayload = {
21
21
  meta: StyleDefinitionVariant['meta'];
22
22
  custom_css: CustomCss;
23
23
  };
24
+ type StylesCollection = Record<StyleDefinitionID, StyleDefinition>;
24
25
  type StylesProvider = {
25
26
  getKey: () => string;
26
27
  priority: number;
27
28
  limit: number;
28
- subscribe: (callback: () => void) => () => void;
29
+ subscribe: (callback: (current?: StylesCollection, previous?: StylesCollection) => void) => () => void;
29
30
  labels: {
30
31
  singular: string | null;
31
32
  plural: string | null;
@@ -46,7 +47,7 @@ type StylesProvider = {
46
47
  declare const stylesRepository: {
47
48
  all: (meta?: Meta) => _elementor_editor_styles.StyleDefinition[];
48
49
  register: (provider: StylesProvider) => void;
49
- subscribe: (cb: () => void) => () => void;
50
+ subscribe: (cb: (previous?: StylesCollection, current?: StylesCollection) => void) => () => void;
50
51
  getProviders: () => StylesProvider[];
51
52
  getProviderByKey: (key: string) => StylesProvider | undefined;
52
53
  };
@@ -78,7 +79,7 @@ type CreateStylesProviderOptions = {
78
79
  key: string | (() => string);
79
80
  priority?: number;
80
81
  limit?: number;
81
- subscribe?: (callback: () => void) => () => void;
82
+ subscribe?: (callback: (current?: StylesCollection, previous?: StylesCollection) => void) => () => void;
82
83
  labels?: {
83
84
  singular: string;
84
85
  plural: string;
@@ -106,4 +107,4 @@ declare const ELEMENTS_STYLES_RESERVED_LABEL = "local";
106
107
 
107
108
  declare function init(): void;
108
109
 
109
- export { type CreateStylesProviderOptions, ELEMENTS_BASE_STYLES_PROVIDER_KEY, ELEMENTS_STYLES_PROVIDER_KEY_PREFIX, ELEMENTS_STYLES_RESERVED_LABEL, type Meta, type StylesProvider, type UpdateActionPayload, type UpdateCustomCssActionPayload, type UpdatePropsActionPayload, type UserCapabilities, createStylesProvider, init, isElementsStylesProvider, stylesRepository, useGetStylesRepositoryCreateAction, useProviders, useUserStylesCapability, validateStyleLabel };
110
+ export { type CreateStylesProviderOptions, ELEMENTS_BASE_STYLES_PROVIDER_KEY, ELEMENTS_STYLES_PROVIDER_KEY_PREFIX, ELEMENTS_STYLES_RESERVED_LABEL, type Meta, type StylesCollection, type StylesProvider, type UpdateActionPayload, type UpdateCustomCssActionPayload, type UpdatePropsActionPayload, type UserCapabilities, createStylesProvider, init, isElementsStylesProvider, stylesRepository, useGetStylesRepositoryCreateAction, useProviders, useUserStylesCapability, validateStyleLabel };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Props } from '@elementor/editor-props';
2
2
  import * as _elementor_editor_styles from '@elementor/editor-styles';
3
- import { StyleDefinition, StyleDefinitionID, StyleDefinitionVariant, CustomCss } from '@elementor/editor-styles';
3
+ import { StyleDefinitionID, StyleDefinition, StyleDefinitionVariant, CustomCss } from '@elementor/editor-styles';
4
4
 
5
5
  type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<T>;
6
6
  type Meta = Record<string, unknown>;
@@ -21,11 +21,12 @@ type UpdateCustomCssActionPayload = {
21
21
  meta: StyleDefinitionVariant['meta'];
22
22
  custom_css: CustomCss;
23
23
  };
24
+ type StylesCollection = Record<StyleDefinitionID, StyleDefinition>;
24
25
  type StylesProvider = {
25
26
  getKey: () => string;
26
27
  priority: number;
27
28
  limit: number;
28
- subscribe: (callback: () => void) => () => void;
29
+ subscribe: (callback: (current?: StylesCollection, previous?: StylesCollection) => void) => () => void;
29
30
  labels: {
30
31
  singular: string | null;
31
32
  plural: string | null;
@@ -46,7 +47,7 @@ type StylesProvider = {
46
47
  declare const stylesRepository: {
47
48
  all: (meta?: Meta) => _elementor_editor_styles.StyleDefinition[];
48
49
  register: (provider: StylesProvider) => void;
49
- subscribe: (cb: () => void) => () => void;
50
+ subscribe: (cb: (previous?: StylesCollection, current?: StylesCollection) => void) => () => void;
50
51
  getProviders: () => StylesProvider[];
51
52
  getProviderByKey: (key: string) => StylesProvider | undefined;
52
53
  };
@@ -78,7 +79,7 @@ type CreateStylesProviderOptions = {
78
79
  key: string | (() => string);
79
80
  priority?: number;
80
81
  limit?: number;
81
- subscribe?: (callback: () => void) => () => void;
82
+ subscribe?: (callback: (current?: StylesCollection, previous?: StylesCollection) => void) => () => void;
82
83
  labels?: {
83
84
  singular: string;
84
85
  plural: string;
@@ -106,4 +107,4 @@ declare const ELEMENTS_STYLES_RESERVED_LABEL = "local";
106
107
 
107
108
  declare function init(): void;
108
109
 
109
- export { type CreateStylesProviderOptions, ELEMENTS_BASE_STYLES_PROVIDER_KEY, ELEMENTS_STYLES_PROVIDER_KEY_PREFIX, ELEMENTS_STYLES_RESERVED_LABEL, type Meta, type StylesProvider, type UpdateActionPayload, type UpdateCustomCssActionPayload, type UpdatePropsActionPayload, type UserCapabilities, createStylesProvider, init, isElementsStylesProvider, stylesRepository, useGetStylesRepositoryCreateAction, useProviders, useUserStylesCapability, validateStyleLabel };
110
+ export { type CreateStylesProviderOptions, ELEMENTS_BASE_STYLES_PROVIDER_KEY, ELEMENTS_STYLES_PROVIDER_KEY_PREFIX, ELEMENTS_STYLES_RESERVED_LABEL, type Meta, type StylesCollection, type StylesProvider, type UpdateActionPayload, type UpdateCustomCssActionPayload, type UpdatePropsActionPayload, type UserCapabilities, createStylesProvider, init, isElementsStylesProvider, stylesRepository, useGetStylesRepositoryCreateAction, useProviders, useUserStylesCapability, validateStyleLabel };
package/dist/index.js CHANGED
@@ -192,7 +192,7 @@ var documentElementsStylesProvider = createStylesProvider({
192
192
  return `${ELEMENTS_STYLES_PROVIDER_KEY_PREFIX}${documentId}`;
193
193
  },
194
194
  priority: 50,
195
- subscribe: (cb) => (0, import_editor_v1_adapters.__privateListenTo)(import_editor_elements.styleRerenderEvents, cb),
195
+ subscribe: (cb) => (0, import_editor_v1_adapters.__privateListenTo)(import_editor_elements.styleRerenderEvents, () => cb()),
196
196
  actions: {
197
197
  all: (meta = {}) => {
198
198
  let elements = (0, import_editor_elements.getElements)();
package/dist/index.mjs CHANGED
@@ -162,7 +162,7 @@ var documentElementsStylesProvider = createStylesProvider({
162
162
  return `${ELEMENTS_STYLES_PROVIDER_KEY_PREFIX}${documentId}`;
163
163
  },
164
164
  priority: 50,
165
- subscribe: (cb) => listenTo(styleRerenderEvents, cb),
165
+ subscribe: (cb) => listenTo(styleRerenderEvents, () => cb()),
166
166
  actions: {
167
167
  all: (meta = {}) => {
168
168
  let elements = getElements();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elementor/editor-styles-repository",
3
3
  "description": "Elementor Editor Styles Repository",
4
- "version": "3.32.0-39",
4
+ "version": "3.32.0-41",
5
5
  "private": false,
6
6
  "author": "Elementor Team",
7
7
  "homepage": "https://elementor.com/",
@@ -33,13 +33,13 @@
33
33
  "dev": "tsup --config=../../tsup.dev.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@elementor/editor-current-user": "3.32.0-39",
37
- "@elementor/editor-elements": "3.32.0-39",
38
- "@elementor/editor-props": "3.32.0-39",
39
- "@elementor/editor-styles": "3.32.0-39",
40
- "@elementor/editor-v1-adapters": "3.32.0-39",
41
- "@elementor/schema": "3.32.0-39",
42
- "@elementor/utils": "3.32.0-39",
36
+ "@elementor/editor-current-user": "3.32.0-41",
37
+ "@elementor/editor-elements": "3.32.0-41",
38
+ "@elementor/editor-props": "3.32.0-41",
39
+ "@elementor/editor-styles": "3.32.0-41",
40
+ "@elementor/editor-v1-adapters": "3.32.0-41",
41
+ "@elementor/schema": "3.32.0-41",
42
+ "@elementor/utils": "3.32.0-41",
43
43
  "@wordpress/i18n": "^5.13.0"
44
44
  },
45
45
  "peerDependencies": {
@@ -28,7 +28,7 @@ export const documentElementsStylesProvider = createStylesProvider( {
28
28
  return `${ ELEMENTS_STYLES_PROVIDER_KEY_PREFIX }${ documentId }`;
29
29
  },
30
30
  priority: 50,
31
- subscribe: ( cb ) => listenTo( styleRerenderEvents, cb ),
31
+ subscribe: ( cb ) => listenTo( styleRerenderEvents, () => cb() ),
32
32
  actions: {
33
33
  all: ( meta = {} ) => {
34
34
  let elements = getElements();
package/src/types.ts CHANGED
@@ -26,11 +26,13 @@ export type UpdateCustomCssActionPayload = {
26
26
  custom_css: CustomCss;
27
27
  };
28
28
 
29
+ export type StylesCollection = Record< StyleDefinitionID, StyleDefinition >;
30
+
29
31
  export type StylesProvider = {
30
32
  getKey: () => string;
31
33
  priority: number;
32
34
  limit: number;
33
- subscribe: ( callback: () => void ) => () => void;
35
+ subscribe: ( callback: ( current?: StylesCollection, previous?: StylesCollection ) => void ) => () => void;
34
36
  labels: {
35
37
  singular: string | null;
36
38
  plural: string | null;
@@ -1,10 +1,10 @@
1
- import { type StylesProvider, type UserCapabilities } from '../types';
1
+ import { type StylesCollection, type StylesProvider, type UserCapabilities } from '../types';
2
2
 
3
3
  export type CreateStylesProviderOptions = {
4
4
  key: string | ( () => string );
5
5
  priority?: number;
6
6
  limit?: number;
7
- subscribe?: ( callback: () => void ) => () => void;
7
+ subscribe?: ( callback: ( current?: StylesCollection, previous?: StylesCollection ) => void ) => () => void;
8
8
  labels?: {
9
9
  singular: string;
10
10
  plural: string;
@@ -1,4 +1,4 @@
1
- import { type Meta, type StylesProvider } from '../types';
1
+ import { type Meta, type StylesCollection, type StylesProvider } from '../types';
2
2
 
3
3
  export const createStylesRepository = () => {
4
4
  const providers: StylesProvider[] = [];
@@ -15,7 +15,7 @@ export const createStylesRepository = () => {
15
15
  return getProviders().flatMap( ( provider ) => provider.actions.all( meta ) );
16
16
  };
17
17
 
18
- const subscribe = ( cb: () => void ) => {
18
+ const subscribe = ( cb: ( previous?: StylesCollection, current?: StylesCollection ) => void ) => {
19
19
  const unsubscribes = providers.map( ( provider ) => {
20
20
  return provider.subscribe( cb );
21
21
  } );