Merge "Improve "selfmove" message's wording"
[lhc/web/wiklou.git] / resources / src / mediawiki.rcfilters / styles / mw.rcfilters.mixins.less
1 @import 'mediawiki.mixins';
2 @import 'mw.rcfilters.variables';
3
4 .animation-delay( ... ) {
5 -webkit-animation-delay: @arguments; // Chrome 4-42, Safari 4-8, Opera 15-29, Android 2.1-4.4.4
6 -moz-animation-delay: @arguments; // Firefox 5-15
7 animation-delay: @arguments; // Chrome 43+, Firefox 16+, IE 10+, Edge 12+, Safari 9+, Opera 12.10 & 30+, iOS 9+, Android 47+
8 }
9
10 // This is a general mixin for a color circle
11 .mw-rcfilters-mixin-circle( @color: #fff, @diameter: 2em, @padding: 0.5em, @border: false, @borderColor: #54595d, @emptyBackground: false ) {
12 .box-sizing( border-box );
13 min-width: @diameter;
14 width: @diameter;
15 min-height: @diameter;
16 height: @diameter;
17 margin: @padding;
18 border-radius: 50%;
19
20 & when ( @emptyBackground = false ) {
21 background-color: @color;
22 }
23 & when ( @emptyBackground = true ) {
24 background-color: @highlight-none;
25 }
26
27 & when ( @border = true ) {
28 border: 1px solid @borderColor;
29 }
30 }
31
32 // This is the circle that appears next to the results
33 // Its visibility is directly dependent on whether there is
34 // a color class on its parent element
35 .result-circle( @colorName: 'none' ) {
36 &-@{colorName} {
37 .mw-rcfilters-mixin-circle( ~'@{highlight-@{colorName}}', @result-circle-diameter, 0 );
38 display: none;
39
40 .mw-rcfilters-highlight-color-@{colorName} & {
41 display: inline-block;
42 }
43 }
44 }
45
46 // A mixin for changes list containers. Applies enough margin-left to fit the 5 highlight circles.
47 .result-circle-margin() {
48 margin-left: ~'calc( ( @{result-circle-diameter} + @{result-circle-margin} ) * 5 + @{result-circle-general-margin} )';
49 }
50
51 // A mixin just for changesListWrapperWidget page, to output the scope of the widget
52 // so it is before the rest of the rule; we need the li& to be in
53 // between the wrapper scope and the color-cX class, which doesn't
54 // work if the rules are inside the above widget LESS scope
55 .highlight-changesListWrapperWidget( @bgcolor ) {
56 .mw-rcfilters-ui-changesListWrapperWidget li&,
57 .mw-rcfilters-ui-changesListWrapperWidget & tr:first-child,
58 .mw-rcfilters-ui-changesListWrapperWidget tr&.mw-rcfilters-ui-changesListWrapperWidget-enhanced-toplevel:not(.mw-rcfilters-ui-changesListWrapperWidget-enhanced-grey) td:not( :nth-child( -n+2 ) ),
59 .mw-rcfilters-ui-changesListWrapperWidget tr&.mw-rcfilters-ui-changesListWrapperWidget-enhanced-nested:not(.mw-rcfilters-ui-changesListWrapperWidget-enhanced-grey) td:not( :nth-child( -n+4 ) ) {
60 background-color: @bgcolor;
61 }
62 }
63
64 // This mixin produces color mixes for two, three and four colors
65 .highlight-color-mix( @color1, @color2, @color3: false, @color4: false ) {
66 @highlight-color-class-var: ~'.mw-rcfilters-highlight-color-@{color1}.mw-rcfilters-highlight-color-@{color2}';
67
68 // The nature of these variables and them being inside
69 // a 'tint' and 'average' LESS functions is such where
70 // the parsing is failing if it is done inside those functions.
71 // Instead, we first construct their LESS variable names,
72 // and then we call them inside those functions by calling @@var
73 @c1var: ~'highlight-@{color1}';
74 @c2var: ~'highlight-@{color2}';
75
76 // Two colors
77 @{highlight-color-class-var} when ( @color3 = false ) and ( @color4 = false ) and not ( @color1 = false ), ( @color2 = false ) {
78 .highlight-changesListWrapperWidget( tint( average( @@c1var, @@c2var ), 50% ) );
79 }
80 // Three colors
81 @{highlight-color-class-var}.mw-rcfilters-highlight-color-@{color3} when ( @color4 = false ) and not ( @color3 = false ) {
82 @c3var: ~'highlight-@{color3}';
83 .highlight-changesListWrapperWidget( tint( mix( @@c1var, average( @@c2var, @@c3var ), 33% ), 30% ) );
84 }
85
86 // Four colors
87 @{highlight-color-class-var}.mw-rcfilters-highlight-color-@{color3}.mw-rcfilters-highlight-color-@{color4} when not ( @color4 = false ) {
88 @c3var: ~'highlight-@{color3}';
89 @c4var: ~'highlight-@{color4}';
90 .highlight-changesListWrapperWidget( tint( mix( @@c1var, mix( @@c2var, average( @@c3var, @@c4var ), 25% ), 25% ), 25% ) );
91 }
92 }