compass-flex-box 0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ require 'compass'
2
+
3
+ # This tells Compass what your Compass extension is called, and where to find
4
+ # its files
5
+ extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
6
+ Compass::Frameworks.register('compass-flex-box', :path => extension_path)
@@ -0,0 +1,288 @@
1
+ @import "compass/css3/shared";
2
+
3
+ // Enabling flexbox: setting an element to be a flex container
4
+ @mixin display-flex() {
5
+ @include experimental-value(display, box, -moz, -webkit, not -o, not -ms, not -khtml, not official);
6
+ @include experimental-value(display, flexbox, not -moz, not -webkit, not -o, -ms, not -khtml, not official);
7
+ @include experimental-value(display, flex, not -moz, -webkit, not -o, not -ms, not -khtml, official);
8
+ }
9
+
10
+ @mixin display-inline-flex() {
11
+ @include experimental-value(display, inline-box, -moz, -webkit, not -o, not -ms, not -khtml, not official);
12
+ @include experimental-value(display, inline-flexbox, not -moz, not -webkit, not -o, -ms, not -khtml, not official);
13
+ @include experimental-value(display, inline-flex, not -moz, -webkit, not -o, not -ms, not -khtml, official);
14
+ }
15
+
16
+ // Axis alignment: specifying alignment of items along the main flexbox axis
17
+
18
+ $default-justify-content: flex-start !default;
19
+
20
+ @mixin justify-content(
21
+ $justification: $default-justify-content
22
+ ) {
23
+ @include flex-property(justify-content, $justification, flex-pack, box-pack);
24
+ }
25
+
26
+ // Cross-axis alignment: specifying alignment of items along the cross-axis
27
+
28
+ $default-align-items: stretch !default;
29
+
30
+ @mixin align-items(
31
+ $alignment: $default-align-items
32
+ ) {
33
+ @include flex-property(align-items, $alignment, flex-align, box-align);
34
+ }
35
+
36
+ // Individual cross-axis alignment: override to align individual items along the cross-axis
37
+
38
+ $default-align-self: stretch !default;
39
+
40
+ @mixin align-self(
41
+ $alignment: $default-align-self
42
+ ) {
43
+ @include flex-property(align-self, $alignment, flex-item-align, null);
44
+ }
45
+
46
+ // Flex line alignment: specifying alignment of flex lines along the cross-axis
47
+
48
+ $default-align-content: stretch !default;
49
+
50
+ @mixin align-content(
51
+ $alignment: $default-align-content
52
+ ) {
53
+ @include flex-property(align-items, $alignment, flex-line-pack, null);
54
+ }
55
+
56
+ // Display order: specifying the order of flex items
57
+
58
+ $default-order: 1 !default;
59
+
60
+ @mixin order(
61
+ $order: $default-order
62
+ ) {
63
+ @include flex-property(order, $order, flex-order, box-ordinal-group);
64
+ }
65
+
66
+ // Flexibility: specifying how the size of items flex
67
+
68
+ $default-flex: 1 !default;
69
+
70
+ @mixin flex(
71
+ $amount: $default-flex
72
+ ) {
73
+ @include flex-property(flex, $amount, flex, box-flex);
74
+ }
75
+
76
+ $default-flex-grow: $default-flex !default;
77
+
78
+ @mixin flex-grow(
79
+ $amount: $default-flex-grow
80
+ ) {
81
+ @include flex-property(flex-grow, $amount);
82
+ }
83
+
84
+ $default-flex-shrink: $default-flex !default;
85
+
86
+ @mixin flex-shrink(
87
+ $amount: $default-flex-shrink
88
+ ) {
89
+ @include flex-property(flex-shrink, $amount);
90
+ }
91
+
92
+ $default-flex-basis: $default-flex !default;
93
+
94
+ @mixin flex-basis(
95
+ $amount: $default-flex-basis
96
+ ) {
97
+ @include flex-property(flex-basis, $amount);
98
+ }
99
+
100
+ // Direction: specifying the direction of the main flexbox axis
101
+
102
+ $default-flex-direction: row !default;
103
+
104
+ @mixin flex-direction(
105
+ $direction: $default-flex-direction
106
+ ) {
107
+ @include flex-property(flex-direction, $direction, flex-direction, box-orient);
108
+ }
109
+
110
+ // Wrapping: specifying if and how flex items wrap along the cross-axis
111
+
112
+ $default-flex-wrap: nowrap !default;
113
+
114
+ @mixin flex-wrap(
115
+ $wrap: $default-flex-wrap
116
+ ) {
117
+ @include flex-property(flex-wrap, $wrap, flex-wrap, box-lines);
118
+ }
119
+
120
+ // Shorthand for flex-direction & flex-wrap
121
+
122
+ $default-flex-flow: $default-flex-direction $default-flex-wrap !default;
123
+
124
+ @mixin flex-flow(
125
+ $flow: $default-flex-flow
126
+ ) {
127
+ @include flex-property(flex-flow, $flow, flex-flow, null);
128
+ }
129
+
130
+ @mixin flex-property($standard-property, $value, $mid-property: null, $old-property: null) {
131
+ $standard-property: unquote($standard-property);
132
+ $mid-property: unquote($mid-property);
133
+ $old-property: unquote($old-property);
134
+ $value: unquote($value);
135
+ $standard-value: $value;
136
+ $mid-value: flex-value($standard-property, $value, mid);
137
+ $old-value: flex-value($standard-property, $value, old);
138
+
139
+ // Safari, Firefox (buggy), iOS, Android browser, older WebKit browsers
140
+ @if $old-property and $old-value {
141
+
142
+ @if $standard-property == flex-direction and ($value == row-reverse or $value == column-reverse) {
143
+ @include experimental(box-direction, reverse, -moz, -webkit, not -o, not -ms, not -khtml, not official);
144
+ }
145
+ @include experimental($old-property, $old-value, -moz, -webkit, not -o, not -ms, not -khtml, not official);
146
+ }
147
+ // IE 10
148
+ @if $mid-property and $mid-value {
149
+ @include experimental($mid-property, $mid-value, not -moz, not -webkit, not -o, -ms, not -khtml, not official);
150
+ }
151
+ // Chrome 21+, Opera 12.1, Firefox 22+
152
+ @include experimental($standard-property, $standard-value, not -moz, -webkit, not -o, not -ms, not -khtml, official);
153
+ }
154
+
155
+ @function flex-value($property, $value, $syntax) {
156
+ $new-value: $value;
157
+ $warning: false;
158
+
159
+ @if $property == justify-content {
160
+ @if $value == flex-start {
161
+ @if $syntax == old or $syntax == mid {
162
+ $new-value: start;
163
+ }
164
+ }
165
+ @else if $value == flex-end {
166
+ @if $syntax == old or $syntax == mid {
167
+ $new-value: end;
168
+ }
169
+ }
170
+ @else if $value == space-between {
171
+ @if $syntax == old {
172
+ $warning: "\"#{$property}: #{$value}\" does not work in the old Firefox implementation";
173
+ }
174
+ @if $syntax == old or $syntax == mid {
175
+ $new-value: justify;
176
+ }
177
+ }
178
+ @else if $value == space-around {
179
+ @if $syntax == old {
180
+ $new-value: null;
181
+ } @else if $syntax == mid {
182
+ $new-value: distribute;
183
+ }
184
+ }
185
+ }
186
+
187
+ @if $property == align-items {
188
+ @if $value == flex-start {
189
+ @if $syntax == old or $syntax == mid {
190
+ $new-value: start;
191
+ }
192
+ }
193
+ @else if $value == flex-end {
194
+ @if $syntax == old or $syntax == mid {
195
+ $new-value: end;
196
+ }
197
+ }
198
+ }
199
+
200
+ @if $property == align-self {
201
+ @if $value == flex-start {
202
+ @if $syntax == mid {
203
+ $new-value: start;
204
+ }
205
+ }
206
+ @else if $value == flex-end {
207
+ @if $syntax == mid {
208
+ $new-value: end;
209
+ }
210
+ }
211
+ }
212
+
213
+ @if $property == align-content {
214
+ @if $value == flex-start {
215
+ @if $syntax == mid {
216
+ $new-value: start;
217
+ }
218
+ }
219
+ @else if $value == flex-end {
220
+ @if $syntax == mid {
221
+ $new-value: end;
222
+ }
223
+ }
224
+ @else if $value == space-between {
225
+ @if $syntax == mid {
226
+ $new-value: justify;
227
+ }
228
+ }
229
+ @else if $value == space-around {
230
+ @if $syntax == mid {
231
+ $new-value: distribute;
232
+ }
233
+ }
234
+ }
235
+
236
+ @if $property == order {
237
+ @if $syntax == old and $value < 1 {
238
+ $warning: "\"#{$property}\" must be a positive integer in the \"#{$syntax}\" syntax";
239
+ $new-value: null;
240
+ }
241
+ }
242
+
243
+ @if $property == flex {
244
+ @if $syntax == old and type_of($value) != number {
245
+ $warning: "\"#{$property}\" only accepts an integer in the \"#{$syntax}\" syntax";
246
+ $new-value: null;
247
+ }
248
+ }
249
+
250
+ @if $property == flex-direction {
251
+ @if $value == row or $value == row-reverse {
252
+ @if $syntax == old {
253
+ $new-value: horizontal;
254
+ }
255
+ }
256
+ @else if $value == column or $value == column-reverse {
257
+ @if $syntax == old {
258
+ $new-value: vertical;
259
+ }
260
+ }
261
+ }
262
+
263
+ @if $property == flex-wrap {
264
+ @if $value == nowrap {
265
+ @if $syntax == old {
266
+ $new-value: single;
267
+ }
268
+ }
269
+ @else if $value == wrap {
270
+ @if $syntax == old {
271
+ $new-value: multiple;
272
+ }
273
+ }
274
+ @else if $value == wrap-reverse {
275
+ @if $syntax == old {
276
+ $new-value: null;
277
+ }
278
+ }
279
+ }
280
+
281
+ @if $new-value == null or $warning {
282
+ @warn if($warning, $warning, "\"#{$property}: #{$value}\" not supported in the \"" + $syntax + "\" syntax");
283
+ }
284
+
285
+ @return $new-value;
286
+ }
287
+
288
+
@@ -0,0 +1,2 @@
1
+ # Make sure you list all the project template files here in the manifest.
2
+ stylesheet 'screen.scss', :media => 'screen, projection'
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: compass-flex-box
3
+ version: !ruby/object:Gem::Version
4
+ hash: 9
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ version: "0.1"
10
+ platform: ruby
11
+ authors:
12
+ - Tim Hettler
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2013-06-06 00:00:00 Z
18
+ dependencies:
19
+ - !ruby/object:Gem::Dependency
20
+ name: sass
21
+ prerelease: false
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ hash: 3
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :runtime
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: compass
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ hash: 3
42
+ segments:
43
+ - 0
44
+ version: "0"
45
+ type: :runtime
46
+ version_requirements: *id002
47
+ description: A compass extension that provides variables & mixins for the latest (and final) Flexible Box Layout (flex-box) specification
48
+ email:
49
+ - me+github@timhettler.com
50
+ executables: []
51
+
52
+ extensions: []
53
+
54
+ extra_rdoc_files: []
55
+
56
+ files:
57
+ - lib/compass-flex-box.rb
58
+ - stylesheets/_flex-box.scss
59
+ - templates/example/manifest.rb
60
+ homepage: https://github.com/timhettler/compass-flex-box
61
+ licenses: []
62
+
63
+ post_install_message:
64
+ rdoc_options: []
65
+
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ hash: 23
83
+ segments:
84
+ - 1
85
+ - 3
86
+ - 6
87
+ version: 1.3.6
88
+ requirements: []
89
+
90
+ rubyforge_project:
91
+ rubygems_version: 1.8.25
92
+ signing_key:
93
+ specification_version: 3
94
+ summary: A compass extension that provides variables & mixins for the latest (and final) Flexible Box Layout (flex-box) specification
95
+ test_files: []
96
+