@elementor/editor-canvas 0.26.0 → 3.32.0-20
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/CHANGELOG.md +16 -0
- package/dist/index.js +170 -31
- package/dist/index.mjs +166 -27
- package/package.json +15 -15
- package/src/__tests__/flex-transformer.test.ts +272 -0
- package/src/__tests__/styles-prop-resolver.test.ts +89 -14
- package/src/components/__tests__/style-renderer.test.tsx +2 -2
- package/src/components/style-renderer.tsx +1 -1
- package/src/hooks/__tests__/use-style-items.test.ts +106 -7
- package/src/hooks/use-style-items.ts +47 -5
- package/src/init-settings-transformers.ts +2 -0
- package/src/init-style-transformers.ts +11 -0
- package/src/renderers/__tests__/__snapshots__/create-styles-renderer.test.ts.snap +2 -0
- package/src/renderers/__tests__/create-styles-renderer.test.ts +98 -0
- package/src/renderers/create-styles-renderer.ts +26 -2
- package/src/style-commands/__tests__/paste-style.test.ts +30 -0
- package/src/style-commands/__tests__/reset-style.test.ts +4 -0
- package/src/style-commands/undoable-actions/paste-element-style.ts +2 -1
- package/src/transformers/settings/attributes-transformer.ts +25 -0
- package/src/transformers/styles/background-overlay-transformer.ts +1 -10
- package/src/transformers/styles/create-combine-array-transformer.ts +3 -1
- package/src/transformers/styles/filter-transformer.ts +13 -10
- package/src/transformers/styles/flex-transformer.ts +55 -0
- package/src/transformers/styles/transform-move-transformer.ts +3 -1
- package/src/transformers/styles/transform-rotate-transformer.ts +19 -0
- package/src/transformers/styles/transform-scale-transformer.ts +11 -0
- package/src/transformers/styles/transform-skew-transformer.ts +15 -0
- package/src/transformers/styles/transition-transformer.ts +25 -0
- package/.turbo/turbo-build.log +0 -22
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
|
@@ -64,10 +64,12 @@ describe( 'pasteStyles', () => {
|
|
|
64
64
|
{
|
|
65
65
|
meta: { breakpoint: null, state: null },
|
|
66
66
|
props: { a: 0, b: 1, c: 2 },
|
|
67
|
+
custom_css: null,
|
|
67
68
|
},
|
|
68
69
|
{
|
|
69
70
|
meta: { breakpoint: null, state: 'hover' },
|
|
70
71
|
props: { a: 1, b: 2 },
|
|
72
|
+
custom_css: null,
|
|
71
73
|
},
|
|
72
74
|
],
|
|
73
75
|
} ),
|
|
@@ -84,10 +86,12 @@ describe( 'pasteStyles', () => {
|
|
|
84
86
|
{
|
|
85
87
|
meta: { breakpoint: null, state: null },
|
|
86
88
|
props: { a: 1, c: 2 },
|
|
89
|
+
custom_css: null,
|
|
87
90
|
},
|
|
88
91
|
{
|
|
89
92
|
meta: { breakpoint: 'tablet', state: 'hover' },
|
|
90
93
|
props: { a: 3, b: 4 },
|
|
94
|
+
custom_css: null,
|
|
91
95
|
},
|
|
92
96
|
],
|
|
93
97
|
} ),
|
|
@@ -106,6 +110,7 @@ describe( 'pasteStyles', () => {
|
|
|
106
110
|
breakpoint: null,
|
|
107
111
|
state: null,
|
|
108
112
|
},
|
|
113
|
+
custom_css: null,
|
|
109
114
|
props: {
|
|
110
115
|
a: 1,
|
|
111
116
|
c: 2,
|
|
@@ -119,6 +124,7 @@ describe( 'pasteStyles', () => {
|
|
|
119
124
|
breakpoint: 'tablet',
|
|
120
125
|
state: 'hover',
|
|
121
126
|
},
|
|
127
|
+
custom_css: null,
|
|
122
128
|
props: {
|
|
123
129
|
a: 3,
|
|
124
130
|
b: 4,
|
|
@@ -138,6 +144,7 @@ describe( 'pasteStyles', () => {
|
|
|
138
144
|
breakpoint: null,
|
|
139
145
|
state: null,
|
|
140
146
|
},
|
|
147
|
+
custom_css: null,
|
|
141
148
|
props: {
|
|
142
149
|
a: 0,
|
|
143
150
|
b: 1,
|
|
@@ -147,6 +154,7 @@ describe( 'pasteStyles', () => {
|
|
|
147
154
|
{
|
|
148
155
|
meta: { breakpoint: null, state: 'hover' },
|
|
149
156
|
props: { a: 1, b: 2 },
|
|
157
|
+
custom_css: null,
|
|
150
158
|
},
|
|
151
159
|
],
|
|
152
160
|
} );
|
|
@@ -178,10 +186,12 @@ describe( 'pasteStyles', () => {
|
|
|
178
186
|
{
|
|
179
187
|
meta: { breakpoint: null, state: null },
|
|
180
188
|
props: { a: 0, b: 1 },
|
|
189
|
+
custom_css: null,
|
|
181
190
|
},
|
|
182
191
|
{
|
|
183
192
|
meta: { breakpoint: null, state: 'hover' },
|
|
184
193
|
props: { a: 1, b: 2 },
|
|
194
|
+
custom_css: null,
|
|
185
195
|
},
|
|
186
196
|
],
|
|
187
197
|
} ),
|
|
@@ -205,12 +215,14 @@ describe( 'pasteStyles', () => {
|
|
|
205
215
|
a: 0,
|
|
206
216
|
b: 1,
|
|
207
217
|
},
|
|
218
|
+
custom_css: null,
|
|
208
219
|
additionalVariants: [
|
|
209
220
|
{
|
|
210
221
|
meta: {
|
|
211
222
|
breakpoint: null,
|
|
212
223
|
state: 'hover',
|
|
213
224
|
},
|
|
225
|
+
custom_css: null,
|
|
214
226
|
props: {
|
|
215
227
|
a: 1,
|
|
216
228
|
b: 2,
|
|
@@ -250,10 +262,12 @@ describe( 'pasteStyles', () => {
|
|
|
250
262
|
{
|
|
251
263
|
meta: { breakpoint: null, state: null },
|
|
252
264
|
props: { a: 1, c: 2 },
|
|
265
|
+
custom_css: null,
|
|
253
266
|
},
|
|
254
267
|
{
|
|
255
268
|
meta: { breakpoint: 'tablet', state: 'hover' },
|
|
256
269
|
props: { a: 3, b: 4 },
|
|
270
|
+
custom_css: null,
|
|
257
271
|
},
|
|
258
272
|
],
|
|
259
273
|
} ),
|
|
@@ -286,10 +300,12 @@ describe( 'pasteStyles', () => {
|
|
|
286
300
|
{
|
|
287
301
|
meta: { breakpoint: null, state: null },
|
|
288
302
|
props: { a: 0, b: 1 },
|
|
303
|
+
custom_css: null,
|
|
289
304
|
},
|
|
290
305
|
{
|
|
291
306
|
meta: { breakpoint: null, state: 'hover' },
|
|
292
307
|
props: { a: 1, b: 2 },
|
|
308
|
+
custom_css: null,
|
|
293
309
|
},
|
|
294
310
|
],
|
|
295
311
|
} ),
|
|
@@ -306,6 +322,7 @@ describe( 'pasteStyles', () => {
|
|
|
306
322
|
{
|
|
307
323
|
meta: { breakpoint: null, state: null },
|
|
308
324
|
props: { a: 1, c: 2 },
|
|
325
|
+
custom_css: null,
|
|
309
326
|
},
|
|
310
327
|
],
|
|
311
328
|
} ),
|
|
@@ -315,6 +332,7 @@ describe( 'pasteStyles', () => {
|
|
|
315
332
|
{
|
|
316
333
|
meta: { breakpoint: null, state: null },
|
|
317
334
|
props: { a: 3, c: 4 },
|
|
335
|
+
custom_css: null,
|
|
318
336
|
},
|
|
319
337
|
],
|
|
320
338
|
} ),
|
|
@@ -330,6 +348,7 @@ describe( 'pasteStyles', () => {
|
|
|
330
348
|
{
|
|
331
349
|
meta: { breakpoint: null, state: null },
|
|
332
350
|
props: { a: 4, c: 5 },
|
|
351
|
+
custom_css: null,
|
|
333
352
|
},
|
|
334
353
|
],
|
|
335
354
|
} ),
|
|
@@ -352,6 +371,7 @@ describe( 'pasteStyles', () => {
|
|
|
352
371
|
a: 1,
|
|
353
372
|
c: 2,
|
|
354
373
|
},
|
|
374
|
+
custom_css: null,
|
|
355
375
|
} );
|
|
356
376
|
|
|
357
377
|
expect( updateElementStyle ).toHaveBeenCalledTimes( 1 );
|
|
@@ -418,10 +438,12 @@ describe( 'pasteStyles', () => {
|
|
|
418
438
|
{
|
|
419
439
|
meta: { breakpoint: null, state: null },
|
|
420
440
|
props: { a: 0, b: 1 },
|
|
441
|
+
custom_css: null,
|
|
421
442
|
},
|
|
422
443
|
{
|
|
423
444
|
meta: { breakpoint: null, state: 'hover' },
|
|
424
445
|
props: { a: 1, b: 2 },
|
|
446
|
+
custom_css: null,
|
|
425
447
|
},
|
|
426
448
|
],
|
|
427
449
|
} ),
|
|
@@ -442,10 +464,12 @@ describe( 'pasteStyles', () => {
|
|
|
442
464
|
{
|
|
443
465
|
meta: { breakpoint: null, state: null },
|
|
444
466
|
props: { a: 0, b: 1 },
|
|
467
|
+
custom_css: null,
|
|
445
468
|
},
|
|
446
469
|
{
|
|
447
470
|
meta: { breakpoint: null, state: 'hover' },
|
|
448
471
|
props: { a: 1, b: 2 },
|
|
472
|
+
custom_css: null,
|
|
449
473
|
},
|
|
450
474
|
],
|
|
451
475
|
} ),
|
|
@@ -471,6 +495,7 @@ describe( 'pasteStyles', () => {
|
|
|
471
495
|
a: 0,
|
|
472
496
|
b: 1,
|
|
473
497
|
},
|
|
498
|
+
custom_css: null,
|
|
474
499
|
additionalVariants: [
|
|
475
500
|
{
|
|
476
501
|
meta: {
|
|
@@ -481,6 +506,7 @@ describe( 'pasteStyles', () => {
|
|
|
481
506
|
a: 1,
|
|
482
507
|
b: 2,
|
|
483
508
|
},
|
|
509
|
+
custom_css: null,
|
|
484
510
|
},
|
|
485
511
|
],
|
|
486
512
|
} );
|
|
@@ -496,6 +522,7 @@ describe( 'pasteStyles', () => {
|
|
|
496
522
|
a: 0,
|
|
497
523
|
b: 1,
|
|
498
524
|
},
|
|
525
|
+
custom_css: null,
|
|
499
526
|
} );
|
|
500
527
|
|
|
501
528
|
expect( updateElementStyle ).toHaveBeenCalledWith( {
|
|
@@ -509,6 +536,7 @@ describe( 'pasteStyles', () => {
|
|
|
509
536
|
a: 0,
|
|
510
537
|
b: 1,
|
|
511
538
|
},
|
|
539
|
+
custom_css: null,
|
|
512
540
|
} );
|
|
513
541
|
|
|
514
542
|
expect( createElementStyle ).toHaveBeenCalledTimes( 1 );
|
|
@@ -533,12 +561,14 @@ describe( 'pasteStyles', () => {
|
|
|
533
561
|
a: 0,
|
|
534
562
|
b: 1,
|
|
535
563
|
},
|
|
564
|
+
custom_css: null,
|
|
536
565
|
additionalVariants: [
|
|
537
566
|
{
|
|
538
567
|
meta: {
|
|
539
568
|
breakpoint: null,
|
|
540
569
|
state: 'hover',
|
|
541
570
|
},
|
|
571
|
+
custom_css: null,
|
|
542
572
|
props: {
|
|
543
573
|
a: 1,
|
|
544
574
|
b: 2,
|
|
@@ -46,10 +46,12 @@ describe( 'resetStyles', () => {
|
|
|
46
46
|
{
|
|
47
47
|
meta: { breakpoint: null, state: null },
|
|
48
48
|
props: { a: 0, b: 1 },
|
|
49
|
+
custom_css: null,
|
|
49
50
|
},
|
|
50
51
|
{
|
|
51
52
|
meta: { breakpoint: null, state: 'hover' },
|
|
52
53
|
props: { a: 1, b: 2 },
|
|
54
|
+
custom_css: null,
|
|
53
55
|
},
|
|
54
56
|
],
|
|
55
57
|
} ),
|
|
@@ -82,6 +84,7 @@ describe( 'resetStyles', () => {
|
|
|
82
84
|
elementId: 'test-container',
|
|
83
85
|
label: ELEMENTS_STYLES_RESERVED_LABEL,
|
|
84
86
|
classesProp: 'classes',
|
|
87
|
+
custom_css: null,
|
|
85
88
|
meta: {
|
|
86
89
|
breakpoint: null,
|
|
87
90
|
state: null,
|
|
@@ -96,6 +99,7 @@ describe( 'resetStyles', () => {
|
|
|
96
99
|
breakpoint: null,
|
|
97
100
|
state: 'hover',
|
|
98
101
|
},
|
|
102
|
+
custom_css: null,
|
|
99
103
|
props: {
|
|
100
104
|
a: 1,
|
|
101
105
|
b: 2,
|
|
@@ -40,12 +40,13 @@ export const undoablePasteElementStyle = () =>
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
if ( styleId ) {
|
|
43
|
-
newStyle.variants.forEach( ( { meta, props } ) => {
|
|
43
|
+
newStyle.variants.forEach( ( { meta, props, custom_css: customCss } ) => {
|
|
44
44
|
updateElementStyle( {
|
|
45
45
|
elementId,
|
|
46
46
|
styleId,
|
|
47
47
|
meta,
|
|
48
48
|
props,
|
|
49
|
+
custom_css: customCss,
|
|
49
50
|
} );
|
|
50
51
|
} );
|
|
51
52
|
} else {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createTransformer } from '../create-transformer';
|
|
2
|
+
|
|
3
|
+
function escapeHtmlAttribute( value: string ): string {
|
|
4
|
+
const specialChars: Record< string, string > = {
|
|
5
|
+
'&': '&',
|
|
6
|
+
'<': '<',
|
|
7
|
+
'>': '>',
|
|
8
|
+
"'": ''',
|
|
9
|
+
'"': '"',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
return value.replace( /[&<>'"]/g, ( char ) => specialChars[ char ] || char );
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const attributesTransformer = createTransformer( ( values: { key: string; value: string }[] ) => {
|
|
16
|
+
return values
|
|
17
|
+
.map( ( value ) => {
|
|
18
|
+
if ( ! value.key || ! value.value ) {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
const escapedValue = escapeHtmlAttribute( value.value );
|
|
22
|
+
return `${ value.key }="${ escapedValue }"`;
|
|
23
|
+
} )
|
|
24
|
+
.join( ' ' );
|
|
25
|
+
} );
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
2
|
-
|
|
3
1
|
import { createTransformer } from '../create-transformer';
|
|
4
2
|
import { type BackgroundImageTransformed } from './background-image-overlay-transformer';
|
|
5
3
|
|
|
@@ -42,8 +40,6 @@ export const backgroundOverlayTransformer = createTransformer(
|
|
|
42
40
|
);
|
|
43
41
|
|
|
44
42
|
function normalizeOverlayValues( overlays: BackgroundOverlay ): BackgroundImageTransformed[] {
|
|
45
|
-
const isVersion330Active = isExperimentActive( 'e_v_3_30' );
|
|
46
|
-
|
|
47
43
|
const mappedValues = overlays.map( ( item ) => {
|
|
48
44
|
if ( typeof item === 'string' ) {
|
|
49
45
|
return {
|
|
@@ -58,10 +54,6 @@ function normalizeOverlayValues( overlays: BackgroundOverlay ): BackgroundImageT
|
|
|
58
54
|
return item;
|
|
59
55
|
} );
|
|
60
56
|
|
|
61
|
-
if ( ! isVersion330Active ) {
|
|
62
|
-
return mappedValues;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
57
|
return mappedValues.filter( ( item ) => item && !! item.src );
|
|
66
58
|
}
|
|
67
59
|
|
|
@@ -71,11 +63,10 @@ function getValuesString(
|
|
|
71
63
|
defaultValue: string,
|
|
72
64
|
preventUnification: boolean = false
|
|
73
65
|
) {
|
|
74
|
-
const isVersion330Active = isExperimentActive( 'e_v_3_30' );
|
|
75
66
|
const isEmpty = items.filter( ( item ) => item?.[ prop ] ).length === 0;
|
|
76
67
|
|
|
77
68
|
if ( isEmpty ) {
|
|
78
|
-
return
|
|
69
|
+
return defaultValue;
|
|
79
70
|
}
|
|
80
71
|
|
|
81
72
|
const formattedValues = items.map( ( item ) => item[ prop ] ?? defaultValue );
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { createTransformer } from '../create-transformer';
|
|
2
2
|
|
|
3
3
|
export const createCombineArrayTransformer = ( delimiter: string ) => {
|
|
4
|
-
return createTransformer( ( value: Array< string | number > ) =>
|
|
4
|
+
return createTransformer( ( value: Array< string | number > ) =>
|
|
5
|
+
value?.length ? value.filter( Boolean ).join( delimiter ) : null
|
|
6
|
+
);
|
|
5
7
|
};
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import { type FilterItemPropValue } from '@elementor/editor-props';
|
|
2
|
-
|
|
3
1
|
import { createTransformer } from '../create-transformer';
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
type DropShadowArgs = { xAxis: string; yAxis: string; blur: string; color: string };
|
|
4
|
+
|
|
5
|
+
type FilterValue = { func: string; args: string | DropShadowArgs };
|
|
6
|
+
|
|
7
|
+
export const filterTransformer = createTransformer( ( filterValues: FilterValue[] ) => {
|
|
6
8
|
if ( filterValues?.length < 1 ) {
|
|
7
9
|
return null;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
|
-
return filterValues.map( mapToFilterFunctionString ).join( ' ' );
|
|
12
|
+
return filterValues.filter( Boolean ).map( mapToFilterFunctionString ).join( ' ' );
|
|
11
13
|
} );
|
|
12
14
|
|
|
13
|
-
const mapToFilterFunctionString = ( value:
|
|
14
|
-
if ( '
|
|
15
|
-
|
|
15
|
+
const mapToFilterFunctionString = ( value: FilterValue ): string => {
|
|
16
|
+
if ( value.func === 'drop-shadow' ) {
|
|
17
|
+
const { xAxis, yAxis, blur, color } = value.args as DropShadowArgs;
|
|
18
|
+
return `drop-shadow(${ xAxis || '0px' } ${ yAxis || '0px' } ${ blur || '10px' } ${ color || 'transparent' })`;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
|
-
if (
|
|
19
|
-
return
|
|
21
|
+
if ( ! value.func || ! value.args ) {
|
|
22
|
+
return '';
|
|
20
23
|
}
|
|
21
24
|
|
|
22
|
-
return
|
|
25
|
+
return `${ value.func }(${ value.args })`;
|
|
23
26
|
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { createTransformer } from '../create-transformer';
|
|
2
|
+
|
|
3
|
+
type Flex = {
|
|
4
|
+
flexGrow?: number | null;
|
|
5
|
+
flexShrink?: number | null;
|
|
6
|
+
flexBasis?: { size: number; unit: string } | string | null;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const flexTransformer = createTransformer( ( value: Flex ) => {
|
|
10
|
+
const grow = value.flexGrow;
|
|
11
|
+
const shrink = value.flexShrink;
|
|
12
|
+
const basis = value.flexBasis;
|
|
13
|
+
|
|
14
|
+
const hasGrow = grow !== undefined && grow !== null;
|
|
15
|
+
const hasShrink = shrink !== undefined && shrink !== null;
|
|
16
|
+
const hasBasis = basis !== undefined && basis !== null;
|
|
17
|
+
|
|
18
|
+
if ( ! hasGrow && ! hasShrink && ! hasBasis ) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if ( hasGrow && hasShrink && hasBasis ) {
|
|
23
|
+
return `${ grow } ${ shrink } ${
|
|
24
|
+
typeof basis === 'object' && basis.size !== undefined ? `${ basis.size }${ basis.unit || '' }` : basis
|
|
25
|
+
}`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if ( hasGrow && hasShrink && ! hasBasis ) {
|
|
29
|
+
return `${ grow } ${ shrink }`;
|
|
30
|
+
}
|
|
31
|
+
if ( hasGrow && ! hasShrink && hasBasis ) {
|
|
32
|
+
return `${ grow } 1 ${
|
|
33
|
+
typeof basis === 'object' && basis.size !== undefined ? `${ basis.size }${ basis.unit || '' }` : basis
|
|
34
|
+
}`;
|
|
35
|
+
}
|
|
36
|
+
if ( ! hasGrow && hasShrink && hasBasis ) {
|
|
37
|
+
return `0 ${ shrink } ${
|
|
38
|
+
typeof basis === 'object' && basis.size !== undefined ? `${ basis.size }${ basis.unit || '' }` : basis
|
|
39
|
+
}`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if ( hasGrow && ! hasShrink && ! hasBasis ) {
|
|
43
|
+
return `${ grow }`;
|
|
44
|
+
}
|
|
45
|
+
if ( ! hasGrow && hasShrink && ! hasBasis ) {
|
|
46
|
+
return `0 ${ shrink }`;
|
|
47
|
+
}
|
|
48
|
+
if ( ! hasGrow && ! hasShrink && hasBasis ) {
|
|
49
|
+
return `0 1 ${
|
|
50
|
+
typeof basis === 'object' && basis.size !== undefined ? `${ basis.size }${ basis.unit || '' }` : basis
|
|
51
|
+
}`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return null;
|
|
55
|
+
} );
|
|
@@ -6,6 +6,8 @@ type TransformMove = {
|
|
|
6
6
|
z: string;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
+
const defaultMove = '0px';
|
|
10
|
+
|
|
9
11
|
export const transformMoveTransformer = createTransformer( ( value: TransformMove ) => {
|
|
10
|
-
return `translate3d(${ value.x }, ${ value.y }, ${ value.z })`;
|
|
12
|
+
return `translate3d(${ value.x ?? defaultMove }, ${ value.y ?? defaultMove }, ${ value.z ?? defaultMove })`;
|
|
11
13
|
} );
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createTransformer } from '../create-transformer';
|
|
2
|
+
|
|
3
|
+
type TransformRotate = {
|
|
4
|
+
x: string;
|
|
5
|
+
y: string;
|
|
6
|
+
z: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const defaultRotate = '0deg';
|
|
10
|
+
|
|
11
|
+
export const transformRotateTransformer = createTransformer( ( value: TransformRotate ) => {
|
|
12
|
+
const transforms = [
|
|
13
|
+
`rotateX(${ value?.x ?? defaultRotate })`,
|
|
14
|
+
`rotateY(${ value?.y ?? defaultRotate })`,
|
|
15
|
+
`rotateZ(${ value?.z ?? defaultRotate })`,
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
return transforms.join( ' ' );
|
|
19
|
+
} );
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createTransformer } from '../create-transformer';
|
|
2
|
+
|
|
3
|
+
type TransformScale = {
|
|
4
|
+
x: string;
|
|
5
|
+
y: string;
|
|
6
|
+
z: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const transformScaleTransformer = createTransformer( ( value: TransformScale ) => {
|
|
10
|
+
return `scale3d(${ value.x ?? 1 }, ${ value.y ?? 1 }, ${ value.z ?? 1 })`;
|
|
11
|
+
} );
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createTransformer } from '../create-transformer';
|
|
2
|
+
|
|
3
|
+
type TransformSkew = {
|
|
4
|
+
x: string;
|
|
5
|
+
y: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const defaultSkew = '0deg';
|
|
9
|
+
|
|
10
|
+
export const transformSkewTransformer = createTransformer( ( value: TransformSkew ) => {
|
|
11
|
+
const x = value?.x ?? defaultSkew;
|
|
12
|
+
const y = value?.y ?? defaultSkew;
|
|
13
|
+
|
|
14
|
+
return `skew(${ x }, ${ y })`;
|
|
15
|
+
} );
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createTransformer } from '../create-transformer';
|
|
2
|
+
|
|
3
|
+
type TransitionValue = {
|
|
4
|
+
selection: {
|
|
5
|
+
key: string;
|
|
6
|
+
value: string;
|
|
7
|
+
};
|
|
8
|
+
size: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const transitionTransformer = createTransformer( ( transitionValues: TransitionValue[] ) => {
|
|
12
|
+
if ( transitionValues?.length < 1 ) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return transitionValues.filter( Boolean ).map( mapToTransitionString ).join( ', ' );
|
|
17
|
+
} );
|
|
18
|
+
|
|
19
|
+
const mapToTransitionString = ( value: TransitionValue ): string => {
|
|
20
|
+
if ( ! value.selection || ! value.size ) {
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return `${ value.selection.value } ${ value.size }`;
|
|
25
|
+
};
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @elementor/editor-canvas@0.26.0 build
|
|
3
|
-
> tsup --config=../../tsup.build.ts
|
|
4
|
-
|
|
5
|
-
[34mCLI[39m Building entry: src/index.ts
|
|
6
|
-
[34mCLI[39m Using tsconfig: ../../../tsconfig.json
|
|
7
|
-
[34mCLI[39m tsup v8.5.0
|
|
8
|
-
[34mCLI[39m Using tsup config: /home/runner/work/elementor-packages/elementor-packages/tsup.build.ts
|
|
9
|
-
[34mCLI[39m Target: esnext
|
|
10
|
-
[34mCLI[39m Cleaning output folder
|
|
11
|
-
[34mESM[39m Build start
|
|
12
|
-
[34mCJS[39m Build start
|
|
13
|
-
[32mCJS[39m [1mdist/index.js [22m[32m48.17 KB[39m
|
|
14
|
-
[32mCJS[39m [1mdist/index.js.map [22m[32m95.71 KB[39m
|
|
15
|
-
[32mCJS[39m ⚡️ Build success in 292ms
|
|
16
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m44.83 KB[39m
|
|
17
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[32m95.49 KB[39m
|
|
18
|
-
[32mESM[39m ⚡️ Build success in 293ms
|
|
19
|
-
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in 15187ms
|
|
21
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m2.42 KB[39m
|
|
22
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m2.42 KB[39m
|