singularitygs 1.4.0 → 1.5.0
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.
- checksums.yaml +4 -4
- data/lib/singularitygs.rb +2 -2
- data/stylesheets/_singularitygs.scss +1 -0
- data/stylesheets/singularitygs/_api.scss +1 -0
- data/stylesheets/singularitygs/api/_calc.scss +201 -0
- data/stylesheets/singularitygs/helpers/_background-grid.scss +35 -12
- data/stylesheets/singularitygs/helpers/_settings.scss +4 -0
- data/stylesheets/singularitygs/language/_parse-add.scss +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13d24083bfaf80520aa48a26f7dee312d3efdd00
|
4
|
+
data.tar.gz: 812438c2a6fd732eb1bb06d026b3a9a6513656c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa7793a362cb1c5e078c2aa50a32cc57fddbb0db08588845c317e94aafc3b6ef58f9fce315023250e566946c2565184f6c26548ad4f4bf9edfed72e72d902cf2
|
7
|
+
data.tar.gz: c536c6256fbe591e0175ddabf1092ad80d6ec6db0688539b0d5af81a85755fe600a7c8b8132fcd8ff406fbd277690f5cbb371f7cf28c4a25aabdc97f5bb11c25
|
data/lib/singularitygs.rb
CHANGED
@@ -0,0 +1,201 @@
|
|
1
|
+
@function output-calc($Span-Map) {
|
2
|
+
// Set up Left/Right maps
|
3
|
+
$Return: ();
|
4
|
+
|
5
|
+
$Span: map-get($Span-Map, 'span');
|
6
|
+
$Location: map-get($Span-Map, 'location');
|
7
|
+
|
8
|
+
$Grid: map-get($Span-Map, 'grid');
|
9
|
+
$Gutter: map-get($Span-Map, 'gutter');
|
10
|
+
$Style: map-get($Span-Map, 'style');
|
11
|
+
|
12
|
+
@if unitless($Gutter) {
|
13
|
+
@error "Calc output style uses fixed gutters (gutters with units). Please define fixed gutters to use calc";
|
14
|
+
@return $Return;
|
15
|
+
}
|
16
|
+
|
17
|
+
@if type-of($Grid) == 'number' {
|
18
|
+
@error "Calc output style is designed to be used with asymmetric grids, especially with a mix of fixed and fluid columns. Please define an asymmetric grid or use another output style.";
|
19
|
+
}
|
20
|
+
|
21
|
+
$Start-Row: map-get($Span-Map, 'start row');
|
22
|
+
$End-Row: map-get($Span-Map, 'end row');
|
23
|
+
|
24
|
+
$Split-Gutter: map-get($Span-Map, 'split gutter');
|
25
|
+
|
26
|
+
$Direction: map-get($Span-Map, 'direction');
|
27
|
+
$Options: map-get($Span-Map, 'options');
|
28
|
+
|
29
|
+
$Dir: $Direction;
|
30
|
+
$Opp: opposite-direction($Dir);
|
31
|
+
|
32
|
+
$Width: '';
|
33
|
+
$Margin: null;
|
34
|
+
$Min-Width: '(';
|
35
|
+
|
36
|
+
$Fixed: ();
|
37
|
+
$Fluid: ();
|
38
|
+
$Fixed-Totals: ('px': 0, 'em': 0, '%': 0);
|
39
|
+
$Gutter-Totals: if(str-index($Style, 'split'), $Gutter * length($Grid), $Gutter * (length($Grid) - 1));
|
40
|
+
$Fluid-Totals: 0;
|
41
|
+
$Fluid-Fixed-Sum: '';
|
42
|
+
$Single-Fluid: '';
|
43
|
+
|
44
|
+
@for $i from 1 through length($Grid) {
|
45
|
+
$Item: nth($Grid, $i);
|
46
|
+
@if not unitless($Item) {
|
47
|
+
$Fixed: map-merge($Fixed, ($i: $Item));
|
48
|
+
}
|
49
|
+
@else {
|
50
|
+
$Fluid: map-merge($Fluid, ($i: $Item));
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
@each $k, $v in $Fixed {
|
55
|
+
$Unit: unit($v);
|
56
|
+
$Running: map-get($Fixed-Totals, $Unit) + $v;
|
57
|
+
$Fixed-Totals: map-merge($Fixed-Totals, ($Unit: $Running));
|
58
|
+
}
|
59
|
+
|
60
|
+
@each $k, $v in $Fluid {
|
61
|
+
$Fluid-Totals: $Fluid-Totals + $v;
|
62
|
+
}
|
63
|
+
|
64
|
+
@each $k, $v in $Fixed-Totals {
|
65
|
+
|
66
|
+
@if $v != 0 {
|
67
|
+
$Fluid-Fixed-Sum: '#{$Fluid-Fixed-Sum}#{$v} + ';
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
// Width of a single fluid item, for calc()
|
72
|
+
$Single-Fluid: '((100% - (#{$Fluid-Fixed-Sum}#{$Gutter-Totals})) / (#{$Fluid-Totals}))';
|
73
|
+
|
74
|
+
// Margin Calculation
|
75
|
+
@if not $Start-Row or not $End-Row {
|
76
|
+
@if $Split-Gutter {
|
77
|
+
$Margin: '#{$Gutter / 2} + ';
|
78
|
+
}
|
79
|
+
|
80
|
+
@for $i from 1 to $Location {
|
81
|
+
@if unitless(nth($Grid, $i)) {
|
82
|
+
$Margin: '#{$Margin}(#{$Single-Fluid} * #{nth($Grid, $i)} + #{$Gutter}) + ';
|
83
|
+
}
|
84
|
+
@else {
|
85
|
+
$Margin: '#{$Margin}(#{nth($Grid, $i)} + #{$Gutter}) + ';
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
@if $Margin != null {
|
90
|
+
$Margin: str-slice($Margin, 0, -4);
|
91
|
+
}
|
92
|
+
|
93
|
+
|
94
|
+
// Width Calculation
|
95
|
+
@if $Span == 1 {
|
96
|
+
@if map-has-key($Fixed, $Location) {
|
97
|
+
$Return: map-merge($Return, ('width': map-get($Fixed, $Location)));
|
98
|
+
}
|
99
|
+
@else if map-has-key($Fluid, $Location) {
|
100
|
+
$Math: '(#{$Single-Fluid}) * #{nth($Grid, $Location)}';
|
101
|
+
$Span-Map: ('width': ('webkit': -webkit-calc(#{unquote($Math)}), 'standard': calc(#{unquote($Math)})));
|
102
|
+
$Return: map-merge($Return, $Span-Map);
|
103
|
+
}
|
104
|
+
}
|
105
|
+
@else {
|
106
|
+
$Location-End: $Location + ($Span - 1);
|
107
|
+
$Fixed-Counter: 0;
|
108
|
+
@for $i from $Location through $Location-End {
|
109
|
+
@if unitless(nth($Grid, $i)) {
|
110
|
+
$Width: '#{$Width}(#{$Single-Fluid} * #{nth($Grid, $i)}';
|
111
|
+
}
|
112
|
+
@else {
|
113
|
+
$Fixed-Counter: $Fixed-Counter + 1;
|
114
|
+
$Min-Width: '#{$Min-Width}#{nth($Grid, $i)} + #{$Gutter} + ';
|
115
|
+
$Width: '#{$Width}(#{nth($Grid, $i)}';
|
116
|
+
}
|
117
|
+
|
118
|
+
|
119
|
+
@if $i != $Location-End {
|
120
|
+
$Width: '#{$Width} + #{$Gutter}) + ';
|
121
|
+
}
|
122
|
+
@else {
|
123
|
+
$Min-Width: str-slice($Min-Width, 0, -4);
|
124
|
+
@if $Fixed-Counter == 1 {
|
125
|
+
$Min-Width: '#{$Min-Width} - #{$Gutter}';
|
126
|
+
}
|
127
|
+
$Min-Width: '#{$Min-Width})';
|
128
|
+
$Width: '#{$Width})';
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
$Min-Map: ('min-width': ('webkit' : -webkit-calc(#{unquote($Min-Width)}), 'standard': calc(#{unquote($Min-Width)}) ));
|
133
|
+
$Span-Map: ('width': ('webkit': -webkit-calc(#{unquote($Width)}), 'standard': calc(#{unquote($Width)}) ) );
|
134
|
+
|
135
|
+
@if sgs-get('calc include min-width') {
|
136
|
+
$Return: map-merge($Return, $Min-Map);
|
137
|
+
}
|
138
|
+
$Return: map-merge($Return, $Span-Map);
|
139
|
+
}
|
140
|
+
|
141
|
+
// Build margins and Floats
|
142
|
+
@if ($End-Row) {
|
143
|
+
$Return: map-merge($Return, ('float': $Opp));
|
144
|
+
$Return: map-merge($Return, ('margin-#{$Dir}': 0));
|
145
|
+
|
146
|
+
@if $Split-Gutter {
|
147
|
+
$Return: map-merge($Return, ('margin-#{$Opp}': $Gutter / 2));
|
148
|
+
}
|
149
|
+
@else {
|
150
|
+
$Return: map-merge($Return, ('margin-#{$Opp}': 0));
|
151
|
+
}
|
152
|
+
}
|
153
|
+
@else {
|
154
|
+
$Return: map-merge($Return, ('float': $Dir));
|
155
|
+
$Return: map-merge($Return, ('margin-#{$Opp}': -100%));
|
156
|
+
|
157
|
+
@if $Start-Row {
|
158
|
+
@if $Split-Gutter {
|
159
|
+
$Return: map-merge($Return, ('margin-#{$Dir}': $Gutter / 2));
|
160
|
+
}
|
161
|
+
@else {
|
162
|
+
$Return: map-merge($Return, ('margin-#{$Dir}': 0));
|
163
|
+
}
|
164
|
+
}
|
165
|
+
@else {
|
166
|
+
$Margin-Map: ('margin-#{$Dir}': ('webkit': -webkit-calc(#{unquote($Margin)}), 'standard': calc(#{unquote($Margin)})));
|
167
|
+
$Return: map-merge($Return, $Margin-Map);
|
168
|
+
}
|
169
|
+
}
|
170
|
+
|
171
|
+
@return $Return;
|
172
|
+
}
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
//////////////////////////////
|
177
|
+
// Happy Syntax for Calc
|
178
|
+
//
|
179
|
+
// Makes working with Calc easier, as it moves Clear to a 1st class citizen of the mixin, and automatically builds the verbose grid-span mixin call
|
180
|
+
//////////////////////////////
|
181
|
+
@mixin calc-span($Span, $Location, $clear: false, $grid: false, $gutter: false, $gutter-style: false, $from: false) {
|
182
|
+
|
183
|
+
@if $gutter != false and unitless($gutter) {
|
184
|
+
@warn "Calc output style uses fixed gutters (gutters with units). Please define fixed gutters to use calc";
|
185
|
+
}
|
186
|
+
|
187
|
+
@if $grid != false and type-of($grid) == 'number' {
|
188
|
+
@warn "Calc output style is designed to be used with asymmetric grids, especially with a mix of fixed and fluid columns. Please define an asymmetric grid.";
|
189
|
+
}
|
190
|
+
|
191
|
+
$Options: ();
|
192
|
+
@if $clear {
|
193
|
+
$Options: map-merge($Options, ('clear': $clear));
|
194
|
+
}
|
195
|
+
@if $from {
|
196
|
+
$Options: map-merge($Options, ('from': $from));
|
197
|
+
}
|
198
|
+
|
199
|
+
$Options: if(length($Options) > 0, $Options, null);
|
200
|
+
@include grid-span($Span, $Location, $grid, $gutter, 'calc', $gutter-style, $Options);
|
201
|
+
}
|
@@ -158,6 +158,7 @@
|
|
158
158
|
|
159
159
|
@mixin background-build($columns, $gutters, $gutter-styles, $color) {
|
160
160
|
$Background-Map: background-map($columns, $gutters, $gutter-styles);
|
161
|
+
$Display: true;
|
161
162
|
|
162
163
|
$Column-Color: $color;
|
163
164
|
$Inverse-Column-Color: mix(black, $color, 15%);
|
@@ -199,32 +200,54 @@
|
|
199
200
|
}
|
200
201
|
|
201
202
|
@if $i != $Grid-Count {
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
203
|
+
@if unit($Counter-Width) == unit($Loop-Width) {
|
204
|
+
$Gradient: append($Gradient, ($Loop-Color $Counter-Width, $Loop-Color ($Counter-Width + $Loop-Width)), 'comma');
|
205
|
+
$Counter-Width: $Counter-Width + $Loop-Width;
|
206
|
+
$Gradient: append($Gradient, ($Gutter-Color $Counter-Width, $Gutter-Color ($Counter-Width + $Gutter-Width)), 'comma');
|
207
|
+
$Counter-Width: $Counter-Width + $Gutter-Width;
|
208
|
+
}
|
209
|
+
@else {
|
210
|
+
$Display: false;
|
211
|
+
}
|
212
|
+
|
206
213
|
}
|
207
214
|
@else if $i == 1 {
|
208
|
-
|
209
|
-
|
215
|
+
@if unit($Counter-Width) == unit($Loop-Width) {
|
216
|
+
$Gradient: append($Gradient, ($Loop-Color, $Loop-Color $Counter-Width, $Gutter-Color $Counter-Width, $Gutter-Color ($Counter-Width + $Gutter-Width)), 'comma');
|
217
|
+
$Counter-Width: $Counter-Width + $Loop-Width + $Gutter-Width;
|
218
|
+
}
|
219
|
+
@else {
|
220
|
+
$Display: false;
|
221
|
+
}
|
222
|
+
|
210
223
|
}
|
211
224
|
@else if $i == $Grid-Count and index($Style, 'split') {
|
212
|
-
|
213
|
-
|
214
|
-
|
225
|
+
@if unit($Counter-Width) == unit($Loop-Width) {
|
226
|
+
$Gradient: append($Gradient, ($Loop-Color $Counter-Width, $Loop-Color ($Counter-Width + $Loop-Width)), 'comma');
|
227
|
+
$Counter-Width: $Counter-Width + $Loop-Width;
|
228
|
+
$Gradient: append($Gradient, ($Gutter-Color $Counter-Width, $Gutter-Color ($Counter-Width + ($Gutter-Width / 2))), 'comma');
|
229
|
+
}
|
230
|
+
@else {
|
231
|
+
$Display: false;
|
232
|
+
}
|
215
233
|
}
|
216
234
|
@else {
|
217
235
|
$Gradient: append($Gradient, ($Loop-Color $Counter-Width, $Loop-Color), 'comma');
|
218
236
|
}
|
219
237
|
}
|
220
238
|
|
221
|
-
@if $
|
222
|
-
@
|
239
|
+
@if $Display {
|
240
|
+
@if $bkpt != -1px {
|
241
|
+
@include breakpoint($bkpt) {
|
242
|
+
background-image: unquote('linear-gradient(to #{opposite-direction($Direction)}, #{$Gradient})');
|
243
|
+
}
|
244
|
+
}
|
245
|
+
@else {
|
223
246
|
background-image: unquote('linear-gradient(to #{opposite-direction($Direction)}, #{$Gradient})');
|
224
247
|
}
|
225
248
|
}
|
226
249
|
@else {
|
227
|
-
|
250
|
+
@warn 'Cannot generate a CSS gradient for grid `#{$Grid}` with gutters `#{$Gutter}` and gutter style `#{$Style}`';
|
228
251
|
}
|
229
252
|
}
|
230
253
|
}
|
@@ -43,7 +43,7 @@
|
|
43
43
|
|
44
44
|
@if length($breakpoint-mq) > 1 {
|
45
45
|
@warn "Responsive contexts are not available for `or` queries as which query to use is ambiguous. Please only use single context queries. Context set to -1px.";
|
46
|
-
$parse-mq: 1px;
|
46
|
+
$parse-mq: -1px;
|
47
47
|
}
|
48
48
|
@else if length($breakpoint-mq) < 1 {
|
49
49
|
@warn "No " + if($Mobile-First, 'min-width', 'max-width') + ' context found. Please use a media query with the correct context. Context set to -1px.';
|
@@ -60,4 +60,4 @@
|
|
60
60
|
}
|
61
61
|
|
62
62
|
@return ($parse-find $parse-mq);
|
63
|
-
}
|
63
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: singularitygs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Kellum
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-01-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sass
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- stylesheets/singularitygs/_helpers.scss
|
57
57
|
- stylesheets/singularitygs/_language.scss
|
58
58
|
- stylesheets/singularitygs/_math.scss
|
59
|
+
- stylesheets/singularitygs/api/_calc.scss
|
59
60
|
- stylesheets/singularitygs/api/_float.scss
|
60
61
|
- stylesheets/singularitygs/api/_isolation.scss
|
61
62
|
- stylesheets/singularitygs/grids/_add.scss
|