singularity-extras 0.0.3 → 1.0.0.alpha.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d23586f01c6d7ee68a3e5b840756640bdfd30f03
4
+ data.tar.gz: 115e07637bd714c2321865c7e6396b629c3bc0de
5
+ SHA512:
6
+ metadata.gz: 494a180495f92834e83b7eb95f16dabd919c3923eecf214f227642e5bf40be1af55e0f9f63b5d6b4a9d3206cc1abe36f57d2d3d6f115a0be9f8269a6203cbf10
7
+ data.tar.gz: 4d0ba497d74d9b2eb667ffb4d5bb92623c3d3197903bac795929de18b9514cc959f18873ff184bb0f708156522604e61c53adcb3ca977db10f63ee83160e822d
@@ -1,11 +1,10 @@
1
1
  require 'compass'
2
2
  require 'singularitygs'
3
3
  require 'modular-scale'
4
- require 'sassy-math'
5
4
 
6
5
  Compass::Frameworks.register("singularity-extras", :path => "#{File.dirname(__FILE__)}/..")
7
6
 
8
7
  module SingularityExtras
9
- VERSION = "0.0.3"
10
- DATE = "2012-04-24"
8
+ VERSION = "1.0.0.alpha.1"
9
+ DATE = "2013-01-17"
11
10
  end
@@ -1,4 +1,4 @@
1
1
  @import "singularity-extras/helpers";
2
2
  @import "singularity-extras/generators";
3
- @import "singularity-extras/output";
3
+ @import "singularity-extras/outputs";
4
4
  @import "singularity-extras/layouts";
@@ -0,0 +1 @@
1
+ @import "outputs/calc";
@@ -1,12 +1,19 @@
1
1
  // Creates a list based on a ratio
2
2
  // Valid options for $start: 'large' or 'small'
