rapido-css 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,198 +0,0 @@
1
- // @@@ These helpers only live here until they land in Compass.
2
-
3
- // ---------------------------------------------------------------------------
4
- // Imports
5
-
6
- @import "compass/support";
7
-
8
- // ---------------------------------------------------------------------------
9
- // Helpers
10
-
11
- // A debug tool for checking browser support
12
- @mixin debug-support-matrix($experimental: true, $ie: true) {
13
- @debug #{'$moz-'}$experimental-support-for-mozilla
14
- #{'$webkit-'}$experimental-support-for-webkit
15
- #{'$microsoft-'}$experimental-support-for-microsoft
16
- #{'$opera-'}$experimental-support-for-opera
17
- #{'$khtml-'}$experimental-support-for-khtml;
18
- @debug #{'$ie6-'}$legacy-support-for-ie6
19
- #{'$ie7-'}$legacy-support-for-ie7
20
- #{'$ie8-'}$legacy-support-for-ie8;
21
- }
22
-
23
- // Capture the current exerimental support settings
24
- @function capture-experimental-matrix() {
25
- @return $experimental-support-for-mozilla
26
- $experimental-support-for-webkit
27
- $experimental-support-for-microsoft
28
- $experimental-support-for-opera
29
- $experimental-support-for-khtml;
30
- }
31
-
32
- // Capture the current legacy-ie support settings
33
- @function capture-legacy-ie-matrix() {
34
- @return $legacy-support-for-ie6
35
- $legacy-support-for-ie7
36
- $legacy-support-for-ie8;
37
- }
38
-
39
- // Capture and store support
40
- $experimental-matrix: capture-experimental-matrix();
41
- $legacy-ie-matrix: capture-legacy-ie-matrix();
42
-
43
- @mixin capture-experimental-matrix {
44
- $experimental-matrix: capture-experimental-matrix();
45
- }
46
-
47
- @mixin capture-legacy-ie-matrix {
48
- $legacy-ie-matrix: capture-legacy-ie-matrix();
49
- }
50
-
51
- @mixin capture-support-matrix {
52
- @include capture-experimental-matrix;
53
- @include capture-legacy-ie-matrix;
54
- }
55
-
56
- // Change the experimental-support settings in specific contexts.
57
- @mixin set-experimental-support(
58
- $moz : false,
59
- $webkit : false,
60
- $ms : false,
61
- $o : false,
62
- $khtml : false
63
- ) {
64
- $experimental-support-for-mozilla : $moz;
65
- $experimental-support-for-webkit : $webkit;
66
- $experimental-support-for-microsoft : $ms;
67
- $experimental-support-for-opera : $o;
68
- $experimental-support-for-khtml : $khtml;
69
- }
70
-
71
- @mixin capture-and-set-experimental(
72
- $moz : false,
73
- $webkit : false,
74
- $ms : false,
75
- $o : false,
76
- $khtml : false
77
- ) {
78
- @include capture-experimental-matrix;
79
- @include set-experimental-support($moz, $webkit, $ms, $o, $khtml);
80
- }
81
-
82
- @mixin capture-and-adjust-experimental(
83
- $moz : $experimental-support-for-mozilla,
84
- $webkit : $experimental-support-for-webkit,
85
- $ms : $experimental-support-for-microsoft,
86
- $o : $experimental-support-for-opera,
87
- $khtml : $experimental-support-for-khtml
88
- ) {
89
- @include capture-experimental-matrix;
90
- @include set-experimental-support($moz, $webkit, $ms, $o, $khtml);
91
- }
92
-
93
- // Change the legacy-support-for-ie* settings in specific contexts.
94
- @mixin set-legacy-ie-support(
95
- $ie6: false,
96
- $ie7: false,
97
- $ie8: false
98
- ) {
99
- $legacy-support-for-ie6: $ie6;
100
- $legacy-support-for-ie7: $ie7;
101
- $legacy-support-for-ie8: $ie8;
102
- }
103
-
104
- @mixin capture-and-set-legacy-ie(
105
- $ie6: false,
106
- $ie7: false,
107
- $ie8: false
108
- ) {
109
- @include capture-legacy-ie-matrix;
110
- @include set-legacy-ie-support($ie6, $ie7, $ie8);
111
- }
112
-
113
- @mixin capture-and-adjust-legacy-ie(
114
- $ie6: $legacy-support-for-ie6,
115
- $ie7: $legacy-support-for-ie7,
116
- $ie8: $legacy-support-for-ie8
117
- ) {
118
- @include capture-and-set-legacy-ie($ie6, $ie7, $ie8);
119
- }
120
-
121
- // Capture current browser support matrix, and set a new matrix of support.
122
- @mixin capture-and-set-support(
123
- $moz : false,
124
- $webkit : false,
125
- $ms : false,
126
- $o : false,
127
- $khtml : false,
128
- $ie6 : false,
129
- $ie7 : false,
130
- $ie8 : false
131
- ) {
132
- // Capture the current state
133
- @include capture-support-matrix;
134
-
135
- // Change support settings
136
- @include set-experimental-support($moz, $webkit, $ms, $o, $khtml);
137
- @include set-legacy-ie-support($ie6, $ie7, $ie8);
138
- }
139
-
140
- // Capture current browser support matrix, and set a new matrix of support.
141
- @mixin capture-and-adjust-support(
142
- $moz : $experimental-support-for-mozilla,
143
- $webkit : $experimental-support-for-webkit,
144
- $ms : $experimental-support-for-microsoft,
145
- $o : $experimental-support-for-opera,
146
- $khtml : $experimental-support-for-khtml,
147
- $ie6 : $legacy-support-for-ie6,
148
- $ie7 : $legacy-support-for-ie7,
149
- $ie8 : $legacy-support-for-ie8
150
- ) {
151
- @include capture-and-set-support($moz, $webkit, $ms, $o, $khtml, $ie6, $ie7, $ie8);
152
- }
153
-
154
-
155
- // This mixin allows you to change the experimental support settings for
156
- // child (@content) styles.
157
- @mixin with-only-support-for(
158
- $moz : false,
159
- $webkit : false,
160
- $ms : false,
161
- $o : false,
162
- $khtml : false,
163
- $ie6 : false,
164
- $ie7 : false,
165
- $ie8 : false
166
- ) {
167
- // Capture current state
168
- $wo-experimental-matrix : capture-experimental-matrix();
169
- $wo-legacy-ie-matrix : capture-legacy-ie-matrix();
170
-
171
- // Set new states
172
- @include set-experimental-support($moz, $webkit, $ms, $o, $khtml);
173
- @include set-legacy-ie-support($ie6, $ie7, $ie8);
174
-
175
- // Apply styles
176
- @content;
177
-
178
- // Return to original support settings
179
- @include set-experimental-support($wo-experimental-matrix...);
180
- @include set-legacy-ie-support($wo-legacy-ie-matrix...);
181
- }
182
-
183
- // This mixin is a shortcut for making slight adjustments to browser support
184
- // for child (@content) styles
185
- @mixin adjust-support-for(
186
- $moz : $experimental-support-for-mozilla,
187
- $webkit : $experimental-support-for-webkit,
188
- $ms : $experimental-support-for-microsoft,
189
- $o : $experimental-support-for-opera,
190
- $khtml : $experimental-support-for-khtml,
191
- $ie6 : $legacy-support-for-ie6,
192
- $ie7 : $legacy-support-for-ie7,
193
- $ie8 : $legacy-support-for-ie8
194
- ) {
195
- @include with-only-support-for($moz, $webkit, $ms, $o, $khtml, $ie6, $ie7, $ie8) {
196
- @content;
197
- }
198
- }
@@ -1,159 +0,0 @@
1
- // @private Default font-size for all browsers
2
- $browser-default-font-size: 16px;
3
-
4
- // Base font size in pixels, if not already defined.
5
- // Should be the same as the font-size of the html element.
6
- $base-font-size: 16px !default;
7
-
8
- // Whether to output fallback values in px when outputting rems.
9
- $rem-with-px-fallback: true !default;
10
-
11
- // Convert any CSS <length> or <percentage> value to any another.
12
- //
13
- // @param $length
14
- // A css <length> or <percentage> value
15
- //
16
- // @param $to-unit
17
- // String matching a css unit keyword, e.g. 'em', '%', etc.
18
- //
19
- // @param $from-context
20
- // When converting from relative units, the absolute length (in px) to
21
- // which $length refers (e.g. for $lengths in em units, would normally be the
22
- // font-size of the current element).
23
- //
24
- // @param $to-context
25
- // For converting to relative units, the absolute length in px to which the
26
- // output value will refer. Defaults to the same as $from-context, since it is
27
- // rarely needed.
28
- @function convert-length(
29
- $length,
30
- $to-unit,
31
- $from-context: $base-font-size,
32
- $to-context: $from-context
33
- ) {
34
-
35
- $from-unit: unit($length);
36
-
37
- // Optimize for cases where `from` and `to` units are accidentally the same.
38
- @if $from-unit == $to-unit { @return $length; }
39
-
40
- // Context values must be in px so we can determine a conversion ratio for
41
- // relative units.
42
- @if unit($from-context) != 'px' { @warn "Paremeter $from-context must resolve to a value in pixel units."; }
43
- @if unit($to-context) != 'px' { @warn "Parameter $to-context must resolve to a value in pixel units."; }
44
-
45
- // Convert input length to pixels
46
- $px-length: $length;
47
-
48
- @if $from-unit != 'px' {
49
- // Convert relative units using the from-context parameter.
50
- @if $from-unit == 'em' { $px-length: $length * $from-context / 1em }
51
- @else if $from-unit == 'rem' { $px-length: $length * $base-font-size / 1rem }
52
- @else if $from-unit == '%' { $px-length: $length * $from-context / 100% }
53
- @else if $from-unit == 'ex' { $px-length: $length * $from-context / 2ex }
54
- // Convert absolute units using Sass' conversion table.
55
- @else if $from-unit == 'in' or
56
- $from-unit == 'mm' or
57
- $from-unit == 'cm' or
58
- $from-unit == 'pt' or
59
- $from-unit == 'pc' { $px-length: 0px + $length }
60
- // Certain units can't be converted.
61
- @else if $from-unit == 'ch' or
62
- $from-unit == 'vw' or
63
- $from-unit == 'vh' or
64
- $from-unit == 'vmin' {
65
- @warn "#{$from-unit} units can't be reliably converted; Returning original value.";
66
- @return $length;
67
- }
68
- @else {
69
- @warn "#{$from-unit} is an unknown length unit. Returning original value.";
70
- @return $length;
71
- }
72
- }
73
-
74
- // Convert length in pixels to the output unit
75
- $output-length: $px-length;
76
- @if $to-unit != 'px' {
77
- // Relative units
78
- @if $to-unit == 'em' { $output-length: $px-length * 1em / $to-context }
79
- @else if $to-unit == 'rem' { $output-length: $px-length * 1rem / $base-font-size }
80
- @else if $to-unit == '%' { $output-length: $px-length * 100% / $to-context }
81
- @else if $to-unit == 'ex' { $output-length: $px-length * 2ex / $to-context }
82
- // Absolute units
83
- @else if $to-unit == 'in' { $output-length: 0in + $px-length }
84
- @else if $to-unit == 'mm' { $output-length: 0mm + $px-length }
85
- @else if $to-unit == 'cm' { $output-length: 0cm + $px-length }
86
- @else if $to-unit == 'pt' { $output-length: 0pt + $px-length }
87
- @else if $to-unit == 'pc' { $output-length: 0pc + $px-length }
88
- // Non-convertible units
89
- @else if $to-unit == 'ch' or
90
- $to-unit == 'vw' or
91
- $to-unit == 'vh' or
92
- $to-unit == 'vmin' {
93
- @warn "#{$to-unit} units can't be reliably converted; Returning original value.";
94
- @return $length;
95
- }
96
- @else {
97
- @warn "#{$to-unit} is an unknown length unit. Returning original value.";
98
- @return $length;
99
- }
100
- }
101
-
102
- @return $output-length;
103
- }
104
-
105
-
106
- // Output a given style rule containing rem values along with an (optional)
107
- // fallback rule for older browsers (with rem values converted to px).
108
- //
109
- // @param $property
110
- // The css property name.
111
- //
112
- // @param $values
113
- // The value (or space-separated list of values) for the property.
114
- //
115
- // @param $use-px-fallback
116
- // [ true | false ]
117
- //
118
- @mixin rem($property, $values, $use-px-fallback: $rem-with-px-fallback) {
119
- // Create a couple of empty lists as output buffers.
120
- $px-values: ();
121
- $rem-values: ();
122
-
123
- // Loop through the $values list
124
- @each $value in $values {
125
- // For each property value, if it's in rem or px, derive both rem and
126
- // px values for it and add those to the end of the appropriate buffer.
127
- // Ensure all pixel values are rounded to the nearest pixel.
128
- @if type-of($value) == number and not unitless($value) and (unit($value) == px or unit($value) == rem) {
129
- @if unit($value) == px {
130
- $px-values: join($px-values, round($value));
131
- $rem-values: join($rem-values, convert-length($value, rem));
132
- }
133
- @else {
134
- $px-values: join($px-values, round(convert-length($value, px)));
135
- $rem-values: join($rem-values, $value);
136
- }
137
- }
138
- @else {
139
- $px-values: join($px-values, $value);
140
- $rem-values: join($rem-values, $value);
141
- }
142
- }
143
-
144
- // Use pixel fallback for browsers that don't understand rem units.
145
- @if $use-px-fallback {
146
- #{$property}: $px-values;
147
- }
148
-
149
- // Use rem values for everyone else (overrides pixel values).
150
- #{$property}: $rem-values;
151
- }
152
-
153
- @mixin if-rem($property, $values, $use-px-fallback: $rem-with-px-fallback) {
154
- $has-rem: false;
155
- @each $value in $values { $has-rem: if(unit($value) == 'rem', true, $has-rem); }
156
- @if $has-rem { @include rem($property, $values, $use-px-fallback); }
157
- @else { #{$property}: $values; }
158
- }
159
-