@elementor/editor-styles-repository 4.1.0-736 → 4.1.0-738

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
@@ -11,6 +11,11 @@ type UserCapabilities = {
11
11
  update: string;
12
12
  updateProps: string;
13
13
  };
14
+ type PregeneratedLinkItem = {
15
+ id: string;
16
+ href: string;
17
+ media: string;
18
+ };
14
19
  type UpdatePropsActionPayload = {
15
20
  id: StyleDefinitionID;
16
21
  meta: StyleDefinitionVariant['meta'];
@@ -46,6 +51,7 @@ type StylesProvider = {
46
51
  }) => void;
47
52
  };
48
53
  capabilities?: UserCapabilities;
54
+ isPregeneratedLink?: (pregeneratedLinkItem: PregeneratedLinkItem) => boolean;
49
55
  };
50
56
 
51
57
  declare const stylesRepository: {
@@ -100,8 +106,9 @@ type CreateStylesProviderOptions = {
100
106
  tracking?: StylesProvider['actions']['tracking'];
101
107
  };
102
108
  capabilities?: UserCapabilities;
109
+ isPregeneratedLink?: (pregeneratedLinkItem: PregeneratedLinkItem) => boolean;
103
110
  };
104
- declare function createStylesProvider({ key, priority, limit, subscribe, labels, actions, capabilities, }: CreateStylesProviderOptions): StylesProvider;
111
+ declare function createStylesProvider({ key, priority, limit, subscribe, labels, actions, capabilities, isPregeneratedLink, }: CreateStylesProviderOptions): StylesProvider;
105
112
 
106
113
  declare function isElementsStylesProvider(key: string): boolean;
107
114
 
@@ -112,4 +119,4 @@ declare const ELEMENTS_STYLES_RESERVED_LABEL = "local";
112
119
 
113
120
  declare function init(): void;
114
121
 
115
- 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 };
122
+ export { type CreateStylesProviderOptions, ELEMENTS_BASE_STYLES_PROVIDER_KEY, ELEMENTS_STYLES_PROVIDER_KEY_PREFIX, ELEMENTS_STYLES_RESERVED_LABEL, type Meta, type PregeneratedLinkItem, 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
@@ -11,6 +11,11 @@ type UserCapabilities = {
11
11
  update: string;
12
12
  updateProps: string;
13
13
  };
14
+ type PregeneratedLinkItem = {
15
+ id: string;
16
+ href: string;
17
+ media: string;
18
+ };
14
19
  type UpdatePropsActionPayload = {
15
20
  id: StyleDefinitionID;
16
21
  meta: StyleDefinitionVariant['meta'];
@@ -46,6 +51,7 @@ type StylesProvider = {
46
51
  }) => void;
47
52
  };
48
53
  capabilities?: UserCapabilities;
54
+ isPregeneratedLink?: (pregeneratedLinkItem: PregeneratedLinkItem) => boolean;
49
55
  };
50
56
 
51
57
  declare const stylesRepository: {
@@ -100,8 +106,9 @@ type CreateStylesProviderOptions = {
100
106
  tracking?: StylesProvider['actions']['tracking'];
101
107
  };
102
108
  capabilities?: UserCapabilities;
109
+ isPregeneratedLink?: (pregeneratedLinkItem: PregeneratedLinkItem) => boolean;
103
110
  };
104
- declare function createStylesProvider({ key, priority, limit, subscribe, labels, actions, capabilities, }: CreateStylesProviderOptions): StylesProvider;
111
+ declare function createStylesProvider({ key, priority, limit, subscribe, labels, actions, capabilities, isPregeneratedLink, }: CreateStylesProviderOptions): StylesProvider;
105
112
 
106
113
  declare function isElementsStylesProvider(key: string): boolean;
107
114
 
@@ -112,4 +119,4 @@ declare const ELEMENTS_STYLES_RESERVED_LABEL = "local";
112
119
 
113
120
  declare function init(): void;
114
121
 
