flint-gs 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4fe5b9e2c39e010d685a44b3e5aa5d3b55b04322
4
- data.tar.gz: 4bf01de85d73743b890317fd08246dc57149cd4e
3
+ metadata.gz: 86f446a4c55cb2d708fe52353d16116ca09b852a
4
+ data.tar.gz: 356f208c87bd7861cba705549c2657a304cd4955
5
5
  SHA512:
6
- metadata.gz: 38fc91877f9c8a18fbaf4f487fee66412d26df390f6566e5b61ac82d98aa38cf1c4f611e11965b60bb5742d892097124c29865a09785d4ef42094d5501f6f003
7
- data.tar.gz: f06b0d3af65caac112d92ae5210f4016f89157b5195939baac98126a47ab7d9198bb66565acff026f0a74d9a8f0c7afb0cca49fa9e995c960ce30cff479b9184
6
+ metadata.gz: 3bdccfc0a8c3515397f08419773009f35e0b769b9f2c1a80eec9789e05001805a9c70ddd3d548b9892ad6e069c87c677df32561bae48a946c75b5c7b70981d22
7
+ data.tar.gz: 4dbfa15f7d4d1f5ebeb1f0232f16bf879362460a1955052009d45342214fa16a3537388e6279a81ca12123deae0400d86d1aef0f339ac4a6b604c5ebf12d8458
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- #Flint [![Gem Version](https://badge.fury.io/rb/flint-gs.svg)](http://badge.fury.io/rb/flint-gs)
1
+ # Flint [![Gem Version](https://badge.fury.io/rb/flint-gs.svg)](http://badge.fury.io/rb/flint-gs)
2
2
 
3
3
  **Flint is designed to be a flexible layout toolkit that developers can use for any responsive grid-based project.** Built on Sass 3.3, Flint is capable of complex responsive layouts customized at each breakpoint; all while using a single mixin, having minimal output, as well as being completely semantic. All of your layout settings are housed in a simple config file and is immensely customizable. Flint will only output the code you need, and nothing else. We handle the hard stuff, so you can focus on the rest.
4
4
 
