stratum 0.1.1 → 0.2.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.
data/.gitignore CHANGED
@@ -1,3 +1,6 @@
1
1
  *gem
2
2
  *swp
3
3
  .sass-cache
4
+ demo/css
5
+ vendor/
6
+ stratum/
@@ -0,0 +1,4 @@
1
+ [submodule "demo/vendor/livereload-js"]
2
+ path = demo/vendor/livereload-js
3
+ url = git@github.com:tyom/livereload-js.git
4
+ dirty = ignore
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2013 Tyom Semonov
2
+
3
+ The MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -9,18 +9,24 @@
9
9
  //
10
10
  // Grid
11
11
  //
12
- // $grid-medium: 940px;
13
- // $grid-large: 1200px;
14
- // $grid-guides: true;
15
- // $grid-guides-color: blue;
12
+ $grid-guides-color: #8aa8c0;
16
13
  // $grid-guides-opacity: .1;
17
14
  // $grid-guides-position: front;
15
+ $grid-type: pixel;
18
16
  $grid-total-columns: 12;
19
17
  $grid-desired-gutter: 20px;
20
18
  // $grid-baseline: 30px;
21
- // $grid-type: flexible;
22
19
  // -----------------------------------------------------------------------------
23
20
 
21
+ @import "utils/vendor-prefix";
22
+ @import "utils/group";
23
+
24
+ // CSS3 mixins
25
+ @import "css3/box-sizing";
26
+
27
+ // Layout
24
28
  @import "layout/grid";
