@elementor/editor-canvas 3.33.0-262 → 3.33.0-265
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
|
@@ -1179,17 +1179,36 @@ var transformSkewTransformer = createTransformer((value) => {
|
|
|
1179
1179
|
});
|
|
1180
1180
|
|
|
1181
1181
|
// src/transformers/styles/transition-transformer.ts
|
|
1182
|
+
var import_editor_controls = require("@elementor/editor-controls");
|
|
1183
|
+
var getAllowedProperties = () => {
|
|
1184
|
+
const allowedProperties = /* @__PURE__ */ new Set();
|
|
1185
|
+
import_editor_controls.transitionProperties.forEach((category) => {
|
|
1186
|
+
category.properties.forEach((property) => {
|
|
1187
|
+
allowedProperties.add(property.value);
|
|
1188
|
+
});
|
|
1189
|
+
});
|
|
1190
|
+
return allowedProperties;
|
|
1191
|
+
};
|
|
1182
1192
|
var transitionTransformer = createTransformer((transitionValues) => {
|
|
1183
1193
|
if (transitionValues?.length < 1) {
|
|
1184
1194
|
return null;
|
|
1185
1195
|
}
|
|
1186
|
-
|
|
1196
|
+
const allowedProperties = getAllowedProperties();
|
|
1197
|
+
const validTransitions = transitionValues.map((value) => mapToTransitionString(value, allowedProperties)).filter(Boolean);
|
|
1198
|
+
if (validTransitions.length === 0) {
|
|
1199
|
+
return null;
|
|
1200
|
+
}
|
|
1201
|
+
return validTransitions.join(", ");
|
|
1187
1202
|
});
|
|
1188
|
-
var mapToTransitionString = (value) => {
|
|
1203
|
+
var mapToTransitionString = (value, allowedProperties) => {
|
|
1189
1204
|
if (!value.selection || !value.size) {
|
|
1190
1205
|
return "";
|
|
1191
1206
|
}
|
|
1192
|
-
|
|
1207
|
+
const property = value.selection.value;
|
|
1208
|
+
if (!allowedProperties.has(property)) {
|
|
1209
|
+
return "";
|
|
1210
|
+
}
|
|
1211
|
+
return `${property} ${value.size}`;
|
|
1193
1212
|
};
|
|
1194
1213
|
|
|
1195
1214
|
// src/init-style-transformers.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1143,17 +1143,36 @@ var transformSkewTransformer = createTransformer((value) => {
|
|
|
1143
1143
|
});
|
|
1144
1144
|
|
|
1145
1145
|
// src/transformers/styles/transition-transformer.ts
|
|
1146
|
+
import { transitionProperties } from "@elementor/editor-controls";
|
|
1147
|
+
var getAllowedProperties = () => {
|
|
1148
|
+
const allowedProperties = /* @__PURE__ */ new Set();
|
|
1149
|
+
transitionProperties.forEach((category) => {
|
|
1150
|
+
category.properties.forEach((property) => {
|
|
1151
|
+
allowedProperties.add(property.value);
|
|
1152
|
+
});
|
|
1153
|
+
});
|
|
1154
|
+
return allowedProperties;
|
|
1155
|
+
};
|
|
1146
1156
|
var transitionTransformer = createTransformer((transitionValues) => {
|
|
1147
1157
|
if (transitionValues?.length < 1) {
|
|
1148
1158
|
return null;
|
|
1149
1159
|
}
|
|
1150
|
-
|
|
1160
|
+
const allowedProperties = getAllowedProperties();
|
|
1161
|
+
const validTransitions = transitionValues.map((value) => mapToTransitionString(value, allowedProperties)).filter(Boolean);
|
|
1162
|
+
if (validTransitions.length === 0) {
|
|
1163
|
+
return null;
|
|
1164
|
+
}
|
|
1165
|
+
return validTransitions.join(", ");
|
|
1151
1166
|
});
|
|
1152
|
-
var mapToTransitionString = (value) => {
|
|
1167
|
+
var mapToTransitionString = (value, allowedProperties) => {
|
|
1153
1168
|
if (!value.selection || !value.size) {
|
|
1154
1169
|
return "";
|
|
1155
1170
|
}
|
|
1156
|
-
|
|
1171
|
+
const property = value.selection.value;
|
|
1172
|
+
if (!allowedProperties.has(property)) {
|
|
1173
|
+
return "";
|
|
1174
|
+
}
|
|
1175
|
+
return `${property} ${value.size}`;
|
|
1157
1176
|
};
|
|
1158
1177
|
|
|
1159
1178
|
// src/init-style-transformers.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-canvas",
|
|
3
3
|
"description": "Elementor Editor Canvas",
|
|
4
|
-
"version": "3.33.0-
|
|
4
|
+
"version": "3.33.0-265",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -37,21 +37,21 @@
|
|
|
37
37
|
"react-dom": "^18.3.1"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@elementor/editor": "3.33.0-
|
|
41
|
-
"@elementor/editor-controls": "3.33.0-
|
|
42
|
-
"@elementor/editor-documents": "3.33.0-
|
|
43
|
-
"@elementor/editor-elements": "3.33.0-
|
|
44
|
-
"@elementor/editor-interactions": "3.33.0-
|
|
45
|
-
"@elementor/editor-notifications": "3.33.0-
|
|
46
|
-
"@elementor/editor-props": "3.33.0-
|
|
47
|
-
"@elementor/editor-responsive": "3.33.0-
|
|
48
|
-
"@elementor/editor-styles": "3.33.0-
|
|
49
|
-
"@elementor/editor-styles-repository": "3.33.0-
|
|
50
|
-
"@elementor/editor-v1-adapters": "3.33.0-
|
|
51
|
-
"@elementor/twing": "3.33.0-
|
|
40
|
+
"@elementor/editor": "3.33.0-265",
|
|
41
|
+
"@elementor/editor-controls": "3.33.0-265",
|
|
42
|
+
"@elementor/editor-documents": "3.33.0-265",
|
|
43
|
+
"@elementor/editor-elements": "3.33.0-265",
|
|
44
|
+
"@elementor/editor-interactions": "3.33.0-265",
|
|
45
|
+
"@elementor/editor-notifications": "3.33.0-265",
|
|
46
|
+
"@elementor/editor-props": "3.33.0-265",
|
|
47
|
+
"@elementor/editor-responsive": "3.33.0-265",
|
|
48
|
+
"@elementor/editor-styles": "3.33.0-265",
|
|
49
|
+
"@elementor/editor-styles-repository": "3.33.0-265",
|
|
50
|
+
"@elementor/editor-v1-adapters": "3.33.0-265",
|
|
51
|
+
"@elementor/twing": "3.33.0-265",
|
|
52
52
|
"@elementor/ui": "1.36.17",
|
|
53
|
-
"@elementor/utils": "3.33.0-
|
|
54
|
-
"@elementor/wp-media": "3.33.0-
|
|
53
|
+
"@elementor/utils": "3.33.0-265",
|
|
54
|
+
"@elementor/wp-media": "3.33.0-265",
|
|
55
55
|
"@floating-ui/react": "^0.27.5",
|
|
56
56
|
"@wordpress/i18n": "^5.13.0"
|
|
57
57
|
},
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { transitionProperties } from '@elementor/editor-controls';
|
|
2
|
+
|
|
3
|
+
import { transitionTransformer, type TransitionValue } from '../transition-transformer';
|
|
4
|
+
|
|
5
|
+
function run( values: TransitionValue[] ) {
|
|
6
|
+
return transitionTransformer( values, { key: 'transition', signal: undefined } );
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
describe( 'transition-transformer', () => {
|
|
10
|
+
it( 'returns null when all transitions are invalid', () => {
|
|
11
|
+
const invalidTransitions: TransitionValue[] = [
|
|
12
|
+
{
|
|
13
|
+
selection: { key: 'invalid-property', value: 'invalid-property' },
|
|
14
|
+
size: '200ms',
|
|
15
|
+
},
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
expect( run( invalidTransitions ) ).toBeNull();
|
|
19
|
+
} );
|
|
20
|
+
|
|
21
|
+
it( 'returns valid transition string for allowed property', () => {
|
|
22
|
+
const allowedProperty = transitionProperties[ 0 ].properties[ 0 ].value;
|
|
23
|
+
const validTransitions: TransitionValue[] = [
|
|
24
|
+
{
|
|
25
|
+
selection: { key: 'all', value: allowedProperty },
|
|
26
|
+
size: '200ms',
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
expect( run( validTransitions ) ).toBe( `${ allowedProperty } 200ms` );
|
|
31
|
+
} );
|
|
32
|
+
|
|
33
|
+
it( 'filters out non-allowed transitions and returns only valid ones', () => {
|
|
34
|
+
const allowedProperty = transitionProperties[ 0 ].properties[ 0 ].value;
|
|
35
|
+
const transitionsWithMixedValidity: TransitionValue[] = [
|
|
36
|
+
{
|
|
37
|
+
selection: { key: 'all', value: allowedProperty },
|
|
38
|
+
size: '200ms',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
selection: { key: 'invalid', value: 'invalid-property' },
|
|
42
|
+
size: '300ms',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
selection: { key: 'another-invalid', value: 'another-invalid-property' },
|
|
46
|
+
size: '400ms',
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
expect( run( transitionsWithMixedValidity ) ).toBe( `${ allowedProperty } 200ms` );
|
|
51
|
+
} );
|
|
52
|
+
} );
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { transitionProperties } from '@elementor/editor-controls';
|
|
2
|
+
|
|
1
3
|
import { createTransformer } from '../create-transformer';
|
|
2
4
|
|
|
3
|
-
type TransitionValue = {
|
|
5
|
+
export type TransitionValue = {
|
|
4
6
|
selection: {
|
|
5
7
|
key: string;
|
|
6
8
|
value: string;
|
|
@@ -8,18 +10,46 @@ type TransitionValue = {
|
|
|
8
10
|
size: string;
|
|
9
11
|
};
|
|
10
12
|
|
|
13
|
+
const getAllowedProperties = (): Set< string > => {
|
|
14
|
+
const allowedProperties = new Set< string >();
|
|
15
|
+
|
|
16
|
+
transitionProperties.forEach( ( category ) => {
|
|
17
|
+
category.properties.forEach( ( property ) => {
|
|
18
|
+
allowedProperties.add( property.value );
|
|
19
|
+
} );
|
|
20
|
+
} );
|
|
21
|
+
|
|
22
|
+
return allowedProperties;
|
|
23
|
+
};
|
|
24
|
+
|
|
11
25
|
export const transitionTransformer = createTransformer( ( transitionValues: TransitionValue[] ) => {
|
|
12
26
|
if ( transitionValues?.length < 1 ) {
|
|
13
27
|
return null;
|
|
14
28
|
}
|
|
15
29
|
|
|
16
|
-
|
|
30
|
+
const allowedProperties = getAllowedProperties();
|
|
31
|
+
|
|
32
|
+
const validTransitions = transitionValues
|
|
33
|
+
.map( ( value ) => mapToTransitionString( value, allowedProperties ) )
|
|
34
|
+
.filter( Boolean );
|
|
35
|
+
|
|
36
|
+
if ( validTransitions.length === 0 ) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return validTransitions.join( ', ' );
|
|
17
41
|
} );
|
|
18
42
|
|
|
19
|
-
const mapToTransitionString = ( value: TransitionValue ): string => {
|
|
43
|
+
const mapToTransitionString = ( value: TransitionValue, allowedProperties: Set< string > ): string => {
|
|
20
44
|
if ( ! value.selection || ! value.size ) {
|
|
21
45
|
return '';
|
|
22
46
|
}
|
|
23
47
|
|
|
24
|
-
|
|
48
|
+
const property = value.selection.value;
|
|
49
|
+
|
|
50
|
+
if ( ! allowedProperties.has( property ) ) {
|
|
51
|
+
return '';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return `${ property } ${ value.size }`;
|
|
25
55
|
};
|