@@ -6,28 +6,28 @@ Take it for a spin on [SassMeister.com](http://sassmeister.com/gist/11489231)!
6
6
 
7
7
  Enjoy.
8
8
 
9
- ##Requirements
9
+ ## Requirements
10
10
 
11
11
  * Sass ~> 3.3.0
12
12
  * Compass ~> 1.0.0.alpha.19
13
13
 
14
- ##Installation
14
+ ## Installation
15
15
 
16
16
  1. `gem install flint-gs`
17
17
  2. Add `require "flint"` to your `config.rb`
18
18
  3. Import it in your stylesheets with `@import "flint";`
19
19
 
20
- If you don't want to install the gem (?!), download/clone the current build files and use the starter `config.rb` to require any custom functions Flint uses. Currently this is required, as we're making use of custom SassScript functions until the 'script `&`' [returns to Sass](https://gist.github.com/nex3/8050187). Adjust the paths according to your project.
20
+ If you don't want to install the gem, download or clone the current build files and use the starter `config.rb` to require any custom Ruby functions Flint uses. Currently this is required, as we're making use of custom SassScript functions until the script '&' [returns to Sass](https://gist.github.com/nex3/8050187). Adjust the paths according to your project.
21
21
 
22
- ##Documentation
22
+ ## Documentation
23
23
 
24
- ###Config
24
+ ### Config
25
25
 
26
26
  Flint's `config` map is unique in the ability that you may define an unlimited number of breakpoints for your project. Whether that be 2 breakpoints, or even 12 breakpoints. Flint gives you full control over the column count on each breakpoint, and unlike most frameworks, you may name these anything that you like. Flint is smart and will figure out which one you're talking about.
27
27
 
28
28
  Speaking of not being like most frameworks, Flint does not require you to set a ridiculous amount of variables just to use a single breakpoint. It actually doesn't require you to set *any* variables. It also doesn't require you to install a seperate extension so that you can define your breakpoints; *all of these features are baked into Flint.* Your columns are fully related to your breakpoints, so that there is never any confusion and everything is kept nice and simple.
29
29
 
30
- ####Usage
30
+ #### Usage
31
31
 
32
32
  To begin, you can either use the default `config` (below) which comes baked in, or you can define your own using the `$flint` variable, using the default config as a template. Settings may be entered in `px` or `em`, and Flint will do the rest.
33
33
 
@@ -114,7 +114,7 @@ $flint: (
114
114
  );
115
115
  ```
116
116
 
117
- ###Foundation
117
+ ### Foundation
118
118
 
119
119
  If you selected `"border-box-sizing": true`, then it is *advised* to create a global foundation instance like so,
120
120
 
@@ -124,7 +124,7 @@ If you selected `"border-box-sizing": true`, then it is *advised* to create a gl
124
124
 
125
125
  That way your output won't be riddled with `box-sizing` declarations everytime you define a span. This will automatically output the rules onto the global selector `*`. In the future this might be automatic, but for now I'll keep it manual.
126
126
 
127
- ###Container
127
+ ### Container
128
128
 
129
129
  Containers act as a row for each individual breakpoint, and if set in your config, uses a max-width. They do not float, so if you have `"center-container"` set to `true` then it will also center your element using `auto` left and right margins.
130
130
 
@@ -145,7 +145,7 @@ Outputs,
145
145
  }
146
146
  ```
147
147
 
148
- ###Clear
148
+ ### Clear
149
149
 
150
150
  Given that Flint is float based, you might find yourself needing to use a clearfix. Flint comes packaged with a micro-clearfix function.
151
151
 
@@ -265,7 +265,7 @@ As you can see, since `"desktop"` is the framework `"default"`, it uses the outp
265
265
 
266
266
  Whatever your `"default"` is set to, **flint** will not wrap those styles in media-queries, so that they may be used in non-supported browsers.
267
267
 
268
- ###Recursive shorthand with identical context
268
+ ### Recursive shorthand with identical context
269
269
 
270
270
  Use this if your nested context is *identical* across all breakpoints. The `context` is the span of the elements parent. ***Update:*** You can now use `$context: auto`, and we'll do all the calculations for you. Just be sure a parent element with a Flint `instance` actually exists or you'll get some weird output, or none at all. **Using `$context: auto` on fixed grids, the width with will be calculated by the parents width, instead of using the base breakpoints width.**
271
271
 
@@ -332,7 +332,7 @@ Outputs,
332
332
  }
333
333
  ```
334
334
 
335
- ###Recursive shorthand with variable context
335
+ ### Recursive shorthand with variable context
336
336
 
337
337
  Use this if your context is *not* indentical across breakpoints. The `context` is the span of the elements parent. ***Update:*** You can now use `$context: auto`, and we'll do all the calculations for you. Just be sure a parent element with a Flint `instance` actually exists or you'll get some weird output, or none at all.
338
338
 
@@ -380,7 +380,7 @@ recursive {
380
380
  }
381
381
  ```
382
382
 
383
- ###Variable shorthand
383
+ ### Variable shorthand
384
384
 
385
385
  Use this if your content needs different spans across each breakpoints. The *order of operations* for this matches the order entered in your `config`.
386
386
 
@@ -424,7 +424,7 @@ Outputs,
424
424
  }
425
425
  ```
426
426
 
427
- ###Variable shorthand with context
427
+ ### Variable shorthand with context
428
428
 
429
429
  Use this if you're *nesting* columns using the variable shorthand. The `context` is the span of the elements parent. ***Update:*** You can now use `$context: auto`, and we'll do all the calculations for you. Just be sure a parent element with a Flint `instance` actually exists or you'll get some weird output, or none at all.
430
430
 
@@ -470,7 +470,7 @@ Outputs,
470
470
  }
471
471
  ```
472
472
 
473
- ###Wrapping in media queries
473
+ ### Wrapping in media queries
474
474
 
475
475
  Use these if you need to apply breakpoint specific styling.
476
476
 
@@ -490,6 +490,11 @@ Use these if you need to apply breakpoint specific styling.
490
490
  // all sizes 10em above tablet's breakpoint
491
491
  }