25
- @import "layout/scaffolding";
26
- // @import "layout/grid-debug";
29
+ // @import "layout/responsive";
30
+
31
+ // Forms
32
+ @import "forms/input-placeholder";
@@ -0,0 +1,8 @@
1
+ @mixin box-sizing($value) {
2
+ // Use vendor prefixes for:
3
+ // - Firefox: all versions
4
+ // - iOS Safari: 3.2-4.3
5
+ // - Android: 2.1-3.0
6
+ // - Blackberry: 7.0
7
+ @include vendor-prefix(box-sizing, $value, moz webkit spec);
8
+ }
@@ -0,0 +1,14 @@
1
+ // Form related mixins
2
+ // ============================================================================
3
+
4
+ @mixin input-placeholder {
5
+ &::-webkit-input-placeholder {
6
+ @content;
7
+ }
8
+ &:-moz-placeholder {
9
+ @content;
10
+ }
11
+ &:-ms-input-placeholder {
12
+ @content;
13
+ }
14
+ }
@@ -0,0 +1,54 @@
1
+ // # Calculate column gutter from desired value
2
+
3
+ // This function will find the nearest round number that
4
+ // fits well with number of columns and total width specified
5
+
6
+ // All parameters are optional (use grid defaults)
7
+
8
+ @function grid-column-gutter($grid-size: $grid-size, $desired: $grid-desired-gutter) {
9
+ $v-gutter: 0px;
10
+ $column: 1;
11
+
12
+ // Find a round gutter width
13
+ @while $column > $v-gutter {
14
+ $column: grid-column-width($grid-size, $grid-total-columns, $v-gutter);
15
+
16
+ @if $column % 1 == 0 {
17
+ $range-from: $desired - 6;
18
+ $range-to: $desired + 20;
19
+ $within-range: $v-gutter >= $range-from and $v-gutter <= $range-to;
20
+ // Find gutter within desired range
21
+ @if $within-range {
22
+ @return $v-gutter;
23
+ }
24
+ }
25
+ $v-gutter: $v-gutter + 1;
26
+ }
27
+ @warn "Couldn't find suitable gutter close to your desired value. Try a different one.";
28
+ }
29
+
30
+ // # Calcuate the width of a single column
31
+ // All parameters are optional (use grid defaults)
32
+ @function grid-column-width($grid-size: $grid-size, $total-columns: $grid-total-columns, $gutter: auto) {
33
+ @if $gutter == auto {
34
+ $gutter: grid-column-gutter($grid-size, $grid-desired-gutter);
35
+ }
36
+ @return ($grid-size - (($total-columns - 1) * $gutter)) / $total-columns;
37
+ }
38
+
39
+ // # Calculate the total width of number of columns including gutters
40
+ // `$column-width` & `$gutter` are optional (use grid defaults)
41
+ @function grid-columns-width($column-span, $column-width: auto, $gutter: auto) {
42
+ @if $column-width == auto {
43
+ $column-width: grid-column-width();
44
+ }
45
+ @if $gutter == auto {
46
+ $gutter: grid-column-gutter($grid-size, $grid-desired-gutter);
47
+ }
48
+ @return ceil($column-span * $column-width + ($column-span - 1) * $gutter);
49
+ }
50
+
51
+ // # Convert percentage of width relative to the total width
52
+ @function grid-percentage($width, $grid-size: ($grid-size + $grid-gutter)) {
53
+ @return percentage($width / $grid-size);
54
+ }
@@ -0,0 +1,84 @@
1
+ // Grid debugging tools: Guides
2
+ // ============================================================================
3
+
4
+ // Guides rely on `::before` pseudo element so the will only work on elements
5
+ // that don't already use it (e.g. not `group(true)`)
6
+
7
+ // Draws grid guides
8
+ @mixin grid-render-guides($grid-size: $grid-size, $grid-type: $grid-type) {
9
+
10
+ $v-block-size: 8;
11
+
12
+ // Pixel grid default values
13
+ $v-column-gutter: grid-column-gutter();
14
+ $v-column-width: grid-column-width();
15
+ $v-column-relative-width: grid-column-gutter() + grid-column-width();
16
+
17
+ @if $grid-type == fluid {
18
+ // Calculate gutter to column ratio
19
+ $v-gutter-ratio: $v-column-gutter / ($v-column-width + $v-column-gutter);
20
+ // Calculate column to grid width ratio
21
+ $v-column-ratio: ($v-column-width + $v-column-gutter) / $grid-size;
22
+
23
+ // Reset column size with percentages
24
+ $v-column-gutter: percentage($v-gutter-ratio);
25
+ $v-column-width: 100 - percentage($v-gutter-ratio);
26
+ $v-column-relative-width: percentage($v-column-ratio);
27
+ }
28
+
29
+ $v-column-gutter: $v-column-width + $v-column-gutter;
30
+ $v-block-height: (($grid-baseline + 1) * $v-block-size) + $grid-baseline;
31
+
32
+ position: relative;
33
+
34
+ &:before {
35
+ content: " ";
36
+ position: absolute;
37
+ top: 0;
38
+ left: 0;
39
+ right: 0;
40
+ bottom: 0;
41
+
42
+ background:
43
+ // Baseline (v-rhythm)
44
+ -webkit-linear-gradient(
45
+ transparent $grid-baseline,
46
+ rgba(white, $grid-guides-opacity) $grid-baseline),
47
+ // Columns
48
+ -webkit-linear-gradient(left,
49
+ rgba($grid-guides-color, $grid-guides-opacity),
50
+ rgba($grid-guides-color, $grid-guides-opacity) $v-column-width,
51
+ transparent $v-column-width,
52
+ transparent $v-column-gutter),
53
+ // Blocks
54
+ -webkit-linear-gradient(
55
+ transparent ($v-block-height - $grid-baseline),
56
+ rgba(white, $grid-guides-opacity / 1.2) $grid-baseline),
57
+ // Base colour
58
+ -webkit-linear-gradient(
59
+ rgba($grid-guides-color, $grid-guides-opacity),
60
+ rgba($grid-guides-color, $grid-guides-opacity));
61
+
62
+ background-size:
63
+ $v-column-gutter $grid-baseline + 1, // v-rhythm
64
+ $v-column-relative-width 10px, // column
65
+ $v-column-gutter ($v-block-height + 1); // block
66
+
67
+ // Grid placement (back by default)
68
+ @if $grid-guides-position == front {
69
+ z-index: 999;
70
+ } @else {
71
+ z-index: -1;
72
+ }
73
+ }
74
+ }
75
+
76
+ // Currently only global for all grids
77
+ @mixin GRID-GUIDES {
78
+ %l-container > %l-row {
79
+ @include grid-render-guides($grid-size);
80
+ &::before {
81
+ margin: 0 $grid-half-gutter;
82
+ }
83
+ }
84
+ }
@@ -0,0 +1,96 @@
1
+ @import "grid-functions";
2
+
3
+ // Grid initialisation
4
+ // -------------------
5
+ $grid-gutter: grid-column-gutter();
6
+ $grid-half-gutter: $grid-gutter / 2;
7
+ $grid-column: grid-column-width();
8
+
9
+
10
+ // Mixins
11
+ // ------
12
+
13
+ // Grid container to set grid bounds
14
+ @mixin grid-container($width: $grid-size) {
15
+ min-width: $width;
16
+ max-width: 100%;
17
+ width: $width;
18
+ margin: {
19
+ left: auto;
20
+ right: auto;
21
+ }
22
+ }
23
+
24
+ // Grid row
25
+ // $type: <pixel|fluid>
26
+ @mixin grid-row($type: $grid-type) {
27
+ @include grid-column-margins($type, -1);
28
+ }
29
+
30
+ // Converts into grid column
31
+ // $variation - can be normal, last, end, inner or centered
32
+ @mixin grid-column($type: $grid-type) {
33
+ @include box-sizing(border-box);
34
+ min-height: 1px;
35
+ float: left;
36
+ }
37
+
38
+ // Column margins
39
+ // $modifier: 1 - normal (column) margins
40
+ // $modifier: -1 - negative (row) margins
41
+ @mixin grid-column-margins($type: $grid-type, $modifier: 1) {
42
+ $v-gutter: auto;
43
+
44
+ @if($type == fluid) {
45
+ $v-gutter: grid-percentage($grid-half-gutter * $modifier);
46
+ } @else if ($type == pixel) {
47
+ $v-gutter: $grid-half-gutter * $modifier;
48
+ }
49
+
50
+ margin-left: $v-gutter;
51
+ margin-right: $v-gutter;
52
+ }
53
+
54
+ // Calculate single column width (in pixels) multipled by number of columns it spans (indluding gutters)
55
+ @mixin grid-column-width($span: 1, $type: $grid-type, $gutter: $grid-gutter) {
56
+ $v-col-width: auto;
57
+
58
+ @if($type == pixel) {
59
+ $v-col-width: grid-columns-width($span);
60
+ } @else if($type == fluid) {
61
+ $v-col-width: grid-percentage(grid-columns-width($span));
62
+ } @else if($type == marginless) {
63
+ $v-col-width: grid-percentage(grid-columns-width($span, $grid-column + $gutter, 0));
64
+ }
65
+
66
+ width: $v-col-width;
67
+ }
68
+
69
+
70
+ // Calculate offset width based on number of columns it spans (including gutters)
71
+ @mixin grid-offset-by-column($span: 1, $direction: left, $flow: positive, $grid-type: $grid-type) {
72
+ $v-offset: 0px;
73
+ $v-gutter: $grid-gutter;
74
+
75
+ // Grid with rows (outer margins)
76
+ @if $grid-type != marginless {
77
+ $v-gutter: $v-gutter * 1.5; // half gutter from row offset
78
+ }
79
+
80
+ // Pixel grid
81
+ @if $grid-type == pixel {
82
+ $v-offset: grid-columns-width($span);
83
+ }
84
+ // Fluid grid
85
+ @if $grid-type == fluid or $grid-type == marginless {
86
+ $v-gutter: grid-percentage($v-gutter);
87
+ $v-offset: grid-percentage(grid-columns-width($span));
88
+ }
89
+
90
+ // Negative offset
91
+ @if $flow == negative {
92
+ $v-offset: -$v-offset + $v-gutter;
93
+ }
94
+
95
+ margin-#{$direction}: $v-offset + $v-gutter;
96
+ }
@@ -0,0 +1,239 @@
1
+ // Semantic grid components
2
+ // ========================
3
+
4
+ // These class placeholders can be used to convert any element into
5
+ // grid component. To use extend element with appropriate placeholder.
6
+ // It will automatically take care of the parent and descending components
7
+ // as long as the correct grid components are used.
8
+
9
+ // The structure of the grid is as follows:
10
+
11
+ // %l-container – A grid is always contained in one of these
12
+ // They use global grid settings and can be overriden with:
13
+ // %l-grid-pixel – Force pixel grid
14
+ // %l-grid-fluid – Force fluid grid
15
+ // %l-marginless – Collapse column margins (gutters)
16
+ //
17
+ // %l-row – Grid consists of a number of rows
18
+ // They are required for correct column margins, but can be omitted,
19
+ // in which case the grid with no `%l-row` becomes marginless
20
+ //
21
+ // %l-col – Column, the unit of the grid
22
+ // %l-col-<$i> – Column size (e.g. `%l-col-4` spans four single columns, including three gutters)
23
+ //
24
+ // l-col-from-left-<$i> – Offset column by <column size> from left
25
+ // l-col-to-left-<$i> – Offset column by <column size> to left (negative margin)
26
+ // l-col-from-right-<$i> – Offset column by <column size> from right
27
+ // l-col-to-right-<$i> – Offset column by <column size> to right (negative margin)
28
+ //
29
+ // %l-last-col-right – This settings forces last column to float to right, which helps to eliminate
30
+ // pixel gap caused by rounding in fluid grids and ensures first and last column
31
+ // occupy full width of grid container.
32
+ // Applied to grid container (@extend).
33
+
34
+ // For examples of usage of these components see `scaffolding.scss` file.
35
+
36
+
37
+ // # Individual grid components
38
+
39
+ // Grid container
40
+ %l-container {
41
+ @include grid-container;
42
+ @include box-sizing(content-box);
43
+ @include group;
44
+
45
+ // Defines inner grid container (nested grid)
46
+ %l-container {
47
+ min-width: 0;
48
+ width: 100%;
49
+ }
50
+
51
+ // Defines grid row
52
+ %l-row {
53
+ @include grid-row;
54
+ @include group;
55
+ }
56
+
57
+ // Defines grid row of forced fluid grid
58
+ &%l-grid-fluid > %l-row, {
59
+ @include grid-row(fluid);
60
+ }
61
+ // Defines grid row of forced pixel grid
62
+ &%l-grid-pixel > %l-row {
63
+ @include grid-row(pixel);
64
+ }
65
+
66
+ // Always set nested grids to fluid
67
+ &%l-container %l-container > %l-row, {
68
+ @include grid-row(fluid);
69
+ }
70
+
71
+ // Defines row of marginless grid
72
+ &%l-marginless > %l-row {
73
+ margin: {
74
+ left: 0;
75
+ right: 0;
76
+ }
77
+ }
78
+ }
79
+
80
+
81
+ // Defines columns
82
+ %l-col {
83
+ @include grid-column;
84
+ }
85
+
86
+
87
+ // Float last column to right if `%l-last-col-right` extended
88
+ // Applied to `%l-container`
89
+ %l-col + %l-col:last-child {
90
+ %l-last-col-right%l-container > &,
91
+ %l-last-col-right%l-container > %l-row & {
92
+ float: right;
93
+ }
94
+ }
95
+
96
+
97
+ // Defines column sizes
98
+ @for $i from 1 through $grid-total-columns {
99
+
100
+ // ## Spans
101
+
102
+ %l-col-#{$i} {
103
+ %l-row & {
104
+ @include grid-column-width($i, $grid-type);
105
+
106
+ %l-marginless > & {
107
+ @include grid-column-width($i, marginless);
108
+ @include grid-column-margins(fluid, 0);
109
+ }
110
+ }
111
+
112
+ // Marginless (container without row)
113
+ %l-container > & {
114
+ @include grid-column-width($i, marginless);
115
+ }
116
+
117
+ // Force pixel grid
118
+ %l-grid-pixel > %l-row > & {
119
+ @include grid-column-width($i, pixel);
120
+ @include grid-column-margins(pixel);
121
+ }
122
+ // Force fluid grid
123
+ %l-grid-fluid > %l-row > &,
124
+ // Always set nested grid to fluid
125
+ %l-container %l-container > %l-row > & {
126
+ @include grid-column-width($i, fluid);
127
+ @include grid-column-margins(fluid);
128
+ }
129
+ }
130
+ }
131
+
132
+
133
+ // Defines column margins
134
+ // Only applied to descendants of rows
135
+ %l-row %l-col {
136
+ @include grid-column-margins;
137
+ }
138
+
139
+
140
+ // TODO Improve
141
+ // Defines column offsets
142
+ %l-container {
143
+ @for $i from 1 through $grid-total-columns {
144
+
145
+ // ## Grid with margins
146
+ // Default grid offsets
147
+ & > %l-row %l-col {
148
+ // From left
149
+ &%l-col-from-left-#{$i} {
150
+ @include grid-offset-by-column($i, left, positive, $grid-type);
151
+ }
152
+
153
+ // To left
154
+ &%l-col-to-left-#{$i} {
155
+ @include grid-offset-by-column($i, left, negative, $grid-type);
156
+ }
157
+
158
+ // From right
159
+ &%l-col-from-right-#{$i} {
160
+ @include grid-offset-by-column($i, right, positive, $grid-type);
161
+ }
162
+
163
+ // To right
164
+ &%l-col-to-right-#{$i} {
165
+ @include grid-offset-by-column($i, right, negative, $grid-type);
166
+ }
167
+ }
168
+
169
+ // Pixel grid offsets
170
+ &%l-grid-pixel > %l-row %l-col {
171
+ // From left
172
+ &%l-col-from-left-#{$i} {
173
+ @include grid-offset-by-column($i, left, positive, pixel);
174
+ }
175
+
176
+ // To left
177
+ &%l-col-to-left-#{$i} {
178
+ @include grid-offset-by-column($i, left, negative, pixel);
179
+ }
180
+
181
+ // From right
182
+ &%l-col-from-right-#{$i} {
183
+ @include grid-offset-by-column($i, right, positive, pixel);
184
+ }
185
+
186
+ // To right
187
+ &%l-col-to-right-#{$i} {
188
+ @include grid-offset-by-column($i, right, negative, pixel);
189
+ }
190
+ }
191
+
192
+ // Fluid grid offsets
193
+ &%l-grid-fluid > %l-row %l-col {
194
+ // From left
195
+ &%l-col-from-left-#{$i} {
196
+ @include grid-offset-by-column($i, left, positive, fluid);
197
+ }
198
+
199
+ // To left
200
+ &%l-col-to-left-#{$i} {
201
+ @include grid-offset-by-column($i, left, negative, fluid);
202
+ }
203
+
204
+ // From right
205
+ &%l-col-from-right-#{$i} {
206
+ @include grid-offset-by-column($i, right, positive, fluid);
207
+ }
208
+
209
+ // To right
210
+ &%l-col-to-right-#{$i} {
211
+ @include grid-offset-by-column($i, right, negative, fluid);
212
+ }
213
+ }
214
+
215
+ // ## Marginless grid
216
+ & > %l-col,
217
+ &%l-marginless %l-col {
218
+ // From left
219
+ &%l-col-from-left-#{$i} {
220
+ @include grid-offset-by-column($i, left, positive, marginless);
221
+ }
222
+
223
+ // To left
224
+ &%l-col-to-left-#{$i} {
225
+ @include grid-offset-by-column($i, left, negative, marginless);
226
+ }
227
+
228
+ // From right
229
+ &%l-col-from-right-#{$i} {
230
+ @include grid-offset-by-column($i, right, positive, marginless);
231
+ }
232
+
233
+ // To right
234
+ &%l-col-to-right-#{$i} {
235
+ @include grid-offset-by-column($i, right, negative, marginless);
236
+ }
237
+ }
238
+ }
239
+ }