chameleon-sass 0.0.12 → 0.5.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a06f632f0013b7dd31c565146f82c0edaa334a9c
4
- data.tar.gz: d62cab8df34e253809817074975df07b5258cc42
3
+ metadata.gz: 7365ad7febbe90e97219559e6e9d1c1ceead9f72
4
+ data.tar.gz: 788b22068a222ee198929c5e9b0c216110f54c0b
5
5
  SHA512:
6
- metadata.gz: e373b52851238af9bb3b0ae7d70e7881c9d8273a429dad3f08598b4cb7b2d6ccd68c204906da2011108498e7c2eff8c08301c204471ebed6e459c475da906e1b
7
- data.tar.gz: f19ec85354cf69d6539b00c092d099a29c350d7a093550bbaa033c2cdb427b1781cab241cf1371f733d63476a58363432f7e9b4e62a2f2c5daec58c25f2ace8d
6
+ metadata.gz: 33b84678c8f5730eac1148e6ffe3936c68a33d791be8f69074e37d37da712ee6b7210e4883a4d0c97765e62a6391d6aa698d7f79d425a53e04a7afa56f604f17
7
+ data.tar.gz: 00daff8a9dae07e8b621bc6e01941c6aea5fe313c38aa55ac5b186111a24b9d2ad73990a8a4350b4af9b30a1ecc2e1e3bde5e587ae96a3dc3d6fb44995b2d9af
data/README.md CHANGED
@@ -1,87 +1,62 @@
1
- Chameleon
2
- =========
1
+ # Chameleon
3
2
 
3
+ Chameleon is a Sass layout framework for responsive web sites and applications.
4
4
 
5
- ## Getting started
5
+ At the heart of Chameleon is the ability to "turn on" classes at different screen sizes:
6
6
 
7
- ### Installing in a Rails project
8
-
9
- Add to your Gemfile:
10
-
11
- `gem 'chameleon-sass'`
12
-
13
- Add to your main Sass stylesheet:
14
-
15
- `@import "chameleon";`
16
-
17
-
18
- ### Installing in a Compass project
19
-
20
- From the command line:
21
-
22
- `gem install chameleon-sass`
23
-
24
- Add to the top of your Compass config file (usually config.rb):
25
-
26
- `require 'chameleon-sass'`
27
-
28
- Add to your main Sass stylesheet:
29
-
30
- `@import "chameleon"`
31
-
32
-
33
- ### Installing in a Bower project
34
-
35
- From the command line:
36
-
37
- `bower install chameleon-sass`
38
-
39
- If you are using Compass you can add the import path to your Compass config file (usually config.rb):
40
-
41
- `add_import_path "bower_components/chameleon-sass/assets/stylesheets/"`
42
-
43
- Otherwise, you will need to manually add the above path to your @import.
44
-
45
- Add to your main Sass stylesheet:
46
-
47
- `@import "chameleon";`
48
-
49
-
50
- ### Generating a responsive grid
7
+ ```html
8
+ <div class="padded padded-small-on-mobile"></div>
9
+ ```
51
10
 
52
- One of the defining feature of Chameleon is that no CSS is generated until you explictly declare the generation of some classes.
11
+ Out of the box Chameleon adds 0Kb to your project. Generate only the classes that you need for your project.
53
12
 
54
- Let's get started by adding some building blocks of a responsive grid:
13
+ ```scss
14
+ @include classes('padded', $on: 'base');
15
+ @include classes('padded-right', $on: 'base mobile');
16
+ ```
55
17
 
56
18
  ```
57
- @import "chameleon";
19
+ .padded {
20
+ padding: 20px;
21
+ }
22
+
23
+ .padded-right {
24
+ padding-right: 20px;
25
+ }
26
+
27
+ @media screen and (max-width: 479px) {
28
+ .padded-right-on-mobile {
29
+ padding-right: 20px;
30
+ }
31
+ }
32
+ ```
58
33
 
59
- @include defaults();
60
- @include grid-defaults();
34
+ Chameleon selectors be used anywhere in your stylesheet - even if they weren't generated into classes.
61
35
 