492
492
  }
493
+ .wrap {
494
+ @include _(greater than 60em) {
495
+ // all sizes above 60em
496
+ }
497
+ }
493
498
  .wrap {
494
499
  @include _(less than tablet) {
495
500
  // all sizes under tablet
@@ -500,6 +505,11 @@ Use these if you need to apply breakpoint specific styling.
500
505
  // all sizes 1em under laptop
501
506
  }
502
507
  }
508
+ .wrap {
509
+ @include _(less than 40em) {
510
+ // all sizes under 40em
511
+ }
512
+ }
503
513
  .wrap {
504
514
  @include _(for desktop tablet) {
505
515
  // only for desktop and tablet
@@ -515,11 +525,16 @@ Use these if you need to apply breakpoint specific styling.
515
525
  // all sizes from desktop to infinity
516
526
  }
517
527
  }
528
+ .wrap {
529
+ @include _(from 20em to 40em) {
530
+ // all sizes from 20em to 40em
531
+ }
532
+ }
518
533
  ```
519
534
 
520
- ###Call by alias
535
+ ### Call by alias
521
536
 
522
- Use if you want to define each span without shorthands. This is useful if you need variable `gutter` modifiers.
537
+ Use if you want to define each span without shorthands.
523
538
 
524
539
  ```scss
525
540
  .name {
@@ -567,9 +582,9 @@ Outputs,
567
582
  }
568
583
  ```
569
584
 
570
- ###Gutter modifiers
585
+ ### Gutter modifiers
571
586
 
572
- Here are different gutter modifiers that may be called in when defining spans using the `$gutter` variable. **You should note**, that when using recursive shorthands the gutter modifiers are also recursive across all breakpoints.
587
+ Here are different gutter modifiers that may be called in when defining spans using the `$gutter` variable. The `$gutter` variable allows you to pass in either a recursive argument, or a variable argument, similar to `$span`.
573
588
 
574
589
  ```scss
575
590
  // default margins
@@ -597,7 +612,6 @@ Here are different gutter modifiers that may be called in when defining spans us
597
612
  }
598
613
 
599
614
  // places gutters on inside by reducing column width by [gutter*2]
600
- // useful for nesting children inside of parents that have normal gutters on fixed grid layouts
601
615
  .gutter-inside {
602
616
  @include _(desktop, 4, $gutter: inside);
603
617
  }
@@ -607,7 +621,7 @@ Here are different gutter modifiers that may be called in when defining spans us
607
621
  @include _(16 12 8 4, $gutter: row alpha omega normal);
608
622
  }
609
623
 
610
- // recursive
624
+ // recursive gutter
611
625
  .recursive-gutter {
612
626
  @include _(16 12 8 4, $gutter: row);
613
627
  }
@@ -700,7 +714,7 @@ Outputs,
700
714
  }
701
715
  ```
702
716
 
703
- ###Shift
717
+ ### Shift
704
718
 
705
719
  Much like the gutter modifiers, you may also call in a shift parameter using the `$shift` variable. This will cause the element to shift the desired amount of columns using positive/negative left margins.
706
720
 
@@ -803,7 +817,7 @@ Outputs,
803
817
  }
804
818
  ```
805
819
 
806
- ##BEM Users
820
+ ## BEM Users
807
821
 
808
822
  Due to the way **BEM** is written, the instance functions cannot fallback to previous selectors in the family tree to find a parent instance, so using `$context: auto` will not work for some BEM users, depending on how you write it.
809
823
 
data/lib/flint.rb CHANGED
@@ -5,8 +5,8 @@ Compass::Frameworks.register('flint', :path => extension_path)
5
5
  # Version is a number. If a version contains alphas, it will be created as a prerelease version
6
6
  # Date is in the form of YYYY-MM-DD
7
7
  module Flint
8
- VERSION = "1.4.0"
9
- DATE = "2014-06-26"
8
+ VERSION = "1.5.0"
9
+ DATE = "2014-06-30"
10
10
  end
11
11
 
12
12
  # Custom functions
@@ -1,13 +1,6 @@
1
- // -------------------------------------------------------------------------------
2
- // Flint - A powerful Sass grid-system designed for complex responsive layouts.
3
- // -------------------------------------------------------------------------------
4
- // @By : Ezekiel Gabrielse
5
- // @Repository : https://github.com/ezekg/flint/
6
- // @Sass >=3.3.3
7
- // @Compass >=1.0.0.alpha.19
8
- // -------------------------------------------------------------------------------
9
-
1
+ // Flint
2
+ // ----
10
3
  @import "flint/config/config";
11
4
  @import "flint/functions/functions";
12
5
  @import "flint/globals/globals";
13
- @import "flint/mixins/mixins";
6
+ @import "flint/mixins/mixins";
@@ -1,7 +1,9 @@
1
1
  // Helpers
2
+ // ----
2
3
  @import "helpers/helpers";
3
4
 
4
5
  // Functions
6
+ // ----
5
7
  @import "lib/map-fetch";
6
8
  @import "lib/get-value";
7
9
  @import "lib/steal-key";
@@ -23,4 +25,5 @@
23
25
  @import "lib/remove";
24
26
  @import "lib/get-family-instance";
25
27
  @import "lib/get-instance-value";
26
- @import "lib/string-to-number";
28
+ @import "lib/string-to-number";
29
+ @import "lib/types-in-list";
@@ -159,7 +159,7 @@
159
159
 
160
160
  // Returns the unit used in config
161
161
  // -------------------------------------------------------------------------------
162
- // @return [bool]
162
+ // @return [literal]
163
163
 
164
164
  @function get-config-unit() {
165
165
  @return unit(get-value("settings", "gutter"));
@@ -167,8 +167,8 @@
167
167
 
168
168
  // Convert pixel value to em
169
169
  // -------------------------------------------------------------------------------
170
- // @param $target [num] : pixel value
171
- // @param $context [num] : context to divide by
170
+ // @param $target [number] : pixel value
171
+ // @param $context [number] : context to divide by
172
172
  // -------------------------------------------------------------------------------
173
173
  // @return : em value of $target relative to $context
174
174
  // -------------------------------------------------------------------------------
@@ -11,20 +11,34 @@
11
11
 
12
12
  @function calc-width($key, $span, $context: null) {
13
13
  @if get-value("settings", "grid") == "fluid" {
14
+
14
15
  @if $key == "container" or $span == "container" {
16
+
15
17
  @return fluid-width(get-value($key, "breakpoint"), get-value($key, "breakpoint"));
18
+
16
19
  } @else if $context == null {
20
+
17
21
  @return fluid-width((get-value($key, "breakpoint") / get-value($key, "columns") * $span), get-value($key, "breakpoint"));
22
+
18
23
  } @else {
24
+
19
25
  @return fluid-width((get-value($key, "breakpoint") / get-value($key, "columns") * $span), ((get-value($key, "breakpoint") / get-value($key, "columns") * $context)));
26
+
20
27
  }
28
+
21
29
  } @if get-value("settings", "grid") == "fixed" {
30
+
22
31
  @if $key == "container" or $span == "container" {
32
+
23
33
  @return get-value($key, "breakpoint");
34
+
24
35
  } @else {
36
+
25
37
  @return get-value($key, "breakpoint") / get-value($key, "columns") * $span;
38
+
26
39
  }
40
+
27
41
  } @else {
28
42
  @return false;
29
43
  }
30
- }
44
+ }
@@ -1,7 +1,7 @@
1
1
  // Fetch value from key in map
2
2
  // -------------------------------------------------------------------------------
3
3
  // @param $map [map] : map to fetch from
4
- // @param $keys [list] : list of keys
4
+ // @param $keys [string | list] : string of key, or list of strings
5
5
  // -------------------------------------------------------------------------------
6
6
  // @return fetched literal | false
7
7
 
