PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.1.2
JetFormBuilder — Dynamic Blocks Form Builder v3.1.2
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / modules / jet-style / assets-src / js / editor / abstract / BorderRadiusCSSCompiler.js
jetformbuilder / modules / jet-style / assets-src / js / editor / abstract Last commit date
BaseCSSCompiler.js 2 years ago BorderCSSCompiler.js 2 years ago BorderRadiusCSSCompiler.js 2 years ago
BorderRadiusCSSCompiler.js
81 lines
1 import BaseCSSCompiler from './BaseCSSCompiler';
2
3 const { get } = window._;
4
5 const {
6 isEmpty,
7 } = JetFBActions;
8
9 function BorderRadiusCSSCompiler() {
10 BaseCSSCompiler.call( this );
11
12 this.isSupported = function ( path ) {
13 return (
14 'border' === path.at( 1 ) &&
15 'radius' === path.at( -1 )
16 );
17 };
18
19 this.compileDeclarations = function (
20 styleRoot, declarations, classNames ) {
21 const baseRadius = get( styleRoot, this.path );
22
23 if ( isEmpty( baseRadius ) ) {
24 return;
25 }
26
27 const topLeft = this.getTopLeft( baseRadius );
28
29 if ( topLeft ) {
30 declarations[ `${ this.cssVar }-top-left` ] = topLeft;
31 }
32
33 const topRight = this.getTopRight( baseRadius );
34
35 if ( topRight ) {
36 declarations[ `${ this.cssVar }-top-right` ] = topRight;
37 }
38
39 const bottomRight = this.getBottomRight( baseRadius );
40
41 if ( bottomRight ) {
42 declarations[ `${ this.cssVar }-bottom-right` ] = bottomRight;
43 }
44
45 const bottomLeft = this.getBottomLeft( baseRadius );
46
47 if ( bottomLeft ) {
48 declarations[ `${ this.cssVar }-bottom-left` ] = bottomLeft;
49 }
50 };
51 }
52
53 BorderRadiusCSSCompiler.prototype = Object.create(
54 BaseCSSCompiler.prototype,
55 );
56
57 BorderRadiusCSSCompiler.prototype.isLinked = function ( value ) {
58 const [ firstKey ] = Object.keys( value );
59
60 return [ 'topLeft', 'topRight', 'bottomLeft', 'bottomRight' ].includes(
61 firstKey,
62 );
63 };
64
65 BorderRadiusCSSCompiler.prototype.getTopLeft = function ( value ) {
66 return this.isLinked( value ) ? value?.topLeft : value;
67 };
68
69 BorderRadiusCSSCompiler.prototype.getTopRight = function ( value ) {
70 return this.isLinked( value ) ? value?.topRight : value;
71 };
72
73 BorderRadiusCSSCompiler.prototype.getBottomLeft = function ( value ) {
74 return this.isLinked( value ) ? value?.bottomLeft : value;
75 };
76
77 BorderRadiusCSSCompiler.prototype.getBottomRight = function ( value ) {
78 return this.isLinked( value ) ? value?.bottomRight : value;
79 };
80
81 export default BorderRadiusCSSCompiler;