singularitygs 1.0.alpha.2 → 1.0.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.
Files changed (65) hide show
  1. data/lib/singularitygs.rb +2 -3
  2. data/stylesheets/_singularitygs.scss +45 -56
  3. data/stylesheets/singularitygs/_api.scss +39 -0
  4. data/stylesheets/singularitygs/_grids.scss +2 -0
  5. data/stylesheets/singularitygs/_gutters.scss +2 -0
  6. data/stylesheets/singularitygs/_helpers.scss +15 -3
  7. data/stylesheets/singularitygs/_language.scss +3 -0
  8. data/stylesheets/singularitygs/_math.scss +3 -0
  9. data/stylesheets/singularitygs/api/_float.scss +93 -0
  10. data/stylesheets/singularitygs/api/_isolation.scss +48 -0
  11. data/stylesheets/singularitygs/grids/_add.scss +10 -0
  12. data/stylesheets/singularitygs/grids/_find.scss +17 -0
  13. data/stylesheets/singularitygs/gutters/_add.scss +10 -0
  14. data/stylesheets/singularitygs/gutters/_find.scss +17 -0
  15. data/stylesheets/singularitygs/helpers/_background-grid.scss +186 -0
  16. data/stylesheets/singularitygs/helpers/_box-sizing.scss +25 -0
  17. data/stylesheets/singularitygs/helpers/_clearfix.scss +51 -0
  18. data/stylesheets/singularitygs/helpers/_columns.scss +15 -0
  19. data/stylesheets/singularitygs/helpers/_directions.scss +37 -0
  20. data/stylesheets/singularitygs/helpers/_find.scss +75 -0
  21. data/stylesheets/singularitygs/helpers/_sass-lists.scss +71 -0
  22. data/stylesheets/singularitygs/helpers/_span-shared.scss +9 -0
  23. data/stylesheets/singularitygs/language/_parse-add.scss +19 -0
  24. data/stylesheets/singularitygs/language/_parse-list.scss +53 -0
  25. data/stylesheets/singularitygs/language/_span.scss +20 -0
  26. data/stylesheets/singularitygs/math/_columns.scss +70 -0
  27. data/stylesheets/singularitygs/math/_context.scss +3 -0
  28. data/stylesheets/singularitygs/math/_gutters.scss +11 -0
  29. data/templates/{project → box-sizing}/behaviors/box-sizing/boxsizing.htc +0 -0
  30. data/templates/{project → box-sizing}/behaviors/box-sizing/boxsizing.php +0 -0
  31. data/templates/box-sizing/manifest.rb +4 -0
  32. data/templates/project/grid.js +16 -0
  33. data/templates/project/grid.min.js +2 -0
  34. data/templates/project/manifest.rb +21 -2
  35. data/templates/project/partials/_base.scss +4 -0
  36. data/templates/project/style.scss +15 -0
  37. metadata +39 -52
  38. data/stylesheets/singularitygs/_background-grid.scss +0 -49
  39. data/stylesheets/singularitygs/_column.scss +0 -51
  40. data/stylesheets/singularitygs/_grid-plugins.scss +0 -4
  41. data/stylesheets/singularitygs/_grid-structure.scss +0 -14
  42. data/stylesheets/singularitygs/_grid-test.scss +0 -58
  43. data/stylesheets/singularitygs/_grid.scss +0 -6
  44. data/stylesheets/singularitygs/_gutter.scss +0 -45
  45. data/stylesheets/singularitygs/_mixins.scss +0 -7
  46. data/stylesheets/singularitygs/grid-plugins/_compound.scss +0 -49
  47. data/stylesheets/singularitygs/grid-plugins/_gridset.scss +0 -16
  48. data/stylesheets/singularitygs/grid-plugins/_ratio-spiral.scss +0 -42
  49. data/stylesheets/singularitygs/grid-plugins/_ratio.scss +0 -24
  50. data/stylesheets/singularitygs/grid-structure/_display-table.scss +0 -1
  51. data/stylesheets/singularitygs/grid-structure/_flexbox.scss +0 -0
  52. data/stylesheets/singularitygs/grid-structure/_float.scss +0 -98
  53. data/stylesheets/singularitygs/grid-structure/_grid-layout.scss +0 -1
  54. data/stylesheets/singularitygs/grid-structure/_isolation.scss +0 -154
  55. data/stylesheets/singularitygs/helpers/_alphabet.scss +0 -1
  56. data/stylesheets/singularitygs/helpers/_grids.scss +0 -34
  57. data/stylesheets/singularitygs/helpers/_gridsets.scss +0 -388
  58. data/stylesheets/singularitygs/helpers/_lists.scss +0 -29
  59. data/stylesheets/singularitygs/mixins/_base-font-size.scss +0 -63
  60. data/stylesheets/singularitygs/mixins/_container.scss +0 -63
  61. data/stylesheets/singularitygs/mixins/_grid-build.scss +0 -9
  62. data/stylesheets/singularitygs/mixins/_grid-objects.scss +0 -28
  63. data/stylesheets/singularitygs/mixins/_grid-padding.scss +0 -8
  64. data/stylesheets/singularitygs/mixins/_grid-span.scss +0 -34
  65. data/stylesheets/singularitygs/mixins/_push-pull.scss +0 -41