115
- 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 };
122
+ export { type CreateStylesProviderOptions, ELEMENTS_BASE_STYLES_PROVIDER_KEY, ELEMENTS_STYLES_PROVIDER_KEY_PREFIX, ELEMENTS_STYLES_RESERVED_LABEL, type Meta, type PregeneratedLinkItem, 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
@@ -155,7 +155,8 @@ function createStylesProvider({
155
155
  },
156
156
  labels,
157
157
  actions,
158
- capabilities
158
+ capabilities,
159
+ isPregeneratedLink
159
160
  }) {
160
161
  return {
161
162
  getKey: typeof key === "string" ? () => key : key,
@@ -177,13 +178,15 @@ function createStylesProvider({
177
178
  updateProps: actions.updateProps,
178
179
  updateCustomCss: actions.updateCustomCss,
179
180
  tracking: actions.tracking
180
- }
181
+ },
182
+ isPregeneratedLink
181
183
  };
182
184
  }
183
185
 
184
186
  // src/providers/document-elements-styles-provider.ts
185
187
  var ELEMENTS_STYLES_PROVIDER_KEY_PREFIX = "document-elements-";
186
188
  var ELEMENTS_STYLES_RESERVED_LABEL = "local";
189
+ var PREGENERATED_LINK_PATTERN = /^local-\d+-(preview|frontend)-[a-zA-Z_-]+-css$/;
187
190
  var documentElementsStylesProvider = createStylesProvider({
188
191
  key: () => {
189
192
  const documentId = (0, import_editor_elements.getCurrentDocumentId)();
@@ -193,6 +196,7 @@ var documentElementsStylesProvider = createStylesProvider({
193
196
  return `${ELEMENTS_STYLES_PROVIDER_KEY_PREFIX}${documentId}`;
194
197
  },
195
198
  priority: 50,
199
+ isPregeneratedLink: ({ id }) => PREGENERATED_LINK_PATTERN.test(id),
196
200
  subscribe: (cb) => (0, import_editor_v1_adapters.__privateListenTo)(import_editor_elements.styleRerenderEvents, () => cb()),
197
201
  actions: {
198
202
  all: (meta = {}) => {
package/dist/index.mjs CHANGED
@@ -125,7 +125,8 @@ function createStylesProvider({
125
125
  },
126
126
  labels,
127
127
  actions,
128
- capabilities
128
+ capabilities,
129
+ isPregeneratedLink
129
130
  }) {
130
131
  return {
131
132
  getKey: typeof key === "string" ? () => key : key,
@@ -147,13 +148,15 @@ function createStylesProvider({
147
148
  updateProps: actions.updateProps,
148
149
  updateCustomCss: actions.updateCustomCss,
149
150
  tracking: actions.tracking
150
- }
151
+ },
152
+ isPregeneratedLink
151
153
  };
152
154
  }
153
155
 
154
156
  // src/providers/document-elements-styles-provider.ts
155
157
  var ELEMENTS_STYLES_PROVIDER_KEY_PREFIX = "document-elements-";
156
158
  var ELEMENTS_STYLES_RESERVED_LABEL = "local";
159
+ var PREGENERATED_LINK_PATTERN = /^local-\d+-(preview|frontend)-[a-zA-Z_-]+-css$/;
157
160
  var documentElementsStylesProvider = createStylesProvider({
158
161
  key: () => {
159
162
  const documentId = getCurrentDocumentId();
@@ -163,6 +166,7 @@ var documentElementsStylesProvider = createStylesProvider({
163
166
  return `${ELEMENTS_STYLES_PROVIDER_KEY_PREFIX}${documentId}`;
164
167
  },
165
168
  priority: 50,
169
+ isPregeneratedLink: ({ id }) => PREGENERATED_LINK_PATTERN.test(id),
166
170
  subscribe: (cb) => listenTo(styleRerenderEvents, () => cb()),
167
171
  actions: {
168
172
  all: (meta = {}) => {
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": "4.1.0-736",
4
+ "version": "4.1.0-738",
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": "4.1.0-736",
37
- "@elementor/editor-elements": "4.1.0-736",
38
- "@elementor/editor-props": "4.1.0-736",
39
- "@elementor/editor-styles": "4.1.0-736",
40
- "@elementor/editor-v1-adapters": "4.1.0-736",
41
- "@elementor/schema": "4.1.0-736",
42
- "@elementor/utils": "4.1.0-736",
36
+ "@elementor/editor-current-user": "4.1.0-738",
37
+ "@elementor/editor-elements": "4.1.0-738",
38
+ "@elementor/editor-props": "4.1.0-738",
39
+ "@elementor/editor-styles": "4.1.0-738",
40
+ "@elementor/editor-v1-adapters": "4.1.0-738",
41
+ "@elementor/schema": "4.1.0-738",
42
+ "@elementor/utils": "4.1.0-738",
43
43
  "@wordpress/i18n": "^5.13.0"
44
44
  },
45
45
  "peerDependencies": {
@@ -12,6 +12,7 @@ import { createStylesProvider } from '../utils/create-styles-provider';
12
12
 
13
13
  export const ELEMENTS_STYLES_PROVIDER_KEY_PREFIX = 'document-elements-';
14
14
  export const ELEMENTS_STYLES_RESERVED_LABEL = 'local';
15
+ const PREGENERATED_LINK_PATTERN = /^local-\d+-(preview|frontend)-[a-zA-Z_-]+-css$/;
15
16
 
16
17
  type ElementsMeta = {
17
18
  elementId: string;
@@ -28,6 +29,7 @@ export const documentElementsStylesProvider = createStylesProvider( {
28
29
  return `${ ELEMENTS_STYLES_PROVIDER_KEY_PREFIX }${ documentId }`;
29
30
  },
30
31
  priority: 50,
32
+ isPregeneratedLink: ( { id } ) => PREGENERATED_LINK_PATTERN.test( id ),
31
33
  subscribe: ( cb ) => listenTo( styleRerenderEvents, () => cb() ),
32
34
  actions: {
33
35
  all: ( meta = {} ) => {
package/src/types.ts CHANGED
@@ -14,6 +14,12 @@ export type UserCapabilities = {
14
14
  updateProps: string;
15
15
  };
16
16
 
17
+ export type PregeneratedLinkItem = {
18
+ id: string;
19
+ href: string;
20
+ media: string;
21
+ };
22
+
17
23
  export type UpdatePropsActionPayload = {
18
24
  id: StyleDefinitionID;
19
25
  meta: StyleDefinitionVariant[ 'meta' ];
@@ -49,4 +55,5 @@ export type StylesProvider = {
49
55
  tracking?: ( data: { event: string; [ key: string ]: unknown } ) => void;
50
56
  };
51
57
  capabilities?: UserCapabilities;
58
+ isPregeneratedLink?: ( pregeneratedLinkItem: PregeneratedLinkItem ) => boolean;
52
59
  };
@@ -1,4 +1,4 @@
1
- import { type StylesCollection, type StylesProvider, type UserCapabilities } from '../types';
1
+ import { type PregeneratedLinkItem, type StylesCollection, type StylesProvider, type UserCapabilities } from '../types';
2
2
 
3
3
  export type CreateStylesProviderOptions = {
4
4
  key: string | ( () => string );
@@ -21,6 +21,7 @@ export type CreateStylesProviderOptions = {
21
21
  tracking?: StylesProvider[ 'actions' ][ 'tracking' ];
22
22
  };
23
23
  capabilities?: UserCapabilities;
24
+ isPregeneratedLink?: ( pregeneratedLinkItem: PregeneratedLinkItem ) => boolean;
24
25
  };
25
26
 
26
27
  const DEFAULT_LIMIT = 10000;
@@ -34,6 +35,7 @@ export function createStylesProvider( {
34
35
  labels,
35
36
  actions,
36
37
  capabilities,
38
+ isPregeneratedLink,
37
39
  }: CreateStylesProviderOptions ): StylesProvider {
38
40
  return {
39
41
  getKey: typeof key === 'string' ? () => key : key,
@@ -56,5 +58,6 @@ export function createStylesProvider( {
56
58
  updateCustomCss: actions.updateCustomCss,
57
59
  tracking: actions.tracking,
58
60
  },
61
+ isPregeneratedLink,
59
62
  };
60
63
  }