pusher-chameleon 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +7 -0
  2. data/.ruby-version +1 -0
  3. data/Gemfile +3 -0
  4. data/Gemfile.lock +23 -0
  5. data/README.md +17 -0
  6. data/docs/.gitignore +4 -0
  7. data/docs/Gemfile +10 -0
  8. data/docs/Gemfile.lock +72 -0
  9. data/docs/README.md +15 -0
  10. data/docs/Rakefile +40 -0
  11. data/docs/_config.production.yml +18 -0
  12. data/docs/_config.yml +39 -0
  13. data/docs/_includes/footer.html +38 -0
  14. data/docs/_includes/head.html +15 -0
  15. data/docs/_includes/header.html +27 -0
  16. data/docs/_includes/icon-github.html +1 -0
  17. data/docs/_includes/icon-github.svg +3 -0
  18. data/docs/_includes/logo-pusher.svg +4 -0
  19. data/docs/_includes/sidebar.html +33 -0
  20. data/docs/_layouts/default.html +53 -0
  21. data/docs/_layouts/page.html +14 -0
  22. data/docs/_layouts/post.html +15 -0
  23. data/docs/_plugins/chameleon_version.rb +11 -0
  24. data/docs/_plugins/copy_images_directory.rb +22 -0
  25. data/docs/_plugins/ext.rb +2 -0
  26. data/docs/_posts/2016-03-16-getting-started.md +28 -0
  27. data/docs/_posts/2016-03-16-introduction.md +24 -0
  28. data/docs/_posts/2016-03-17-buttons.md +61 -0
  29. data/docs/_posts/2016-03-17-colors.md +139 -0
  30. data/docs/_posts/2016-03-17-flex.md +24 -0
  31. data/docs/_posts/2016-03-17-forms.md +66 -0
  32. data/docs/_posts/2016-03-17-visibility.md +28 -0
  33. data/docs/_posts/2016-04-04-typography.md +111 -0
  34. data/docs/_posts/2016-04-05-syntax-highlighting.md +28 -0
  35. data/docs/_posts/2016-05-08-alerts.md +50 -0
  36. data/docs/_posts/2016-05-12-labels.md +22 -0
  37. data/docs/_posts/2016-05-13-tooltips.md +33 -0
  38. data/docs/_sass/_base.scss +36 -0
  39. data/docs/_sass/_chameleon_imports.scss +20 -0
  40. data/docs/_sass/_layout.scss +136 -0
  41. data/docs/_sass/_typography.scss +41 -0
  42. data/docs/_sass/layout/_aside.scss +151 -0
  43. data/docs/about.md +15 -0
  44. data/docs/autoprefixer.yml +4 -0
  45. data/docs/css/main.scss +11 -0
  46. data/docs/feed.xml +30 -0
  47. data/docs/index.html +23 -0
  48. data/images/ui_icons/alert_beta.svg +3 -0
  49. data/images/ui_icons/alert_info.svg +3 -0
  50. data/images/ui_icons/alert_tick.svg +6 -0
  51. data/images/ui_icons/alert_warning.svg +6 -0
  52. data/images/ui_icons/chevron_down.svg +3 -0
  53. data/images/ui_icons/github--active.svg +6 -0
  54. data/images/ui_icons/github.svg +6 -0
  55. data/images/ui_icons/google--active.svg +6 -0
  56. data/images/ui_icons/google.svg +10 -0
  57. data/images/ui_icons/plus.svg +3 -0
  58. data/javascripts/chameleon/code_box.js +14 -0
  59. data/javascripts/chameleon/pusher_featurette.js +52 -0
  60. data/javascripts/chameleon/pusher_text_cycler.js +60 -0
  61. data/lib/pusher-chameleon.rb +71 -0
  62. data/lib/pusher-chameleon/engine.rb +13 -0
  63. data/lib/pusher-chameleon/version.rb +8 -0
  64. data/package.json +24 -0
  65. data/pusher-chameleon.gemspec +21 -0
  66. data/stylesheets/.gitkeep +0 -0
  67. data/stylesheets/_base.scss +400 -0
  68. data/stylesheets/_global.scss +96 -0
  69. data/stylesheets/chameleon.scss +30 -0
  70. data/stylesheets/components/_alert.scss +102 -0
  71. data/stylesheets/components/_code_box.scss +84 -0
  72. data/stylesheets/components/_flex_aligners.scss +38 -0
  73. data/stylesheets/components/_label.scss +41 -0
  74. data/stylesheets/components/_signpost.scss +150 -0
  75. data/stylesheets/components/_spacers.scss +11 -0
  76. data/stylesheets/components/_statistic.scss +62 -0
  77. data/stylesheets/components/_tooltip.scss +65 -0
  78. data/stylesheets/components/_visibility.scss +117 -0
  79. data/stylesheets/forms/_base.scss +47 -0
  80. data/stylesheets/forms/_buttons.scss +242 -0
  81. data/stylesheets/forms/_checkbox.scss +31 -0
  82. data/stylesheets/forms/_field.scss +11 -0
  83. data/stylesheets/forms/_fieldset.scss +18 -0
  84. data/stylesheets/forms/_forms.scss +21 -0
  85. data/stylesheets/forms/_input.scss +14 -0
  86. data/stylesheets/forms/_range.scss +110 -0
  87. data/stylesheets/forms/_select.scss +15 -0
  88. data/stylesheets/forms/_textarea.scss +11 -0
  89. data/stylesheets/grid/_classes.scss +152 -0
  90. data/stylesheets/grid/_column.scss +126 -0
  91. data/stylesheets/grid/_flex-grid.scss +268 -0
  92. data/stylesheets/grid/_grid.scss +60 -0
  93. data/stylesheets/grid/_gutter.scss +34 -0
  94. data/stylesheets/grid/_layout.scss +51 -0
  95. data/stylesheets/grid/_position.scss +73 -0
  96. data/stylesheets/grid/_row.scss +95 -0
  97. data/stylesheets/grid/_size.scss +24 -0
  98. data/stylesheets/typography/_base.scss +60 -0
  99. data/stylesheets/typography/_helpers.scss +66 -0
  100. data/stylesheets/typography/_import.scss +54 -0
  101. data/stylesheets/typography/_syntax_highlighting.scss +168 -0
  102. data/stylesheets/typography/_syntax_highlighting_dark.scss +73 -0
  103. data/stylesheets/typography/_syntax_highlighting_light.scss +73 -0
  104. data/stylesheets/typography/_titles.scss +69 -0
  105. data/stylesheets/typography/_typography.scss +12 -0
  106. data/stylesheets/util/_breakpoint.scss +273 -0
  107. data/stylesheets/util/_color.scss +42 -0
  108. data/stylesheets/util/_flex.scss +68 -0
  109. data/stylesheets/util/_mixins.scss +233 -0
  110. data/stylesheets/util/_selector.scss +40 -0
  111. data/stylesheets/util/_unit.scss +90 -0
  112. data/stylesheets/util/_url_helper.scss +30 -0
  113. data/stylesheets/util/_util.scss +13 -0
  114. data/stylesheets/util/_value.scss +107 -0
  115. metadata +199 -0
