pusher-chameleon 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.ruby-version +1 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +23 -0
- data/README.md +17 -0
- data/docs/.gitignore +4 -0
- data/docs/Gemfile +10 -0
- data/docs/Gemfile.lock +72 -0
- data/docs/README.md +15 -0
- data/docs/Rakefile +40 -0
- data/docs/_config.production.yml +18 -0
- data/docs/_config.yml +39 -0
- data/docs/_includes/footer.html +38 -0
- data/docs/_includes/head.html +15 -0
- data/docs/_includes/header.html +27 -0
- data/docs/_includes/icon-github.html +1 -0
- data/docs/_includes/icon-github.svg +3 -0
- data/docs/_includes/logo-pusher.svg +4 -0
- data/docs/_includes/sidebar.html +33 -0
- data/docs/_layouts/default.html +53 -0
- data/docs/_layouts/page.html +14 -0
- data/docs/_layouts/post.html +15 -0
- data/docs/_plugins/chameleon_version.rb +11 -0
- data/docs/_plugins/copy_images_directory.rb +22 -0
- data/docs/_plugins/ext.rb +2 -0
- data/docs/_posts/2016-03-16-getting-started.md +28 -0
- data/docs/_posts/2016-03-16-introduction.md +24 -0
- data/docs/_posts/2016-03-17-buttons.md +61 -0
- data/docs/_posts/2016-03-17-colors.md +139 -0
- data/docs/_posts/2016-03-17-flex.md +24 -0
- data/docs/_posts/2016-03-17-forms.md +66 -0
- data/docs/_posts/2016-03-17-visibility.md +28 -0
- data/docs/_posts/2016-04-04-typography.md +111 -0
- data/docs/_posts/2016-04-05-syntax-highlighting.md +28 -0
- data/docs/_posts/2016-05-08-alerts.md +50 -0
- data/docs/_posts/2016-05-12-labels.md +22 -0
- data/docs/_posts/2016-05-13-tooltips.md +33 -0
- data/docs/_sass/_base.scss +36 -0
- data/docs/_sass/_chameleon_imports.scss +20 -0
- data/docs/_sass/_layout.scss +136 -0
- data/docs/_sass/_typography.scss +41 -0
- data/docs/_sass/layout/_aside.scss +151 -0
- data/docs/about.md +15 -0
- data/docs/autoprefixer.yml +4 -0
- data/docs/css/main.scss +11 -0
- data/docs/feed.xml +30 -0
- data/docs/index.html +23 -0
- data/images/ui_icons/alert_beta.svg +3 -0
- data/images/ui_icons/alert_info.svg +3 -0
- data/images/ui_icons/alert_tick.svg +6 -0
- data/images/ui_icons/alert_warning.svg +6 -0
- data/images/ui_icons/chevron_down.svg +3 -0
- data/images/ui_icons/github--active.svg +6 -0
- data/images/ui_icons/github.svg +6 -0
- data/images/ui_icons/google--active.svg +6 -0
- data/images/ui_icons/google.svg +10 -0
- data/images/ui_icons/plus.svg +3 -0
- data/javascripts/chameleon/code_box.js +14 -0
- data/javascripts/chameleon/pusher_featurette.js +52 -0
- data/javascripts/chameleon/pusher_text_cycler.js +60 -0
- data/lib/pusher-chameleon.rb +71 -0
- data/lib/pusher-chameleon/engine.rb +13 -0
- data/lib/pusher-chameleon/version.rb +8 -0
- data/package.json +24 -0
- data/pusher-chameleon.gemspec +21 -0
- data/stylesheets/.gitkeep +0 -0
- data/stylesheets/_base.scss +400 -0
- data/stylesheets/_global.scss +96 -0
- data/stylesheets/chameleon.scss +30 -0
- data/stylesheets/components/_alert.scss +102 -0
- data/stylesheets/components/_code_box.scss +84 -0
- data/stylesheets/components/_flex_aligners.scss +38 -0
- data/stylesheets/components/_label.scss +41 -0
- data/stylesheets/components/_signpost.scss +150 -0
- data/stylesheets/components/_spacers.scss +11 -0
- data/stylesheets/components/_statistic.scss +62 -0
- data/stylesheets/components/_tooltip.scss +65 -0
- data/stylesheets/components/_visibility.scss +117 -0
- data/stylesheets/forms/_base.scss +47 -0
- data/stylesheets/forms/_buttons.scss +242 -0
- data/stylesheets/forms/_checkbox.scss +31 -0
- data/stylesheets/forms/_field.scss +11 -0
- data/stylesheets/forms/_fieldset.scss +18 -0
- data/stylesheets/forms/_forms.scss +21 -0
- data/stylesheets/forms/_input.scss +14 -0
- data/stylesheets/forms/_range.scss +110 -0
- data/stylesheets/forms/_select.scss +15 -0
- data/stylesheets/forms/_textarea.scss +11 -0
- data/stylesheets/grid/_classes.scss +152 -0
- data/stylesheets/grid/_column.scss +126 -0
- data/stylesheets/grid/_flex-grid.scss +268 -0
- data/stylesheets/grid/_grid.scss +60 -0
- data/stylesheets/grid/_gutter.scss +34 -0
- data/stylesheets/grid/_layout.scss +51 -0
- data/stylesheets/grid/_position.scss +73 -0
- data/stylesheets/grid/_row.scss +95 -0
- data/stylesheets/grid/_size.scss +24 -0
- data/stylesheets/typography/_base.scss +60 -0
- data/stylesheets/typography/_helpers.scss +66 -0
- data/stylesheets/typography/_import.scss +54 -0
- data/stylesheets/typography/_syntax_highlighting.scss +168 -0
- data/stylesheets/typography/_syntax_highlighting_dark.scss +73 -0
- data/stylesheets/typography/_syntax_highlighting_light.scss +73 -0
- data/stylesheets/typography/_titles.scss +69 -0
- data/stylesheets/typography/_typography.scss +12 -0
- data/stylesheets/util/_breakpoint.scss +273 -0
- data/stylesheets/util/_color.scss +42 -0
- data/stylesheets/util/_flex.scss +68 -0
- data/stylesheets/util/_mixins.scss +233 -0
- data/stylesheets/util/_selector.scss +40 -0
- data/stylesheets/util/_unit.scss +90 -0
- data/stylesheets/util/_url_helper.scss +30 -0
- data/stylesheets/util/_util.scss +13 -0
- data/stylesheets/util/_value.scss +107 -0
- metadata +199 -0
@@ -0,0 +1,73 @@
|
|
1
|
+
.highlight {
|
2
|
+
background: darken($color-black, 5%);
|
3
|
+
|
4
|
+
code,
|
5
|
+
pre {
|
6
|
+
text-shadow: 0 1px rgba(0, 0, 0, .75);
|
7
|
+
color:#f2f0ec;
|
8
|
+
}
|
9
|
+
|
10
|
+
.c { color: #747369 } /* Comment */
|
11
|
+
.err { color: #EC5f67 } /* Error */
|
12
|
+
.k { color: #C594C5 } /* Keyword */
|
13
|
+
.l { color: #f99157 } /* Literal */
|
14
|
+
.n { color: #f2f0ec } /* Name */
|
15
|
+
.o { color: #66cccc } /* Operator */
|
16
|
+
.p { color: #f2f0ec } /* Punctuation */
|
17
|
+
.cm { color: #747369 } /* Comment.Multiline */
|
18
|
+
.cp { color: #747369 } /* Comment.Preproc */
|
19
|
+
.c1 { color: #747369 } /* Comment.Single */
|
20
|
+
.cs { color: #747369 } /* Comment.Special */
|
21
|
+
.gd { color: #EC5f67 } /* Generic.Deleted */
|
22
|
+
.ge { font-style: italic } /* Generic.Emph */
|
23
|
+
.gh { color: #f2f0ec; font-weight: bold } /* Generic.Heading */
|
24
|
+
.gi { color: #99C794 } /* Generic.Inserted */
|
25
|
+
.gp { color: #747369; font-weight: bold } /* Generic.Prompt */
|
26
|
+
.gs { font-weight: bold } /* Generic.Strong */
|
27
|
+
.gu { color: #66cccc; font-weight: bold } /* Generic.Subheading */
|
28
|
+
.kc { color: #C594C5 } /* Keyword.Constant */
|
29
|
+
.kd { color: #EC5f67 } /* Keyword.Declaration */
|
30
|
+
.kn { color: #66cccc } /* Keyword.Namespace */
|
31
|
+
.kp { color: #C594C5 } /* Keyword.Pseudo */
|
32
|
+
.kr { color: #C594C5 } /* Keyword.Reserved */
|
33
|
+
.kt { color: #ffcc66 } /* Keyword.Type */
|
34
|
+
.ld { color: #99C794 } /* Literal.Date */
|
35
|
+
.m { color: #f99157 } /* Literal.Number */
|
36
|
+
.s { color: #99C794 } /* Literal.String */
|
37
|
+
.na { color: #6699cc } /* Name.Attribute */
|
38
|
+
.nb { color: #f2f0ec } /* Name.Builtin */
|
39
|
+
.nc { color: #ffcc66 } /* Name.Class */
|
40
|
+
.no { color: #EC5f67 } /* Name.Constant */
|
41
|
+
.nd { color: #66cccc } /* Name.Decorator */
|
42
|
+
.ni { color: #f2f0ec } /* Name.Entity */
|
43
|
+
.ne { color: #EC5f67 } /* Name.Exception */
|
44
|
+
.nf { color: #6699cc } /* Name.Function */
|
45
|
+
.nl { color: #f2f0ec } /* Name.Label */
|
46
|
+
.nn { color: #ffcc66 } /* Name.Namespace */
|
47
|
+
.nx { color: #99C794 } /* Name.Other */
|
48
|
+
.py { color: #f2f0ec } /* Name.Property */
|
49
|
+
.nt { color: #EC5f67 } /* Name.Tag */
|
50
|
+
.nv { color: #EC5f67 } /* Name.Variable */
|
51
|
+
.ow { color: #66cccc } /* Operator.Word */
|
52
|
+
.w { color: #f2f0ec } /* Text.Whitespace */
|
53
|
+
.mf { color: #f99157 } /* Literal.Number.Float */
|
54
|
+
.mh { color: #f99157 } /* Literal.Number.Hex */
|
55
|
+
.mi { color: #f99157 } /* Literal.Number.Integer */
|
56
|
+
.mo { color: #f99157 } /* Literal.Number.Oct */
|
57
|
+
.sb { color: #99C794 } /* Literal.String.Backtick */
|
58
|
+
.sc { color: #f2f0ec } /* Literal.String.Char */
|
59
|
+
.sd { color: #747369 } /* Literal.String.Doc */
|
60
|
+
.s2 { color: #99C794 } /* Literal.String.Double */
|
61
|
+
.se { color: #f99157 } /* Literal.String.Escape */
|
62
|
+
.sh { color: #99C794 } /* Literal.String.Heredoc */
|
63
|
+
.si { color: #f99157 } /* Literal.String.Interpol */
|
64
|
+
.sx { color: #99C794 } /* Literal.String.Other */
|
65
|
+
.sr { color: #99C794 } /* Literal.String.Regex */
|
66
|
+
.s1 { color: #FAC863 } /* Literal.String.Single */
|
67
|
+
.ss { color: #99C794 } /* Literal.String.Symbol */
|
68
|
+
.bp { color: #f2f0ec } /* Name.Builtin.Pseudo */
|
69
|
+
.vc { color: #EC5f67 } /* Name.Variable.Class */
|
70
|
+
.vg { color: #EC5f67 } /* Name.Variable.Global */
|
71
|
+
.vi { color: #EC5f67 } /* Name.Variable.Instance */
|
72
|
+
.il { color: #f99157 } /* Literal.Number.Integer.Long */
|
73
|
+
}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
.highlight {
|
2
|
+
background: $color-snow;
|
3
|
+
|
4
|
+
code,
|
5
|
+
pre {
|
6
|
+
text-shadow: 0 1px #fff;
|
7
|
+
color: #2b303b;
|
8
|
+
}
|
9
|
+
|
10
|
+
.c { color: #a7adba } /* Comment */
|
11
|
+
.err { color: #bf616a } /* Error */
|
12
|
+
.k { color: #b48ead } /* Keyword */
|
13
|
+
.l { color: #d08770 } /* Literal */
|
14
|
+
.n { color: #2b303b } /* Name */
|
15
|
+
.o { color: #96b5b4 } /* Operator */
|
16
|
+
.p { color: #2b303b } /* Punctuation */
|
17
|
+
.cm { color: #a7adba } /* Comment.Multiline */
|
18
|
+
.cp { color: #a7adba } /* Comment.Preproc */
|
19
|
+
.c1 { color: #a7adba } /* Comment.Single */
|
20
|
+
.cs { color: #a7adba } /* Comment.Special */
|
21
|
+
.gd { color: #bf616a } /* Generic.Deleted */
|
22
|
+
.ge { font-style: italic } /* Generic.Emph */
|
23
|
+
.gh { color: #2b303b; font-weight: bold } /* Generic.Heading */
|
24
|
+
.gi { color: #25a25a } /* Generic.Inserted */
|
25
|
+
.gp { color: #a7adba; font-weight: bold } /* Generic.Prompt */
|
26
|
+
.gs { font-weight: bold } /* Generic.Strong */
|
27
|
+
.gu { color: #96b5b4; font-weight: bold } /* Generic.Subheading */
|
28
|
+
.kc { color: #b48ead } /* Keyword.Constant */
|
29
|
+
.kd { color: #b48ead } /* Keyword.Declaration */
|
30
|
+
.kn { color: #96b5b4 } /* Keyword.Namespace */
|
31
|
+
.kp { color: #b48ead } /* Keyword.Pseudo */
|
32
|
+
.kr { color: #b48ead } /* Keyword.Reserved */
|
33
|
+
.kt { color: #ebcb8b } /* Keyword.Type */
|
34
|
+
.ld { color: #25a25a } /* Literal.Date */
|
35
|
+
.m { color: #d08770 } /* Literal.Number */
|
36
|
+
.s { color: #25a25a } /* Literal.String */
|
37
|
+
.na { color: #6699cc } /* Name.Attribute */
|
38
|
+
.nb { color: #2b303b } /* Name.Builtin */
|
39
|
+
.nc { color: #ebcb8b } /* Name.Class */
|
40
|
+
.no { color: #bf616a } /* Name.Constant */
|
41
|
+
.nd { color: #96b5b4 } /* Name.Decorator */
|
42
|
+
.ni { color: #2b303b } /* Name.Entity */
|
43
|
+
.ne { color: #bf616a } /* Name.Exception */
|
44
|
+
.nf { color: #6699cc } /* Name.Function */
|
45
|
+
.nl { color: #2b303b } /* Name.Label */
|
46
|
+
.nn { color: #ebcb8b } /* Name.Namespace */
|
47
|
+
.nx { color: #6699cc } /* Name.Other */
|
48
|
+
.py { color: #2b303b } /* Name.Property */
|
49
|
+
.nt { color: #96b5b4 } /* Name.Tag */
|
50
|
+
.nv { color: #bf616a } /* Name.Variable */
|
51
|
+
.ow { color: #96b5b4 } /* Operator.Word */
|
52
|
+
.w { color: #2b303b } /* Text.Whitespace */
|
53
|
+
.mf { color: #d08770 } /* Literal.Number.Float */
|
54
|
+
.mh { color: #d08770 } /* Literal.Number.Hex */
|
55
|
+
.mi { color: #d08770 } /* Literal.Number.Integer */
|
56
|
+
.mo { color: #d08770 } /* Literal.Number.Oct */
|
57
|
+
.sb { color: #25a25a } /* Literal.String.Backtick */
|
58
|
+
.sc { color: #2b303b } /* Literal.String.Char */
|
59
|
+
.sd { color: #a7adba } /* Literal.String.Doc */
|
60
|
+
.s2 { color: #25a25a } /* Literal.String.Double */
|
61
|
+
.se { color: #d08770 } /* Literal.String.Escape */
|
62
|
+
.sh { color: #25a25a } /* Literal.String.Heredoc */
|
63
|
+
.si { color: #d08770 } /* Literal.String.Interpol */
|
64
|
+
.sx { color: #25a25a } /* Literal.String.Other */
|
65
|
+
.sr { color: #25a25a } /* Literal.String.Regex */
|
66
|
+
.s1 { color: #25a25a } /* Literal.String.Single */
|
67
|
+
.ss { color: #25a25a } /* Literal.String.Symbol */
|
68
|
+
.bp { color: #2b303b } /* Name.Builtin.Pseudo */
|
69
|
+
.vc { color: #bf616a } /* Name.Variable.Class */
|
70
|
+
.vg { color: #bf616a } /* Name.Variable.Global */
|
71
|
+
.vi { color: #bf616a } /* Name.Variable.Instance */
|
72
|
+
.il { color: #d08770 } /* Literal.Number.Integer.Long */
|
73
|
+
}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
@mixin chameleon-typography-titles {
|
2
|
+
.title--alpha,
|
3
|
+
.title--beta,
|
4
|
+
.title--gamma,
|
5
|
+
.title--epsilon,
|
6
|
+
.title--zeta {
|
7
|
+
@extend %font-family-primary;
|
8
|
+
}
|
9
|
+
|
10
|
+
.title--delta {
|
11
|
+
@extend %font-family-secondary;
|
12
|
+
}
|
13
|
+
|
14
|
+
.title--alpha {
|
15
|
+
font-size: rem-calc(28px);
|
16
|
+
line-height: 1.1em;
|
17
|
+
font-weight: 400;
|
18
|
+
letter-spacing: -1.4px;
|
19
|
+
|
20
|
+
strong {
|
21
|
+
font-weight: 500;
|
22
|
+
}
|
23
|
+
|
24
|
+
@media #{$medium-up} {
|
25
|
+
font-size: rem-calc(34px);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
.title--beta {
|
30
|
+
font-size: rem-calc(24px);
|
31
|
+
line-height: 1.25em;
|
32
|
+
font-weight: 400;
|
33
|
+
color: $color-black;
|
34
|
+
letter-spacing: -2px;
|
35
|
+
|
36
|
+
@media #{$medium-up} {
|
37
|
+
font-size: rem-calc(28px);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
.title--gamma {
|
42
|
+
font-size: rem-calc(22px);
|
43
|
+
font-weight: 400;
|
44
|
+
line-height: 1.15em;
|
45
|
+
}
|
46
|
+
|
47
|
+
.title--delta {
|
48
|
+
@extend %font-family-secondary;
|
49
|
+
font-size: rem-calc(18px);
|
50
|
+
font-weight: 400;
|
51
|
+
line-height: 1.4em;
|
52
|
+
text-transform: none;
|
53
|
+
}
|
54
|
+
|
55
|
+
.title--epsilon {
|
56
|
+
@extend %font-family-primary;
|
57
|
+
font-size: rem-calc(16px);
|
58
|
+
font-weight: 500;
|
59
|
+
line-height: 1.1em;
|
60
|
+
}
|
61
|
+
|
62
|
+
.title--zeta {
|
63
|
+
text-transform: uppercase;
|
64
|
+
font-size: rem-calc(12px);
|
65
|
+
font-weight: 700;
|
66
|
+
color: $color-black;
|
67
|
+
line-height: 1.1em;
|
68
|
+
}
|
69
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
@import 'import';
|
2
|
+
@import 'base';
|
3
|
+
@import 'titles';
|
4
|
+
@import 'helpers';
|
5
|
+
@import 'syntax_highlighting';
|
6
|
+
|
7
|
+
@mixin CHAMELEON-typography {
|
8
|
+
@include chameleon-typography-base;
|
9
|
+
@include chameleon-typography-titles;
|
10
|
+
@include chameleon-typography-helpers;
|
11
|
+
@include chameleon-typography-syntax-highlighting;
|
12
|
+
}
|
@@ -0,0 +1,273 @@
|
|
1
|
+
// Foundation for Sites by ZURB
|
2
|
+
// foundation.zurb.com
|
3
|
+
// Licensed under MIT Open Source
|
4
|
+
|
5
|
+
////
|
6
|
+
/// @group breakpoints
|
7
|
+
////
|
8
|
+
|
9
|
+
// scss-lint:disable ZeroUnit
|
10
|
+
|
11
|
+
/// A list of named breakpoints. You can use these with the `breakpoint()` mixin to quickly create media queries.
|
12
|
+
/// @type Map
|
13
|
+
$breakpoints: (
|
14
|
+
small: 0,
|
15
|
+
medium: 640px,
|
16
|
+
large: 1024px,
|
17
|
+
xlarge: 1200px,
|
18
|
+
xxlarge: 1440px,
|
19
|
+
) !default;
|
20
|
+
|
21
|
+
@if not map-has-key($breakpoints, small) or not map-has-key($breakpoints, medium) {
|
22
|
+
@error 'Your list of breakpoints (defined in $breakpoints) must include one named "small" and one named "medium".';
|
23
|
+
}
|
24
|
+
@else if map-get($breakpoints, small) != 0 {
|
25
|
+
@error 'Your "small" breakpoint (defined in $breakpoints) must be set to "0".';
|
26
|
+
}
|
27
|
+
|
28
|
+
/// All of the names in this list will be output as classes in your CSS, like `.small-12`, `.medium-6`, and so on. Each value in this list must also be in the `$breakpoints` map.
|
29
|
+
/// @type List
|
30
|
+
$breakpoint-classes: (small medium large) !default;
|
31
|
+
|
32
|
+
/// Generates a media query string matching the input value. Refer to the documentation for the `breakpoint()` mixin to see what the possible inputs are.
|
33
|
+
///
|
34
|
+
/// @param {Keyword|Number} $val [small] - Breakpoint name, or px, rem, or em value to process.
|
35
|
+
@function breakpoint($val: small) {
|
36
|
+
// Size or keyword
|
37
|
+
$bp: nth($val, 1);
|
38
|
+
// Value for max-width media queries
|
39
|
+
$bp-max: 0;
|
40
|
+
// Direction of media query (up, down, or only)
|
41
|
+
$dir: if(length($val) > 1, nth($val, 2), up);
|
42
|
+
// Eventual output
|
43
|
+
$str: '';
|
44
|
+
// Is it a named media query?
|
45
|
+
$named: false;
|
46
|
+
|
47
|
+
// Orientation media queries have a unique syntax
|
48
|
+
@if $bp == 'landscape' or $bp == 'portrait' {
|
49
|
+
@return '(orientation: #{$bp})';
|
50
|
+
}
|
51
|
+
@else if $bp == 'retina' {
|
52
|
+
@return '(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)';
|
53
|
+
}
|
54
|
+
|
55
|
+
// Try to pull a named breakpoint out of the $breakpoints map
|
56
|
+
@if type-of($bp) == 'string' {
|
57
|
+
@if map-has-key($breakpoints, $bp) {
|
58
|
+
@if $dir == 'only' or $dir == 'down' {
|
59
|
+
$bp-max: -zf-map-next($breakpoints, $bp);
|
60
|
+
}
|
61
|
+
|
62
|
+
$bp: map-get($breakpoints, $bp);
|
63
|
+
$named: true;
|
64
|
+
}
|
65
|
+
@else {
|
66
|
+
$bp: 0;
|
67
|
+
@warn 'breakpoint(): "#{$val}" is not defined in your $breakpoints setting.';
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
// Convert any pixel, rem, or unitless value to em
|
72
|
+
$bp: -zf-bp-to-em($bp);
|
73
|
+
@if $bp-max {
|
74
|
+
$bp-max: -zf-bp-to-em($bp-max) - (1/16);
|
75
|
+
}
|
76
|
+
|
77
|
+
// Conditions to skip media query creation
|
78
|
+
// - It's a named breakpoint that resolved to "0 down" or "0 up"
|
79
|
+
// - It's a numeric breakpoint that resolved to "0 " + anything
|
80
|
+
@if $bp > 0em or $dir == 'only' or $dir == 'down' {
|
81
|
+
// `only` ranges use the format `(min-width: n) and (max-width: n)`
|
82
|
+
@if $dir == 'only' {
|
83
|
+
// Only named media queries can have an "only" range
|
84
|
+
@if $named == true {
|
85
|
+
// Only use "min-width" if the floor is greater than 0
|
86
|
+
@if $bp > 0em {
|
87
|
+
$str: $str + '(min-width: #{$bp})';
|
88
|
+
|
89
|
+
// Only add "and" to the media query if there's a ceiling
|
90
|
+
@if $bp-max != null {
|
91
|
+
$str: $str + ' and ';
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
// Only use "max-width" if there's a ceiling
|
96
|
+
@if $bp-max != null {
|
97
|
+
$str: $str + '(max-width: #{$bp-max})';
|
98
|
+
}
|
99
|
+
}
|
100
|
+
@else {
|
101
|
+
@warn 'breakpoint(): Only named media queries can have an `only` range.';
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
// `down` ranges use the format `(max-width: n)`
|
106
|
+
@else if $dir == 'down' {
|
107
|
+
$max: if($named, $bp-max, $bp);
|
108
|
+
|
109
|
+
// Skip media query creation if input value is exactly "0 down",
|
110
|
+
// unless the function was called as "small down", in which case it's just "small only"
|
111
|
+
@if $named or $bp > 0em {
|
112
|
+
@if $max != null {
|
113
|
+
$str: $str + '(max-width: #{$max})';
|
114
|
+
}
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
// `up` ranges use the format `(min-width: n)`
|
119
|
+
@else if $bp > 0em {
|
120
|
+
$str: $str + '(min-width: #{$bp})';
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
@return $str;
|
125
|
+
}
|
126
|
+
|
127
|
+
/// Wraps a media query around the content you put inside the mixin. This mixin accepts a number of values:
|
128
|
+
/// - If a string is passed, the mixin will look for it in the `$breakpoints` map, and use a media query there.
|
129
|
+
/// - If a pixel value is passed, it will be converted to an em value using `$global-font-size` as the base.
|
130
|
+
/// - If a rem value is passed, the unit will be changed to em.
|
131
|
+
/// - If an em value is passed, the value will be used as-is.
|
132
|
+
///
|
133
|
+
/// @param {Keyword|Number} $value - Breakpoint name, or px, rem, or em value to process.
|
134
|
+
///
|
135
|
+
/// @output If the breakpoint is "0px and larger", outputs the content as-is. Otherwise, outputs the content wrapped in a media query.
|
136
|
+
@mixin breakpoint($value) {
|
137
|
+
$str: breakpoint($value);
|
138
|
+
|
139
|
+
// If $str is still an empty string, no media query is needed
|
140
|
+
@if $str == '' {
|
141
|
+
@content;
|
142
|
+
}
|
143
|
+
|
144
|
+
// Otherwise, wrap the content in a media query
|
145
|
+
@else {
|
146
|
+
@media screen and #{$str} {
|
147
|
+
@content;
|
148
|
+
}
|
149
|
+
}
|
150
|
+
}
|
151
|
+
|
152
|
+
/// Convers the breakpoints map to a URL-encoded string, like this: `key1=value1&key2=value2`. The value is then dropped into the CSS for a special `<meta>` tag, which is read by the Foundation JavaScript. This is how we transfer values from Sass to JavaScript, so they can be defined in one place.
|
153
|
+
/// @access private
|
154
|
+
///
|
155
|
+
/// @param {Map} $map - Map to convert.
|
156
|
+
///
|
157
|
+
/// @returns {String} A string containing the map's contents.
|
158
|
+
@function -zf-bp-serialize($map) {
|
159
|
+
$str: '';
|
160
|
+
@each $key, $value in $map {
|
161
|
+
$str: $str + $key + '=' + -zf-bp-to-em($value) + '&';
|
162
|
+
}
|
163
|
+
$str: str-slice($str, 1, -2);
|
164
|
+
|
165
|
+
@return $str;
|
166
|
+
}
|
167
|
+
|
168
|
+
/// Find the next key in a map.
|
169
|
+
/// @access private
|
170
|
+
///
|
171
|
+
/// @param {Map} $map - Map to traverse.
|
172
|
+
/// @param {Mixed} $key - Key to use as a starting point.
|
173
|
+
///
|
174
|
+
/// @returns {Mixed} The value for the key after `$key`, if `$key` was found. If `$key` was not found, or `$key` was the last value in the map, returns `null`.
|
175
|
+
@function -zf-map-next($map, $key) {
|
176
|
+
// Store the values of the map as a list, so we can access them with nth
|
177
|
+
$values: map-values($map);
|
178
|
+
|
179
|
+
// Ghetto for loop
|
180
|
+
$i: 1;
|
181
|
+
$found: false;
|
182
|
+
@each $val in map-keys($map) {
|
183
|
+
@if $found == false {
|
184
|
+
@if ($key == $val) {
|
185
|
+
$found: true;
|
186
|
+
}
|
187
|
+
$i: $i + 1;
|
188
|
+
}
|
189
|
+
}
|
190
|
+
|
191
|
+
// If the key doesn't exist, or it's the last key in the map, return null
|
192
|
+
@if $i > length($map) {
|
193
|
+
@return null;
|
194
|
+
}
|
195
|
+
// Otherwise, return the value
|
196
|
+
@else {
|
197
|
+
@return nth($values, $i);
|
198
|
+
}
|
199
|
+
}
|
200
|
+
|
201
|
+
/// Get a value for a breakpoint from a responsive config map. If the config map has the key `$value`, the exact breakpoint value is returned. If the config map does *not* have the breakpoint, the value matching the next lowest breakpoint in the config map is returned.
|
202
|
+
/// @access private
|
203
|
+
///
|
204
|
+
/// @param {Map} $map - Input config map.
|
205
|
+
/// @param {Keyword} $value - Breakpoint name to use.
|
206
|
+
///
|
207
|
+
/// @return {Mixed} The corresponding breakpoint value.
|
208
|
+
@function -zf-get-bp-val($map, $value) {
|
209
|
+
// Check if the breakpoint name exists globally
|
210
|
+
@if not map-has-key($breakpoints, $value) {
|
211
|
+
@return null;
|
212
|
+
}
|
213
|
+
// Check if the breakpoint name exists in the local config map
|
214
|
+
@else if map-has-key($map, $value) {
|
215
|
+
// If it does, just return the value
|
216
|
+
@return map-get($map, $value);
|
217
|
+
}
|
218
|
+
// Otherwise, find the next lowest breakpoint and return that value
|
219
|
+
@else {
|
220
|
+
$anchor: null;
|
221
|
+
$found: false;
|
222
|
+
|
223
|
+
@each $key, $val in $breakpoints {
|
224
|
+
@if not $found {
|
225
|
+
@if map-has-key($map, $key) {
|
226
|
+
$anchor: $key;
|
227
|
+
}
|
228
|
+
@if $key == $value {
|
229
|
+
$found: true;
|
230
|
+
}
|
231
|
+
}
|
232
|
+
}
|
233
|
+
|
234
|
+
@return map-get($map, $anchor);
|
235
|
+
}
|
236
|
+
}
|
237
|
+
|
238
|
+
// Legacy breakpoint variables
|
239
|
+
// These will be removed in 6.3
|
240
|
+
$small-up: null;
|
241
|
+
$small-only: null;
|
242
|
+
$medium-up: null;
|
243
|
+
$medium-only: null;
|
244
|
+
$large-up: null;
|
245
|
+
$large-only: null;
|
246
|
+
$xlarge-up: null;
|
247
|
+
$xlarge-only: null;
|
248
|
+
$xxlarge-up: null;
|
249
|
+
$xxlarge-only: null;
|
250
|
+
|
251
|
+
@if map-has-key($breakpoints, small) {
|
252
|
+
$small-up: screen;
|
253
|
+
$small-only: unquote('screen and #{breakpoint(small only)}');
|
254
|
+
}
|
255
|
+
|
256
|
+
@if map-has-key($breakpoints, medium) {
|
257
|
+
$medium-up: unquote('screen and #{breakpoint(medium)}');
|
258
|
+
$medium-only: unquote('screen and #{breakpoint(medium only)}');
|
259
|
+
}
|
260
|
+
|
261
|
+
@if map-has-key($breakpoints, large) {
|
262
|
+
$large-up: unquote('screen and #{breakpoint(large)}');
|
263
|
+
$large-only: unquote('screen and #{breakpoint(large only)}');
|
264
|
+
}
|
265
|
+
|
266
|
+
@if map-has-key($breakpoints, xlarge) {
|
267
|
+
$xlarge-up: unquote('screen and #{breakpoint(xlarge)}');
|
268
|
+
$xlarge-only: unquote('screen and #{breakpoint(xlarge only)}');
|
269
|
+
}
|
270
|
+
|
271
|
+
@if map-has-key($breakpoints, xxlarge) {
|
272
|
+
$xxlarge-up: unquote('screen and #{breakpoint(xxlarge)}');
|
273
|
+
}
|