3
3
  @function ratio($ratio, $steps, $start: 'small') {
4
- $x: 1;
5
4
  $return: ();
6
5
 
7
- @for $i from 0 through $steps - 1 {
8
- $xr: $x * pow($ratio, $i);
9
- $return: append($return, $xr);
6
+ @for $i from 1 through $steps {
7
+ @if function-exists(pow) {
8
+ $return: append($return, pow($ratio, $i));
9
+ }
10
+ @else {
11
+ $x: $ratio;
12
+ @for $i from 2 through $i {
13
+ $x: $x * $ratio;
14
+ }
15
+ $return: append($return, $x);
16
+ }
10
17
  }
11
18
 
12
19
  @if $start == 'small' and $ratio < 1 {
@@ -1,6 +1,10 @@
1
1
  // "Snaps" an asymmetric grid to a symmetric one by including gutters in the grid definitions
2
2
  // Will only work properly with integer asymmetric grids
3
3
  @function snap($grid, $gutter) {
4
+ @if not unitless($gutter) {
5
+ @return $grid;
6
+ }
7
+
4
8
  $holder: ();
5
9
 
6
10
  @each $column in $grid {
@@ -0,0 +1,204 @@
1
+ $Singularity-Settings: map-merge($Singularity-Settings, ('calc include min-width': true));
2
+
3
+ @function output-calc($Span-Map) {
4
+ // Set up Left/Right maps
5
+ $Return: ();
6
+
7
+ $Span: map-get($Span-Map, 'span');
8
+ $Location: map-get($Span-Map, 'location');
9
+
10
+ $Grid: map-get($Span-Map, 'grid');
11
+ $Gutter: map-get($Span-Map, 'gutter');
12
+ $Style: map-get($Span-Map, 'style');
13
+
14
+ @if unitless($Gutter) {
15
+ @warn "Calc output style uses fixed gutters (gutters with units). Please define fixed gutters to use calc";
16
+ @return $Return;
17
+ }
18
+
19
+ @if type-of($Grid) == 'number' {
20
+ @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.";
21
+ @return $Return;
22
+ }
23
+
24
+ $Start-Row: map-get($Span-Map, 'start row');
25
+ $End-Row: map-get($Span-Map, 'end row');
26
+
27
+ $Split-Gutter: map-get($Span-Map, 'split gutter');
28
+
29
+ $Direction: map-get($Span-Map, 'direction');
30
+ $Options: map-get($Span-Map, 'options');
31
+
32
+ $Dir: $Direction;
33
+ $Opp: opposite-direction($Dir);
34
+
35
+ $Width: '';
36
+ $Margin: null;
37
+ $Min-Width: '(';
38
+
39
+ $Fixed: ();
40
+ $Fluid: ();
41
+ $Fixed-Totals: ('px': 0, 'em': 0, '%': 0);
42
+ $Gutter-Totals: if(str-index($Style, 'split') > 0, $Gutter * length($Grid), $Gutter * (length($Grid) - 1));
43
+ $Fluid-Totals: 0;
44
+ $Fluid-Fixed-Sum: '';
45
+ $Single-Fluid: '';
46
+
47
+ @for $i from 1 through length($Grid) {
48
+ $Item: nth($Grid, $i);
49
+ @if not unitless($Item) {
50
+ $Fixed: map-merge($Fixed, ($i: $Item));
51
+ }
52
+ @else {
53
+ $Fluid: map-merge($Fluid, ($i: $Item));
54
+ }
55
+ }
56
+
57
+ @each $k, $v in $Fixed {
58
+ $Unit: unit($v);
59
+ $Running: map-get($Fixed-Totals, $Unit) + $v;
60
+ $Fixed-Totals: map-merge($Fixed-Totals, ($Unit: $Running));
61
+ }
62
+
63
+ @each $k, $v in $Fluid {
64
+ $Fluid-Totals: $Fluid-Totals + $v;
65
+ }
66
+
67
+ @each $k, $v in $Fixed-Totals {
68
+
69
+ @if $v != 0 {
70
+ $Fluid-Fixed-Sum: '#{$Fluid-Fixed-Sum}#{$v} + ';
71
+ }
72
+ }
73
+
74
+ // Width of a single fluid item, for calc()
75
+ $Single-Fluid: '((100% - (#{$Fluid-Fixed-Sum}#{$Gutter-Totals})) / (#{$Fluid-Totals}))';
76
+
77
+ // Margin Calculation
78
+ @if not $Start-Row or not $End-Row {
79
+ @if $Split-Gutter {
80
+ $Margin: '#{$Gutter / 2} + ';
81
+ }
82
+
83
+ @for $i from 1 to $Location {
84
+ @if unitless(nth($Grid, $i)) {
85
+ $Margin: '#{$Margin}(#{$Single-Fluid} * #{nth($Grid, $i)} + #{$Gutter}) + ';
86
+ }
87
+ @else {
88
+ $Margin: '#{$Margin}(#{nth($Grid, $i)} + #{$Gutter}) + ';
89
+ }
90
+ }
91
+ }
92
+ @if $Margin != null {
93
+ $Margin: str-slice($Margin, 0, -4);
94
+ }
95
+
96
+
97
+ // Width Calculation
98
+ @if $Span == 1 {
99
+ @if map-has-key($Fixed, $Location) {
100
+ $Return: map-merge($Return, ('width': map-get($Fixed, $Location)));
101
+ }
102
+ @else if map-has-key($Fluid, $Location) {
103
+ $Math: '(#{$Single-Fluid}) * #{nth($Grid, $Location)}';
104
+ $Span-Map: ('width': ('webkit': -webkit-calc(#{unquote($Math)}), 'standard': calc(#{unquote($Math)})));
105
+ $Return: map-merge($Return, $Span-Map);
106
+ }
107
+ }
108
+ @else {
109
+ $Location-End: $Location + ($Span - 1);
110
+ $Fixed-Counter: 0;
111
+ @for $i from $Location through $Location-End {
112
+ @if unitless(nth($Grid, $i)) {
113
+ $Width: '#{$Width}(#{$Single-Fluid} * #{nth($Grid, $i)}';
114
+ }
115
+ @else {
116
+ $Fixed-Counter: $Fixed-Counter + 1;
117
+ $Min-Width: '#{$Min-Width}#{nth($Grid, $i)} + #{$Gutter} + ';
118
+ $Width: '#{$Width}(#{nth($Grid, $i)}';
119
+ }
120
+
121
+
122
+ @if $i != $Location-End {
123
+ $Width: '#{$Width} + #{$Gutter}) + ';
124
+ }
125
+ @else {
126
+ $Min-Width: str-slice($Min-Width, 0, -4);
127
+ @if $Fixed-Counter == 1 {
128
+ $Min-Width: '#{$Min-Width} - #{$Gutter}';
129
+ }
130
+ $Min-Width: '#{$Min-Width})';
131
+ $Width: '#{$Width})';
132
+ }
133
+ }
134
+
135
+ $Min-Map: ('min-width': ('webkit' : -webkit-calc(#{unquote($Min-Width)}), 'standard': calc(#{unquote($Min-Width)}) ));
136
+ $Span-Map: ('width': ('webkit': -webkit-calc(#{unquote($Width)}), 'standard': calc(#{unquote($Width)}) ) );
137
+
138
+ @if sgs-get('calc include min-width') {
139
+ $Return: map-merge($Return, $Min-Map);
140
+ }
141
+ $Return: map-merge($Return, $Span-Map);
142
+ }
143
+
144
+ // Build margins and Floats
145
+ @if ($End-Row) {
146
+ $Return: map-merge($Return, ('float': $Opp));
147
+ $Return: map-merge($Return, ('margin-#{$Dir}': 0));
148
+
149
+ @if $Split-Gutter {
150
+ $Return: map-merge($Return, ('margin-#{$Opp}': $Gutter / 2));
151
+ }
152
+ @else {
153
+ $Return: map-merge($Return, ('margin-#{$Opp}': 0));
154
+ }
155
+ }
156
+ @else {
157
+ $Return: map-merge($Return, ('float': $Dir));
158
+ $Return: map-merge($Return, ('margin-#{$Opp}': -100%));
159
+
160
+ @if $Start-Row {
161
+ @if $Split-Gutter {
162
+ $Return: map-merge($Return, ('margin-#{$Dir}': $Gutter / 2));
163
+ }
164
+ @else {
165
+ $Return: map-merge($Return, ('margin-#{$Dir}': 0));
166
+ }
167
+ }
168
+ @else {
169
+ $Margin-Map: ('margin-#{$Dir}': ('webkit': -webkit-calc(#{unquote($Margin)}), 'standard': calc(#{unquote($Margin)})));
170
+ $Return: map-merge($Return, $Margin-Map);
171
+ }
172
+ }
173
+
174
+ @return $Return;
175
+ }
176
+
177
+
178
+
179
+ //////////////////////////////
180
+ // Happy Syntax for Calc
181
+ //
182
+ // 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
183
+ //////////////////////////////
184
+ @mixin calc-span($Span, $Location, $clear: false, $grid: false, $gutter: false, $gutter-style: false, $from: false) {
185
+
186
+ @if $gutter != false and unitless($gutter) {
187
+ @warn "Calc output style uses fixed gutters (gutters with units). Please define fixed gutters to use calc";
188
+ }
189
+
190
+ @if $grid != false and type-of($grid) == 'number' {
191
+ @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.";
192
+ }
193
+
194
+ $Options: ();
195
+ @if $clear {
196
+ $Options: map-merge($Options, ('clear': $clear));
197
+ }
198
+ @if $from {
199
+ $Options: map-merge($Options, ('from': $from));
200
+ }
201
+
202
+ $Options: if(length($Options) > 0, $Options, null);
203
+ @include grid-span($Span, $Location, $grid, $gutter, 'calc', $gutter-style, $Options);
204
+ }
metadata CHANGED
@@ -1,81 +1,58 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: singularity-extras
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 3
9
- version: 0.0.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0.alpha.1
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - Scott Kellum
13
8
  - Sam Richard
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-04-24 00:00:00 -04:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2013-01-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: singularitygs
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- - 0
31
- - 1
32
- version: 0.0.1
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ~>
19
+ - !ruby/object:Gem::Version
20
+ version: 1.2.0.rc.1
33
21
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: sassy-math
37
22
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- segments:
43
- - 1
44
- - 5
45
- version: "1.5"
46
- type: :runtime
47
- version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: 1.2.0.rc.1
28
+ - !ruby/object:Gem::Dependency
49
29
  name: modular-scale
50
- prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- segments:
56
- - 1
57
- - 0
58
- - 6
59
- version: 1.0.6
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: 2.0.0.alpha5
60
35
  type: :runtime
61
- version_requirements: *id003
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ version: 2.0.0.alpha5
62
42
  description: Advanced responsive grid system for Sass and Compass
63
- email:
43
+ email:
64
44
  - scott@scottkellum.com
65
45
  - snugug@gmail.com
66
46
  executables: []
67
-
68
47
  extensions: []
69
-
70
48
  extra_rdoc_files: []
71
-
72
- files:
49
+ files:
73
50
  - lib/singularity-extras.rb
74
51
  - stylesheets/_singularity-extras.scss
75
52
  - stylesheets/singularity-extras/_generators.scss
76
53
  - stylesheets/singularity-extras/_helpers.scss
77
54
  - stylesheets/singularity-extras/_layouts.scss
78
- - stylesheets/singularity-extras/_output.scss
55
+ - stylesheets/singularity-extras/_outputs.scss
79
56
  - stylesheets/singularity-extras/generators/_compound.scss
80
57
  - stylesheets/singularity-extras/generators/_ratio-spiral.scss
81
58
  - stylesheets/singularity-extras/generators/_ratio.scss
@@ -84,36 +61,30 @@ files:
84
61
  - stylesheets/singularity-extras/helpers/_repeat.scss
85
62
  - stylesheets/singularity-extras/helpers/_reverse.scss
86
63
  - stylesheets/singularity-extras/layouts/_layout.scss
87
- has_rdoc: true
64
+ - stylesheets/singularity-extras/outputs/_calc.scss
88
65
  homepage: http://singularity.gs
89
66
  licenses: []
90
-
67
+ metadata: {}
91
68
  post_install_message:
92
69
  rdoc_options: []
93
-
94
- require_paths:
70
+ require_paths:
95
71
  - lib
96
- required_ruby_version: !ruby/object:Gem::Requirement
97
- requirements:
98
- - - ">="
99
- - !ruby/object:Gem::Version
100
- segments:
101
- - 0
102
- version: "0"
103
- required_rubygems_version: !ruby/object:Gem::Requirement
104
- requirements:
105
- - - ">="
106
- - !ruby/object:Gem::Version
107
- segments:
108
- - 1
109
- - 2
110
- version: "1.2"
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '1.2'
111
82
  requirements: []
112
-
113
83
  rubyforge_project: singularity-extras
114
- rubygems_version: 1.3.6
84
+ rubygems_version: 2.0.3
115
85
  signing_key:
116
- specification_version: 3
117
- summary: Singularity is a fluid grid system that can generate uniform columns as well as asymmetric and compound grids with tools to write grids as functions, mixins, or class based objects.
86
+ specification_version: 4
87
+ summary: Singularity is a fluid grid system that can generate uniform columns as well
88
+ as asymmetric and compound grids with tools to write grids as functions, mixins,
89
+ or class based objects.
118
90
  test_files: []
119
-
File without changes