62
- @include classes("cols-spaced", $on: ("base" "fablet-up" "tablet-up" "desktop-up"));
63
- @include classes("cols-to-rows", $on: ("base" "mobile" "fablet-down" "tablet-down"));
36
+ ```scss
37
+ .myModule {
38
+ @extend %padded;
39
+ @extend %padded-small-on-mobile;
40
+ @extend %padded-on-tablet;
41
+ border: 3px dashed red;
42
+ }
43
+ ```
64
44
 
65
- @include classes("col-1-2", $on: "base");
66
- @include classes("col-1-3", $on: "base");
67
- @include classes("col-1-4", $on: "base");
45
+ You can also create selectors of your own using Chameleon's core mixins.
68
46
 
69
- @include classes("rows-spaced", $on: "base");
70
- @include classes("cols-spaced", $on: "base");
47
+ ```scss
48
+ @include placeholder('myHelper') {
49
+ color: red;
50
+ }
51
+ @include classes('myHelper', $on: 'base mobile tablet-up');
71
52
  ```
72
- Here we use the default breakpoint expressions defined by Chameleon to generate classes that work for different viewport sizes.
73
53
 
74
- Now, import your stylesheet into your page and add some markup:
54
+ Multi-element modifiers provide a powerful, concise and expressive way to compose modules.
75
55
 
76
- ```
77
- <div class="row cols-spaced">
78
- <div class="col-1-2">
79
- <div class="panel">Half</div>
80
- </div>
81
- <div class="col-1-2">
82
- <div class="panel">Half</div>
83
- </div>
56
+ ```html
57
+ <div class="row cols-spaced cols-to-rows-on-mobile">
58
+ <div class="col-1-3"></div>
59
+ <div class="col-1-3"></div>
60
+ <div class="col-1-3"></div>
84
61
  </div>
85
- ```
86
-
87
- Congrats! You just generated a super easy to use, easily customisable, responsive grid system.
62
+ ```
@@ -1,7 +1,2 @@
1
- @import "functions"
2
- @import "config"
3
- @import "mixins"
4
- @import "config/units"
5
- @import "objects"
6
- @import "helpers"
7
- @import "defaults"
1
+ @import "core"
2
+ @import "library"
@@ -1,3 +1,3 @@
1
1
  @import "config/base-sizing"
2
2
  @import "config/breakpoints"
3
- @import "config/units"
3
+ @import "config/sizing"
@@ -0,0 +1,3 @@
1
+ @import "functions"
2
+ @import "config"
3
+ @import "mixins"
@@ -1,4 +1,3 @@
1
1
  =defaults
2
2
  *
3
- position: relative
4
3
  box-sizing: border-box
@@ -1,3 +1,3 @@
1
1
  @import "helpers/box"
2
2
  @import "helpers/position"
3
- @import "helpers/visibility"
3
+ @import "helpers/visibility"
@@ -0,0 +1,3 @@
1
+ @import "objects"
2
+ @import "helpers"
3
+ @import "defaults"
@@ -1 +1,2 @@
1
- @import "mixins/responsive"
1
+ @import "mixins/responsive"
2
+ @import "mixins/utility"
@@ -0,0 +1,9 @@
1
+ $sizing-map: (
2
+ "none": 0,
3
+ "tiny": rem(5),
4
+ "small": rem(10),
5
+ "default": rem(20),
6
+ "big": rem(40),
7
+ "bigger": rem(60),
8
+ "huge": rem(80)
9
+ ) !default;
@@ -1,3 +1,76 @@
1
+ $box-map: ('spaced': 'margin', 'padded': 'padding')
2
+ $position-list: ('top' 'left' 'bottom' 'right')
3
+
4
+ // Display
5
+ +placeholders("block")
6
+ display: block
7
+
8
+ +placeholders("inline-block")
9
+ display: inline-block
10
+
11
+
12
+ // Size
1
13
  +placeholders("widest")
2
14
  display: block
3
15
  width: 100%