@@ -0,0 +1,120 @@
1
+ // Checks type of each item in list
2
+ // -------------------------------------------------------------------------------
3
+ // @param $list [list] : list of items
4
+ // @param $assert-types [string | list] : single or list of types to assert
5
+ // @param $assert-length [number] : assert length of list
6
+ // -------------------------------------------------------------------------------
7
+ // @return [bool]
8
+
9
+ @function types-in-list($list, $assert-types: null, $assert-length: null) {
10
+ @if is-list($list) {
11
+
12
+ // Assert types in list?
13
+ // ----
14
+ @if $assert-types {
15
+
16
+ // Assert length of list?
17
+ // ----
18
+ @if $assert-length {
19
+ // Get length of list
20
+ $length: length($list);
21
+
22
+ // Make sure lengths match
23
+ @if $length == $assert-length {
24
+ // Keep empty list of types
25
+ $types: ();
26
+
27
+ // List of asserted types?
28
+ // ----
29
+ @if is-list($assert-types) {
30
+
31
+ // Make sure length of types match list
32
+ // ----
33
+ @if length($assert-types) == $length {
34
+
35
+ // Loop over each item in list
36
+ @for $i from 1 through $assert-length {
37
+ $item: nth($list, $i);
38
+ $type: nth($assert-types, $i);
39
+
40
+ // Check if type of item matches asserted type
41
+ @if type-of($item) != $type {
42
+ @return false;
43
+ }
44
+
45
+ $types: append($types, $type);
46
+ }
47
+
48
+ // Lengths did not match
49
+ // ----
50
+ } @else {
51
+ @return false;
52
+ }
53
+
54
+ // Assert a single type across list
55
+ // ----
56
+ } @else {
57
+ // Assert single type
58
+ $type: nth($assert-types, 1);
59
+
60
+ // Loop over each item in list
61
+ @for $i from 1 through $assert-length {
62
+ $item: nth($list, $i);
63
+
64
+ // Check if type of item matches asserted type
65
+ @if type-of($item) != $type {
66
+ @return false;
67
+ }
68
+ }
69
+
70
+ $types: append($types, $type);
71
+ }
72
+
73
+ // Return list of types
74
+ @return true; // $types;
75
+
76
+ // Lengths did not match, return false
77
+ } @else {
78
+ @return false;
79
+ }
80
+
81
+ // Just assert types in list, any length
82
+ // ----
83
+ } @else {
84
+ // Get asserted type
85
+ $type: $assert-types;
86
+
87
+ // Check each items type
88
+ @each $item in $list {
89
+ // Check if type of item matches asserted type
90
+ @if type-of($item) != $type {
91
+ @return false;
92
+ }
93
+ }
94
+
95
+ // Passed check, return type
96
+ @return true; // $type;
97
+ }
98
+
99
+ // Just assert type of first item in list
100
+ // ----
101
+ } @else {
102
+ // Get type of first item in list
103
+ $type: type-of(nth($list, 1));
104
+
105
+ // Check each items type
106
+ @each $item in $list {
107
+ // Check if type of item matches asserted type
108
+ @if type-of($item) != $type {
109
+ @return false;
110
+ }
111
+ }
112
+
113
+ // Passed check, return type
114
+ @return true; // $type;
115
+ }
116
+ // Was not a list, return false
117
+ } @else {
118
+ @return false;
119
+ }
120
+ }
@@ -1,14 +1,18 @@
1
1
  // Set global variable to check if foundation has been applied globally
2
+ // ----
2
3
  $flint__foundation: "nonexistant" !global;
3
4
 
4
5
  // Gather all keys, breakpoints and column counts
6
+ // ----
5
7
  $flint__all__keys: get-all-keys() !global;
6
8
  $flint__all__breakpoints: get-all-breakpoints() !global;
7
9
  $flint__all__columns: get-all-columns() !global;
8
10
 
9
11
  // Keep track of all instances of mixin
12
+ // ----
10
13
  $flint__instance-count: 0 !global;
11
14
  $flint__instances: () !global;
12
15
 
13
16
  // Font size for em calculation
17
+ // ----
14
18
  $flint__base-font-size: 16px !global;