stratum 0.3.6 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/assets/stylesheets/layout/_grid.scss +15 -8
- data/assets/stylesheets/layout/_responsive.scss +3 -52
- data/assets/stylesheets/layout/grid/_mixins.scss +7 -2
- data/assets/stylesheets/layout/responsive/_feature-detection.scss +89 -0
- data/assets/stylesheets/layout/responsive/_overrides.scss +74 -0
- data/assets/stylesheets/layout/responsive/helper-classes.scss +25 -0
- data/lib/stratum/version.rb +1 -1
- metadata +6 -3
@@ -1,25 +1,29 @@
|
|
1
1
|
// Grid defaults settings
|
2
2
|
// ----------------------
|
3
3
|
|
4
|
-
$grid-responsive: false !default;
|
5
|
-
|
6
4
|
$grid-size: 980px !default;
|
7
|
-
|
5
|
+
$grid-min-width: 320px !default;
|
8
6
|
$grid-type: fluid !default;
|
9
7
|
$grid-total-columns: 12 !default;
|
10
8
|
$grid-desired-gutter: 20px !default;
|
11
9
|
$grid-baseline: 18px !default;
|
12
10
|
|
13
|
-
//
|
11
|
+
// Scaffolding
|
12
|
+
$scaffolding-debug: true !default; // Highlight disabled features that are used
|
13
|
+
|
14
|
+
// Responsive defaults
|
15
|
+
$grid-responsive-screen-small: 480px !default;
|
16
|
+
$grid-responsive-screen-medium: 980px !default;
|
17
|
+
$grid-responsive-screen-large: 1280px !default;
|
18
|
+
$grid-responsive-screen-x-large: 1800px !default;
|
19
|
+
|
20
|
+
// Grid guides settings
|
21
|
+
$grid-guides: true !default;
|
14
22
|
$grid-guides-class: false !default; // Adds `.m-show-guides` and `.m-show-guides.m-front` to scaffolding
|
15
23
|
$grid-guides-color: #8aa8c0 !default;
|
16
24
|
$grid-guides-opacity: .2 !default;
|
17
25
|
$grid-guides-position: back !default;
|
18
26
|
|
19
|
-
// Scaffolding
|
20
|
-
$scaffolding-debug: true !default; // Highlight disabled features that are used
|
21
|
-
|
22
|
-
|
23
27
|
// Various semantic grid features can be disabled per project by
|
24
28
|
// setting the following variables to false. This will result in
|
25
29
|
// smaller CSS file and quicker compilation
|
@@ -29,6 +33,9 @@ $scaffolding-debug: true !default; // Highlight disabled features
|
|
29
33
|
// $grid-overrides: false;
|
30
34
|
// $grid-subdivisions: false;
|
31
35
|
|
36
|
+
// Responsiveness
|
37
|
+
$grid-responsive: true !default; // Should default grid columns have basic responsive properties (collapsing)
|
38
|
+
|
32
39
|
@import "stratum";
|
33
40
|
|
34
41
|
@import "grid/functions";
|
@@ -1,52 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
@
|
4
|
-
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
|
5
|
-
@content;
|
6
|
-
}
|
7
|
-
}
|
8
|
-
@mixin smartphone-landscape {
|
9
|
-
@media only screen and (min-width : 321px) {
|
10
|
-
@content;
|
11
|
-
}
|
12
|
-
}
|
13
|
-
@mixin smartphone-portrait {
|
14
|
-
@media only screen and (max-width : 320px) {
|
15
|
-
@content;
|
16
|
-
}
|
17
|
-
}
|
18
|
-
@mixin tablet {
|
19
|
-
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) {
|
20
|
-
@content;
|
21
|
-
}
|
22
|
-
}
|
23
|
-
@mixin tablet-landscape {
|
24
|
-
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation: landscape) {
|
25
|
-
@content;
|
26
|
-
}
|
27
|
-
}
|
28
|
-
@mixin tablet-portrait {
|
29
|
-
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation: portrait) {
|
30
|
-
@content;
|
31
|
-
}
|
32
|
-
}
|
33
|
-
@mixin retina {
|
34
|
-
@media only screen and (-webkit-min-device-pixel-ratio : 1.5), only screen and (min-device-pixel-ratio : 1.5) {
|
35
|
-
@content;
|
36
|
-
}
|
37
|
-
}
|
38
|
-
@mixin medium-screen {
|
39
|
-
@media only screen and (min-width : 1024px) {
|
40
|
-
@content;
|
41
|
-
}
|
42
|
-
}
|
43
|
-
@mixin large-screen {
|
44
|
-
@media only screen and (min-width : 1300px) {
|
45
|
-
@content;
|
46
|
-
}
|
47
|
-
}
|
48
|
-
@mixin x-large-screen {
|
49
|
-
@media only screen and (min-width : 1824px) {
|
50
|
-
@content;
|
51
|
-
}
|
52
|
-
}
|
1
|
+
@import "responsive/feature-detection";
|
2
|
+
@import "responsive/overrides";
|
3
|
+
@import "responsive/helper-classes";
|
@@ -15,6 +15,7 @@ $grid-column: grid-column-width();
|
|
15
15
|
@extend %-clearfix;
|
16
16
|
@include box-sizing(content-box);
|
17
17
|
width: $width;
|
18
|
+
min-width: $grid-min-width;
|
18
19
|
margin: {
|
19
20
|
left: auto;
|
20
21
|
right: auto;
|
@@ -57,8 +58,12 @@ $grid-column: grid-column-width();
|
|
57
58
|
|
58
59
|
|
59
60
|
// Calculate single column width (in pixels) multipled by number of columns it spans (indluding gutters)
|
60
|
-
@mixin grid-column-width($span: 1, $type: $grid-type, $gutter: $grid-gutter, $total-columns: $grid-total-columns) {
|
61
|
-
width: grid-columns-width($span, $grid-column, $gutter, $type, $total-columns);
|
61
|
+
@mixin grid-column-width($span: 1, $type: $grid-type, $gutter: $grid-gutter, $total-columns: $grid-total-columns, $max: null) {
|
62
|
+
$l-width: grid-columns-width($span, $grid-column, $gutter, $type, $total-columns);
|
63
|
+
@if $max and $l-width > $max {
|
64
|
+
$l-width: $max;
|
65
|
+
}
|
66
|
+
width: $l-width;
|
62
67
|
}
|
63
68
|
|
64
69
|
|
@@ -0,0 +1,89 @@
|
|
1
|
+
$responsive-features:
|
2
|
+
smartphone "(min-device-width: 320px) and (max-device-width: 480px)",
|
3
|
+
tablet "(min-device-width : 768px) and (max-device-width : 1024px)",
|
4
|
+
// Due to comma in the list should be the last item when combined with other in 'and' sequence
|
5
|
+
retina "(-webkit-min-device-pixel-ratio: 1.5), (min-device-pixel-ratio: 1.5)",
|
6
|
+
|
7
|
+
landscape "(orientation: landscape)",
|
8
|
+
portrait "(orientation: portrait)",
|
9
|
+
|
10
|
+
x-large-screen "(min-width: #{$grid-responsive-screen-x-large})",
|
11
|
+
large-screen "(min-width: #{$grid-responsive-screen-large}) and (max-width: #{$grid-responsive-screen-x-large - 1})",
|
12
|
+
medium-screen "(min-width: #{$grid-responsive-screen-medium}) and (max-width: #{$grid-responsive-screen-large - 1})",
|
13
|
+
small-screen "(min-width: #{$grid-responsive-screen-small}) and (max-width: #{$grid-responsive-screen-medium - 1})",
|
14
|
+
x-small-screen "(max-width: #{$grid-responsive-screen-small - 1})"
|
15
|
+
;
|
16
|
+
|
17
|
+
// Get the feature from available map and return its query
|
18
|
+
|
19
|
+
@function -get-media-feature($requested-feature) {
|
20
|
+
$-result: null;
|
21
|
+
|
22
|
+
@each $feature in $responsive-features {
|
23
|
+
$-name: nth($feature, 1);
|
24
|
+
$-query: nth($feature, 2);
|
25
|
+
|
26
|
+
@if $-name == $requested-feature {
|
27
|
+
$-result: $-query;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
@if not $-result {
|
32
|
+
@warn "❗ '#{$requested-feature}'' is not a recognised responsive feature"
|
33
|
+
}
|
34
|
+
|
35
|
+
@return $-result;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Combine media features frome supplied parameters
|
39
|
+
// comma separate for 'or' sequence. To group in 'and' sequence wrap in (braces)
|
40
|
+
|
41
|
+
@function -combine-media-features($features...) {
|
42
|
+
$-features: "";
|
43
|
+
@each $or-feature in $features {
|
44
|
+
// 'either/or' features
|
45
|
+
@if type-of($or-feature) == string {
|
46
|
+
$-index: index($features, $or-feature);
|
47
|
+
$-is-last: $-index == length($features);
|
48
|
+
$-features: $-features + -get-media-feature($or-feature) + if(not $-is-last, ", ", "");
|
49
|
+
|
50
|
+
// combined 'and' features
|
51
|
+
} @else {
|
52
|
+
$and-features: $or-feature;
|
53
|
+
$-and-result: "";
|
54
|
+
|
55
|
+
@each $and-feature in $and-features {
|
56
|
+
$-index: index($and-features, $and-feature);
|
57
|
+
$-is-last: $-index == length($and-features);
|
58
|
+
$-and-result: $-and-result + -get-media-feature($and-feature) + if(not $-is-last, " and ", "");
|
59
|
+
}
|
60
|
+
|
61
|
+
$-features: $-features + $-and-result;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
@return $-features;
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
// Respond to media features mixin
|
70
|
+
// -------------------------------
|
71
|
+
|
72
|
+
// Usage:
|
73
|
+
|
74
|
+
// Comma-separate for either (or) and space-separate for each (and) feature
|
75
|
+
|
76
|
+
// ```
|
77
|
+
// @include respond-to(large-screen, medium-screen, smartphone portrait retina) {
|
78
|
+
// background: red;
|
79
|
+
// }
|
80
|
+
// ```
|
81
|
+
|
82
|
+
// Results in styles targeting either large screens or medium screens or retina smarthphones in portrait orientation only
|
83
|
+
|
84
|
+
@mixin respond-to($features...) {
|
85
|
+
// @debug -combine-media-features($features...);
|
86
|
+
@media only screen and #{-combine-media-features($features...)} {
|
87
|
+
@content;
|
88
|
+
}
|
89
|
+
}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
// Overrides for default grid column definitions
|
2
|
+
// ---------------------------------------------
|
3
|
+
|
4
|
+
$grid-responsive: null !default;
|
5
|
+
|
6
|
+
@if $grid-responsive != false {
|
7
|
+
|
8
|
+
// Small screen
|
9
|
+
@include respond-to(small-screen) {
|
10
|
+
|
11
|
+
@for $i from 1 through $grid-total-columns {
|
12
|
+
|
13
|
+
%l-col-#{$i} {
|
14
|
+
// Columns with gutters
|
15
|
+
%l-row & {
|
16
|
+
$i: if($i % 2 > 0, $i + 1, $i);
|
17
|
+
@include grid-column-width($i * 2, fluid, $max: 100%);
|
18
|
+
|
19
|
+
&:last-child:nth-child(odd) {
|
20
|
+
@include grid-column-width(1, fluid, $total-columns: 1);
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
// Columns without gutters
|
25
|
+
%l-container &,
|
26
|
+
%l-gutterless & {
|
27
|
+
@include grid-column-width($i * 2, fluid, $gutter: 0, $max: 100%);
|
28
|
+
|
29
|
+
&:last-child:nth-child(odd) {
|
30
|
+
@include grid-column-width(1, fluid, $gutter: 0, $total-columns: 1);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
}
|
35
|
+
|
36
|
+
}
|
37
|
+
|
38
|
+
}
|
39
|
+
|
40
|
+
|
41
|
+
// Tiny screen
|
42
|
+
@include respond-to(x-small-screen) {
|
43
|
+
|
44
|
+
@for $i from 1 through $grid-total-columns {
|
45
|
+
|
46
|
+
%l-col-#{$i} {
|
47
|
+
// Columns with gutters
|
48
|
+
%l-row & {
|
49
|
+
@include grid-column-width(1, fluid, $total-columns: 1);
|
50
|
+
}
|
51
|
+
|
52
|
+
// Columns without gutters
|
53
|
+
%l-container &,
|
54
|
+
%l-gutterless & {
|
55
|
+
@include grid-column-width(1, fluid, $gutter: 0, $total-columns: 1);
|
56
|
+
}
|
57
|
+
|
58
|
+
}
|
59
|
+
|
60
|
+
// Subdivisions
|
61
|
+
@if $grid-subdivisions != false {
|
62
|
+
// Column size ratios
|
63
|
+
@for $n from 1 through $grid-total-columns {
|
64
|
+
%l-col-#{$i}-of-#{$n} {
|
65
|
+
@include grid-column-width(1, fluid, $gutter: 0, $total-columns: 1);
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
}
|
71
|
+
|
72
|
+
}
|
73
|
+
|
74
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
// Responsive layout helper classes
|
2
|
+
// --------------------------------
|
3
|
+
|
4
|
+
// Each feature in `$responsive-feature` can be directly controlled
|
5
|
+
// with a helper class in the format:
|
6
|
+
// `.l-#{feature-name}-hide`
|
7
|
+
// `.l-#{feature-name}-show`
|
8
|
+
|
9
|
+
// Example:
|
10
|
+
// ```
|
11
|
+
// <div class="hero l-smartphone-hide">…</div>
|
12
|
+
// ```
|
13
|
+
|
14
|
+
@each $feature in $responsive-features {
|
15
|
+
$-feature-name: nth($feature, 1);
|
16
|
+
|
17
|
+
@include respond-to($-feature-name) {
|
18
|
+
.l-#{$-feature-name}-hide {
|
19
|
+
display: none !important;
|
20
|
+
}
|
21
|
+
.l-#{$-feature-name}-show {
|
22
|
+
display: inherit !important;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
data/lib/stratum/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stratum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.4'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2013-03-16 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &70094945051220 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70094945051220
|
25
25
|
description: Stratum is a collection of SASS mixins and utilities for your web development
|
26
26
|
needs.
|
27
27
|
email: tyom@semonov.com
|
@@ -67,6 +67,9 @@ files:
|
|
67
67
|
- assets/stylesheets/layout/grid/semantics/_offsets.scss
|
68
68
|
- assets/stylesheets/layout/grid/semantics/_overrides.scss
|
69
69
|
- assets/stylesheets/layout/grid/semantics/_subdivisions.scss
|
70
|
+
- assets/stylesheets/layout/responsive/_feature-detection.scss
|
71
|
+
- assets/stylesheets/layout/responsive/_overrides.scss
|
72
|
+
- assets/stylesheets/layout/responsive/helper-classes.scss
|
70
73
|
- assets/stylesheets/layout/scaffolding.scss
|
71
74
|
- bin/stratum
|
72
75
|
- lib/stratum.rb
|