-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'wyattanderson-flexbox'
- Loading branch information
Showing
11 changed files
with
125 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,4 @@ | |
@import "css3/filter"; | ||
@import "css3/pie"; | ||
@import "css3/user-interface"; | ||
@import "css3/flexbox"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
@import "../support"; | ||
@import "shared"; | ||
|
||
// This is the underlying implementation for all the other mixins in this module. | ||
// It is the only way to access prefix support for older versions of the spec. | ||
// Deviates from canonical Compass implementation by dropping support for | ||
// older versions of the Flexbox spec. | ||
// | ||
// `$properties`: map of property-value pairs that should be prefixed | ||
@mixin flexbox($properties) { | ||
@each $prop, $value in $properties { | ||
@if $prop == display { | ||
@include experimental-value(display, $value, not(-moz), -webkit, | ||
not(-o), not(-ms), not(-khtml), official); | ||
} @else { | ||
@include experimental($prop, $value, not(-moz), -webkit, not(-o), | ||
not(-ms), not(-khtml), official); | ||
} | ||
} | ||
} | ||
|
||
// Values for $display are: flex (default), inline-flex | ||
@mixin display-flex($display: flex) { | ||
@include flexbox((display: $display)); | ||
} | ||
|
||
// Values: row | row-reverse | column | column-reverse | ||
@mixin flex-direction($direction) { | ||
@include flexbox((flex-direction: $direction)); | ||
} | ||
|
||
// Values: nowrap | wrap | wrap-reverse | ||
@mixin flex-wrap($wrap) { | ||
@include flexbox((flex-wrap: $wrap)); | ||
} | ||
|
||
// Shorthand for flex-direction and flex-wrap. | ||
@mixin flex-flow($flow) { | ||
@include flexbox((flex-flow: $flow)); | ||
} | ||
|
||
// Accepts an integer | ||
@mixin order($order) { | ||
@include flexbox((order: $order)); | ||
} | ||
|
||
// Shorthand for flex-grow, flex-shrink and optionally flex-basis. | ||
// Space separated, in that order. | ||
@mixin flex($flex) { | ||
@include flexbox((flex: $flex)); | ||
} | ||
|
||
// Accepts a number. | ||
@mixin flex-grow($flex-grow) { | ||
@include flexbox((flex-grow: $flex-grow)); | ||
} | ||
|
||
// Accepts a number. | ||
@mixin flex-shrink($flex-shrink) { | ||
@include flexbox((flex-shrink: $flex-shrink)); | ||
} | ||
|
||
// Accepts any legal value for the width property. | ||
@mixin flex-basis($flex-basis) { | ||
@include flexbox((flex-basis: $flex-basis)); | ||
} | ||
|
||
// Legal values: flex-start | flex-end | center | space-between | space-around | ||
@mixin justify-content($justify-content) { | ||
@include flexbox((justify-content: $justify-content)); | ||
} | ||
|
||
// Legal values: flex-start | flex-end | center | baseline | stretch | ||
@mixin align-items($align-items) { | ||
@include flexbox((align-items: $align-items)); | ||
} | ||
|
||
// Legal values: auto | flex-start | flex-end | center | baseline | stretch | ||
@mixin align-self($align-self) { | ||
@include flexbox((align-self: $align-self)); | ||
} | ||
|
||
// Legal values: flex-start | flex-end | center | space-between | space-around | stretch | ||
@mixin align-content($align-content) { | ||
@include flexbox((align-content: $align-content)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var compareIt = require('../helper/compare'); | ||
|
||
describe("Flexbox", function() { | ||
var flexShould = function(spec, ruleset, output) { | ||
return compareIt("should " + spec, ruleset, output, | ||
['compass/css3/flexbox']); | ||
}; | ||
|
||
compareIt("should output all flexbox properties", | ||
"@include flexbox(( display: flex, flex-direction: row-reverse, flex-wrap: wrap-reverse, flex-flow: row-reverse wrap-reverse, order: 1, flex: 1 0 auto, flex-grow: 1, flex-shrink: 0, flex-basis: auto, justify-content: flex-start, align-items: flex-start, align-self: flex-start, align-content: flex-start));", | ||
"display:-webkit-flex;display:flex;-webkit-flex-direction:row-reverse;flex-direction:row-reverse;-webkit-flex-wrap:wrap-reverse;flex-wrap:wrap-reverse;-webkit-flex-flow:row-reverse wrap-reverse;flex-flow:row-reverse wrap-reverse;-webkit-order:1;order:1;-webkit-flex:1 0 auto;flex:1 0 auto;-webkit-flex-grow:1;flex-grow:1;-webkit-flex-shrink:0;flex-shrink:0;-webkit-flex-basis:auto;flex-basis:auto;-webkit-justify-content:flex-start;justify-content:flex-start;-webkit-align-items:flex-start;align-items:flex-start;-webkit-align-self:flex-start;align-self:flex-start;-webkit-align-content:flex-start;align-content:flex-start", | ||
['compass/css3/flexbox']); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var render = require('../helper/render'); | ||
var ruleset = require('../helper/ruleset'); | ||
|
||
module.exports = function(spec, inputRuleset, expectedOutput, imports) { | ||
return it(spec, function (done) { | ||
render(ruleset(inputRuleset), function(output, err) { | ||
expect(output).toBe(ruleset(expectedOutput)); | ||
done(); | ||
}, imports); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module.exports = function(prop) { | ||
return 'a{b:'+prop+';}'; | ||
return 'a{b:'+prop+'}'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters