@elementor/editor-canvas 0.22.1 → 0.22.3
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +15 -0
- package/dist/index.d.mts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +34 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/styles-prop-resolver.test.ts +19 -2
- package/src/index.ts +1 -0
- package/src/transformers/create-transformers-registry.ts +3 -0
- package/src/transformers/styles/background-overlay-transformer.ts +17 -2
- package/src/__tests__/__mocks__/styles-schema.ts +0 -1234
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
2
|
+
|
|
1
3
|
import { createTransformer } from '../create-transformer';
|
|
2
4
|
import { type BackgroundImageTransformed } from './background-image-overlay-transformer';
|
|
3
5
|
|
|
@@ -19,6 +21,10 @@ export const backgroundOverlayTransformer = createTransformer(
|
|
|
19
21
|
|
|
20
22
|
const normalizedValues = normalizeOverlayValues( value );
|
|
21
23
|
|
|
24
|
+
if ( normalizedValues.length === 0 ) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
22
28
|
const images = getValuesString( normalizedValues, 'src', 'none', true );
|
|
23
29
|
const repeats = getValuesString( normalizedValues, 'repeat', 'repeat' );
|
|
24
30
|
const attachments = getValuesString( normalizedValues, 'attachment', 'scroll' );
|
|
@@ -36,7 +42,9 @@ export const backgroundOverlayTransformer = createTransformer(
|
|
|
36
42
|
);
|
|
37
43
|
|
|
38
44
|
function normalizeOverlayValues( overlays: BackgroundOverlay ): BackgroundImageTransformed[] {
|
|
39
|
-
|
|
45
|
+
const isVersion330Active = isExperimentActive( 'e_v_3_30' );
|
|
46
|
+
|
|
47
|
+
const mappedValues = overlays.map( ( item ) => {
|
|
40
48
|
if ( typeof item === 'string' ) {
|
|
41
49
|
return {
|
|
42
50
|
src: item,
|
|
@@ -49,6 +57,12 @@ function normalizeOverlayValues( overlays: BackgroundOverlay ): BackgroundImageT
|
|
|
49
57
|
|
|
50
58
|
return item;
|
|
51
59
|
} );
|
|
60
|
+
|
|
61
|
+
if ( ! isVersion330Active ) {
|
|
62
|
+
return mappedValues;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return mappedValues.filter( ( item ) => item && !! item.src );
|
|
52
66
|
}
|
|
53
67
|
|
|
54
68
|
function getValuesString(
|
|
@@ -57,10 +71,11 @@ function getValuesString(
|
|
|
57
71
|
defaultValue: string,
|
|
58
72
|
preventUnification: boolean = false
|
|
59
73
|
) {
|
|
74
|
+
const isVersion330Active = isExperimentActive( 'e_v_3_30' );
|
|
60
75
|
const isEmpty = items.filter( ( item ) => item?.[ prop ] ).length === 0;
|
|
61
76
|
|
|
62
77
|
if ( isEmpty ) {
|
|
63
|
-
return null;
|
|
78
|
+
return isVersion330Active ? defaultValue : null;
|
|
64
79
|
}
|
|
65
80
|
|
|
66
81
|
const formattedValues = items.map( ( item ) => item[ prop ] ?? defaultValue );
|