16
+ max-width: 100%
17
+
18
+ +placeholders("tallest")
19
+ display: block
20
+ height: 100%
21
+ max-height: 100%
22
+
23
+
24
+ // Padding / Margin / Spacing
25
+ =rows($prop, $size)
26
+ #{$prop}-top: $size
27
+ #{$prop}-bottom: $size
28
+
29
+ =cols($prop, $size)
30
+ #{$prop}-left: $size
31
+ #{$prop}-right: $size
32
+
33
+ @each $box-label, $box-property in $box-map
34
+
35
+ +placeholders('#{$box-label}')
36
+ #{$box-property}: map-get($sizing-map, 'default')
37
+
38
+ +placeholders('#{$box-label}-rows')
39
+ +rows($box-property, map-get($sizing-map, 'default'))
40
+
41
+ +placeholders('#{$box-label}-cols')
42
+ +cols($box-property, map-get($sizing-map, 'default'))
43
+
44
+ @each $position in $position-list
45
+ +placeholders('#{$box-label}-#{$position}')
46
+ #{$box-property}-#{$position}: map-get($sizing-map, 'default')
47
+
48
+ @each $size-name, $size in $sizing-map
49
+ +placeholders('#{$box-label}-#{$size-name}')
50
+ #{$box-property}: $size
51
+
52
+ +placeholders('#{$box-label}-rows-#{$size-name}')
53
+ +rows($box-property, $size)
54
+
55
+ +placeholders('#{$box-label}-cols-#{$size-name}')
56
+ +cols($box-property, $size)
57
+
58
+ @each $position in $position-list
59
+ +placeholders('#{$box-label}-#{$position}-#{$size-name}')
60
+ #{$box-property}-#{$position}: #{$size}
61
+
62
+
63
+ =inline-blocks-spaced-defaults
64
+ [class*="inline-blocks-spaced"] > *
65
+ letter-spacing: normal
66
+
67
+ @each $size-name, $size in $sizing-map
68
+ +placeholders('inline-blocks-spaced-#{$size}')
69
+ letter-spacing: $size
70
+ +write-once($ref: 'IBSD')
71
+ +inline-blocks-spaced-defaults
72
+
73
+ +placeholders('inline-blocks-spaced-#{$size}')
74
+ letter-spacing: $size
75
+ +write-once($ref: 'IBSD')
76
+ +inline-blocks-spaced-defaults
@@ -1,9 +1,33 @@
1
+ +placeholders("aligned-left")
2
+ text-align: left
3
+
1
4
  +placeholders("aligned-right")
2
5
  text-align: right
3
6
 
4
7
  +placeholders("aligned-center")
5
8
  text-align: center
6
9
 
10
+
11
+ +placeholders("positioned-absolute")
12
+ position: absolute
13
+
14
+ +placeholders("positioned-relative")
15
+ position: relative
16
+
17
+ +placeholders("positioned-fixed")
18
+ position: fixed
19
+
20
+ +placeholders("positioned-static")
21
+ position: static
22
+
23
+
24
+ +placeholders("floated-left")
25
+ float: left
26
+
27
+ +placeholders("floated-right")
28
+ float: right
29
+
30
+
7
31
  +placeholders("expanded")
8
32
  &:before,
9
33
  &:after
@@ -1,13 +1,11 @@
1
- // H5BP visibility styles
2
-
3
- // Hide from both screenreaders and browsers: h5bp.com/u
1
+ // Hide from both screenreaders and browsers
4
2
 
5
3
  +placeholders("hidden")
6
4
  display: none !important
7
5
  visibility: hidden
8
6
 
9
7
 
10
- // Hide only visually, but have it available for screenreaders: h5bp.com/v
8
+ // Hide only visually, but have it available for screenreaders
11
9
 
12
10
  +placeholders("concealed")
13
11
  border: 0 !important
@@ -20,19 +18,6 @@
20
18
  width: 1px !important
21
19
 
22
20
 
23
- // Extends the .visuallyhidden class to allow the element to be focusable when navigated to via the keyboard: h5bp.com/p
24
-
25
- +placeholders("concealed-focusable")
26
- &:active,
27
- &:focus
28
- clip: auto
29
- height: auto
30
- margin: 0
31
- overflow: visible
32
- position: static
33
- width: auto
34
-
35
-
36
21
  // Hide visually and from screenreaders, but maintain layout
