neat-compass 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,8 @@
6
6
  @import "neat-helpers";
7
7
 
8
8
  // Grid
9
- @import "grid/global-variables";
9
+ @import "grid/private";
10
+ @import "grid/reset";
10
11
  @import "grid/grid";
11
12
  @import "grid/omega";
12
13
  @import "grid/outer-container";
@@ -70,3 +70,38 @@
70
70
 
71
71
  @return $values;
72
72
  }
73
+
74
+ // Layout direction
75
+ @function get-direction($layout, $default) {
76
+ $direction: nil;
77
+
78
+ @if $layout == LTR or $layout == RTL {
79
+ $direction: direction-from-layout($layout);
80
+ } @else {
81
+ $direction: direction-from-layout($default);
82
+ }
83
+
84
+ @return $direction;
85
+ }
86
+
87
+ @function direction-from-layout($layout) {
88
+ $direction: nil;
89
+
90
+ @if $layout == LTR {
91
+ $direction: right;
92
+ } @else {
93
+ $direction: left;
94
+ }
95
+
96
+ @return $direction;
97
+ }
98
+
99
+ @function get-opposite-direction($direction) {
100
+ $opposite-direction: left;
101
+
102
+ @if $direction == left {
103
+ $opposite-direction: right;
104
+ }
105
+
106
+ @return $opposite-direction;
107
+ }
@@ -1,8 +1,14 @@
1
1
  // Remove last element gutter
2
- @mixin omega($query: block, $direction: right) {
2
+ @mixin omega($query: block, $direction: default) {
3
3
  $table: if(belongs-to(table, $query), true, false);
4
4
  $auto: if(belongs-to(auto, $query), true, false);
5
5
 
6
+ @if $direction != default {
7
+ @warn "The omega mixin will no longer take a $direction argument. To change the layout direction, use row($direction) or set $default-layout-direction instead."
8
+ } @else {
9
+ $direction: get-direction($layout-direction, $default-layout-direction);
10
+ }
11
+
6
12
  @if length($query) == 1 {
7
13
  @if $auto {
8
14
  &:last-child {
@@ -21,9 +27,7 @@
21
27
  }
22
28
 
23
29
  @else {
24
- &:nth-child(#{$query}) {
25
- margin-#{$direction}: 0;
26
- }
30
+ @include nth-child($query, $direction);
27
31
  }
28
32
  }
29
33
 
@@ -50,9 +54,7 @@
50
54
  }
51
55
 
52
56
  @else {
53
- &:nth-child(#{nth($query, 1)}) {
54
- margin-#{$direction}: 0;
55
- }
57
+ @include nth-child(nth($query, 1), $direction);
56
58
  }
57
59
  }
58
60
  }
@@ -62,7 +64,16 @@
62
64
  }
63
65
  }
64
66
 