@@ -0,0 +1,25 @@
1
+ @import "compass/css3/shared";
2
+
3
+ @mixin box-sizing($bs) {
4
+ $bs: unquote($bs);
5
+ @include experimental(box-sizing, $bs,
6
+ -moz, -webkit, not -o, not -ms, not -khtml, official
7
+ );
8
+
9
+ @if $bs == 'border-box' {
10
+ @if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
11
+ *behavior: url("../behaviors/box-sizing/boxsizing.php");
12
+ }
13
+ }
14
+ @else {
15
+ *behavior: none;
16
+ }
17
+ }
18
+
19
+ %border-box {
20
+ @include box-sizing('border-box');
21
+ }
22
+
23
+ %content-box {
24
+ @include box-sizing('content-box');
25
+ }
@@ -0,0 +1,51 @@
1
+ $legacy-support-for-ie6: false !default;
2
+ $legacy-support-for-ie7: false !default;
3
+ $legacy-support-for-mozilla: false !default;
4
+
5
+ @mixin clearfix {
6
+ @if $legacy-support-for-ie6 and $legacy-support-for-ie7 and not $legacy-support-for-mozilla {
7
+ /* for IE 6/7 */
8
+ *zoom: expression(this.runtimeStyle.zoom="1", this.appendChild(document.createElement("br")).style.cssText="clear:both;font:0/0 serif");
9
+ /* non-JS fallback */
10
+ *zoom: 1;
11
+
12
+ &:before,
13
+ &:after {
14
+ content: "";
15
+ display: table;
16
+ }
17
+
18
+ &:after {
19
+ clear: both;
20
+ }
21
+ }
22
+ @else if $legacy-support-for-ie6 and $legacy-support-for-ie7 and $legacy-support-for-mozilla {
23
+ /* for IE 6/7 */
24
+ *zoom: expression(this.runtimeStyle.zoom="1", this.appendChild(document.createElement("br")).style.cssText="clear:both;font:0/0 serif");
25
+ /* non-JS fallback */
26
+ *zoom: 1;
27
+
28
+ &:before,
29
+ &:after {
30
+ content: ".";
31
+ display: block;
32
+ height: 0;
33
+ overflow: hidden;
34
+ }
35
+
36
+ &:after {
37
+ clear: both;
38
+ }
39
+ }
40
+ @else {
41
+ &:after {
42
+ content: "";
43
+ display: table;
44
+ clear: both;
45
+ }
46
+ }
47
+ }
48
+
49
+ %clearfix {
50
+ @include clearfix;
51
+ }
@@ -0,0 +1,15 @@
1
+ @function end-row($span, $location, $columns) {
2
+ $columns: find-grid($columns);
3
+
4
+ @if $location == 'last' or $location == 'omega' {
5
+ @return true;
6
+ }
7
+ @else {
8
+ @if $location + ($span - 1) == column-count($columns) {
9
+ @return true;
10
+ }
11
+ @else {
12
+ @return false;
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,37 @@
1
+ //////////////////////////////
2
+ // Find Opposite Direction
3
+ //////////////////////////////
4
+ @function opposite-direction($dir) {
5
+ @if $dir == 'left' {
6
+ @return right;
7
+ }
8
+ @else if $dir == 'right' {
9
+ @return left;
10
+ }
11
+ @else if $dir == 'ltr' {
12
+ @return rtl;
13
+ }
14
+ @else if $dir == 'rtl' {
15
+ @return ltr;
16
+ }
17
+ @else {
18
+ @warn "#{$dir} is not a direction! Make sure your direction is all lowercase!";
19
+ @return false;
20
+ }
21
+ }
22
+
23
+ //////////////////////////////
24
+ // Find Direction Name
25
+ //////////////////////////////
26
+ @function named-direction($dir) {
27
+ @if $dir == 'ltr' {
28
+ @return left;
29
+ }
30
+ @else if $dir == 'rtl' {
31
+ @return right;
32
+ }
33
+ @else {
34
+ @warn "#{$dir} is not a valid HTML direction! Make sure you are using a valid HTML direction";
35
+ @return false;
36
+ }
37
+ }
@@ -0,0 +1,75 @@
1
+ //////////////////////////////
2
+ // Find Object
3
+ //
4
+ // Finds relevant object
5
+ // Must be using Breakpoint to work properly
6
+ //////////////////////////////
7
+ @function find-object($haystack, $user-object: false) {
8
+ $length: length($haystack);
9
+
10
+ @if $user-object != false {
11
+ @return $user-object;
12
+ }
13
+ @else if $length > 1 {
14
+ $query-min: breakpoint-get-context('min-width');
15
+ $query-max: breakpoint-get-context('max-width');
16
+
17
+ // If we've got a min-width or max-width
18
+ @if $query-min or $query-max {
19
+ // Reverse the grid so we can step through it
20
+ $reverse-haystack: ();
21
+ @for $i from 2 through $length {
22
+ $reverse-haystack: append($reverse-haystack, nth($haystack, $i), comma);
23
+ }
24
+ $reverse-haystack: reverse($reverse-haystack);
25
+ $rg-length: $length - 1;
26
+
27
+ // Grab the largest and smallest MQs
28
+ $smallest: nth(nth($haystack, 2), 2);
29
+ $largest: nth(nth($reverse-haystack, 1), 2);
30
+ $context: $query-min;
31
+
32
+ @if not ($mobile-first) {
33
+ $context: $query-max;
34
+ }
35
+
36
+
37
+ // If it's smallest than the smallest MQ, use the 1st grid
38
+ @if $context < $smallest {
39
+ @return nth($haystack, 1);
40
+ }
41
+ // If it's larger than or equal to the largest MQ, use the last grid
42
+ @else if $context >= $largest {
43
+ @return nth(nth($reverse-haystack, 1), 1);
44
+ }
45
+ // If it's in between the smallest and largest, go run a check.
46
+ @else {
47
+ // Loop through each MQ.
48
+ @for $j from 1 through $rg-length {
49
+ $query: nth(nth($reverse-haystack, $j), 2);
50
+
51
+ // If the MQ is greather than or equal to the the MQ in question, use it! (mobile first)
52
+ @if ($mobile-first) {
53
+ @if $context >= $query {
54
+ @return nth(nth($reverse-haystack, $j), 1);
55
+ }
56
+ }
57
+ // If the MQ is less than or equal to the the MQ in question, use it! (not mobile first)
58
+ @else {
59
+ @if $context <= $query {
60
+ @return nth(nth($reverse-haystack, $j), 1);
61
+ }
62
+ }
63
+ }
64
+ }
65
+ }
66
+ // All else fails, return the first grid
67
+ @else {
68
+ @return nth($haystack, 1);
69
+ }
70
+ }
71
+ // All else fails, return the first grid
72
+ @else {
73
+ @return nth($haystack, 1);
74
+ }
75
+ }
@@ -0,0 +1,71 @@
1
+ // ---------------------------------------------------------------------------
2
+ // Sass List Helpers
3
+ //
4
+ // - list-sum()
5
+ // - query-list()
6
+
7
+ // ---------------------------------------------------------------------------
8
+ // Functions
9
+
10
+ // Return the sum of all items in a list.
11
+ //
12
+ // list-sum($list)
13
+ // - $list : <list>
14
+ @function list-sum($list) {
15
+ $sum: 0;
16
+ @each $item in $list {
17
+ $sum: $sum + $item;
18
+ }
19
+ @return $sum;
20
+ }
21
+
22
+ // Return list of index locations where a query appears in a list,
23
+ // including unit queries.
24
+ //
25
+ // query-list($list, $query [, $mode])
26
+ // - $list : <list>
27
+ // - $query : <anything>
28
+ // - $mode : none | unit
29
+ // - "none" (default) runs a standard query.
30
+ // - "unit" finds all items with the same unit.
31
+ @function query-list(
32
+ $list,
33
+ $query,
34
+ $mode: none
35
+ ) {
36
+ $return: ();
37
+
38
+ // loop through $list
39
+ @for $i from 1 through length($list) {
40
+ @if $mode == unit {
41
+ // if the list item matches the query, write where it is to the list.
42
+ @if unit(nth($list, $i)) == $query {
43
+ $return: append($return, $i);
44
+ }
45
+ }
46
+ @else {
47
+ // if the list item matches the query, write where it is to the list.
48
+ @if nth(nth($list, $i), 1) == $query {
49
+ $return: append($return, $i);
50
+ }
51
+ }
52
+ }
53
+
54
+ // if nothing matches then return false.
55
+ @if $return == () {
56
+ $return: false;
57
+ }
58
+
59
+ // return list.
60
+ @return $return;
61
+ }
62
+
63
+ // Reverses direction of a list
64
+ @function reverse($list) {
65
+ $length: length($list);
66
+ $return: ();
67
+ @for $i from 0 to $length {
68
+ $return: append($return, nth($list, $length - $i), comma);
69
+ }
70
+ @return $return;
71
+ }
@@ -0,0 +1,9 @@
1
+ @mixin span-shared {
2
+ @if $include-border-box {
3
+ @include box-sizing('border-box');
4
+ }
5
+
6
+ @if $include-clearfix {
7
+ @include clearfix;
8
+ }
9
+ }
@@ -0,0 +1,19 @@
1
+ @function parse-add($definition) {
2
+ $grid: ();
3
+ $mq: false;
4
+ $mq-find: false;
5
+
6
+ @each $item in $definition {
7
+ @if $item != 'at' and $mq-find != true {
8
+ $grid: append($grid, $item, 'space');
9
+ }
10
+ @else if $item == 'at' {
11
+ $mq-find: true;
12
+ }
13
+ @else {
14
+ $mq: $item;
15
+ }
16
+ }
17
+
18
+ @return ($grid $mq);
19
+ }
@@ -0,0 +1,53 @@
1
+ //////////////////////////////
2
+ // Parse natural language string
3
+ //
4
+ // Retrieve values from the natural language string.
5
+ // parse-string($var, $list)
6
+ // $var : <string>
7
+ // - at/span/of or any other keywords.
8
+ // - 'span' queries the unprefixed span declaration.
9
+ // - 'at' can also query first, last, alpha, and omega.
10
+ // $list : <list>
11
+ // - A list like this: last 2 of (1 1 2) push 1
12
+ //
13
+ //////////////////////////////
14
+ @function parse-span-list($var, $list) {
15
+
16
+ $found: false;
17
+
18
+ $grid: ();
19
+
20
+ // Loop through list.
21
+ @each $item in $list {
22
+
23
+ // if 'span' - return the first numeric.
24
+ // if keyword was found - return the following item.
25
+ @if (type-of($item) == number and $var == span and $found != 'grid') or $found == true {
26
+
27
+ // @if $found == true
28
+ @return $item;
29
+ }
30
+
31
+ // Special handling for Grids
32
+ @else if $item == $var and $var == 'of' {
33
+ $found: 'grid';
34
+ }
35
+
36
+ @else if $found == 'grid' {
37
+ @if type-of($item) == number {
38
+ $grid: append($grid, $item, 'space');
39
+ }
40
+ @else {
41
+ @return $grid;
42
+ }
43
+ }
44
+
45
+ // Any keyword - return the following value.
46
+ @else if $item == $var {
47
+ $found: true;
48
+ }
49
+ }
50
+
51
+ // Wasn't found.
52
+ @return false;
53
+ }
@@ -0,0 +1,20 @@
1
+ //////////////////////////////
2
+ // "Natural Language" Parsing
3
+ //
4
+ // Keywords:
5
+ // span: Column Span
6
+ // at: Column Location
7
+ // of: Context
8
+ // gutters: Gutters
9
+ // output: Output
10
+ //////////////////////////////
11
+ @mixin span($input) {
12
+ $span: nth($input, 1);
13
+
14
+ $location: parse-span-list('at', $input);
15
+ $context: parse-span-list('of', $input);
16
+ $gutter: parse-span-list('gutters', $input);
17
+ $output: parse-span-list('output', $input);
18
+
19
+ @include grid-span($span, $location, $context, $gutter, $output)
20
+ }
@@ -0,0 +1,70 @@
1
+ //////////////////////////////
2
+ // Find width, in percentages, of the column span
3
+ //////////////////////////////
4
+ @function column-span($span, $location, $columns: false, $gutter: false) {
5
+
6
+ // Find the columns and gutters
7
+ $columns: find-grid($columns);
8
+ $gutter: find-gutter($gutter);
9
+
10
+ // Combine the columns and gutters
11
+ $columns-and-gutters: column-sum($columns, $gutter);
12
+
13
+ // Equal width columns are easy! Deal with them!
14
+ @if type-of($columns) == 'number' or length($columns) == 1 {
15
+ $span-and-gutters: $span + (($span - 1) * nth($gutter, 1));
16
+ @return $span-and-gutters / $columns-and-gutters * 100%;
17
+ }
18
+ // Asymmetric lists are harder, so we're going to treat them as their own columns
19
+ @else if type-of($columns) == 'list' or length($columns) > 1 {
20
+ // Build a fake column set
21
+ $sum: 0;
22
+ $holder: ();
23
+
24
+ @for $i from $location to ($location + $span) {
25
+ $holder: append($holder, nth(nth($columns, $i), 1), comma);
26
+ }
27
+
28
+ // Get sub-column sum
29
+ $span-and-gutters: column-sum($holder, $gutter);
30
+ @return $span-and-gutters / $columns-and-gutters * 100%;
31
+ }
32
+ @else {
33
+ @warn "Can't find a working set of columns! That's terrible!";
34
+ @return false;
35
+ }
36
+ }
37
+
38
+ //////////////////////////////
39
+ // Find the total sum of the columns
40
+ //////////////////////////////
41
+ @function column-sum($columns, $gutter) {
42
+ @if type-of($columns) == 'number' or length($columns) == 1 {
43
+ @return nth($columns, 1) + ((column-count(nth($columns, 1)) - 1) * nth($gutter, 1));
44
+ }
45
+ @else if type-of($columns) == 'list' {
46
+ $sum: 0;
47
+ @each $column in $columns {
48
+ $sum: $sum + nth($column, 1);
49
+ }
50
+ $sum: $sum + (column-count($columns) - 1) * nth($gutter, 1);
51
+ @return $sum;
52
+ }
53
+ }
54
+
55
+ //////////////////////////////
56
+ // Find the number of columns
57
+ //////////////////////////////
58
+ @function column-count($columns) {
59
+ @if type-of($columns) == 'number' {
60
+ @return $columns;
61
+ }
62
+ @if type-of($columns) == 'list' {
63
+ @if length($columns) == 1 {
64
+ @return nth($columns, 1);
65
+ }
66
+ @else {
67
+ @return length($columns);
68
+ }
69
+ }
70
+ }