@@ -0,0 +1,42 @@
1
+ // Foundation for Sites by ZURB
2
+ // foundation.zurb.com
3
+ // Licensed under MIT Open Source
4
+
5
+ ////
6
+ /// @group functions
7
+ ////
8
+
9
+ /// Checks the lightness of `$color`, and if it passes the `$threshold` of lightness, it returns the `$yes` color. Otherwise, it returns the `$no` color. Use this function to dynamically output a foreground color based on a given background color.
10
+ ///
11
+ /// @param {Color} $color - Color to check the lightness of.
12
+ /// @param {Color} $yes [$black] - Color to return if `$color` is light.
13
+ /// @param {Color} $no [$white] - Color to return if `$color` is dark.
14
+ /// @param {Percentage} $threshold [60%] - Threshold of lightness to check against.
15
+ ///
16
+ /// @returns {Color} The $yes color or $no color.
17
+ @function foreground($color, $yes: $black, $no: $white, $threshold: 60%) {
18
+ @if $color == transparent {
19
+ $color: $body-background;
20
+ }
21
+ @if (lightness($color) > $threshold) {
22
+ @return $yes;
23
+ }
24
+ @else {
25
+ @return $no;
26
+ }
27
+ }
28
+
29
+ /// Scales a color to be lighter if it's light, or darker if it's dark. Use this function to tint a color appropriate to its lightness.
30
+ ///
31
+ /// @param {Color} $color - Color to scale.
32
+ /// @param {Percentage} $scale [5%] - Amount to scale up or down.
33
+ /// @param {Percentage} $threshold [40%] - Threshold of lightness to check against.
34
+ ///
35
+ /// @returns {Color} A scaled color.
36
+ @function smart-scale($color, $scale: 5%, $threshold: 40%) {
37
+ @if lightness($color) > $threshold {
38
+ $scale: -$scale;
39
+ }
40
+ @return scale-color($color, $lightness: $scale);
41
+ }
42
+
@@ -0,0 +1,68 @@
1
+ $-zf-flex-justify: (
2
+ 'left': flex-start,
3
+ 'right': flex-end,
4
+ 'center': center,
5
+ 'justify': space-between,
6
+ 'spaced': space-around,
7
+ );
8
+
9
+ $-zf-flex-align: (
10
+ 'top': flex-start,
11
+ 'bottom': flex-end,
12
+ 'middle': center,
13
+ 'stretch': stretch,
14
+ );
15
+
16
+ /// Enables flexbox by adding `display: flex` to the element.
17
+ @mixin flex {
18
+ display: flex;
19
+ }
20
+
21
+ /// Horizontally or vertically aligns the items within a flex container.
22
+ ///
23
+ /// @param {Keyword} $x [null] - Horizontal alignment to use. Can be `left`, `right`, `center`, `justify`, or `spaced`. Or, set it to `null` (the default) to not set horizontal alignment.
24
+ /// @param {Keyword} $y [null] - Vertical alignment to use. Can be `top`, `bottom`, `middle`, or `stretch`. Or, set it to `null` (the default) to not set vertical alignment.
25
+ @mixin flex-align($x: null, $y: null) {
26
+ @if $x {
27
+ @if map-has-key($-zf-flex-justify, $x) {
28
+ $x: map-get($-zf-flex-justify, $x);
29
+ }
30
+ @else {
31
+ @warn 'flex-grid-row-align(): #{$x} is not a valid value for horizontal alignment. Use left, right, center, justify, or spaced.'
32
+ }
33
+ }
34
+
35
+ @if $y {
36
+ @if map-has-key($-zf-flex-align, $y) {
37
+ $y: map-get($-zf-flex-align, $y);
38
+ }
39
+ @else {
40
+ @warn 'flex-grid-row-align(): #{$y} is not a valid value for vertical alignment. Use top, bottom, middle, or stretch.'
41
+ }
42
+ }
43
+
44
+ justify-content: $x;
45
+ align-items: $y;
46
+ }
47
+
48
+ /// Vertically align a single column within a flex row. Apply this mixin to a flex column.
49
+ ///
50
+ /// @param {Keyword} $y [null] - Vertical alignment to use. Can be `top`, `bottom`, `middle`, or `stretch`. Or, set it to `null` (the default) to not set vertical alignment.
51
+ @mixin flex-align-self($y: null) {
52
+ @if $y {
53
+ @if map-has-key($-zf-flex-align, $y) {
54
+ $y: map-get($-zf-flex-align, $y);
55
+ }
56
+ @else {
57
+ @warn 'flex-grid-column-align(): #{$y} is not a valid value for alignment. Use top, bottom, middle, or stretch.'
58
+ }
59
+ }
60
+
61
+ align-self: $y;
62
+ }
63
+
64
+ /// Changes the source order of a flex child. Children with lower numbers appear first in the layout.
65
+ /// @param {Number} $order [0] - Order number to apply.
66
+ @mixin flex-order($order: 0) {
67
+ order: $order;
68
+ }
@@ -0,0 +1,233 @@
1
+ // Foundation for Sites by ZURB
2
+ // foundation.zurb.com
3
+ // Licensed under MIT Open Source
4
+
5
+ ////
6
+ /// @group functions
7
+ ////
8
+
9
+ /// Creates a CSS triangle, which can be used for dropdown arrows, dropdown pips, and more. Use this mixin inside a `&::before` or `&::after` selector, to attach the triangle to an existing element.
10
+ ///
11
+ /// @param {Number} $triangle-size - Width of the triangle.
12
+ /// @param {Color} $triangle-color - Color of the triangle.
13
+ /// @param {Keyword} $triangle-direction - Direction the triangle points. Can be `up`, `right`, `down`, or `left`.
14
+ @mixin css-triangle(
15
+ $triangle-size,
16
+ $triangle-color,
17
+ $triangle-direction
18
+ ) {
19
+ content: '';
20
+ display: block;
21
+ width: 0;
22
+ height: 0;
23
+ border: inset $triangle-size;
24
+
25
+ @if ($triangle-direction == down) {
26
+ border-color: $triangle-color transparent transparent;
27
+ border-top-style: solid;
28
+ border-bottom-width: 0;
29
+ }
30
+ @if ($triangle-direction == up) {
31
+ border-color: transparent transparent $triangle-color;
32
+ border-bottom-style: solid;
33
+ border-top-width: 0;
34
+ }
35
+ @if ($triangle-direction == right) {
36
+ border-color: transparent transparent transparent $triangle-color;
37
+ border-left-style: solid;
38
+ border-right-width: 0;
39
+ }
40
+ @if ($triangle-direction == left) {
41
+ border-color: transparent $triangle-color transparent transparent;
42
+ border-right-style: solid;
43
+ border-left-width: 0;
44
+ }
45
+ }
46
+
47
+ /// Creates a menu icon with a set width, height, number of bars, and colors. The mixin uses the height of the icon and the weight of the bars to determine spacing. <div class="docs-example-burger"></div>
48
+ ///
49
+ /// @param {Color} $color [$black] - Color to use for the icon.
50
+ /// @param {Color} $color-hover [$dark-gray] - Color to use when the icon is hovered over.
51
+ /// @param {Number} $width [20px] - Width of the icon.
52
+ /// @param {Number} $height [16px] - Height of the icon.
53
+ /// @param {Number} $weight [2px] - Height of individual bars in the icon.
54
+ /// @param {Number} $bars [3] - Number of bars in the icon.
55
+ @mixin hamburger(
56
+ $color: $black,
57
+ $color-hover: $dark-gray,
58
+ $width: 20px,
59
+ $height: 16px,
60
+ $weight: 2px,
61
+ $bars: 3
62
+ ) {
63
+ // box-shadow CSS output
64
+ $shadow: ();
65
+ $hover-shadow: ();
66
+
67
+ // Spacing between bars is calculated based on the total height of the icon and the weight of each bar
68
+ $spacing: floor(($height - ($weight * $bars)) / ($bars - 1));
69
+
70
+ // Icon container
71
+ position: relative;
72
+ display: inline-block;
73
+ vertical-align: middle;
74
+ cursor: pointer;
75
+ width: $width;
76
+ height: $height;
77
+
78
+ // Icon bars
79
+ &::after {
80
+ content: '';
81
+ position: absolute;
82
+ display: block;
83
+ width: 100%;
84
+ height: $weight;
85
+ background: $color;
86
+ top: 0;
87
+ left: 0;
88
+
89
+ @for $i from 2 through $bars {
90
+ $offset: ($weight + $spacing) * ($i - 1);
91
+ $shadow: append($shadow, 0 $offset 0 $color, comma);
92
+ }
93
+
94
+ box-shadow: $shadow;
95
+ }
96
+
97
+ // Hover state
98
+ @if $color-hover {
99
+ // Generate CSS
100
+ @for $i from 2 through $bars {
101
+ $offset: ($weight + $spacing) * ($i - 1);
102
+ $hover-shadow: append($hover-shadow, 0 $offset 0 $color-hover, comma);
103
+ }
104
+
105
+ &:hover::after {
106
+ background: $color-hover;
107
+ box-shadow: $hover-shadow;
108
+ }
109
+ }
110
+ }
111
+
112
+ /// Adds a downward-facing triangle as a background image to an element. The image is formatted as an SVG, making it easy to change the color. Because Internet Explorer doesn't support encoded SVGs as background images, a PNG fallback is also included.
113
+ /// There are two PNG fallbacks: a black triangle and a white triangle. The one used depends on the lightness of the input color.
114
+ ///
115
+ /// @param {Color} $color [$black] - Color to use for the triangle.
116
+ @mixin background-triangle($color: $black) {
117
+ $rgb: 'rgb%28#{red($color)}, #{green($color)}, #{blue($color)}%29';
118
+
119
+ background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="32" height="24" viewBox="0 0 32 24"><polygon points="0,0 32,0 16,24" style="fill: #{$rgb}"></polygon></svg>');
120
+
121
+ @media screen and (min-width:0\0) {
122
+ @if lightness($color) < 60% {
123
+ // White triangle
124
+ background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAYCAYAAACbU/80AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIpJREFUeNrEkckNgDAMBBfRkEt0ObRBBdsGXUDgmQfK4XhH2m8czQAAy27R3tsw4Qfe2x8uOO6oYLb6GlOor3GF+swURAOmUJ+RwtEJs9WvTGEYxBXqI1MQAZhCfUQKRzDMVj+TwrAIV6jvSUEkYAr1LSkcyTBb/V+KYfX7xAeusq3sLDtGH3kEGACPWIflNZfhRQAAAABJRU5ErkJggg==');
125
+ }
126
+ @else {
127
+ // Black triangle
128
+ background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAYCAYAAACbU/80AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAMBJREFUeNrEllsOhCAMRVszC9IlzU7KCmVHTJsoMWYMUtpyv9BgbuXQB5ZSdgBYYY4ycgBivk8KYFsQMfMiTTBP4o3nUzCKzOabLJbLy2/g31evGkAginR4/ZegKH5qX3bJCscA3t0x3kgO5tQFyhhFf50xRqFLbyMUNJQzgyjGS/wgCpvKqkRBpuWrE4V9d+1E4dPUXqIg107SQOE/2DRQxMwTDygIInVDET9T3lCoj/6j/VCmGjZOl2lKpZ8AAwDQP7zIimDGFQAAAABJRU5ErkJggg==');
129
+ }
130
+ }
131
+ }
132
+
133
+ /// Applies the micro clearfix hack popularized by Nicolas Gallagher. Include this mixin on a container if its children are all floated, to give the container a proper height.
134
+ /// The clearfix is augmented with specific styles to prevent borders in flexbox environments
135
+ /// @link http://nicolasgallagher.com/micro-clearfix-hack/ Micro Clearfix Hack
136
+ /// @link http://danisadesigner.com/blog/flexbox-clear-fix-pseudo-elements/ Flexbox fix
137
+ @mixin clearfix {
138
+ &::before,
139
+ &::after {
140
+ content: ' ';
141
+ display: table;
142
+ flex-basis: 0;
143
+ order: 1;
144
+ }
145
+
146
+ &::after {
147
+ clear: both;
148
+ }
149
+ }
150
+
151
+ /// Adds CSS for a "quantity query" selector that automatically sizes elements based on how many there are inside a container.
152
+ /// @link http://alistapart.com/article/quantity-queries-for-css Quantity Queries for CSS
153
+ ///
154
+ /// @param {Number} $max - Maximum number of items to detect. The higher this number is, the more CSS that's required to cover each number of items.
155
+ /// @param {Keyword} $elem [li] - Tag to use for sibling selectors.
156
+ @mixin auto-width($max, $elem: li) {
157
+ @for $i from 2 through $max {
158
+ &:nth-last-child(#{$i}):first-child,
159
+ &:nth-last-child(#{$i}):first-child ~ #{$elem} {
160
+ width: percentage(1 / $i);
161
+ }
162
+ }
163
+ }
164
+
165
+ /// Removes the focus ring around an element when a mouse input is detected.
166
+ @mixin disable-mouse-outline {
167
+ [data-whatinput='mouse'] & {
168
+ outline: 0;
169
+ }
170
+ }
171
+
172
+ /// Makes an element visually hidden, but still accessible to keyboards and assistive devices.
173
+ /// @link http://snook.ca/archives/html_and_css/hiding-content-for-accessibility Hiding Content for Accessibility
174
+ @mixin element-invisible {
175
+ position: absolute !important;
176
+ width: 1px;
177
+ height: 1px;
178
+ overflow: hidden;
179
+ clip: rect(0, 0, 0, 0);
180
+ }
181
+
182
+ /// Reverses the CSS output created by the `element-invisible()` mixin.
183
+ @mixin element-invisible-off {
184
+ position: static !important;
185
+ height: auto;
186
+ width: auto;
187
+ overflow: visible;
188
+ clip: auto;
189
+ }
190
+
191
+ /// Vertically centers the element inside of its first non-static parent,
192
+ /// @link http://www.sitepoint.com/centering-with-sass/ Centering With Sass
193
+ @mixin vertical-center {
194
+ position: absolute;
195
+ top: 50%;
196
+ transform: translateY(-50%);
197
+ }
198
+
199
+ /// Horizontally centers the element inside of its first non-static parent,
200
+ /// @link http://www.sitepoint.com/centering-with-sass/ Centering With Sass
201
+ @mixin horizontal-center {
202
+ position: absolute;
203
+ left: 50%;
204
+ transform: translateX(-50%);
205
+ }
206
+
207
+ /// Absolutely centers the element inside of its first non-static parent,
208
+ /// @link http://www.sitepoint.com/centering-with-sass/ Centering With Sass
209
+ @mixin absolute-center {
210
+ position: absolute;
211
+ top: 50%;
212
+ left: 50%;
213
+ transform: translate(-50%, -50%);
214
+ }
215
+
216
+ /// Iterates through breakpoints defined in `$breakpoint-classes` and prints the CSS inside the mixin at each breakpoint's media query. Use this with the grid, or any other component that has responsive classes.
217
+ ///
218
+ /// @param {Boolean} $small [true] - If `false`, the mixin will skip the `small` breakpoint. Use this with components that don't prefix classes with `small-`, only `medium-` and up.
219
+ @mixin -zf-each-breakpoint($small: true) {
220
+ $map: $breakpoint-classes;
221
+
222
+ @if not $small {
223
+ $map: map-remove($map, small);
224
+ }
225
+
226
+ @each $size in $map {
227
+ $-zf-size: $size !global;
228
+
229
+ @include breakpoint($size) {
230
+ @content;
231
+ }
232
+ }
233
+ }
@@ -0,0 +1,40 @@
1
+ // Foundation for Sites by ZURB
2
+ // foundation.zurb.com
3
+ // Licensed under MIT Open Source
4
+
5
+ ////
6
+ /// @group functions
7
+ ////
8
+
9
+ /// Generates a selector with every text input type. You can also filter the list to only output a subset of those selectors.
10
+ ///
11
+ /// @param {List|Keyword} $types [()] - A list of text input types to use. Leave blank to use all of them.
12
+ @function text-inputs($types: ()) {
13
+ $return: ();
14
+
15
+ $all-types:
16
+ text
17
+ password
18
+ date
19
+ datetime
20
+ datetime-local
21
+ month
22
+ week
23
+ email
24
+ number
25
+ search
26
+ tel
27
+ time
28
+ url
29
+ color;
30
+
31
+ @if not has-value($types) {
32
+ $types: $all-types;
33
+ }
34
+
35
+ @each $type in $types {
36
+ $return: append($return, unquote('[type=\'#{$type}\']'), comma);
37
+ }
38
+
39
+ @return $return;
40
+ }
@@ -0,0 +1,90 @@
1
+ // Foundation for Sites by ZURB
2
+ // foundation.zurb.com
3
+ // Licensed under MIT Open Source
4
+
5
+ ////
6
+ /// @group functions
7
+ ////
8
+
9
+ $global-font-size: 100% !default;
10
+
11
+ // scss-lint:disable ZeroUnit
12
+
13
+ /// Removes the unit (e.g. px, em, rem) from a value, returning the number only.
14
+ ///
15
+ /// @param {Number} $num - Number to strip unit from.
16
+ ///
17
+ /// @returns {Number} The same number, sans unit.
18
+ @function strip-unit($num) {
19
+ @return $num / ($num * 0 + 1);
20
+ }
21
+
22
+ /// Converts one or more pixel values into matching rem values.
23
+ ///
24
+ /// @param {Number|List} $values - One or more values to convert. Be sure to separate them with spaces and not commas. If you need to convert a comma-separated list, wrap the list in parentheses.
25
+ /// @param {Number} $base [null] - The base value to use when calculating the `rem`. If you're using Foundation out of the box, this is 16px. If this parameter is `null`, the function will reference the `$base-font-size` variable as the base.
26
+ ///
27
+ /// @returns {List} A list of converted values.
28
+ @function rem-calc($values, $base: null) {
29
+ $rem-values: ();
30
+ $count: length($values);
31
+
32
+ // If no base is defined, defer to the global font size
33
+ @if $base == null {
34
+ $base: $global-font-size;
35
+ }
36
+
37
+ // If the base font size is a %, then multiply it by 16px
38
+ // This is because 100% font size = 16px in most all browsers
39
+ @if unit($base) == '%' {
40
+ $base: ($base / 100%) * 16px;
41
+ }
42
+
43
+ @if $count == 1 {
44
+ @return -zf-to-rem($values, $base);
45
+ }
46
+
47
+ @for $i from 1 through $count {
48
+ $rem-values: append($rem-values, -zf-to-rem(nth($values, $i), $base));
49
+ }
50
+
51
+ @return $rem-values;
52
+ }
53
+
54
+ // Converts a unitless, pixel, or rem value to em, for use in breakpoints.
55
+ @function -zf-bp-to-em($value) {
56
+ // Pixel and unitless values are converted to rems
57
+ @if unit($value) == 'px' or unitless($value) {
58
+ $value: rem-calc($value, $base: 16px);
59
+ }
60
+
61
+ // Then the value is converted to ems
62
+ @return strip-unit($value) * 1em;
63
+ }
64
+
65
+ /// Converts a pixel value to matching rem value. *Any* value passed, regardless of unit, is assumed to be a pixel value. By default, the base pixel value used to calculate the rem value is taken from the `$global-font-size` variable.
66
+ /// @access private
67
+ ///
68
+ /// @param {Number} $value - Pixel value to convert.
69
+ /// @param {Number} $base [null] - Base for pixel conversion.
70
+ ///
71
+ /// @returns {Number} A number in rems, calculated based on the given value and the base pixel value. rem values are passed through as is.
72
+ @function -zf-to-rem($value, $base: null) {
73
+ // Check if the value is a number
74
+ @if type-of($value) != 'number' {
75
+ @warn inspect($value) + ' was passed to rem-calc(), which is not a number.';
76
+ @return $value;
77
+ }
78
+
79
+ // Calculate rem if units for $value is not rem
80
+ @if unit($value) != 'rem' {
81
+ $value: strip-unit($value) / strip-unit($base) * 1rem;
82
+ }
83
+
84
+ // Turn 0rem into 0
85
+ @if $value == 0rem {
86
+ $value: 0;
87
+ }
88
+
89
+ @return $value;
90
+ }