65
- @mixin nth-omega($nth, $display: block, $direction: right) {
66
- @warn "The nth-omega() mixin is deprecated. Please use omega() instead.";
67
- @include omega($nth $display, $direction);
67
+ @mixin nth-child($query, $direction) {
68
+ $opposite-direction: get-opposite-direction($direction);
69
+
70
+ &:nth-child(#{$query}) {
71
+ margin-#{$direction}: 0;
72
+ }
73
+
74
+ @if type-of($query) == number {
75
+ &:nth-child(#{$query}+1) {
76
+ clear: $opposite-direction;
77
+ }
78
+ }
68
79
  }
@@ -0,0 +1,21 @@
1
+ $parent-columns: $grid-columns !default;
2
+ $fg-column: $column;
3
+ $fg-gutter: $gutter;
4
+ $fg-max-columns: $grid-columns;
5
+ $container-display-table: false !default;
6
+ $layout-direction: nil !default;
7
+
8
+ @function flex-grid($columns, $container-columns: $fg-max-columns) {
9
+ $width: $columns * $fg-column + ($columns - 1) * $fg-gutter;
10
+ $container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter;
11
+ @return percentage($width / $container-width);
12
+ }
13
+
14
+ @function flex-gutter($container-columns: $fg-max-columns, $gutter: $fg-gutter) {
15
+ $container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter;
16
+ @return percentage($gutter / $container-width);
17
+ }
18
+
19
+ @function grid-width($n) {
20
+ @return $n * $gw-column + ($n - 1) * $gw-gutter;
21
+ }
@@ -0,0 +1,12 @@
1
+ @mixin reset-display {
2
+ $container-display-table: false;
3
+ }
4
+
5
+ @mixin reset-layout-direction {
6
+ $layout-direction: $default-layout-direction;
7
+ }
8
+
9
+ @mixin reset-all {
10
+ @include reset-display;
11
+ @include reset-layout-direction;
12
+ }
@@ -1,5 +1,6 @@
1
- @mixin row($display: block) {
1
+ @mixin row($display: block, $direction: $default-layout-direction) {
2
2
  @include clearfix;
3
+ $layout-direction: $direction;
3
4
 
4
5
  @if $display == table {
5
6
  display: table;
@@ -14,6 +15,3 @@
14
15
  }
15
16
  }
16
17
 
17
- @mixin reset-display {
18
- $container-display-table: false;
19
- }
@@ -1,5 +1,9 @@
1
1
  @mixin shift($n-columns: 1) {
2
- margin-left: $n-columns * flex-grid(1, $parent-columns) + $n-columns * flex-gutter($parent-columns);
2
+
3
+ $direction: get-direction($layout-direction, $default-layout-direction);
4
+ $opposite-direction: get-opposite-direction($direction);
5
+
6
+ margin-#{$opposite-direction}: $n-columns * flex-grid(1, $parent-columns) + $n-columns * flex-gutter($parent-columns);
3
7
 
4
8
  // Reset nesting context
5
9
  $parent-columns: $grid-columns;
@@ -4,55 +4,42 @@
4
4
  $container-columns: container-span($span);
5
5
  $display-table: false;
6
6
 
7
+ $direction: get-direction($layout-direction, $default-layout-direction);
8
+ $opposite-direction: get-opposite-direction($direction);
9
+
7
10
  @if $container-columns != $grid-columns {
8
11
  $parent-columns: $container-columns;
9
- }
10
-
11
- @else {
12
+ } @else {
12
13
  $parent-columns: $grid-columns;
13
14
  }
14
15
 
15
16
  @if $container-display-table == true {
16
17
  $display-table: true;
17
- }
18
-
19
- @else if $display == table {
18
+ } @else if $display == table {
20
19
  $display-table: true;
21
- }
22
-
23
- @else {
20
+ } @else {
24
21
  $display-table: false;
25
22
  }
26
23
 
27
24
  @if $display-table {
28
25
  display: table-cell;
29
- padding-right: flex-gutter($container-columns);
26
+ padding-#{$direction}: flex-gutter($container-columns);
30
27
  width: flex-grid($columns, $container-columns) + flex-gutter($container-columns);
31
28
 
32
29
  &:last-child {
33
30
  width: flex-grid($columns, $container-columns);
34
- padding-right: 0;
35
- }
36
- }
37
-
38
- @else if $display == inline-block {
39
- @include inline-block;
40
- margin-right: flex-gutter($container-columns);
41
- width: flex-grid($columns, $container-columns);
42
-
43
- &:last-child {
44
- margin-right: 0;
31
+ padding-#{$direction}: 0;
45
32
  }
46
33
  }
47
34
 
48
35
  @else {
49
36
  display: block;
50
- float: left;
51
- margin-right: flex-gutter($container-columns);
37
+ float: #{$opposite-direction};
38
+ margin-#{$direction}: flex-gutter($container-columns);
52
39
  width: flex-grid($columns, $container-columns);
53
40
 
54
41
  &:last-child {
55
- margin-right: 0;
42
+ margin-#{$direction}: 0;
56
43
  }
57
44
  }
58
45
  }
@@ -50,3 +50,8 @@
50
50
  @warn "Wrong number of arguments for breakpoint(). Read the documentation for more details.";
51
51
  }
52
52
  }
53
+
54
+ @mixin nth-omega($nth, $display: block, $direction: default) {
55
+ @warn "The nth-omega() mixin is deprecated. Please use omega() instead.";
56
+ @include omega($nth $display, $direction);
57
+ }
@@ -20,6 +20,7 @@
20
20
  position: fixed;
21
21
  right: 0;
22
22
  width: 100%;
23
+ pointer-events: none;
23
24
 
24
25
  @if $visual-grid-index == back {
25
26
  z-index: -1;
@@ -4,3 +4,4 @@ $grid-columns: 12 !default; // Total number of columns in the grid
4
4
  $max-width: em(1088) !default; // Max-width of the outer container
5
5
  $border-box-sizing: true !default; // Makes all elements have a border-box layout
6
6
  $default-feature: min-width; // Default @media feature for the breakpoint() mixin
7
+ $default-layout-direction: LTR !default;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neat-compass
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-04 00:00:00.000000000 Z
12
+ date: 2013-05-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: compass
@@ -72,12 +72,13 @@ files:
72
72
  - stylesheets/neat/functions/_private.scss
73
73
  - stylesheets/neat/functions/_px-to-em.scss
74
74
  - stylesheets/neat/grid/_fill-parent.scss
75
- - stylesheets/neat/grid/_global-variables.scss
76
75
  - stylesheets/neat/grid/_grid.scss
77
76
  - stylesheets/neat/grid/_media.scss
78
77
  - stylesheets/neat/grid/_omega.scss
79
78
  - stylesheets/neat/grid/_outer-container.scss
80
79
  - stylesheets/neat/grid/_pad.scss
80
+ - stylesheets/neat/grid/_private.scss
81
+ - stylesheets/neat/grid/_reset.scss
81
82
  - stylesheets/neat/grid/_row.scss
82
83
  - stylesheets/neat/grid/_shift.scss
83
84
  - stylesheets/neat/grid/_span-columns.scss
@@ -1,5 +0,0 @@
1
- $parent-columns: $grid-columns !default;
2
- $fg-column: $column;
3
- $fg-gutter: $gutter;
4
- $fg-max-columns: $grid-columns;
5
- $container-display-table: false !default;