singularitygs 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,6 @@ require 'breakpoint'
4
4
  Compass::Frameworks.register("singularitygs", :path => "#{File.dirname(__FILE__)}/..")
5
5
 
6
6
  module SingularityGS
7
- VERSION = "1.0.3"
7
+ VERSION = "1.0.4"
8
8
  DATE = "2013-04-03"
9
9
  end
@@ -1,4 +1,4 @@
1
1
  @import "math/columns";
2
2
  @import "math/gutters";
3
3
  @import "math/context";
4
- @import "math/span";
4
+ @import "math/grid";
@@ -113,8 +113,8 @@
113
113
  //
114
114
  // Makes working with Float easier, as it allows you to walk the grid for symmetric grids and easy applying of 'last' and 'first', as well as automatically building the verbose grid-span mixin call
115
115
  //////////////////////////////
116
- @mixin float-span($span, $location: false, $columns: false, $gutter: false) {
117
- $grid: find-grid($columns);
116
+ @mixin float-span($span, $location: false, $grid: false, $gutter: false) {
117
+ $grid: find-grid($grid);
118
118
  $gutter: find-gutter($gutter);
119
119
  $row: false;
120
120
 
@@ -97,6 +97,6 @@
97
97
  //
98
98
  // Makes working with Isolation easier, as it moves Clear to a 1st class citizen of the mixin, and automatically builds the verbose grid-span mixin call
99
99
  //////////////////////////////
100
- @mixin isolation-span($span, $location, $clear: false, $columns: false, $gutter: false) {
101
- @include grid-span($span, $location, $columns, $gutter, 'isolation', $clear);
100
+ @mixin isolation-span($span, $location, $clear: false, $grid: false, $gutter: false) {
101
+ @include grid-span($span, $location, $grid, $gutter, 'isolation', $clear);
102
102
  }
@@ -48,11 +48,13 @@ $overlay-position: relative !default;
48
48
  // Set the position of the switch.
49
49
  $overlay-switch-position: left bottom !default;
50
50
 
51
+ $background-grid-color: Chocolate !default;
52
+
51
53
  @mixin grid-overlay (
52
54
  $selector: 'body',
53
55
  $columns: false,
54
56
  $gutter: false,
55
- $color: rgba(Chocolate, .5)
57
+ $color: $background-grid-color
56
58
  ) {
57
59
 
58
60
  $vert: nth($overlay-switch-position, 1);
@@ -106,11 +108,11 @@ $overlay-switch-position: left bottom !default;
106
108
  @mixin grid-toggle(
107
109
  $columns: false,
108
110
  $gutter: false,
109
- $color: rgba(Chocolate, .5)
111
+ $color: $background-grid-color
110
112
  ) {
111
113
 
112
114
  [data-development-grid="show"] {
113
- @include background-grid;
115
+ @include background-grid($columns, $gutter, $color);
114
116
  }
115
117
  }
116
118
 
@@ -120,7 +122,7 @@ $overlay-switch-position: left bottom !default;
120
122
  @mixin background-grid(
121
123
  $columns: false,
122
124
  $gutter: false,
123
- $color: Chocolate
125
+ $color: $background-grid-color
124
126
  ) {
125
127
 
126
128
  $background-length: length($grids);
@@ -8,7 +8,7 @@
8
8
 
9
9
  @if $bs == 'border-box' {
10
10
  @if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
11
- *behavior: url("../behaviors/box-sizing/boxsizing.php");
11
+ *behavior: stylesheet-url("../behaviors/box-sizing/boxsizing.php");
12
12
  }
13
13
  }
14
14
  @else {
@@ -1,80 +1,80 @@
1
1
  //////////////////////////////
2
2
  // Find width, in percentages, of the column span
3
3
  //////////////////////////////
4
- @function column-span($span, $location, $columns: false, $gutter: false) {
4
+ @function column-span($span, $location, $grid: false, $gutter: false) {
5
5
 
6
- // Find the columns and gutters
7
- $columns: find-grid($columns);
6
+ // Find the grid and gutters
7
+ $grid: find-grid($grid);
8
8
  $gutter: find-gutter($gutter);
9
9
 
10
- // @debug $columns;
10
+ // @debug $grid;
11
11
  // @debug $gutter;
12
12
 
13
- // Combine the columns and gutters
14
- $columns-and-gutters: column-sum($columns, $gutter);
13
+ // Combine the grid and gutters
14
+ $grid-and-gutters: column-sum($grid, $gutter);
15
15
 
16
- // @debug $columns-and-gutters;
16
+ // @debug $grid-and-gutters;
17
17
 
18
- // Equal width columns are easy! Deal with them!
19
- @if type-of($columns) == 'number' or length($columns) == 1 {
18
+ // Equal width grid are easy! Deal with them!
19
+ @if type-of($grid) == 'number' or length($grid) == 1 {
20
20
  $span-and-gutters: $span + $gutter * ($span - 1);
21
- @return $span-and-gutters / $columns-and-gutters * 100%;
21
+ @return $span-and-gutters / $grid-and-gutters * 100%;
22
22
  }
23
- // Asymmetric lists are harder, so we're going to treat them as their own columns
24
- @else if type-of($columns) == 'list' or length($columns) > 1 {
23
+ // Asymmetric lists are harder, so we're going to treat them as their own grid
24
+ @else if type-of($grid) == 'list' or length($grid) > 1 {
25
25
  $span-and-gutters: 0;
26
26
 
27
27
  @if $location == 1 and $span >= 1 {
28
28
  @for $i from 1 through $span {
29
- $span-and-gutters: $span-and-gutters + nth($columns, $i) + $gutter;
29
+ $span-and-gutters: $span-and-gutters + nth($grid, $i) + $gutter;
30
30
  }
31
31
  }
32
32
  @else {
33
33
  $total: $location + $span - 1;
34
34
  @for $i from $location through $total {
35
- $span-and-gutters: $span-and-gutters + nth($columns, $i) + $gutter;
35
+ $span-and-gutters: $span-and-gutters + nth($grid, $i) + $gutter;
36
36
  }
37
37
  }
38
38
  $span-and-gutters: $span-and-gutters - $gutter;
39
39
 
40
- @return $span-and-gutters / $columns-and-gutters * 100%;
40
+ @return $span-and-gutters / $grid-and-gutters * 100%;
41
41
  }
42
42
  @else {
43
- @warn "Can't find a working set of columns! That's terrible!";
43
+ @warn "Can't find a working set of grid! That's terrible!";
44
44
  @return false;
45
45
  }
46
46
  }
47
47
 
48
48
  //////////////////////////////
49
- // Find the total sum of the columns
49
+ // Find the total sum of the grid
50
50
  //////////////////////////////
51
- @function column-sum($columns, $gutter) {
52
- @if type-of($columns) == 'number' or length($columns) == 1 {
53
- @return nth($columns, 1) + ((column-count(nth($columns, 1)) - 1) * nth($gutter, 1));
51
+ @function column-sum($grid, $gutter) {
52
+ @if type-of($grid) == 'number' or length($grid) == 1 {
53
+ @return nth($grid, 1) + ((column-count(nth($grid, 1)) - 1) * nth($gutter, 1));
54
54
  }
55
- @else if type-of($columns) == 'list' {
55
+ @else if type-of($grid) == 'list' {
56
56
  $sum: 0;
57
- @each $column in $columns {
57
+ @each $column in $grid {
58
58
  $sum: $sum + nth($column, 1);
59
59
  }
60
- $sum: $sum + (column-count($columns) - 1) * nth($gutter, 1);
60
+ $sum: $sum + (column-count($grid) - 1) * nth($gutter, 1);
61
61
  @return $sum;
62
62
  }
63
63
  }
64
64
 
65
65
  //////////////////////////////
66
- // Find the number of columns
66
+ // Find the number of grid
67
67
  //////////////////////////////
68
- @function column-count($columns) {
69
- @if type-of($columns) == 'number' {
70
- @return $columns;
68
+ @function column-count($grid) {
69
+ @if type-of($grid) == 'number' {
70
+ @return $grid;
71
71
  }
72
- @if type-of($columns) == 'list' {
73
- @if length($columns) == 1 {
74
- @return nth($columns, 1);
72
+ @if type-of($grid) == 'list' {
73
+ @if length($grid) == 1 {
74
+ @return nth($grid, 1);
75
75
  }
76
76
  @else {
77
- @return length($columns);
77
+ @return length($grid);
78
78
  }
79
79
  }
80
80
  }
@@ -1,11 +1,11 @@
1
- @function gutter-span($gutter: false, $columns: false) {
1
+ @function gutter-span($gutter: false, $grid: false) {
2
2
 
3
3
  // Find the columns and gutters
4
- $columns: find-grid($columns);
4
+ $grid: find-grid($grid);
5
5
  $gutter: find-gutter($gutter);
6
6
 
7
7
  // Combine the columns and gutters
8
- $columns-and-gutters: column-sum($columns, $gutter);
8
+ $grid-and-gutters: column-sum($grid, $gutter);
9
9
 
10
- @return (nth($gutter, 1) / $columns-and-gutters) * 100%
10
+ @return (nth($gutter, 1) / $grid-and-gutters) * 100%
11
11
  }
@@ -0,0 +1,159 @@
1
+ @import "singularitygs";
2
+
3
+ $break: 700px;
4
+ $break2: 900px;
5
+ $break3: 1200px;
6
+
7
+ $grids: add-grid(2);
8
+ $grids: add-grid(2 8 2 1 at $break);
9
+ $grids: add-grid(12 at $break2);
10
+ $grids: add-grid(1 3 5 7 9 at $break3);
11
+ $gutters: add-gutter(1/3);
12
+ // $gutters: add-gutter(.25 at $break);
13
+ $output: 'float';
14
+
15
+ body {
16
+ margin: 0;
17
+ padding: 0;
18
+ @include background-grid;
19
+ }
20
+
21
+ div {
22
+ height: 50px;
23
+ }
24
+
25
+ #foo {
26
+ background: red;
27
+ height: 30px;
28
+ @include grid-span(1, 2);
29
+
30
+ @include breakpoint($break) {
31
+ @include grid-span(1, 4);
32
+ clear: none;
33
+ }
34
+
35
+ @include breakpoint($break2) {
36
+ @include grid-span(2, 11);
37
+ }
38
+
39
+ @include breakpoint($break3) {
40
+ @include grid-span(1, 3);
41
+ @include push(2, 1);
42
+ }
43
+ }
44
+
45
+ #bar {
46
+ background: green;
47
+ height: 20px;
48
+ @include grid-span(1, 1);
49
+ clear: left;
50
+
51
+ @include breakpoint($break) {
52
+ @include grid-span(2, 2);
53
+ @include push(1, 1);
54
+ clear: none;
55
+ }
56
+
57
+ @include breakpoint($break2) {
58
+ @include grid-span(8, 3);
59
+ clear: none;
60
+ }
61
+
62
+ @include breakpoint($break3) {
63
+ @include grid-span(1, 1);
64
+ @include pull(3, 1);
65
+ }
66
+
67
+ }
68
+
69
+ #baz {
70
+ background: purple;
71
+ @include grid-span(1, 1);
72
+
73
+ @include breakpoint($break) {
74
+ // This piece's position is very wonky in Float, and as such we need to do some custom silliness to place it. It winds up looking similar to Isolation positioning, but in revers. Fortunately, because we have functions like column-span, gutter-span, and grid-span, we're able to build this fairly easily and have the heavy lifting of the math done for us.
75
+ width: column-span(1, 1);
76
+ float: right;
77
+ margin-left: -100%;
78
+ margin-right: grid-span(2, 2) + gutter-span();
79
+ clear: none;
80
+ }
81
+
82
+ @include breakpoint($break2) {
83
+ margin-right: 0;
84
+ @include grid-span(2, 1);
85
+ @include pull(10, 1);
86
+ clear: none;
87
+ }
88
+
89
+ @include breakpoint($break3) {
90
+ @include grid-span(1, 5);
91
+ }
92
+ }
93
+
94
+ #qux {
95
+ background: yellow;
96
+ @include grid-span(1, 1);
97
+ clear: both;
98
+
99
+ @include breakpoint($break) {
100
+ @include grid-span(3, 2);
101
+ // clear: left;
102
+ }
103
+
104
+ @include breakpoint($break2) {
105
+ @include grid-span(3, 4);
106
+ clear: both;
107
+ @include push(3, 1);
108
+ }
109
+
110
+ @include breakpoint($break3) {
111
+ @include grid-span(1, 2);
112
+ clear: none;
113
+ @include pull(2, 2);
114
+ }
115
+ }
116
+
117
+ #waldo {
118
+ background: blue;
119
+ height: 70px;
120
+
121
+ @include grid-span(1, 2);
122
+
123
+ @include breakpoint($break) {
124
+ @include grid-span(1, 1);
125
+ clear: left;
126
+ }
127
+
128
+ @include breakpoint($break2) {
129
+ @include grid-span(3, 1);
130
+ @include pull(6, 1);
131
+ }
132
+
133
+ @include breakpoint($break3) {
134
+ @include grid-span(1, 4);
135
+ clear: none;
136
+ margin-right: -100%;
137
+ margin-left: 0;
138
+ }
139
+ }
140
+
141
+ #garfield {
142
+ background: orange;
143
+
144
+ @include grid-span(2, 1);
145
+
146
+ @include breakpoint($break) {
147
+ @include float-span(4, 1);
148
+ }
149
+
150
+ @include breakpoint($break2) {
151
+ @include grid-span(5, 8);
152
+ }
153
+
154
+ @include breakpoint($break3) {
155
+ @include grid-span(2, 3);
156
+ clear: both;
157
+ @include push(2, 1);
158
+ }
159
+ }
@@ -0,0 +1,132 @@
1
+ @import "singularitygs";
2
+
3
+ $break: 700px;
4
+ $break2: 900px;
5
+ $break3: 1200px;
6
+
7
+ $grids: add-grid(2);
8
+ $grids: add-grid(2 8 2 1 at $break);
9
+ $grids: add-grid(12 at $break2);
10
+ $grids: add-grid(1 3 5 7 9 at $break3);
11
+ $gutters: add-gutter(1/3);
12
+ // $gutters: add-gutter(.25 at $break);
13
+ // $output: 'float';
14
+
15
+ body {
16
+ margin: 0;
17
+ padding: 0;
18
+ @include background-grid;
19
+ }
20
+
21
+ div {
22
+ height: 50px;
23
+ }
24
+
25
+ #foo {
26
+ background: red;
27
+ height: 30px;
28
+ @include grid-span(1, 2);
29
+
30
+ @include breakpoint($break) {
31
+ @include grid-span(1, 4);
32
+ }
33
+
34
+ @include breakpoint($break2) {
35
+ @include grid-span(2, 11);
36
+ }
37
+
38
+ @include breakpoint($break3) {
39
+ @include grid-span(1, 3);
40
+ }
41
+ }
42
+
43
+ #bar {
44
+ background: green;
45
+ height: 20px;
46
+ @include grid-span(1, 1);
47
+
48
+ @include breakpoint($break) {
49
+ @include grid-span(2, 2);
50
+ }
51
+
52
+ @include breakpoint($break2) {
53
+ @include grid-span(8, 3)
54
+ }
55
+
56
+ @include breakpoint($break3) {
57
+ @include grid-span(1, 1);
58
+ }
59
+
60
+ }
61
+
62
+ #baz {
63
+ background: purple;
64
+ @include grid-span(1, 1, $options: 'both');
65
+
66
+ @include breakpoint($break) {
67
+ @include grid-span(1, 1);
68
+ }
69
+
70
+ @include breakpoint($break2) {
71
+ @include grid-span(2, 1);
72
+ }
73
+
74
+ @include breakpoint($break3) {
75
+ @include grid-span(1, 5);
76
+ }
77
+ }
78
+
79
+ #qux {
80
+ background: yellow;
81
+
82
+ @include grid-span(1, 1, $options: 'left');
83
+
84
+ @include breakpoint($break) {
85
+ @include grid-span(3, 2, $options: 'left');
86
+ }
87
+
88
+ @include breakpoint($break2) {
89
+ @include grid-span(3, 4, $options: 'both');
90
+ }
91
+
92
+ @include breakpoint($break3) {
93
+ @include grid-span(1, 2);
94
+ }
95
+ }
96
+
97
+ #waldo {
98
+ background: blue;
99
+ height: 70px;
100
+
101
+ @include grid-span(1, 2, $options: 'right');
102
+
103
+ @include breakpoint($break) {
104
+ @include grid-span(1, 1, $options: 'left');
105
+ }
106
+
107
+ @include breakpoint($break2) {
108
+ @include grid-span(3, 1, $options: 'right');
109
+ }
110
+
111
+ @include breakpoint($break3) {
112
+ @include grid-span(1, 4);
113
+ }
114
+ }
115
+
116
+ #garfield {
117
+ background: orange;
118
+
119
+ @include grid-span(2, 1, $options: 'left');
120
+
121
+ @include breakpoint($break) {
122
+ @include isolation-span(4, 1, 'both');
123
+ }
124
+
125
+ @include breakpoint($break2) {
126
+ @include grid-span(5, 8);
127
+ }
128
+
129
+ @include breakpoint($break3) {
130
+ @include grid-span(2, 3, $options: 'both');
131
+ }
132
+ }
@@ -0,0 +1,17 @@
1
+ <html>
2
+ <head>
3
+ <title>Singularity HTML Demo</title>
4
+ <link rel="stylesheet" href="stylesheets/demo-float.css">
5
+ </head>
6
+ <body>
7
+ <div id="page">
8
+ <div id="foo"></div>
9
+ <div id="bar"></div>
10
+ <div id="baz"></div>
11
+ <div id="qux"></div>
12
+ <div id="waldo"></div>
13
+ <div id="garfield"></div>
14
+ </div>
15
+
16
+ </body>
17
+ </html>
@@ -0,0 +1,17 @@
1
+ <html>
2
+ <head>
3
+ <title>Singularity HTML Demo</title>
4
+ <link rel="stylesheet" href="stylesheets/demo-isolation.css">
5
+ </head>
6
+ <body>
7
+ <div id="page">
8
+ <div id="foo"></div>
9
+ <div id="bar"></div>
10
+ <div id="baz"></div>
11
+ <div id="qux"></div>
12
+ <div id="waldo"></div>
13
+ <div id="garfield"></div>
14
+ </div>
15
+
16
+ </body>
17
+ </html>
@@ -0,0 +1,17 @@
1
+ description "Singularity Demos"
2
+
3
+ discover :stylesheets
4
+ file 'isolation.html', :to => 'isolation.html'
5
+ file 'float.html', :to => 'float.html'
6
+
7
+ help %Q{
8
+ For help with Singularity, please ask a question on Stack Overflow (http://stackoverflow.com/questions/ask) tagged with "singularitygs".
9
+
10
+ To file an issue with Singularity, please use our GitHub Issue Queue (https://github.com/Team-Sass/Singularity/issues).
11
+ }
12
+
13
+ welcome_message %Q{
14
+ Welcome to the Singularity Demo!
15
+
16
+ These two sites, with their accompanying Sass, should give you a working example as to how Singularity works with its two out-of-the-box output styles.
17
+ }
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 3
9
- version: 1.0.3
8
+ - 4
9
+ version: 1.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Scott Kellum
@@ -98,11 +98,16 @@ files:
98
98
  - stylesheets/singularitygs/language/_span.scss
99
99
  - stylesheets/singularitygs/math/_columns.scss
100
100
  - stylesheets/singularitygs/math/_context.scss
101
+ - stylesheets/singularitygs/math/_grid.scss
101
102
  - stylesheets/singularitygs/math/_gutters.scss
102
- - stylesheets/singularitygs/math/_span.scss
103
103
  - templates/box-sizing/behaviors/box-sizing/boxsizing.htc
104
104
  - templates/box-sizing/behaviors/box-sizing/boxsizing.php
105
105
  - templates/box-sizing/manifest.rb
106
+ - templates/demos/demo-float.scss
107
+ - templates/demos/demo-isolation.scss
108
+ - templates/demos/float.html
109
+ - templates/demos/isolation.html
110
+ - templates/demos/manifest.rb
106
111
  - templates/project/grid.js
107
112
  - templates/project/grid.min.js
108
113
  - templates/project/manifest.rb