37
22
 
38
23
  +placeholders("camouflaged")
@@ -94,8 +94,8 @@ $devices: (null)
94
94
  // Genenerate a list of classes for different breakpoints
95
95
  // Usage: +classes(big-thing, mobile tablet desktop-up)
96
96
 
97
- =classes($name, $on: false)
98
- $devices: if($on, $on, $devices)
97
+ =classes($name, $on: "base")
98
+ $devices: if($on == "all", $devices, $on)
99
99
  @each $device in $devices
100
100
  $postfix: if($device == "base", "", -on-#{$device})
101
101
  +on($device)
@@ -0,0 +1,6 @@
1
+ $write-map: ()
2
+ @mixin write-once($ref)
3
+ $written: map-get($write-map, $ref)
4
+ @if $written != true
5
+ @content
6
+ $write-map: map-merge($write-map, ($ref: true)) !global
@@ -1,50 +1,6 @@
1
- $width-container: rem(1000)
2
- $width-container-medium: rem(700)
3
- $width-container-small: rem(500)
4
- $width-container-tiny: rem(250)
5
-
6
- =container($width-container)
7
-
8
- $larger-than-fablet: if($width-container > rem($device-width-tablet - 1), true, false)
9
-
10
- max-width: $width-container
1
+ =container($max-width, $min-margin)
2
+ max-width: $max-width
11
3
  margin: 0 auto
12
4
 
13
- @if $larger-than-fablet
14
- +mq($to: px($width-container + $unit-big * 2))
15
- margin: 0 $unit-big
16
-
17
- +on("fablet-down")
18
- margin: 0 $unit
19
-
20
- @else
21
- +mq($to: px($width-container + $unit * 2))
22
- margin: 0 $unit
23
-
24
- %container
25
- +container($width-container)
26
-
27
- %container-medium
28
- +container($width-container-medium)
29
-
30
- %container-small
31
- +container($width-container-small)
32
-
33
- %container-tiny
34
- +container($width-container-tiny)
35
-
36
-
37
- // Complex col/container layouts
38
- %col-left-edge-to-1-3-container
39
- @extend %col
40
- width: calc((100vw - #{$width-container})/2 + (#{$width-container} * 1/3))
41
-
42
- @media all and (max-width: $width-container)
43
- width: calc(100vw * 1/3)
44
-
45
- %col-to-2-3-container
46
- @extend %col
47
- width: $width-container * 2/3
48
-
49
- @media all and (max-width: $width-container)
50
- width: 66.666666%
5
+ +mq($to: $max-width + $min-margin * 2)
6
+ margin: 0 $min-margin
@@ -1,16 +1,13 @@
1
- =grid-defaults
1
+ =grid-defaults($unmin: false, $spacing: -0.3em)
2
2
  .row
3
3
  @extend %expanded
4
- letter-spacing: -0.25em
5
4
 
6
- +on("fablet-down")
7
- letter-spacing: -0.27em
5
+ @if $unmin == true
6
+ letter-spacing: $spacing
8
7
 
9
- > *
10
- letter-spacing: normal
11
-
12
- .row.no-cols
13
- letter-spacing: normal
8
+ & > *,
9
+ &.no-cols
10
+ letter-spacing: normal
14
11
 
15
12
  [class^="col-"],
16
13
  [class*=" col-"]
@@ -22,7 +19,6 @@
22
19
  display: inline-block
23
20
  min-height: 1px
24
21
  vertical-align: top
25
- letter-spacing: normal
26
22
  word-spacing: normal
27
23
 
28
24
  +placeholders("col-1-2")
@@ -107,16 +103,20 @@
107
103
  padding-left: $gutter
108
104
 
109
105
  +placeholders("cols-spaced-small")
110
- +cols-spaced($unit-small)
106
+ +cols-spaced(map-get($sizing-map, 'small'))
111
107
 
112
108
  +placeholders("cols-spaced")
113
- +cols-spaced($unit)
109
+ +cols-spaced(map-get($sizing-map, 'default'))
114
110
 
115
111
  +placeholders("cols-spaced-big")
116
- +cols-spaced($unit-big)
112
+ +cols-spaced(map-get($sizing-map, 'big'))
117
113
 
118
114
  +placeholders("cols-spaced-huge")
119
- +cols-spaced($unit-huge)
115
+ +cols-spaced(map-get($sizing-map, 'huge'))
116
+
117
+ @each $size-name, $size in $sizing-map
118
+ +placeholders("cols-spaced-#{$size-name}")
119
+ +cols-spaced($size)
120
120
 
121
121
 
122
122
  // Row spacing - add baseline gutter
@@ -126,25 +126,21 @@
126
126
  padding-bottom: $_gutter
127
127
 
128
128
  // Space cols that have been switched to rows too
129
- &[class*="cols-to-rows"]
130
- margin-bottom: -$_gutter // removes gutter below last row / cols
129
+ &[class*="cols-to-rows"] > *
130
+ margin-bottom: $_gutter
131
131
 
132
- & > *
133
- margin-bottom: $_gutter
132
+ // Suck up margin from the last visible child
133
+ // Use negative margin in case the last child isn't visible
134
+ // Use :after in case someone else slaps a margin class on the element
135
+ &:after
136
+ content: ''
137
+ display: table
138
+ margin-bottom: -$_gutter
134
139
 
135
- +placeholders("rows-spaced-small")
136
- +rows-spaced($unit-small)
137
140
 
138
141
  +placeholders("rows-spaced")
139
- +rows-spaced($unit)
140
-
141
- +placeholders("rows-spaced-big")
142
- +rows-spaced($unit-big)
143
-
144
- +placeholders("rows-spaced-huge")
145
- +rows-spaced($unit-huge)
142
+ +rows-spaced(map-get($sizing-map, 'default'))
146
143
 
147
- =rows-spaced-defaults
148
- // This can happily be applied to all rows
149
- .row:last-child
150
- padding-bottom: 0
144
+ @each $size-name, $size in $sizing-map
145
+ +placeholders("rows-spaced-#{$size-name}")
146
+ +rows-spaced($size)
@@ -1,5 +1,5 @@
1
1
  module ChameleonSass
2
- VERSION = "0.0.12"
2
+ VERSION = "0.5.4"
3
3
  DATE = "2015-09-10"
4
4
 
5
5
  class << self
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chameleon-sass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Grant
@@ -19,20 +19,23 @@ files:
19
19
  - README.md
20
20
  - assets/stylesheets/_chameleon.sass
21
21
  - assets/stylesheets/_config.sass
22
+ - assets/stylesheets/_core.sass
22
23
  - assets/stylesheets/_defaults.sass
23
24
  - assets/stylesheets/_functions.sass
24
25
  - assets/stylesheets/_helpers.sass
26
+ - assets/stylesheets/_library.sass
25
27
  - assets/stylesheets/_mixins.sass
26
28
  - assets/stylesheets/_objects.sass
27
29
  - assets/stylesheets/config/_base-sizing.sass
28
30
  - assets/stylesheets/config/_breakpoints.scss
29
- - assets/stylesheets/config/_units.sass
31
+ - assets/stylesheets/config/_sizing.scss
30
32
  - assets/stylesheets/functions/_maps.sass
31
33
  - assets/stylesheets/functions/_units.scss
32
34
  - assets/stylesheets/helpers/_box.sass
33
35
  - assets/stylesheets/helpers/_position.sass
34
36
  - assets/stylesheets/helpers/_visibility.sass
35
37
  - assets/stylesheets/mixins/_responsive.sass
38
+ - assets/stylesheets/mixins/_utility.sass
36
39
  - assets/stylesheets/objects/_containers.sass
37
40
  - assets/stylesheets/objects/_grid.sass
38
41
  - lib/chameleon-sass.rb
@@ -1,7 +0,0 @@
1
- // Grid units
2
- $unit-tiny: rem(5) !default
3
- $unit-small: rem(10) !default
4
- $unit: rem(20) !default
5
- $unit-big: rem(40) !default
6
- $unit-bigger: rem(60) !default
7
- $unit-huge: rem(80) !default