]> git.proxmox.com Git - extjs.git/blame - extjs/classic/theme-base/sass/etc/mixins/frame.scss
add extjs 6.0.1 sources
[extjs.git] / extjs / classic / theme-base / sass / etc / mixins / frame.scss
CommitLineData
6527f429
DM
1@function pad($radius) {\r
2 $radius: boxmax($radius);\r
3 $radius: parseint($radius);\r
4 @if $radius >= 10 {\r
5 @return $radius;\r
6 }\r
7 @else {\r
8 @return "0" + $radius;\r
9 }\r
10}\r
11\r
12@function frame-size($border-width, $inner-border-width, $border-radius) {\r
13 // We use the border-radius of the two corners on each edge to determine the "edge's\r
14 // border-radius". For IE, the framing elements need to be as large as the larger of\r
15 // the border-radius and the border-width on each edge. These values are passed on to\r
16 // JavaScript using an encoded background-image url and the equivalent operations are\r
17 // handled by Renderable.js.\r
18 $frame-top: max(top($border-width) + top($inner-border-width), max(top($border-radius), right($border-radius)));\r
19 $frame-right: max(right($border-width) + right($inner-border-width), max(right($border-radius), bottom($border-radius)));\r
20 $frame-bottom: max(bottom($border-width) + bottom($inner-border-width), max(bottom($border-radius), left($border-radius)));\r
21 $frame-left: max(left($border-width) + left($inner-border-width), max(left($border-radius), top($border-radius)));\r
22\r
23 $frame-max: max($frame-top $frame-right $frame-bottom $frame-left);\r
24\r
25 // Slices produced by the slicer are always equally sized so that\r
26 // they can be sprited. This means that all sides that have frames\r
27 // must be the same size\r
28 @if $frame-top != 0 {\r
29 $frame-top: $frame-max;\r
30 }\r
31 @if $frame-right != 0 {\r
32 $frame-right: $frame-max;\r
33 }\r
34 @if $frame-bottom != 0 {\r
35 $frame-bottom: $frame-max;\r
36 }\r
37 @if $frame-left != 0 {\r
38 $frame-left: $frame-max;\r
39 }\r
40\r
41 @return $frame-top $frame-right $frame-bottom $frame-left\r
42}\r
43\r
44@mixin x-frame(\r
45 $cls,\r
46 $ui: null,\r
47 $border-radius: 0px,\r
48 $border-width: 0px,\r
49 $padding: null,\r
50 $background-color: null,\r
51 $background-gradient: null,\r
52 $table: false,\r
53 $background-direction: top,\r
54 $include-frame-rtl: false,\r
55 $background-stretch: null,\r
56 $ignore-frame-padding: false,\r
57 $inner-border-width: 0\r
58) {\r
59 $cls-ui: $cls;\r
60 $cls-ui: null;\r
61 @if $ui != null {\r
62 $cls-ui: $cls + '-' + $ui;\r
63 }\r
64\r
65 @if is-null($inner-border-width) {\r
66 // default inner border width to 0 if the caller passed null or 'none' (e.g. buttons do this)\r
67 $inner-border-width: 0;\r
68 }\r
69\r
70 $vertical: false;\r
71 @if not is-null($background-gradient) and ($background-direction == left or $background-direction == right) {\r
72 $vertical: true;\r
73 }\r
74\r
75 $background-stretch-position: null;\r
76 @if is-null($background-stretch) {\r
77 @if $background-direction == top {\r
78 $background-stretch: bottom;\r
79 } @else if $background-direction == right {\r
80 $background-stretch: left;\r
81 } @else if $background-direction == bottom {\r
82 $background-stretch: top;\r
83 } @else if $background-direction == left {\r
84 $background-stretch: right;\r
85 }\r
86 }\r
87\r
88 @if $background-stretch == top {\r
89 $background-stretch-position: bottom;\r
90 } @else if $background-stretch == bottom {\r
91 $background-stretch-position: top;\r
92 } @else if $background-stretch == left {\r
93 $background-stretch-position: right;\r
94 } @else if $background-stretch == right {\r
95 $background-stretch-position: left;\r
96 }\r
97\r
98 @if not is-null($background-gradient) {\r
99 $stretch: slicer-background-stretch($cls-ui, $background-stretch);\r
100 }\r
101\r
102 $frame-size: frame-size($border-width, $inner-border-width, $border-radius);\r
103 $frame-top: nth($frame-size, 1);\r
104 $frame-right: nth($frame-size, 2);\r
105 $frame-bottom: nth($frame-size, 3);\r
106 $frame-left: nth($frame-size, 4);\r
107\r
108 $frame-max: max($frame-size);\r
109\r
110 $frame: slicer-frame($cls-ui, $frame-size);\r
111\r
112 $padding-top: 0;\r
113 $padding-right: 0;\r
114 $padding-bottom: 0;\r
115 $padding-left: 0;\r
116\r
117 $frame-info-padding-top: 0;\r
118 $frame-info-padding-right: 0;\r
119 $frame-info-padding-bottom: 0;\r
120 $frame-info-padding-left: 0;\r
121\r
122 // For CSS3 browsers, if the border-radius is larger than the border-width, we need to\r
123 // apply padding to inset the content. These values can never be 0 because frame-xxx\r
124 // includes border-xxx in its max.\r
125 //\r
126 @if not $ignore-frame-padding {\r
127 $padding-top: $frame-top - top($border-width);\r
128 $padding-right: $frame-right - right($border-width);\r
129 $padding-bottom: $frame-bottom - bottom($border-width);\r
130 $padding-left: $frame-left - left($border-width);\r
131 } @else {\r
132 // In nocss3 browsers we can never ignore frame padding, because the framing elements\r
133 // cannot be overlapped by the content.\r
134 $frame-info-padding-top: $frame-top - top($border-width);\r
135 $frame-info-padding-right: $frame-right - right($border-width);\r
136 $frame-info-padding-bottom: $frame-bottom - bottom($border-width);\r
137 $frame-info-padding-left: $frame-left - left($border-width);\r
138 }\r
139\r
140 // If there is additional padding, this is understood to be a request to ensure that\r
141 // the content is **at least** this far from the inside of the border. If the framing\r
142 // requires more padding, that wins. This is the amount of padding you need in CSS3\r
143 // browsers.\r
144 //\r
145 @if not is-null($padding) {\r
146 $padding-top: max($padding-top, top($padding));\r
147 $padding-right: max($padding-right, right($padding));\r
148 $padding-bottom: max($padding-bottom, bottom($padding));\r
149 $padding-left: max($padding-left, left($padding));\r
150 }\r
151\r
152 // For IE, the framing elements are sized by frame-xxx and the "-mc" will carry the\r
153 // extra-padding-xxx.\r
154 //\r
155 $extra-padding-top: max(top($border-width) + $padding-top - $frame-top, 0);\r
156 $extra-padding-right: max(right($border-width) + $padding-right - $frame-right, 0);\r
157 $extra-padding-bottom: max(bottom($border-width) + $padding-bottom - $frame-bottom, 0);\r
158 $extra-padding-left: max(left($border-width) + $padding-left - $frame-left, 0);\r
159\r
160 $framing-info: '';\r
161\r
162 @if $table == true {\r
163 $framing-info: $framing-info + 't';\r
164 } @else {\r
165 $framing-info: $framing-info + 'd';\r
166 }\r
167 @if $vertical == true {\r
168 $framing-info: $framing-info + 'v';\r
169 } @else {\r
170 $framing-info: $framing-info + 'h';\r
171 }\r
172\r
173 $framing-info: $framing-info + '-' +\r
174 nopx($frame-top) + '-' +\r
175 nopx($frame-right) + '-' +\r
176 nopx($frame-bottom) + '-' +\r
177 nopx($frame-left) + '-' +\r
178 nopx(top($border-width)) + '-' +\r
179 nopx(right($border-width)) + '-' +\r
180 nopx(bottom($border-width)) + '-' +\r
181 nopx(left($border-width)) + '-' +\r
182 if($ignore-frame-padding, $frame-info-padding-top, nopx($padding-top)) + '-' +\r
183 if($ignore-frame-padding, $frame-info-padding-right, nopx($padding-right)) + '-' +\r
184 if($ignore-frame-padding, $frame-info-padding-bottom, nopx($padding-bottom)) + '-' +\r
185 if($ignore-frame-padding, $frame-info-padding-left, nopx($padding-left));\r
186\r
187 .#{$prefix}#{$cls-ui} {\r
188 @if length($border-radius) == 2 {\r
189 @include border-top-left-radius(nth($border-radius, 1));\r
190 @include border-top-right-radius(nth($border-radius, 2));\r
191 } @else if length($border-radius) == 3 {\r
192 @include border-top-left-radius(nth($border-radius, 1));\r
193 @include border-top-right-radius(nth($border-radius, 2));\r
194 @include border-bottom-right-radius(nth($border-radius, 3));\r
195 } @else if length($border-radius) == 4 {\r
196 @include border-top-left-radius(nth($border-radius, 1));\r
197 @include border-top-right-radius(nth($border-radius, 2));\r
198 @include border-bottom-right-radius(nth($border-radius, 3));\r
199 @include border-bottom-left-radius(nth($border-radius, 4));\r
200 } @else {\r
201 @include border-radius($border-radius);\r
202 }\r
203\r
204 padding: $padding-top $padding-right $padding-bottom $padding-left;\r
205 border-width: $border-width;\r
206 border-style: solid;\r
207\r
208 @if not is-null($background-color) {\r
209 @if not is-null($background-gradient) {\r
210 @include background-gradient($background-color, $background-gradient, $background-direction);\r
211 }\r
212 @else {\r
213 background-color: $background-color;\r
214 }\r
215 }\r
216 }\r
217\r
218 @if $include-frame-rtl {\r
219 @if $background-direction == left {\r
220 $background-direction: right;\r
221 } @else if $background-direction == right {\r
222 $background-direction: left;\r
223 }\r
224\r
225 @if $background-direction == left or $background-direction == right {\r
226 .#{$prefix}rtl.#{$prefix}#{$cls-ui} {\r
227 @include background-gradient(\r
228 $background-color,\r
229 $background-gradient,\r
230 $background-direction\r
231 );\r
232 }\r
233 }\r
234 }\r
235\r
236 @if $include-slicer-border-radius {\r
237 .#{$prefix}#{$cls-ui}-mc {\r
238 @if not is-null($background-gradient) {\r
239 background-image: slicer-frame-background-image($cls-ui, '#{$cls}/#{$cls-ui}-fbg');\r
240\r
241 @if $vertical {\r
242 background-position: $background-stretch-position 0;\r
243 background-repeat: repeat-y;\r
244 } @else {\r
245 background-position: 0 $background-stretch-position;\r
246 }\r
247 }\r
248 @if not is-null($background-color) {\r
249 background-color: $background-color;\r
250 }\r
251 }\r
252\r
253 @if $include-frame-rtl and not is-null($background-gradient) {\r
254 .#{$prefix}rtl.#{$prefix}#{$cls-ui}-mc {\r
255 background-image: slicer-frame-background-image-rtl($cls-ui, '#{$cls}/#{$cls-ui}-fbg-rtl');\r
256 background-position: rtl-background-position($background-stretch-position 0);\r
257 }\r
258 }\r
259 }\r
260\r
261 @if $include-slicer-border-radius {\r
262 .#{$prefix}nbr {\r
263 // This rule must be in x-nbr to avoid matching on CSS3 browsers.\r
264 .#{$prefix}#{$cls-ui} {\r
265 padding: 0 !important;\r
266 border-width: 0 !important;\r
267 @include border-radius(0px);\r
268 @if not is-null($background-color) {\r
269 background-color: transparent !important;\r
270 } @else {\r
271 background: #fff;\r
272 }\r
273 @if not is-null($background-gradient) {\r
274 background-image: none;\r
275 }\r
276 // it is helpful to suppress box-shadow when debugging nocss3 mode in modern browsers\r
277 box-shadow: none !important;\r
278 }\r
279 }\r
280\r
281 .#{$prefix}#{$cls-ui}-frameInfo {\r
282 // Pass along Div/Table, Horz/Vert, border-radius and border-width\r
283 // Here we're encoding the framing information in an arbitrary fashion so\r
284 // it can be parsed by the component and get information about the framing.\r
285 // Originally, this tried to embed the information using a background image\r
286 // pointing to about:blank#info however in IE with SSL, this would trigger\r
287 // the insecure content warning. We also tried encoding the info using a\r
288 // filter as follows (where framing-info is a string containing the encoded data):\r
289 // filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=false, src="ext-frame#{$framing-info}");\r
290 // However the filter property can only be read by IE, making it impossible\r
291 // to debug nocss3 mode in modern browsers. Font-family meets all the\r
292 // requirements for tunneling data to JavaScript. It can contain an\r
293 // arbitrary string value, which can be read in JS in any browser, and it\r
294 // does not trigger any network interactions.\r
295 font-family: #{$framing-info};\r
296 }\r
297\r
298 // These rules apply to elements that are not rendered on CSS3 browsers so we do\r
299 // not need to force the browser to walk to the root of the document searching\r
300 // for x-nbr!\r
301\r
302 @if $vertical {\r
303 // vertical framing element background positions\r
304 .#{$prefix}#{$cls-ui}-tl {\r
305 background-position: 0 0;\r
306 }\r
307\r
308 .#{$prefix}#{$cls-ui}-tr {\r
309 background-position: 0 (-$frame-max);\r
310 }\r
311\r
312 .#{$prefix}#{$cls-ui}-bl {\r
313 background-position: 0 (-$frame-max * 2);\r
314 }\r
315\r
316 .#{$prefix}#{$cls-ui}-br {\r
317 background-position: 0 (-$frame-max * 3);\r
318 }\r
319\r
320 .#{$prefix}#{$cls-ui}-ml {\r
321 background-position: (-$frame-max) 0;\r
322 }\r
323\r
324 .#{$prefix}#{$cls-ui}-mr {\r
325 background-position: right 0;\r
326 }\r
327\r
328 .#{$prefix}#{$cls-ui}-tc {\r
329 background-position: $background-stretch-position 0;\r
330 }\r
331\r
332 .#{$prefix}#{$cls-ui}-bc {\r
333 background-position: $background-stretch-position (-$frame-max);\r
334 }\r
335\r
336 @if $include-frame-rtl {\r
337 .#{$prefix}rtl.#{$prefix}#{$cls-ui}-tc {\r
338 background-position: rtl-background-position($background-stretch-position 0);\r
339 }\r
340\r
341 .#{$prefix}rtl.#{$prefix}#{$cls-ui}-bc {\r
342 background-position: rtl-background-position($background-stretch-position (-$frame-max));\r
343 }\r
344 }\r
345 } @else {\r
346 // horizontal framing element background positions\r
347 .#{$prefix}#{$cls-ui}-tl {\r
348 background-position: 0 (-$frame-max * 2);\r
349 }\r
350\r
351 .#{$prefix}#{$cls-ui}-tr {\r
352 background-position: right (-$frame-max * 3);\r
353 }\r
354\r
355 .#{$prefix}#{$cls-ui}-bl {\r
356 background-position: 0 (-$frame-max * 4);\r
357 }\r
358\r
359 .#{$prefix}#{$cls-ui}-br {\r
360 background-position: right (-$frame-max * 5);\r
361 }\r
362\r
363 .#{$prefix}#{$cls-ui}-ml {\r
364 @if $background-stretch-position == 'right' or $background-stretch-position == 'left' {\r
365 background-position: $background-stretch-position 0;\r
366 } @else {\r
367 background-position: 0 $background-stretch-position;\r
368 }\r
369 }\r
370\r
371 .#{$prefix}#{$cls-ui}-mr {\r
372 @if $background-stretch-position == 'right' or $background-stretch-position == 'left' {\r
373 background-position: $background-stretch-position 0;\r
374 } @else {\r
375 background-position: right $background-stretch-position;\r
376 }\r
377 }\r
378\r
379 .#{$prefix}#{$cls-ui}-tc {\r
380 background-position: 0 0;\r
381 }\r
382\r
383 .#{$prefix}#{$cls-ui}-bc {\r
384 background-position: 0 (-$frame-max);\r
385 }\r
386 }\r
387\r
388 .#{$prefix}#{$cls-ui}-tr,\r
389 .#{$prefix}#{$cls-ui}-br,\r
390 .#{$prefix}#{$cls-ui}-mr {\r
391 padding-right: $frame-right;\r
392 }\r
393\r
394 .#{$prefix}#{$cls-ui}-tl,\r
395 .#{$prefix}#{$cls-ui}-bl,\r
396 .#{$prefix}#{$cls-ui}-ml {\r
397 padding-left: $frame-left;\r
398 }\r
399\r
400 .#{$prefix}#{$cls-ui}-tc {\r
401 height: $frame-top;\r
402 }\r
403 .#{$prefix}#{$cls-ui}-bc {\r
404 height: $frame-bottom;\r
405 }\r
406\r
407 .#{$prefix}#{$cls-ui}-tl,\r
408 .#{$prefix}#{$cls-ui}-bl,\r
409 .#{$prefix}#{$cls-ui}-tr,\r
410 .#{$prefix}#{$cls-ui}-br,\r
411 .#{$prefix}#{$cls-ui}-tc,\r
412 .#{$prefix}#{$cls-ui}-bc,\r
413 .#{$prefix}#{$cls-ui}-ml,\r
414 .#{$prefix}#{$cls-ui}-mr {\r
415 @if $background-color != transparent {\r
416 background-image: slicer-corner-sprite($cls-ui, '#{$cls}/#{$cls-ui}-corners');\r
417 }\r
418 }\r
419\r
420 @if $background-color != transparent {\r
421 @if $include-frame-rtl {\r
422 .#{$prefix}rtl {\r
423 &.#{$prefix}#{$cls-ui}-tl,\r
424 &.#{$prefix}#{$cls-ui}-ml,\r
425 &.#{$prefix}#{$cls-ui}-bl,\r
426 &.#{$prefix}#{$cls-ui}-tr,\r
427 &.#{$prefix}#{$cls-ui}-mr,\r
428 &.#{$prefix}#{$cls-ui}-br {\r
429 background-image: slicer-corner-sprite-rtl($cls-ui, '#{$cls}/#{$cls-ui}-corners-rtl');\r
430 }\r
431 }\r
432 }\r
433 }\r
434\r
435 @if $vertical == true {\r
436 .#{$prefix}#{$cls-ui}-tc,\r
437 .#{$prefix}#{$cls-ui}-bc {\r
438 @if $background-color != transparent {\r
439 background-image: slicer-sides-sprite($cls-ui, '#{$cls}/#{$cls-ui}-sides');\r
440 background-repeat: repeat-x;\r
441 }\r
442 }\r
443\r
444 @if $include-frame-rtl and $background-color != transparent {\r
445 .#{$prefix}rtl {\r
446 &.#{$prefix}#{$cls-ui}-tc,\r
447 &.#{$prefix}#{$cls-ui}-bc {\r
448 background-image: slicer-sides-sprite-rtl($cls-ui, '#{$cls}/#{$cls-ui}-sides-rtl');\r
449 }\r
450 }\r
451 }\r
452 } @else {\r
453 .#{$prefix}#{$cls-ui}-ml,\r
454 .#{$prefix}#{$cls-ui}-mr {\r
455 @if $background-color != transparent {\r
456 background-image: slicer-sides-sprite($cls-ui, '#{$cls}/#{$cls-ui}-sides');\r
457 @if is-null($background-gradient) {\r
458 background-repeat: repeat-y;\r
459 }\r
460 }\r
461 }\r
462 }\r
463\r
464 .#{$prefix}#{$cls-ui}-mc {\r
465 padding: $extra-padding-top $extra-padding-right $extra-padding-bottom $extra-padding-left;\r
466 }\r
467 }\r
468\r
469 @include x-slicer($cls-ui);\r
470}\r