1- @use ' sass:map' ;
2-
3- $_defaultConfig : (
1+ $defaults : (
42 gutter-background-color : #eeeeee ,
53 gutter-icon-horizontal-bg-image-url :
64 url (' data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==' ),
@@ -12,44 +10,38 @@ $_defaultConfig: (
1210 gutter-disabled-cursor : default ,
1311);
1412
15- @function var-or-map-default ($name , $map ) {
16- @return var (--as - #{$name } , map .get ($map , $name ));
13+ as-split {
14+ @each $name , $defaultValue in $defaults {
15+ --_as -#{$name } : var (--as - #{$name } , #{$defaultValue } );
16+ }
1717}
1818
19- @mixin theme ($config : ()) {
20- $mergedConfig : map .merge ($_defaultConfig , $config );
21-
22- as-split {
23- display : flex ;
24- flex-wrap : nowrap ;
25- justify-content : flex-start ;
26- align-items : stretch ;
27- overflow : hidden ;
28- width : 100% ;
29- height : 100% ;
30-
31- & .as-horizontal {
32- flex-direction : row ;
33- }
34-
35- & .as-vertical {
36- flex-direction : column ;
37- }
19+ @function get-var ($name ) {
20+ @return var (--_as - #{$name } );
21+ }
3822
39- // Add transition only when transition enabled + split initialized + not currently dragging.
40- & .as-transition.as-init :not (.as-dragging ) {
41- & > .as-split-gutter ,
42- & > .as-split-area {
43- transition : flex-basis var-or-map-default (' transition-duration' , $mergedConfig );
44- }
23+ as-split {
24+ display : flex ;
25+ flex-wrap : nowrap ;
26+ justify-content : flex-start ;
27+ align-items : stretch ;
28+ overflow : hidden ;
29+ width : 100% ;
30+ height : 100% ;
31+
32+ // Add transition only when transition enabled + split initialized + not currently dragging.
33+ & .as-transition.as-init :not (.as-dragging ) {
34+ & > .as-split-gutter ,
35+ & > .as-split-area {
36+ transition : flex-basis get-var (' transition-duration' );
4537 }
4638 }
4739
48- .as-split-gutter {
40+ & > .as-split-gutter {
4941 border : none ;
5042 flex-grow : 0 ;
5143 flex-shrink : 0 ;
52- background-color : var-or-map-default (' gutter-background-color' , $mergedConfig );
44+ background-color : get-var (' gutter-background-color' );
5345 display : flex ;
5446 align-items : center ;
5547 justify-content : center ;
@@ -59,44 +51,15 @@ $_defaultConfig: (
5951 pointer-events : none ;
6052 }
6153
62- .as-horizontal > & {
63- flex-direction : row ;
64- cursor : col-resize ;
65- // Fix safari bug about gutter height when direction is horizontal.
66- height : 100% ;
67- }
68-
69- .as-vertical > & {
70- flex-direction : column ;
71- cursor : row-resize ;
54+ & > .as-split-gutter-icon {
7255 width : 100% ;
73- }
74-
75- .as-disabled > & {
76- cursor : var-or-map-default (' gutter-disabled-cursor' , $mergedConfig );
77- }
78- }
79-
80- .as-split-gutter-icon {
81- width : 100% ;
82- height : 100% ;
83- background-position : center center ;
84- background-repeat : no-repeat ;
85-
86- .as-horizontal & {
87- background-image : var-or-map-default (' gutter-icon-horizontal-bg-image-url' , $mergedConfig );
88- }
89-
90- .as-vertical & {
91- background-image : var-or-map-default (' gutter-icon-vertical-bg-image-url' , $mergedConfig );
92- }
93-
94- .as-disabled & {
95- background-image : var-or-map-default (' gutter-icon-disabled-bg-image-url' , $mergedConfig );
56+ height : 100% ;
57+ background-position : center center ;
58+ background-repeat : no-repeat ;
9659 }
9760 }
9861
99- .as-split-area {
62+ & > .as-split-area {
10063 flex-grow : 0 ;
10164 flex-shrink : 0 ;
10265 overflow-x : hidden ;
@@ -109,24 +72,63 @@ $_defaultConfig: (
10972 overflow-y : hidden ;
11073 }
11174
112- .as-iframe-fix {
75+ & > .as-iframe-fix {
11376 position : absolute ;
11477 top : 0 ;
11578 left : 0 ;
11679 width : 100% ;
11780 height : 100% ;
11881 }
82+ }
83+
84+ & .as-horizontal {
85+ flex-direction : row ;
86+
87+ & > .as-split-gutter {
88+ flex-direction : row ;
89+ cursor : col-resize ;
90+ // Fix safari bug about gutter height when direction is horizontal.
91+ height : 100% ;
92+
93+ & > .as-split-gutter-icon {
94+ background-image : get-var (' gutter-icon-horizontal-bg-image-url' );
95+ }
96+ }
11997
120- .as-horizontal & {
98+ & > .as-split-area {
12199 height : 100% ;
122100 }
101+ }
123102
124- .as-vertical & {
103+ & .as-vertical {
104+ flex-direction : column ;
105+
106+ & > .as-split-gutter {
107+ flex-direction : column ;
108+ cursor : row-resize ;
109+ width : 100% ;
110+
111+ & > .as-split-gutter-icon {
112+ background-image : get-var (' gutter-icon-vertical-bg-image-url' );
113+ }
114+ }
115+
116+ & > .as-split-area {
125117 width : 100% ;
126118
127119 & .as-hidden {
128120 max-width : 0 ;
129121 }
130122 }
131123 }
124+
125+ & .as-disabled {
126+ & > .as-split-gutter {
127+ cursor : get-var (' gutter-disabled-cursor' );
128+
129+ & > .as-split-gutter-icon {
130+ background-image : get-var (' gutter-icon-disabled-bg-image-url' );
131+ }
132+ }
133+ }
132134}
0 commit comments