Merge "Add Special:Users as a synonym for Special:ListUsers"
[lhc/web/wiklou.git] / resources / src / mediawiki.less / mediawiki.mixins.less
1 // Common LESS mixin library for MediaWiki
2 //
3 // By default the folder containing this file is included in the LESS import paths,
4 // which makes this file importable by all less files via `@import 'mediawiki.mixins';`.
5 //
6 // The mixins included below are considered a public interface for MediaWiki extensions.
7 // The signatures of parametrized mixins should be kept as stable as possible.
8 //
9 // See <http://lesscss.org/#-mixins> for more information about how to write mixins.
10
11 .background-image( @url ) {
12 background-image: e( '/* @embed */' ) url( @url );
13 }
14
15 .vertical-gradient( @startColor: gray, @endColor: white, @startPos: 0, @endPos: 100% ) {
16 background-color: @endColor;
17 background-image: -webkit-linear-gradient( top, @startColor @startPos, @endColor @endPos ); // Safari 5.1+, Chrome 10+
18 background-image: -moz-linear-gradient( top, @startColor @startPos, @endColor @endPos ); // Firefox 3.6+
19 background-image: linear-gradient( @startColor @startPos, @endColor @endPos ); // Standard
20 }
21
22 // SVG support using a transparent gradient to guarantee cross-browser
23 // compatibility (browsers able to understand gradient syntax support also SVG).
24 // http://pauginer.tumblr.com/post/36614680636/invisible-gradient-technique
25 //
26 // We do not embed the fallback image on the assumption that the gain for old browsers
27 // is not worth the harm done to modern ones.
28 .background-image-svg( @svg, @fallback ) {
29 background-image: url( @fallback );
30 background-image: linear-gradient( transparent, transparent ), e( '/* @embed */' ) url( @svg );
31 }
32
33 // Shorthand for background-image-svg. Use if your PNG and SVG have the same name
34 // and only if you cannot use ResourceLoaderImage module for some particular reason.
35 .background-image-svg-quick( @url ) {
36 .background-image-svg( ~'@{url}.svg', ~'@{url}.png' );
37 }
38
39 .list-style-image( @url ) {
40 list-style-image: e( '/* @embed */' ) url( @url );
41 }
42
43 .list-style-image-svg( @svg, @fallback ) {
44 list-style-image: e( '/* @embed */' ) url( @svg );
45 /* Fallback to PNG bullet for IE 8 and below using CSS hack */
46 list-style-image: e( '/* @embed */' ) url( @fallback ) e( '\9' );
47 }
48
49 .hyphens( @value: auto ) {
50 & when ( @value = auto ) {
51 // Legacy `word-wrap`; IE 6-11, Edge 12+, Firefox 3.5+, Chrome 4+, Safari 3.1+,
52 // Opera 11.5+, iOS 3.2+, Android 2.1+
53 // `overflow-wrap` is W3 standard, but it doesn't seem as if browser vendors
54 // will abandon `word-wrap` (it has wider support), therefore no duplication.
55 word-wrap: break-word;
56 }
57 & when ( @value = none ) {
58 word-wrap: normal;
59 }
60
61 // CSS3 hyphenation
62 -webkit-hyphens: @value; // Safari 5.1+, iOS 4.3+
63 -moz-hyphens: @value; // Firefox 6-42
64 -ms-hyphens: @value; // IE 10-11, Edge 12+
65 hyphens: @value; // Firefox 43+, Chrome 55+, Android 62+, UC Browser 11.8+, Samsung 6.2+
66 }
67
68 .transform( @value ) {
69 -webkit-transform: @value; // Safari 3.1-8.0, iOS 3.2-8.4, Android 2.1-4.4.4
70 -moz-transform: @value; // Firefox 3.5-15
71 transform: @value; // Chrome 36+, Firefox 16+, IE 10+, Safari 9+, Opera 23+, iOS 9.2+, Android 5+
72 }
73
74 .transition( @value ) {
75 -webkit-transition: @value; // Safari 3.1-6.0, iOS 3.2-6.1, Android 2.1-4.3
76 -moz-transition: @value; // Firefox 4-15
77 transition: @value; // Chrome 26+, Firefox 16+, IE 10+, Safari 6.1+, Opera 12.1+, iOS 7+, Android 4.4+
78 }
79
80 // Provide a hardware accelerated transform transition
81 // We can't use `.transition()` because WebKit requires `-webkit-` prefix before `transform`
82 // Example usage: `.transition-transform( 1s, opacity 2s );`
83 // First parameter is additional options for `transform` transition commencing with
84 // duration property @see https://www.w3.org/TR/css3-transitions/#transition-duration-property
85 // and remaining parameters are additional transitions."
86 .transition-transform( ... ) {
87 -webkit-backface-visibility: hidden; // Older Webkit browsers: Promote element to a composite layer & involve the GPU
88 -webkit-transition: -webkit-transform @arguments; // Safari 3.1-8, iOS 3.2-8.4, Android 2.1-4.4.4
89 -moz-transition: -moz-transform @arguments; // Firefox 4-15 for `-moz-transition`
90 transition: transform @arguments; // Chrome 36+, Firefox 16+, IE 10+, Safari 9+, Opera 12.1+, iOS 9.2+, Android 36+
91 }
92
93 .box-sizing( @value ) {
94 -webkit-box-sizing: @value; // Safari 3.1-5.0, iOS 3.2-4.3, Android 2.1-3.0
95 -moz-box-sizing: @value; // Firefox 4-28,
96 box-sizing: @value; // Chrome 10+, Firefox 29+, IE 8+, Safari 5.1+, Opera 10+, iOS 5+, Android 4+
97 }
98
99 .box-shadow( @value ) {
100 -webkit-box-shadow: @value; // Safari 3.1-5.0, iOS 3.2-4.3, Android 2.1-3.0
101 box-shadow: @value; // Chrome 10+, Firefox 4+, IE 9+, Safari 5.1+, Opera 11+, iOS 5+, Android 4+
102 }
103
104 .column-count( @value ) {
105 -webkit-column-count: @value;
106 -moz-column-count: @value;
107 column-count: @value;
108 }
109
110 .column-width( @value ) {
111 -webkit-column-width: @value; // Chrome Any, Safari 3+, Opera 15+
112 -moz-column-width: @value; // Firefox 1.5+
113 column-width: @value; // IE 10+, Opera 11.1-12.1
114 }
115
116 .column-break-inside-avoid() {
117 -webkit-column-break-inside: avoid; // Chrome Any, Safari 3+, Opera 15+
118 page-break-inside: avoid; // Firefox 1.5+
119 break-inside: avoid-column; // IE 10+, Opera 11.1-12.1
120 }
121
122 .flex-display( @display: flex ) {
123 display: ~'-webkit-@{display}'; // iOS 6-, Safari 3.1-6
124 display: ~'-moz-@{display}'; // Firefox 21-
125 display: ~'-ms-@{display}box'; // IE 10
126 display: @display;
127 }
128
129 .flex-wrap( @wrap: wrap ) {
130 -webkit-flex-wrap: @wrap; // iOS 6-, Safari 3.1-6
131 -moz-flex-wrap: @wrap; // Firefox 21-
132 -ms-flex-wrap: @wrap; // IE 10
133 flex-wrap: @wrap;
134 }
135
136 .flex( @grow: 1, @shrink: 1, @width: auto, @order: 1 ) {
137 // For 2009/2012 spec alignment consistency with current default
138 -webkit-box-pack: justify; // iOS 6-, Safari 3.1-6
139 -moz-box-pack: justify; // Firefox 21-
140 -ms-flex-pack: justify; // IE 10 (2012 spec)
141 justify-content: space-between; // Current default
142
143 // 2009 spec only supports 'flexible' as opposed to grow (flexPositive)
144 // and shrink (flexNegative); default to grow value
145 -webkit-box-flex: @grow; // iOS 6-, Safari 3.1-6
146 -moz-box-flex: @grow; // Firefox 21-
147 width: @width; // Fallback for flex-basis
148 -ms-flex: @grow @shrink @width; // IE 10
149 flex: @grow @shrink @width;
150 -webkit-box-ordinal-group: @order; // iOS 6-, Safari 3.1-6
151 -moz-box-ordinal-group: @order; // Firefox 21-
152 -ms-flex-order: @order; // IE 10
153 order: @order;
154 }
155
156 /* stylelint-disable selector-no-vendor-prefix, at-rule-no-unknown */
157 .mixin-placeholder( @rules ) {
158 // WebKit, Blink, Edge
159 &::-webkit-input-placeholder {
160 @rules();
161 }
162 // Internet Explorer 10-11
163 &:-ms-input-placeholder {
164 @rules();
165 }
166 // Firefox 19-
167 &::-moz-placeholder {
168 @rules();
169 }
170 // Firefox 4-18
171 &:-moz-placeholder {
172 @rules();
173 }
174 // W3C Standard Selectors Level 4
175 &::placeholder {
176 @rules();
177 }
178 }
179 /* stylelint-enable selector-no-vendor-prefix, at-rule-no-unknown */
180
181 // Screen Reader Helper Mixin
182 .mixin-screen-reader-text() {
183 display: block;
184 position: absolute !important; /* stylelint-disable-line declaration-no-important */
185 clip: rect( 1px, 1px, 1px, 1px );
186 width: 1px;
187 height: 1px;
188 margin: -1px;
189 border: 0;
190 padding: 0;
191 overflow: hidden;
192 }