archetype 0.0.1.pre.1 → 0.0.1.pre.3.00dfd9a
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +88 -0
- data/LICENSE +16 -0
- data/README.md +87 -1
- data/VERSION.yml +6 -0
- data/lib/README.rdoc +4 -0
- data/lib/archetype.rb +45 -0
- data/lib/archetype/functions.rb +9 -0
- data/lib/archetype/functions/hash.rb +149 -0
- data/lib/archetype/functions/helpers.rb +125 -0
- data/lib/archetype/functions/styleguide_memoizer.rb +61 -0
- data/lib/archetype/sass_extensions.rb +6 -0
- data/lib/archetype/sass_extensions/functions.rb +14 -0
- data/lib/archetype/sass_extensions/functions/environment.rb +14 -0
- data/lib/archetype/sass_extensions/functions/lists.rb +284 -0
- data/lib/archetype/sass_extensions/functions/locale.rb +77 -0
- data/lib/archetype/sass_extensions/functions/numbers.rb +19 -0
- data/lib/archetype/sass_extensions/functions/styleguide.rb +406 -0
- data/lib/archetype/sass_extensions/functions/ui.rb +59 -0
- data/lib/archetype/sass_extensions/functions/version.rb +95 -0
- data/lib/archetype/version.rb +75 -0
- data/stylesheets/_archetype.scss +2 -0
- data/stylesheets/archetype/_base.scss +46 -0
- data/stylesheets/archetype/_config.scss +366 -0
- data/stylesheets/archetype/_grid.scss +3 -0
- data/stylesheets/archetype/_hacks.scss +72 -0
- data/stylesheets/archetype/_init.scss +23 -0
- data/stylesheets/archetype/_styleguide.scss +6 -0
- data/stylesheets/archetype/_ui.scss +326 -0
- data/stylesheets/archetype/_util.scss +12 -0
- data/stylesheets/archetype/base/_h5bp.scss +307 -0
- data/stylesheets/archetype/base/_hybrid.scss +25 -0
- data/stylesheets/archetype/base/_normalize.scss +595 -0
- data/stylesheets/archetype/base/_reset.scss +72 -0
- data/stylesheets/archetype/grid/_config.scss +14 -0
- data/stylesheets/archetype/grid/_grid.scss +391 -0
- data/stylesheets/archetype/styleguide/_components.scss +25 -0
- data/stylesheets/archetype/styleguide/_helpers.scss +215 -0
- data/stylesheets/archetype/styleguide/_primitives.scss +10 -0
- data/stylesheets/archetype/styleguide/_styleguide.scss +41 -0
- data/stylesheets/archetype/styleguide/components/_alerts.scss +59 -0
- data/stylesheets/archetype/styleguide/components/_annotations.scss +27 -0
- data/stylesheets/archetype/styleguide/components/_bristol.scss +15 -0
- data/stylesheets/archetype/styleguide/components/_button_groups.scss +47 -0
- data/stylesheets/archetype/styleguide/components/_button_toolbars.scss +17 -0
- data/stylesheets/archetype/styleguide/components/_buttons.scss +338 -0
- data/stylesheets/archetype/styleguide/components/_canvas.scss +15 -0
- data/stylesheets/archetype/styleguide/components/_carets.scss +336 -0
- data/stylesheets/archetype/styleguide/components/_closes.scss +63 -0
- data/stylesheets/archetype/styleguide/components/_container.scss +27 -0
- data/stylesheets/archetype/styleguide/components/_copy.scss +85 -0
- data/stylesheets/archetype/styleguide/components/_flyouts.scss +52 -0
- data/stylesheets/archetype/styleguide/components/_headings.scss +33 -0
- data/stylesheets/archetype/styleguide/components/_headlines.scss +63 -0
- data/stylesheets/archetype/styleguide/components/_hovercards.scss +27 -0
- data/stylesheets/archetype/styleguide/components/_icons.scss +17 -0
- data/stylesheets/archetype/styleguide/components/_identities.scss +34 -0
- data/stylesheets/archetype/styleguide/components/_links.scss +66 -0
- data/stylesheets/archetype/styleguide/components/_loaders.scss +154 -0
- data/stylesheets/archetype/styleguide/components/_menu_items.scss +31 -0
- data/stylesheets/archetype/styleguide/components/_module.scss +15 -0
- data/stylesheets/archetype/styleguide/components/_pullquotes.scss +29 -0
- data/stylesheets/archetype/styleguide/components/_punchcut.scss +18 -0
- data/stylesheets/archetype/styleguide/components/_tooltips.scss +28 -0
- data/stylesheets/archetype/styleguide/primitives/_animations.scss +17 -0
- data/stylesheets/archetype/styleguide/primitives/_dimensions.scss +50 -0
- data/stylesheets/archetype/styleguide/primitives/_glyphs.scss +11 -0
- data/stylesheets/archetype/styleguide/primitives/_misc.scss +8 -0
- data/stylesheets/archetype/styleguide/primitives/_palettes.scss +94 -0
- data/stylesheets/archetype/styleguide/primitives/_shadows.scss +23 -0
- data/stylesheets/archetype/styleguide/primitives/_sprites.scss +46 -0
- data/stylesheets/archetype/styleguide/primitives/_textures.scss +10 -0
- data/stylesheets/archetype/styleguide/primitives/_typography.scss +56 -0
- data/stylesheets/archetype/util/_debug.scss +40 -0
- data/stylesheets/archetype/util/_lists.scss +57 -0
- data/stylesheets/archetype/util/_misc.scss +108 -0
- data/stylesheets/archetype/util/_rtl.scss +279 -0
- data/stylesheets/archetype/util/_spacing.scss +78 -0
- data/stylesheets/archetype/util/_styles.scss +466 -0
- data/stylesheets/archetype/util/_targeting.scss +210 -0
- data/stylesheets/archetype/util/_units.scss +18 -0
- data/templates/example/index.html +40 -0
- data/templates/example/manifest.rb +13 -0
- data/templates/example/screen.scss +99 -0
- data/templates/example/vendor/archetype/animations/loaders/large/large.png +0 -0
- data/templates/example/vendor/archetype/animations/loaders/large/large_dark.png +0 -0
- data/templates/example/vendor/archetype/animations/loaders/large/large_dark_static.png +0 -0
- data/templates/example/vendor/archetype/animations/loaders/large/large_static.png +0 -0
- data/templates/example/vendor/archetype/animations/loaders/medium/medium.png +0 -0
- data/templates/example/vendor/archetype/animations/loaders/medium/medium_dark.png +0 -0
- data/templates/example/vendor/archetype/animations/loaders/medium/medium_dark_static.png +0 -0
- data/templates/example/vendor/archetype/animations/loaders/medium/medium_static.png +0 -0
- data/templates/example/vendor/archetype/animations/loaders/small/small.png +0 -0
- data/templates/example/vendor/archetype/animations/loaders/small/small_dark.png +0 -0
- data/templates/example/vendor/archetype/animations/loaders/small/small_dark_static.png +0 -0
- data/templates/example/vendor/archetype/animations/loaders/small/small_static.png +0 -0
- data/templates/example/vendor/archetype/fontawesome-webfont.eot +0 -0
- data/templates/example/vendor/archetype/fontawesome-webfont.svg +255 -0
- data/templates/example/vendor/archetype/fontawesome-webfont.ttf +0 -0
- data/templates/example/vendor/archetype/fontawesome-webfont.woff +0 -0
- data/templates/project/manifest.rb +9 -0
- data/templates/project/screen.scss +1 -0
- data/templates/project/vendor/archetype/animations/loaders/large/large.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/large/large_dark.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/large/large_dark_static.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/large/large_static.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/medium/medium.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/medium/medium_dark.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/medium/medium_dark_static.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/medium/medium_static.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/small/small.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/small/small_dark.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/small/small_dark_static.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/small/small_static.png +0 -0
- data/templates/project/vendor/archetype/fontawesome-webfont.eot +0 -0
- data/templates/project/vendor/archetype/fontawesome-webfont.svg +255 -0
- data/templates/project/vendor/archetype/fontawesome-webfont.ttf +0 -0
- data/templates/project/vendor/archetype/fontawesome-webfont.woff +0 -0
- data/test/fixtures/stylesheets/archetype/assets/fonts/fontawesome-webfont.eot +0 -0
- data/test/fixtures/stylesheets/archetype/assets/fonts/fontawesome-webfont.svg +255 -0
- data/test/fixtures/stylesheets/archetype/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/test/fixtures/stylesheets/archetype/assets/fonts/fontawesome-webfont.woff +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/large/large.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/large/large_dark.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/large/large_dark_static.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/large/large_static.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/medium/medium.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/medium/medium_dark.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/medium/medium_dark_static.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/medium/medium_static.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/small/small.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/small/small_dark.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/small/small_dark_static.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/small/small_static.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/sprites/hovercard_tip.png +0 -0
- data/test/fixtures/stylesheets/archetype/config.rb +19 -0
- data/test/fixtures/stylesheets/archetype/expected/b.css +14 -0
- data/test/fixtures/stylesheets/archetype/expected/base.css +349 -0
- data/test/fixtures/stylesheets/archetype/expected/hacks/ie_pseudo.css +11 -0
- data/test/fixtures/stylesheets/archetype/expected/locale.css +23 -0
- data/test/fixtures/stylesheets/archetype/expected/styleguide/buttons.css +2091 -0
- data/test/fixtures/stylesheets/archetype/expected/styleguide/fallback_styles.css +9 -0
- data/test/fixtures/stylesheets/archetype/expected/styleguide/nested_styleguides.css +24 -0
- data/test/fixtures/stylesheets/archetype/expected/styleguide/selective_state.css +174 -0
- data/test/fixtures/stylesheets/archetype/expected/ui/glyph_icon.css +37 -0
- data/test/fixtures/stylesheets/archetype/expected/ui/hide_element.css +8 -0
- data/test/fixtures/stylesheets/archetype/expected/ui/stroke.css +17 -0
- data/test/fixtures/stylesheets/archetype/expected/ui/triangle.css +35 -0
- data/test/fixtures/stylesheets/archetype/expected/utilities/associative.css +9 -0
- data/test/fixtures/stylesheets/archetype/expected/utilities/if-set.css +9 -0
- data/test/fixtures/stylesheets/archetype/expected/utilities/spacing/horizontal-spacing.css +29 -0
- data/test/fixtures/stylesheets/archetype/expected/utilities/spacing/vertical-spacing.css +29 -0
- data/test/fixtures/stylesheets/archetype/expected/utilities/styles/filter.css +11 -0
- data/test/fixtures/stylesheets/archetype/expected/utilities/styles/font-family.css +16 -0
- data/test/fixtures/stylesheets/archetype/expected/utilities/styles/z-index.css +15 -0
- data/test/fixtures/stylesheets/archetype/expected/utilities/targeting/target-browser.css +100 -0
- data/test/fixtures/stylesheets/archetype/expected/utilities/targeting/target-os.css +55 -0
- data/test/fixtures/stylesheets/archetype/source/b.scss +9 -0
- data/test/fixtures/stylesheets/archetype/source/base.scss +3 -0
- data/test/fixtures/stylesheets/archetype/source/hacks/ie_pseudo.scss +13 -0
- data/test/fixtures/stylesheets/archetype/source/locale.scss +43 -0
- data/test/fixtures/stylesheets/archetype/source/styleguide/buttons.scss +18 -0
- data/test/fixtures/stylesheets/archetype/source/styleguide/fallback_styles.scss +22 -0
- data/test/fixtures/stylesheets/archetype/source/styleguide/nested_styleguides.scss +40 -0
- data/test/fixtures/stylesheets/archetype/source/styleguide/selective_state.scss +22 -0
- data/test/fixtures/stylesheets/archetype/source/ui/glyph_icon.scss +13 -0
- data/test/fixtures/stylesheets/archetype/source/ui/hide_element.scss +5 -0
- data/test/fixtures/stylesheets/archetype/source/ui/stroke.scss +13 -0
- data/test/fixtures/stylesheets/archetype/source/ui/triangle.scss +13 -0
- data/test/fixtures/stylesheets/archetype/source/utilities/associative.scss +24 -0
- data/test/fixtures/stylesheets/archetype/source/utilities/if-set.scss +16 -0
- data/test/fixtures/stylesheets/archetype/source/utilities/spacing/horizontal-spacing.scss +27 -0
- data/test/fixtures/stylesheets/archetype/source/utilities/spacing/vertical-spacing.scss +27 -0
- data/test/fixtures/stylesheets/archetype/source/utilities/styles/filter.scss +9 -0
- data/test/fixtures/stylesheets/archetype/source/utilities/styles/font-family.scss +9 -0
- data/test/fixtures/stylesheets/archetype/source/utilities/styles/z-index.scss +18 -0
- data/test/fixtures/stylesheets/archetype/source/utilities/targeting/target-browser.scss +70 -0
- data/test/fixtures/stylesheets/archetype/source/utilities/targeting/target-os.scss +42 -0
- data/test/helpers/diff.rb +49 -0
- data/test/helpers/io.rb +36 -0
- data/test/helpers/test_case.rb +62 -0
- data/test/integrations/archetype_test.rb +126 -0
- data/test/test_helper.rb +26 -0
- data/test/units/sass_extensions_test.rb +207 -0
- metadata +303 -15
@@ -0,0 +1,78 @@
|
|
1
|
+
// @category utilities/spacing
|
2
|
+
|
3
|
+
// abstract spacing calculations
|
4
|
+
// @function _spacing
|
5
|
+
// @private
|
6
|
+
// @param $unit {Number} unit of measurement
|
7
|
+
// @param $direction {String} [horizontal|vertical] spacing
|
8
|
+
// @param $abuse {Bool} @see _getUnit
|
9
|
+
// @return {String} the calculated spacing
|
10
|
+
@function _spacing($unit: nil, $direction: horizontal, $abuse: false) {
|
11
|
+
@if $unit == nil {
|
12
|
+
@return nil;
|
13
|
+
}
|
14
|
+
$unit: _getUnit($unit, $abuse);
|
15
|
+
$spacing: if($direction == vertical, $CONFIG_VERTICAL_SPACING, $CONFIG_HORIZONTAL_SPACING);
|
16
|
+
@return ($unit * $spacing);
|
17
|
+
}
|
18
|
+
|
19
|
+
// horizonatl spacing calculations
|
20
|
+
// @function horizontal-spacing
|
21
|
+
// @param $unit {Number} unit of measurement
|
22
|
+
// @param $abuse {Bool} @see _getUnit
|
23
|
+
// @return {String} the calculated horizontal spacing
|
24
|
+
@function horizontal-spacing($unit, $abuse: false) {
|
25
|
+
@return _spacing($unit, $abuse: $abuse);
|
26
|
+
}
|
27
|
+
|
28
|
+
// vertical spacing calculations
|
29
|
+
// @function vertical-spacing
|
30
|
+
// @param $unit {Number} unit of measurement
|
31
|
+
// @param $abuse {Bool} @see _getUnit
|
32
|
+
// @return {String} the calculated vertical spacing
|
33
|
+
@function vertical-spacing($unit, $abuse: false) {
|
34
|
+
@return _spacing($unit, $direction: vertical, $abuse: $abuse);
|
35
|
+
}
|
36
|
+
|
37
|
+
// generate the vertical spacing offset
|
38
|
+
// @mixin vertical-spacing
|
39
|
+
// @param $list {List} the list of units e.g. (1) => $top:1 $bottom:1; (1 0) => $top:1 $bottom:0;
|
40
|
+
// @param $top {Number} the units to offset from the top
|
41
|
+
// @param $bottom {Number} the units to offset from the bottom
|
42
|
+
// @param $method {String} [margin|padding] offset method
|
43
|
+
// @param $abuse {Bool} @see _getUnit
|
44
|
+
@mixin vertical-spacing($list: false, $top: nil, $bottom: nil, $method: false, $abuse: false) {
|
45
|
+
$list: get-collection($list, ($top $bottom), $min: 2);
|
46
|
+
@include _spacing($list, vertical, $method: $method, $abuse: $abuse);
|
47
|
+
}
|
48
|
+
// generate the horizontal spacing offset
|
49
|
+
// @mixin horizontal-spacing
|
50
|
+
// @param $list {List} the list of units e.g. (1) => $left:1 $right:1; (1 0) => $left:1 $right:0;
|
51
|
+
// @param $left {Number} the units to offset from the left
|
52
|
+
// @param $right {Number} the units to offset from the right
|
53
|
+
// @param $method {String} [margin|padding] offset method
|
54
|
+
// @param $abuse {Bool} @see _getUnit
|
55
|
+
@mixin horizontal-spacing($list: false, $left: nil, $right: nil, $method: false, $abuse: false) {
|
56
|
+
$list: get-collection($list, ($left $right), $min: 2);
|
57
|
+
@include _spacing($list, $method: $method, $abuse: $abuse);
|
58
|
+
}
|
59
|
+
|
60
|
+
// generate the spacing output
|
61
|
+
// @mixin spacing
|
62
|
+
// @private
|
63
|
+
// @param $units {List} the list of units e.g. (1) => $left:1 $right:1; (1 0) => $left:1 $right:0;
|
64
|
+
// @param $method {String} [margin|padding] offset method
|
65
|
+
// @param $abuse {Bool} @see _getUnit
|
66
|
+
@mixin _spacing($units, $direction: horizontal, $method: false, $abuse: false) {
|
67
|
+
@if(not $method) {
|
68
|
+
$method: $CONFIG_SPACING_METHOD;
|
69
|
+
}
|
70
|
+
@if($direction == vertical) {
|
71
|
+
@include if-set(#{$method}-top, vertical-spacing(nth($units,1), $abuse: $abuse), $ignore: nil);
|
72
|
+
@include if-set(#{$method}-bottom, vertical-spacing(nth($units,2), $abuse: $abuse), $ignore: nil);
|
73
|
+
}
|
74
|
+
@else {
|
75
|
+
@include if-set(#{$method}-#{rtl(left)}, horizontal-spacing(nth($units,1), $abuse: $abuse), $ignore: nil);
|
76
|
+
@include if-set(#{$method}-#{rtl(right)}, horizontal-spacing(nth($units,2), $abuse: $abuse), $ignore: nil);
|
77
|
+
}
|
78
|
+
}
|
@@ -0,0 +1,466 @@
|
|
1
|
+
@import "compass/layout/stretching";
|
2
|
+
|
3
|
+
// @category utilities/styles
|
4
|
+
|
5
|
+
// this is a proxy for output-style
|
6
|
+
// we need this to prevent Sass from throwing an error as you currently can't use recursive mixins :/
|
7
|
+
// @mixin _outputStyle
|
8
|
+
// @private
|
9
|
+
// @param $property {String} the CSS property to output
|
10
|
+
// @param $value {*} the CSS value to output
|
11
|
+
@mixin _outputStyle($property, $value: nil) {
|
12
|
+
@if($value != nil) {
|
13
|
+
@if($property == target-browser) {
|
14
|
+
@include target-browser(nth($value,1), nth($value,2), nth($value,3));
|
15
|
+
}
|
16
|
+
@else if($property == font-family) {
|
17
|
+
@include font-family($value);
|
18
|
+
}
|
19
|
+
@else if($property == font-style) {
|
20
|
+
@include font-style($value);
|
21
|
+
}
|
22
|
+
@else {
|
23
|
+
@include output-style($property, $value);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
// output a property or augment it to use a mixin
|
29
|
+
// @mixin output-style
|
30
|
+
// @param $property {String} the CSS property to output
|
31
|
+
// @param $value {*} the CSS value to output
|
32
|
+
@mixin output-style($property, $value: nil) {
|
33
|
+
@if($property != nil and nth(-compass-list($value), 1) != nil and not index($CONFIG_DISABLED_CSS, $property)) {
|
34
|
+
// for mixins, we need to do some custom work
|
35
|
+
// border-radius
|
36
|
+
@if($property == border-radius) { @include border-radius(rtl($value, border-radius)); }
|
37
|
+
// box-sizing
|
38
|
+
@else if($property == box-sizing) { @include box-sizing($value); }
|
39
|
+
// box-shadow
|
40
|
+
@else if($property == box-shadow) { @include box-shadow($value); }
|
41
|
+
// text-shadow
|
42
|
+
@else if($property == text-shadow) { @include text-shadow($value); }
|
43
|
+
// filter-gradient
|
44
|
+
@else if($property == filter-gradient) { @include filter-gradient(nth($value,1), nth($value,2), nth($value,3)); }
|
45
|
+
// background
|
46
|
+
@else if($property == background) { @include background($value); }
|
47
|
+
// background-image
|
48
|
+
@else if($property == background-image or $property == gradient) { @include background-image($value); }
|
49
|
+
// background-clip
|
50
|
+
@else if($property == background-clip) { @include background-clip($value); }
|
51
|
+
// background-size
|
52
|
+
@else if($property == background-size) { @include background-size($value); }
|
53
|
+
// background-origin
|
54
|
+
@else if($property == background-origin) { @include background-origin($value); }
|
55
|
+
// IE filters
|
56
|
+
@else if($property == ie-filter) { @include ie-filter($value); }
|
57
|
+
// hide-text
|
58
|
+
@else if($property == hide-text) { @include hide-text($direction: if($value == true, $hide-text-direction, $value)); }
|
59
|
+
// inline-block
|
60
|
+
@else if($property == inline-block) { @include inline-block(); }
|
61
|
+
// opacity
|
62
|
+
@else if($property == opacity) { @include opacity($value); }
|
63
|
+
// min-width
|
64
|
+
@else if($property == min-width) { @include min-width($value); }
|
65
|
+
// min-height
|
66
|
+
@else if($property == min-height) { @include min-height($value); }
|
67
|
+
// max-width
|
68
|
+
@else if($property == max-width) { @include max-width($value); }
|
69
|
+
// max-height
|
70
|
+
@else if($property == max-height) { @include max-height($value); }
|
71
|
+
// stretch
|
72
|
+
@else if($property == stretch) { @include stretch(); }
|
73
|
+
// bunch of RTL support
|
74
|
+
@else if($property == margin) { @include margin($value); }
|
75
|
+
@else if($property == margin-left) { @include margin-left($value); }
|
76
|
+
@else if($property == margin-right) { @include margin-right($value); }
|
77
|
+
@else if($property == padding) { @include padding($value); }
|
78
|
+
@else if($property == padding-left) { @include padding-left($value); }
|
79
|
+
@else if($property == padding-right) { @include padding-right($value); }
|
80
|
+
@else if($property == border-width) { @include border-width($value); }
|
81
|
+
@else if($property == border-left-width) { @include border-left-width($value); }
|
82
|
+
@else if($property == border-right-width) { @include border-right-width($value); }
|
83
|
+
@else if($property == border-color) { @include border-color($value); }
|
84
|
+
@else if($property == border-left-color) { @include border-left-color($value); }
|
85
|
+
@else if($property == border-right-color) { @include border-right-color($value); }
|
86
|
+
@else if($property == border-style) { @include border-style($value); }
|
87
|
+
@else if($property == border-left-style) { @include border-left-style($value); }
|
88
|
+
@else if($property == border-right-style) { @include border-right-style($value); }
|
89
|
+
@else if($property == clear) { @include clear($value); }
|
90
|
+
@else if($property == float) { @include float($value); }
|
91
|
+
@else if($property == text-align) { @include text-align($value); }
|
92
|
+
@else if($property == background-position) { @include background-position($value); }
|
93
|
+
@else if($property == left) { @include left($value); }
|
94
|
+
@else if($property == right) { @include right($value); }
|
95
|
+
@else if($property == glyph-icon) { @include glyph-icon(nth($value, 1), nth($value, 2), nth($value, 3), nth($value, 4), nth($value, 5)); }
|
96
|
+
// animations
|
97
|
+
@else if($property == animation) {
|
98
|
+
@if archetype-version('compass >= 0.13') {
|
99
|
+
@include animation($value);
|
100
|
+
}
|
101
|
+
@else {
|
102
|
+
-webkit-animation: $value;
|
103
|
+
-moz-animation: $value;
|
104
|
+
-ms-animation: $value;
|
105
|
+
-o-animation: $value;
|
106
|
+
animation: $value;
|
107
|
+
}
|
108
|
+
}
|
109
|
+
// hasLayout
|
110
|
+
@else if($property == has-layout) {
|
111
|
+
// if value is true, don't pass it along
|
112
|
+
@if($value == true) {
|
113
|
+
@include has-layout();
|
114
|
+
}
|
115
|
+
@else {
|
116
|
+
@include has-layout($value);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
// clearfix
|
120
|
+
@else if($property == clearfix) {
|
121
|
+
@if($value == legacy-pie-clearfix) {
|
122
|
+
@include legacy-pie-clearfix();
|
123
|
+
}
|
124
|
+
@else if($value == pie-clearfix) {
|
125
|
+
@include pie-clearfix();
|
126
|
+
}
|
127
|
+
@else {
|
128
|
+
@include clearfix();
|
129
|
+
}
|
130
|
+
}
|
131
|
+
// z-index
|
132
|
+
@else if($property == z-index) {
|
133
|
+
$value: -compass-list($value);
|
134
|
+
@if(length($value) > 1) { @include z-index(nth($value, 1), nth($value, 2)); }
|
135
|
+
@else { @include z-index($value); }
|
136
|
+
}
|
137
|
+
// make sure content is always quoted
|
138
|
+
@else if($property == content) { #{$property}: quote($value); }
|
139
|
+
// :before/:after
|
140
|
+
@else if($property == ie-pseudo-before or $property == ie-pseudo-after) {
|
141
|
+
$value: -compass-list($value);
|
142
|
+
$content: false;
|
143
|
+
$tag: '';
|
144
|
+
@if length($value) > 1 {
|
145
|
+
$content: nth($value, 2);
|
146
|
+
@if length($value) > 2 {
|
147
|
+
$tag: nth($value, 3);
|
148
|
+
}
|
149
|
+
}
|
150
|
+
@if $property == ie-pseudo-before {
|
151
|
+
@include ie-pseudo-before(nth($value, 1), $content, $tag);
|
152
|
+
}
|
153
|
+
@else {
|
154
|
+
@include ie-pseudo-after(nth($value, 1), $content, $tag);
|
155
|
+
}
|
156
|
+
}
|
157
|
+
// otherwise just use a key-value pair
|
158
|
+
@else { #{$property}: $value; }
|
159
|
+
}
|
160
|
+
}
|
161
|
+
|
162
|
+
// convert a list of key-value pairs into CSS rules
|
163
|
+
// @mixin to-styles
|
164
|
+
// @param $list {List} a key-value paired list of ($property $value)
|
165
|
+
// @param $states {Bool|List} if true, output all states; if false, output no states; if a list, output only the states in the list
|
166
|
+
// @param $exclude {List} a list of styles to exclude from output
|
167
|
+
@mixin to-styles($list: (), $states: true, $selectors: true, $exclude: ()) {
|
168
|
+
$exclude: -compass-list($exclude);
|
169
|
+
$states-data: ();
|
170
|
+
$selectors-data: ();
|
171
|
+
@each $item in $list {
|
172
|
+
@if(length($item) > 1) {
|
173
|
+
$property: nth($item, 1);
|
174
|
+
$value: nth($item, 2);
|
175
|
+
@if(not index($exclude, $property)) {
|
176
|
+
@if($property == states and $states != false) {
|
177
|
+
$states-data: $value;
|
178
|
+
}
|
179
|
+
@else if($property == selectors and $selectors != false) {
|
180
|
+
$selectors-data: $value;
|
181
|
+
}
|
182
|
+
@else if($selectors == true and $states == true) {
|
183
|
+
@include _outputStyle($property, unquote($value));
|
184
|
+
}
|
185
|
+
}
|
186
|
+
}
|
187
|
+
}
|
188
|
+
// deal with the states
|
189
|
+
@if length($states-data) > 0 {
|
190
|
+
@each $state in $states-data {
|
191
|
+
$value: nth($state, 2);
|
192
|
+
$state: first-value-of($state);
|
193
|
+
@if(index(-compass-list($states), $state) or $states == true) {
|
194
|
+
#{_getStateSelector($state)} {
|
195
|
+
@include _toStyles2($value, true, true, $exclude);
|
196
|
+
}
|
197
|
+
}
|
198
|
+
}
|
199
|
+
}
|
200
|
+
// deal with the nested selectors
|
201
|
+
@if length($selectors-data) > 0 {
|
202
|
+
@each $selector in $selectors-data {
|
203
|
+
@if(index(-compass-list($selectors), $selector) or $selectors == true) {
|
204
|
+
#{first-value-of($selector)} {
|
205
|
+
@include _toStyles2(nth($selector, 2), true, true, $exclude);
|
206
|
+
}
|
207
|
+
}
|
208
|
+
}
|
209
|
+
}
|
210
|
+
}
|
211
|
+
|
212
|
+
// this is identical to to-styles, but we need to avoid Sass' recursion check :(
|
213
|
+
@mixin _toStyles2($list: (), $states: true, $selectors: true, $exclude: ()) {
|
214
|
+
$exclude: -compass-list($exclude);
|
215
|
+
$states-data: ();
|
216
|
+
$selectors-data: ();
|
217
|
+
@each $item in $list {
|
218
|
+
@if(length($item) > 1) {
|
219
|
+
$property: nth($item, 1);
|
220
|
+
$value: nth($item, 2);
|
221
|
+
@if(not index($exclude, $property)) {
|
222
|
+
@if($property == states and $states != false) {
|
223
|
+
$states-data: $value;
|
224
|
+
}
|
225
|
+
@else if($property == selectors and $selectors != false) {
|
226
|
+
$selectors-data: $value;
|
227
|
+
}
|
228
|
+
@else if($selectors == true and $states == true) {
|
229
|
+
@include _outputStyle($property, unquote($value));
|
230
|
+
}
|
231
|
+
}
|
232
|
+
}
|
233
|
+
}
|
234
|
+
// deal with the states
|
235
|
+
@if length($states-data) > 0 {
|
236
|
+
@each $state in $states-data {
|
237
|
+
$value: nth($state, 2);
|
238
|
+
$state: first-value-of($state);
|
239
|
+
@if(index(-compass-list($states), $state) or $states == true) {
|
240
|
+
#{_getStateSelector($state)} {
|
241
|
+
@include _toStyles_final($value, $exclude);
|
242
|
+
}
|
243
|
+
}
|
244
|
+
}
|
245
|
+
}
|
246
|
+
// deal with the nested selectors
|
247
|
+
@if length($selectors-data) > 0 {
|
248
|
+
@each $selector in $selectors-data {
|
249
|
+
@if(index(-compass-list($selectors), $selector) or $selectors == true) {
|
250
|
+
#{first-value-of($selector)} {
|
251
|
+
@include _toStyles_final(nth($selector, 2), $exclude);
|
252
|
+
}
|
253
|
+
}
|
254
|
+
}
|
255
|
+
}
|
256
|
+
}
|
257
|
+
// this is a dumbed down version of to-styles. this is the final step and won't go any deeper
|
258
|
+
@mixin _toStyles_final($list: (), $exclude: ()) {
|
259
|
+
$exclude: -compass-list($exclude);
|
260
|
+
@each $item in $list {
|
261
|
+
@if(length($item) > 1) {
|
262
|
+
$property: nth($item, 1);
|
263
|
+
$value: nth($item, 2);
|
264
|
+
@if(not index($exclude, $property)) {
|
265
|
+
@include _outputStyle($property, unquote($value));
|
266
|
+
}
|
267
|
+
}
|
268
|
+
}
|
269
|
+
}
|
270
|
+
|
271
|
+
// helper function to compute the selector for various states
|
272
|
+
// @function _getStateSelector
|
273
|
+
// @private
|
274
|
+
// @param $state {String} the state to select
|
275
|
+
// @param $prefix {String} the prefix to append to the state (for class names only)
|
276
|
+
@function _getStateSelector($state, $prefix: $CONFIG_STATE_PREFIX) {
|
277
|
+
$selector: associative($CONFIG_STATE_MAPPINGS, $state, $strict: true);
|
278
|
+
@if $selector == nil or length($selector) == 0 {
|
279
|
+
$selector: '&.#{if(index(-compass-list($CONFIG_STATE_NO_PREFIX), $state), $prefix, "")}#{$state}';
|
280
|
+
}
|
281
|
+
@return $selector;
|
282
|
+
}
|
283
|
+
|
284
|
+
// mixin for outputting filters in legacy IE
|
285
|
+
// @mixin ie-filter
|
286
|
+
// @param $value {String|List} a set of filters to output, sans `progid:DXImageTransform.Microsoft` prefix
|
287
|
+
@mixin ie-filter($value, $use-prefix: false) {
|
288
|
+
$out: false;
|
289
|
+
$value: -compass-list($value);
|
290
|
+
$ms-filter-prefix: 'progid:DXImageTransform.Microsoft.';
|
291
|
+
@each $item in $value {
|
292
|
+
@if($item != none) {
|
293
|
+
$item: #{$ms-filter-prefix}#{$item};
|
294
|
+
}
|
295
|
+
$out: if($out, '#{$out},#{$item}', '#{$item}');
|
296
|
+
}
|
297
|
+
@if($out) {
|
298
|
+
@if $use-prefix != only {
|
299
|
+
filter: unquote($out);
|
300
|
+
}
|
301
|
+
@if $use-prefix {
|
302
|
+
-ms-filter: quote($out);
|
303
|
+
}
|
304
|
+
}
|
305
|
+
}
|
306
|
+
|
307
|
+
// mixin for generating a pseudo-element
|
308
|
+
// @mixin pseudo-element
|
309
|
+
// @param $width {String} width (default 0 for positioning in FF3)
|
310
|
+
// @param $height {String} height
|
311
|
+
// @param $content {String} content (this should be quoted)
|
312
|
+
// @param $display {String} display [block|inline|etc]
|
313
|
+
// @param $position {String} positioning [absolute|relative|etc]
|
314
|
+
@mixin pseudo-element($width: 0, $height: auto, $content: $CONTENT_PLACEHOLDER, $display: block, $position: false) {
|
315
|
+
@include if-set(content, quote($content));
|
316
|
+
@include if-set(display, $display);
|
317
|
+
@include if-set(width, $width);
|
318
|
+
@include if-set(height, $height);
|
319
|
+
@include if-set(position, $position);
|
320
|
+
}
|
321
|
+
|
322
|
+
// this is a helper for simple gradients when a direction is desired in degrees,
|
323
|
+
// but we still want to support old webkit browsers
|
324
|
+
// @mixin gradient-with-deg
|
325
|
+
// @param $deg {Number} the direction degree
|
326
|
+
// @param $start {Color} the start color
|
327
|
+
// @param $end {Color} the end color
|
328
|
+
@mixin gradient-with-deg($deg, $start, $end) {
|
329
|
+
// make sure it's a deg
|
330
|
+
$deg: if(unitless($deg), $deg * 1deg, $deg);
|
331
|
+
// we'll divide the circle into sections
|
332
|
+
$sector: (360deg / 8);
|
333
|
+
// offset it for calculations
|
334
|
+
$tmp: $deg - ($sector / 2);
|
335
|
+
$map: (
|
336
|
+
(right top),
|
337
|
+
(right),
|
338
|
+
(right bottom),
|
339
|
+
(bottom),
|
340
|
+
(left bottom),
|
341
|
+
(left),
|
342
|
+
(left top),
|
343
|
+
(top)
|
344
|
+
);
|
345
|
+
// compute the region it falls in
|
346
|
+
$region: nth($map, ceil(if($tmp < 0deg, 360 - $tmp, $tmp) / $sector));
|
347
|
+
// NOTE: we temporarily disable old webkit gradients as they don't support degrees
|
348
|
+
// this is a fallback for old webkit
|
349
|
+
@if($support-for-original-webkit-gradients) {
|
350
|
+
background-image: -owg(linear-gradient($region, $start, $end));
|
351
|
+
}
|
352
|
+
$tmp: $support-for-original-webkit-gradients;
|
353
|
+
$support-for-original-webkit-gradients: false;
|
354
|
+
// now the others
|
355
|
+
@include background-image(linear-gradient($deg, $start, $end));
|
356
|
+
// restore the old webkit value
|
357
|
+
$support-for-original-webkit-gradients: $tmp;
|
358
|
+
}
|
359
|
+
|
360
|
+
// abstract common issues and generate safe styles
|
361
|
+
@mixin safe($property: nil, $value: nil) {
|
362
|
+
@if($property != nil and $value != nil) {
|
363
|
+
// os friendly font stacks
|
364
|
+
@if($property == font-family) {
|
365
|
+
$stack: associative($CONFIG_SAFE_FONTS, $value, $strict: true);
|
366
|
+
@if($stack != nil and length($stack) > 0) {
|
367
|
+
// first, step through the list of os safe fonts
|
368
|
+
@each $collection in $stack {
|
369
|
+
@if(length($collection) > 1) {
|
370
|
+
$default: nil;
|
371
|
+
$os: nth($collection, 1);
|
372
|
+
$fonts: nth($collection, 2);
|
373
|
+
$family: nil;
|
374
|
+
// next, step through the list of lang safe fonts
|
375
|
+
@each $item in $fonts {
|
376
|
+
@if($item != nil) {
|
377
|
+
$lang: nth($item, 1);
|
378
|
+
$font: nth($item, 2);
|
379
|
+
// check if the language matches or it's the default
|
380
|
+
@if($lang == default or lang($lang)) {
|
381
|
+
$family: $font;
|
382
|
+
}
|
383
|
+
// if it's the default, keep track of it
|
384
|
+
@if($lang == default) {
|
385
|
+
$default: $font;
|
386
|
+
}
|
387
|
+
// if the keyword `default` is in the font-stack, substitute it with the default font-stack
|
388
|
+
$family: list-replace($family, index(-compass-list($family), default), $default, comma);
|
389
|
+
}
|
390
|
+
}
|
391
|
+
@include target-os($os, font-family, $family);
|
392
|
+
}
|
393
|
+
}
|
394
|
+
$value: nil;
|
395
|
+
}
|
396
|
+
}
|
397
|
+
// text-transform: uppercase isn't friendly to turkish
|
398
|
+
@else if($property == text-transform and $value == uppercase and lang(tr_TR)) {
|
399
|
+
// TODO - more investigation, this may affect other locales as well
|
400
|
+
// @link http://www.w3.org/International/tests/html-css/text-transform/results-text-transform
|
401
|
+
// @link https://developer.mozilla.org/en/CSS/text-transform
|
402
|
+
$value: nil;
|
403
|
+
}
|
404
|
+
@else if($property == font-variant and $value == small-caps and lang(tr_TR)) {
|
405
|
+
// TODO - more investigation, this may affect other locales as well
|
406
|
+
// @link https://developer.mozilla.org/en/CSS/font-variant
|
407
|
+
$value: nil;
|
408
|
+
}
|
409
|
+
// italics aren't pretty in CJK
|
410
|
+
@else if($property == font-style and $value == italic and lang(CJK)) {
|
411
|
+
$value: nil;
|
412
|
+
}
|
413
|
+
// if $value was set to `nil`, this does nothing
|
414
|
+
@include output-style($property, $value);
|
415
|
+
}
|
416
|
+
}
|
417
|
+
|
418
|
+
// web-safe font stacks, if no safe fonts are found, use the raw `$family` as output
|
419
|
+
// @mixin font-family
|
420
|
+
// @param $family {String} the font stack to output
|
421
|
+
@mixin font-family($family: nil) {
|
422
|
+
@include safe(font-family, $family);
|
423
|
+
}
|
424
|
+
|
425
|
+
// safely use text-transform:uppercase without localization issues
|
426
|
+
// @mixin uppercase
|
427
|
+
@mixin uppercase() {
|
428
|
+
@include safe(text-transform, uppercase);
|
429
|
+
}
|
430
|
+
|
431
|
+
// safely use font-variant:small-caps without localization issues
|
432
|
+
// @mixin small-caps
|
433
|
+
@mixin small-caps() {
|
434
|
+
@include safe(font-variant, small-caps);
|
435
|
+
}
|
436
|
+
|
437
|
+
// safely use font-style without localization issues
|
438
|
+
// @mixin font-style
|
439
|
+
// @param $style {String} the style
|
440
|
+
@mixin font-style($style: nil) {
|
441
|
+
@include safe(font-style, $style);
|
442
|
+
}
|
443
|
+
|
444
|
+
// a method for maintaining z-index order
|
445
|
+
// @mixin z-index
|
446
|
+
// @param $value {Number} the z-index offset
|
447
|
+
// @param $layer {String|Number} the initial z-index layer to start from
|
448
|
+
@mixin z-index($value: 0, $layer: 0) {
|
449
|
+
@if(type-of($layer) == string) {
|
450
|
+
$layer: index($CONFIG_Z_LAYERS, $layer);
|
451
|
+
$layer: if($layer, $layer - 1, 0) * $CONFIG_Z_LAYERS_OFFSET;
|
452
|
+
}
|
453
|
+
z-index: ($value + $layer);
|
454
|
+
}
|
455
|
+
|
456
|
+
// generate a tag name with a prefix
|
457
|
+
// @function prefixed-tag
|
458
|
+
// @param $tag {String} the tag to prefix
|
459
|
+
// @param $prefix {String} the prefix to prepend to the tag
|
460
|
+
// @return {String} the prefix joined with the tag
|
461
|
+
@function prefixed-tag($tag: '', $prefix: $CONFIG_GENERATED_TAG_PREFIX) {
|
462
|
+
@if $tag != '' {
|
463
|
+
$tag: '-#{$tag}';
|
464
|
+
}
|
465
|
+
@return '#{$prefix}#{$tag}';
|
466
|
+
}
|