doggystyle 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/.hound.yml +5 -0
- data/.npmignore +18 -0
- data/.ruby-version +1 -0
- data/.scss-lint.yml +243 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/RELEASING.md +1 -0
- data/Rakefile +9 -0
- data/bin/doggystyle +5 -0
- data/bower.json +38 -0
- data/circle.yml +13 -0
- data/core/_imports.scss +229 -0
- data/core/animations/_jump.scss +7 -0
- data/core/animations/_shake.scss +24 -0
- data/core/animations/_wobble.scss +8 -0
- data/core/functions/_mobile-first.scss +3 -0
- data/core/functions/_opposite-direction.scss +45 -0
- data/core/functions/casts/_to-bool.scss +19 -0
- data/core/functions/casts/_to-color.scss +74 -0
- data/core/functions/casts/_to-list.scss +38 -0
- data/core/functions/casts/_to-map.scss +27 -0
- data/core/functions/casts/_to-null.scss +15 -0
- data/core/functions/casts/_to-number.scss +66 -0
- data/core/functions/casts/_to-string.scss +15 -0
- data/core/functions/colours/_colour-contrast.scss +61 -0
- data/core/functions/colours/_colour.scss +69 -0
- data/core/functions/colours/_random-colour.scss +78 -0
- data/core/functions/lists/_contains.scss +62 -0
- data/core/functions/lists/_first.scss +19 -0
- data/core/functions/lists/_insert-nth.scss +37 -0
- data/core/functions/lists/_last.scss +11 -0
- data/core/functions/lists/_merge.scss +30 -0
- data/core/functions/lists/_prepend.scss +11 -0
- data/core/functions/lists/_remove-nth.scss +53 -0
- data/core/functions/lists/_remove.scss +30 -0
- data/core/functions/lists/_replace-nth.scss +55 -0
- data/core/functions/lists/_replace.scss +36 -0
- data/core/functions/lists/_reverse.scss +31 -0
- data/core/functions/lists/_second.scss +19 -0
- data/core/functions/lists/_shift.scss +24 -0
- data/core/functions/lists/_slice.scss +52 -0
- data/core/functions/lists/_sort.scss +51 -0
- data/core/functions/maps/_map-deep-get.scss +51 -0
- data/core/functions/maps/_map-deep-set.scss +34 -0
- data/core/functions/maps/_map-depth.scss +23 -0
- data/core/functions/maps/_map-extend.scss +47 -0
- data/core/functions/maps/_map-has-keys.scss +23 -0
- data/core/functions/maps/_map-has-nested-keys.scss +24 -0
- data/core/functions/maps/_map-set.scss +4 -0
- data/core/functions/maps/_map-zip.scss +50 -0
- data/core/functions/numbers/_add-unit.scss +54 -0
- data/core/functions/numbers/_pad.scss +16 -0
- data/core/functions/numbers/_spacer.scss +16 -0
- data/core/functions/numbers/_strip.scss +29 -0
- data/core/functions/numbers/_units.scss +17 -0
- data/core/functions/svg/_dots.scss +84 -0
- data/core/functions/svg/_fake-radius.scss +131 -0
- data/core/functions/svg/_lines.scss +76 -0
- data/core/functions/svg/_svg.scss +12 -0
- data/core/functions/text/_smart-lineheight.scss +13 -0
- data/core/functions/text/_string-explode.scss +45 -0
- data/core/functions/text/_string-replace.scss +38 -0
- data/core/helpers/_custom-elements.scss +114 -0
- data/core/helpers/_eases.scss +44 -0
- data/core/helpers/_reset.scss +282 -0
- data/core/helpers/_show-breakpoints.scss +25 -0
- data/core/helpers/_strings.scss +648 -0
- data/core/helpers/_warnings.scss +3 -0
- data/core/helpers/checks/_check.scss +69 -0
- data/core/helpers/checks/_is-absolute-length.scss +25 -0
- data/core/helpers/checks/_is-angel.scss +25 -0
- data/core/helpers/checks/_is-arglist.scss +11 -0
- data/core/helpers/checks/_is-bool.scss +23 -0
- data/core/helpers/checks/_is-calc.scss +11 -0
- data/core/helpers/checks/_is-colour.scss +23 -0
- data/core/helpers/checks/_is-dark.scss +14 -0
- data/core/helpers/checks/_is-duration.scss +15 -0
- data/core/helpers/checks/_is-false.scss +13 -0
- data/core/helpers/checks/_is-first-character.scss +11 -0
- data/core/helpers/checks/_is-frequency.scss +15 -0
- data/core/helpers/checks/_is-function.scss +44 -0
- data/core/helpers/checks/_is-integer.scss +15 -0
- data/core/helpers/checks/_is-length.scss +16 -0
- data/core/helpers/checks/_is-light.scss +14 -0
- data/core/helpers/checks/_is-list.scss +11 -0
- data/core/helpers/checks/_is-map.scss +11 -0
- data/core/helpers/checks/_is-null.scss +11 -0
- data/core/helpers/checks/_is-number.scss +19 -0
- data/core/helpers/checks/_is-percentage.scss +13 -0
- data/core/helpers/checks/_is-position.scss +16 -0
- data/core/helpers/checks/_is-pseudo.scss +24 -0
- data/core/helpers/checks/_is-relative-length.scss +25 -0
- data/core/helpers/checks/_is-resolution.scss +15 -0
- data/core/helpers/checks/_is-selector.scss +3 -0
- data/core/helpers/checks/_is-string.scss +11 -0
- data/core/helpers/checks/_is-time.scss +15 -0
- data/core/helpers/checks/_is-unit.scss +16 -0
- data/core/helpers/private/_arglist-to-list.scss +36 -0
- data/core/helpers/private/_brightness.scss +13 -0
- data/core/helpers/private/_find-digits.scss +41 -0
- data/core/helpers/private/_find-integer.scss +40 -0
- data/core/helpers/private/_from-hex.scss +48 -0
- data/core/helpers/private/_from-hsl.scss +55 -0
- data/core/helpers/private/_from-rgb.scss +55 -0
- data/core/helpers/private/_get-color-value.scss +26 -0
- data/core/helpers/private/_hash-fix.scss +15 -0
- data/core/helpers/private/_hex-to-dec.scss +28 -0
- data/core/helpers/private/_length.scss +26 -0
- data/core/helpers/private/_lightness.scss +15 -0
- data/core/helpers/private/_list-items-to-strings.scss +8 -0
- data/core/helpers/private/_min-max-number.scss +12 -0
- data/core/helpers/private/_pow.scss +29 -0
- data/core/helpers/private/_string-compare.scss +38 -0
- data/core/helpers/private/_string-explode.scss +43 -0
- data/core/helpers/private/_sudo.scss +23 -0
- data/core/helpers/symbols/_arrows.scss +337 -0
- data/core/helpers/symbols/_block.scss +97 -0
- data/core/helpers/symbols/_box.scss +385 -0
- data/core/helpers/symbols/_common.scss +101 -0
- data/core/helpers/symbols/_currency.scss +82 -0
- data/core/helpers/symbols/_dingbats.scss +565 -0
- data/core/helpers/symbols/_geometric.scss +289 -0
- data/core/helpers/symbols/_letterlike.scss +235 -0
- data/core/helpers/symbols/_misc.scss +568 -0
- data/core/helpers/symbols/_operators.scss +766 -0
- data/core/helpers/symbols/_punctuation.scss +214 -0
- data/core/mixins/_align.scss +15 -0
- data/core/mixins/_animate.scss +16 -0
- data/core/mixins/_aspect-ratio.scss +86 -0
- data/core/mixins/_backface-visibility.scss +7 -0
- data/core/mixins/_background-image.scss +13 -0
- data/core/mixins/_blend.scss +10 -0
- data/core/mixins/_blendmodes.scss +24 -0
- data/core/mixins/_border-radius.scss +105 -0
- data/core/mixins/_browsers.scss +155 -0
- data/core/mixins/_bulletpoint.scss +12 -0
- data/core/mixins/_center.scss +3 -0
- data/core/mixins/_clearfix.scss +7 -0
- data/core/mixins/_columns.scss +22 -0
- data/core/mixins/_custom-property.scss +15 -0
- data/core/mixins/_devices.scss +97 -0
- data/core/mixins/_dropdown.scss +38 -0
- data/core/mixins/_fake-radius.scss +99 -0
- data/core/mixins/_filters.scss +163 -0
- data/core/mixins/_flip.scss +11 -0
- data/core/mixins/_font-face.scss +11 -0
- data/core/mixins/_fontsize.scss +126 -0
- data/core/mixins/_gallery.scss +134 -0
- data/core/mixins/_gradient.scss +72 -0
- data/core/mixins/_image-size.scss +18 -0
- data/core/mixins/_image.scss +12 -0
- data/core/mixins/_inputs.scss +18 -0
- data/core/mixins/_keyframes.scss +8 -0
- data/core/mixins/_last.scss +5 -0
- data/core/mixins/_nth-last.scss +7 -0
- data/core/mixins/_nth.scss +10 -0
- data/core/mixins/_placeholder.scss +15 -0
- data/core/mixins/_prefixer.scss +55 -0
- data/core/mixins/_selection.scss +15 -0
- data/core/mixins/_shadow.scss +7 -0
- data/core/mixins/_size.scss +13 -0
- data/core/mixins/_smart-horizontal.scss +21 -0
- data/core/mixins/_sudo-image.scss +12 -0
- data/core/mixins/_text-shadow.scss +30 -0
- data/core/mixins/_transforms.scss +264 -0
- data/core/mixins/_transition.scss +189 -0
- data/core/mixins/_triangle-classic.scss +170 -0
- data/core/mixins/_triangle.scss +250 -0
- data/core/mixins/_unwrap.scss +5 -0
- data/core/mixins/_user-select.scss +5 -0
- data/core/mixins/_vertical.scss +10 -0
- data/core/mixins/columns/_columns.scss +92 -0
- data/core/mixins/flexbox/_flex-container.scss +201 -0
- data/core/mixins/flexbox/_flex-grid.scss +235 -0
- data/core/mixins/flexbox/_flex-items.scss +140 -0
- data/core/mixins/flexbox/_flex-remove.scss +12 -0
- data/core/mixins/grid/_break-between.scss +6 -0
- data/core/mixins/grid/_grid.scss +150 -0
- data/core/mixins/svg/_svg-size.scss +4 -0
- data/core/mixins/svg/_svg.scss +9 -0
- data/core/placeholders/_clear.scss +27 -0
- data/core/placeholders/_cursor.scss +35 -0
- data/core/placeholders/_misc.scss +20 -0
- data/core/placeholders/_rendering.scss +21 -0
- data/core/placeholders/_text.scss +41 -0
- data/core/settings/_colours.scss +30 -0
- data/core/settings/_directories.scss +7 -0
- data/core/settings/_global.scss +14 -0
- data/core/settings/_grid.scss +24 -0
- data/core/settings/_padding.scss +8 -0
- data/core/settings/_spacing.scss +8 -0
- data/core/settings/_text.scss +13 -0
- data/doggystyle.gemspec +29 -0
- data/eyeglass-exports.js +7 -0
- data/features/install.feature +29 -0
- data/features/step_definitions/doggystyle_steps.rb +31 -0
- data/features/support/bourbon_support.rb +19 -0
- data/features/support/env.rb +1 -0
- data/features/update.feature +30 -0
- data/features/version.feature +5 -0
- data/index.js +7 -0
- data/lib/doggystyle.rb +7 -0
- data/lib/doggystyle/generator.rb +81 -0
- data/lib/doggystyle/version.rb +3 -0
- data/package.json +33 -0
- data/spec/doggystyle/library/border_color_spec.rb +51 -0
- data/spec/doggystyle/library/border_radius_spec.rb +25 -0
- data/spec/doggystyle/library/border_style_spec.rb +51 -0
- data/spec/doggystyle/library/border_width_spec.rb +51 -0
- data/spec/doggystyle/library/buttons_spec.rb +53 -0
- data/spec/doggystyle/library/clearfix_spec.rb +18 -0
- data/spec/doggystyle/library/contrast_switch_spec.rb +23 -0
- data/spec/doggystyle/library/ellipsis_spec.rb +20 -0
- data/spec/doggystyle/library/font_face_spec_1.rb +16 -0
- data/spec/doggystyle/library/font_face_spec_2.rb +21 -0
- data/spec/doggystyle/library/font_face_spec_3.rb +16 -0
- data/spec/doggystyle/library/font_face_spec_4.rb +17 -0
- data/spec/doggystyle/library/font_stacks_spec.rb +40 -0
- data/spec/doggystyle/library/hide_text_spec.rb +17 -0
- data/spec/doggystyle/library/hide_visually_spec.rb +35 -0
- data/spec/doggystyle/library/margin_spec.rb +51 -0
- data/spec/doggystyle/library/modular_scale_spec.rb +43 -0
- data/spec/doggystyle/library/padding_spec.rb +51 -0
- data/spec/doggystyle/library/position_spec.rb +67 -0
- data/spec/doggystyle/library/prefixer_spec.rb +34 -0
- data/spec/doggystyle/library/shade_spec.rb +31 -0
- data/spec/doggystyle/library/size_spec.rb +31 -0
- data/spec/doggystyle/library/strip_unit_spec.rb +31 -0
- data/spec/doggystyle/library/text_inputs_spec.rb +75 -0
- data/spec/doggystyle/library/tint_spec.rb +31 -0
- data/spec/doggystyle/library/triangle_spec.rb +31 -0
- data/spec/doggystyle/library/word_wrap_spec.rb +29 -0
- data/spec/doggystyle/utilities/assign_inputs_spec.rb +50 -0
- data/spec/doggystyle/utilities/collapse_directionals.rb +25 -0
- data/spec/doggystyle/utilities/directional_values_spec.rb +21 -0
- data/spec/doggystyle/utilities/font_source_declaration_spec.rb +29 -0
- data/spec/doggystyle/utilities/retrieve_bourbon_setting_spec.rb +31 -0
- data/spec/doggystyle/utilities/unpack_spec.rb +32 -0
- data/spec/doggystyle/validators/contains_spec.rb +27 -0
- data/spec/doggystyle/validators/is_length_spec.rb +49 -0
- data/spec/doggystyle/validators/is_light_spec.rb +37 -0
- data/spec/doggystyle/validators/is_number_spec.rb +43 -0
- data/spec/doggystyle/validators/is_size_spec.rb +43 -0
- data/spec/fixtures/_setup.scss +1 -0
- data/spec/fixtures/library/border-color.scss +26 -0
- data/spec/fixtures/library/border-radius.scss +17 -0
- data/spec/fixtures/library/border-style.scss +21 -0
- data/spec/fixtures/library/border-width.scss +21 -0
- data/spec/fixtures/library/buttons.scss +17 -0
- data/spec/fixtures/library/clearfix.scss +5 -0
- data/spec/fixtures/library/contrast-switch.scss +9 -0
- data/spec/fixtures/library/ellipsis.scss +5 -0
- data/spec/fixtures/library/font-face-1.scss +6 -0
- data/spec/fixtures/library/font-face-2.scss +10 -0
- data/spec/fixtures/library/font-face-3.scss +8 -0
- data/spec/fixtures/library/font-face-4.scss +7 -0
- data/spec/fixtures/library/font-stacks.scss +41 -0
- data/spec/fixtures/library/hide-text.scss +5 -0
- data/spec/fixtures/library/hide-visually.scss +9 -0
- data/spec/fixtures/library/margin.scss +21 -0
- data/spec/fixtures/library/modular-scale.scss +29 -0
- data/spec/fixtures/library/padding.scss +21 -0
- data/spec/fixtures/library/position.scss +25 -0
- data/spec/fixtures/library/prefixer.scss +13 -0
- data/spec/fixtures/library/shade.scss +17 -0
- data/spec/fixtures/library/size.scss +13 -0
- data/spec/fixtures/library/strip-unit.scss +17 -0
- data/spec/fixtures/library/text-inputs.scss +21 -0
- data/spec/fixtures/library/tint.scss +17 -0
- data/spec/fixtures/library/triangle.scss +9 -0
- data/spec/fixtures/library/word-wrap.scss +9 -0
- data/spec/fixtures/utilities/assign-inputs.scss +19 -0
- data/spec/fixtures/utilities/collapse-directionals.scss +17 -0
- data/spec/fixtures/utilities/directional-values.scss +13 -0
- data/spec/fixtures/utilities/font-source-declaration.scss +11 -0
- data/spec/fixtures/utilities/retrieve-bourbon-setting.scss +16 -0
- data/spec/fixtures/utilities/unpack.scss +17 -0
- data/spec/fixtures/validators/contains.scss +28 -0
- data/spec/fixtures/validators/is-length.scss +35 -0
- data/spec/fixtures/validators/is-light.scss +29 -0
- data/spec/fixtures/validators/is-number.scss +31 -0
- data/spec/fixtures/validators/is-size.scss +31 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/support/matchers/have_rule.rb +35 -0
- data/spec/support/matchers/have_ruleset.rb +20 -0
- data/spec/support/matchers/have_value.rb +17 -0
- data/spec/support/parser_support.rb +16 -0
- data/spec/support/sass_support.rb +10 -0
- metadata +527 -0
@@ -0,0 +1,163 @@
|
|
1
|
+
$filter-values : inherit initial unset;
|
2
|
+
$filter-types : url blur brightness contrast drop-shadow grayscale hue-rotate invert opacity saturate sepia;
|
3
|
+
|
4
|
+
/// Filter mixin that allows various syntax's
|
5
|
+
///
|
6
|
+
/// @author Mark Notton
|
7
|
+
///
|
8
|
+
/// @access public
|
9
|
+
///
|
10
|
+
/// @param {Map} $settings - Each argument should consist of a filter type and it's value
|
11
|
+
///
|
12
|
+
/// @require {variable} transform-types
|
13
|
+
/// @require {variable} transform-values
|
14
|
+
/// @require {function} _arglist-to-list
|
15
|
+
/// @require {function} contains
|
16
|
+
/// @require {function} is-function
|
17
|
+
/// @require {function} is-string
|
18
|
+
/// @require {mixin} prefixer
|
19
|
+
///
|
20
|
+
/// @example scss - Usage
|
21
|
+
/// Doggy Style Syntax
|
22
|
+
/// @include filter(blur 5, sepia 100);
|
23
|
+
/// Bourbon Syntax
|
24
|
+
/// @include filter(blur(5), sepia(100));
|
25
|
+
/// Generic Syntax
|
26
|
+
/// @include filter(blur(5) sepia(100));
|
27
|
+
///
|
28
|
+
/// @example css - CSS Output
|
29
|
+
/// -webkit-filter: blur(5px) sepia(100%);
|
30
|
+
/// -moz-filter: blur(5px) sepia(100%);
|
31
|
+
/// filter: blur(5px) sepia(100%);
|
32
|
+
|
33
|
+
@mixin filter($settings...) {
|
34
|
+
|
35
|
+
$filters : ();
|
36
|
+
$fallback-settings : ();
|
37
|
+
|
38
|
+
@if not contains($filter-values, $settings, true) and length($settings) >= 1 {
|
39
|
+
|
40
|
+
// This is an over-engineered section of code to to allow for all types of syntaxes.
|
41
|
+
// Essestially making it work with Bourbon and other frameworks.
|
42
|
+
@if length($settings) == 1 {
|
43
|
+
@for $i from 1 through length($settings) {
|
44
|
+
@each $setting in nth($settings, $i) {
|
45
|
+
@if is-function($setting) {
|
46
|
+
$fallback-settings : append($fallback-settings, $setting, comma);
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
$settings-lists : if(length($fallback-settings) > 1, $fallback-settings, _arglist-to-list($settings));
|
52
|
+
|
53
|
+
|
54
|
+
@each $settings in $settings-lists {
|
55
|
+
|
56
|
+
@if is-function($settings) {
|
57
|
+
$settings : is-function($settings);
|
58
|
+
}
|
59
|
+
|
60
|
+
|
61
|
+
$filter : null;
|
62
|
+
$value : ();
|
63
|
+
|
64
|
+
|
65
|
+
// Check for transforms
|
66
|
+
@each $setting in $settings {
|
67
|
+
@if is-string($setting) and contains($filter-types, $setting) {
|
68
|
+
$filter : $setting;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
// @debug $filter;
|
72
|
+
|
73
|
+
// Check and validate all transform types
|
74
|
+
@each $setting in $settings {
|
75
|
+
@if not is-string($setting) {
|
76
|
+
@if contains($filter, (blur)) {
|
77
|
+
// Values that require a unit
|
78
|
+
$value : append($value, addUnit($setting));
|
79
|
+
} @elseif contains($filter, (hue-rotate)) {
|
80
|
+
// Values that require an angle
|
81
|
+
$value : append($value, addUnit($setting, deg));
|
82
|
+
} @elseif contains($filter, (invert opacity saturate sepia contrast grayscale)) {
|
83
|
+
// Values that require an percent
|
84
|
+
$value : append($value, addUnit($setting, %));
|
85
|
+
} @elseif $filter == drop-shadow {
|
86
|
+
// Specific for drop-shdaow
|
87
|
+
@each $val in $setting {
|
88
|
+
@if is-number($val) {
|
89
|
+
$value : append($value, addUnit($val));
|
90
|
+
} @elseif is-colour($val) {
|
91
|
+
$value : append($value, $val);
|
92
|
+
}
|
93
|
+
}
|
94
|
+
} @else {
|
95
|
+
// All other values
|
96
|
+
$value : append($value, $setting);
|
97
|
+
}
|
98
|
+
} @elseif contains($filter-values, $setting) {
|
99
|
+
// Values that are strings and are global values
|
100
|
+
$value : append($value, $setting);
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
// Append transform and value to the transforms list
|
105
|
+
@if $filter != null {
|
106
|
+
$filters : append($filters, $filter+"("+$value+")");
|
107
|
+
}
|
108
|
+
|
109
|
+
}
|
110
|
+
} @else {
|
111
|
+
$filters : nth($settings, 1);
|
112
|
+
}
|
113
|
+
|
114
|
+
@include prefixer(filter, $filters);
|
115
|
+
|
116
|
+
}
|
117
|
+
|
118
|
+
@mixin url($value:null) {
|
119
|
+
@include filter(url $value);
|
120
|
+
}
|
121
|
+
|
122
|
+
@mixin blur($value:5px) {
|
123
|
+
@include filter(blur $value);
|
124
|
+
}
|
125
|
+
|
126
|
+
@mixin brightness($value:0.4) {
|
127
|
+
@include filter(brightness $value);
|
128
|
+
}
|
129
|
+
|
130
|
+
@mixin contrast($value:200%) {
|
131
|
+
@include filter(contrast $value);
|
132
|
+
}
|
133
|
+
|
134
|
+
@mixin dropshadow($value) { @include drop-shadow($value); }
|
135
|
+
@mixin drop-shadow($value:16px 16px 20px blue) {
|
136
|
+
@include filter(drop-shadow $value);
|
137
|
+
}
|
138
|
+
|
139
|
+
@mixin greyscale($value) { @include grayscale($value); }
|
140
|
+
@mixin grayscale($value:50%) {
|
141
|
+
@include filter(grayscale $value);
|
142
|
+
}
|
143
|
+
|
144
|
+
@mixin hue($value) { @include hue($value); }
|
145
|
+
@mixin hue-rotate($value:90deg) {
|
146
|
+
@include filter(hue-rotate $value);
|
147
|
+
}
|
148
|
+
|
149
|
+
@mixin invert($value:75%) {
|
150
|
+
@include filter(invert $value);
|
151
|
+
}
|
152
|
+
|
153
|
+
@mixin opacity($value:25%) {
|
154
|
+
@include filter(opacity $value);
|
155
|
+
}
|
156
|
+
|
157
|
+
@mixin saturate($value:30%) {
|
158
|
+
@include filter(saturate $value);
|
159
|
+
}
|
160
|
+
|
161
|
+
@mixin sepia($value:60%) {
|
162
|
+
@include filter(sepia $value);
|
163
|
+
}
|
@@ -0,0 +1,126 @@
|
|
1
|
+
// //This will add a lineheight in percentage that's just a little bit greater than the font
|
2
|
+
// @mixin fontsize($size:$text, $lineheight:10%, $letterspacing:normal) {
|
3
|
+
// @if (str-index(#{$lineheight}, "%")) {
|
4
|
+
// // Make the lingheight a percentage of the font size
|
5
|
+
// $lineheight: strip($lineheight);
|
6
|
+
// $height: ($size/100*$lineheight)+$size;
|
7
|
+
// font-size:addUnit($size); line-height:addUnit($height);
|
8
|
+
// } @else {
|
9
|
+
// // Manually add a lineheight
|
10
|
+
// font-size:addUnit($size); line-height:addUnit($lineheight);
|
11
|
+
// }
|
12
|
+
// @if ($letterspacing != normal and isNumber($letterspacing)) {
|
13
|
+
// letter-spacing:addUnit($letterspacing);
|
14
|
+
// }
|
15
|
+
// }
|
16
|
+
|
17
|
+
//This will add a lineheight in percentage that's just a little bit greater than the font
|
18
|
+
@mixin fontsize($size:$fs, $smart:true) {
|
19
|
+
@if type-of($size) == number {
|
20
|
+
font-size:addUnit($size);
|
21
|
+
line-height:smart-lineheight($size, $smart);
|
22
|
+
} @else {
|
23
|
+
@if (length($size) >= 2) {
|
24
|
+
font-size:addUnit(nth($size, 1));
|
25
|
+
line-height:smart-lineheight(nth($size, 2), $smart);
|
26
|
+
}
|
27
|
+
@if (length($size) == 3) {
|
28
|
+
letter-spacing:addUnit(nth($size, 3));
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
@function _define-smart-fontsize-settings($args:null, $condition:null) {
|
34
|
+
|
35
|
+
$units : ();
|
36
|
+
$lineheight-bool : true;
|
37
|
+
|
38
|
+
// Default Settings
|
39
|
+
$settings : ( );
|
40
|
+
|
41
|
+
// Add a default lineheight based off the default size setting
|
42
|
+
@if $condition == max {
|
43
|
+
// Size
|
44
|
+
$settings : map-set($settings, size, ($font-size*2 - ($font-size/2)));
|
45
|
+
// Lineheight
|
46
|
+
$settings : map-set($settings, lineheight, smart-lineheight(map-get($settings, size)));
|
47
|
+
// Break
|
48
|
+
$settings : map-set($settings, break, $max);
|
49
|
+
} @else {
|
50
|
+
// Size
|
51
|
+
$settings : map-set($settings, size, $font-size);
|
52
|
+
// Lineheight
|
53
|
+
$settings : map-set($settings, lineheight, smart-lineheight(map-get($settings, size)));
|
54
|
+
// Break
|
55
|
+
$settings : map-set($settings, break, ceil((($large - $medium) / 2) + $medium));
|
56
|
+
}
|
57
|
+
|
58
|
+
// Check arguments
|
59
|
+
@each $rule in $args {
|
60
|
+
@if is-bool($rule) {
|
61
|
+
$lineheight-bool : $rule;
|
62
|
+
}
|
63
|
+
@if is-number($rule) {
|
64
|
+
$units : append($units, $rule);
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
// Set fontsize
|
69
|
+
@if length($units) >= 1 {
|
70
|
+
$settings : map-set($settings, size, nth($units, 1));
|
71
|
+
}
|
72
|
+
|
73
|
+
// Set lineheight
|
74
|
+
@if length($units) >= 2 {
|
75
|
+
$settings : map-set($settings, lineheight, smart-lineheight(nth($units, 2), $lineheight-bool));
|
76
|
+
}
|
77
|
+
|
78
|
+
// Set breakpoint
|
79
|
+
@if length($units) >= 3 {
|
80
|
+
$settings : map-set($settings, break, nth($units, 3));
|
81
|
+
}
|
82
|
+
|
83
|
+
// Return settings
|
84
|
+
@return $settings;
|
85
|
+
}
|
86
|
+
|
87
|
+
@mixin smart-fontsize($minArgs:null, $maxArgs:null, $defArgs:null) {
|
88
|
+
|
89
|
+
// Max
|
90
|
+
$max-settings : _define-smart-fontsize-settings($maxArgs, max);
|
91
|
+
$max-size : map-get($max-settings, size);
|
92
|
+
$max-lineheight : map-get($max-settings, lineheight);
|
93
|
+
$max-break : map-get($max-settings, break);
|
94
|
+
|
95
|
+
@include break($max-break min-width) {
|
96
|
+
font-size:addUnit($max-size);
|
97
|
+
line-height:$max-lineheight;
|
98
|
+
}
|
99
|
+
|
100
|
+
// Min
|
101
|
+
$min-settings : _define-smart-fontsize-settings($minArgs, min);
|
102
|
+
$min-size : map-get($min-settings, size);
|
103
|
+
$min-lineheight : map-get($min-settings, lineheight);
|
104
|
+
$min-break : map-get($min-settings, break);
|
105
|
+
|
106
|
+
@include break($min-break max-width) {
|
107
|
+
font-size:addUnit($min-size);
|
108
|
+
line-height:$min-lineheight;
|
109
|
+
}
|
110
|
+
|
111
|
+
// Inbetween
|
112
|
+
@if $defArgs == null {
|
113
|
+
font-size : addUnit($max-size/11, vw);
|
114
|
+
line-height: smart-lineheight(if($max-size > 30, $max-size/2.28, $max-size));
|
115
|
+
} @else {
|
116
|
+
$def-settings : _define-smart-fontsize-settings($defArgs);
|
117
|
+
$def-size : map-get($def-settings, size);
|
118
|
+
$def-lineheight : map-get($def-settings, lineheight);
|
119
|
+
$def-break : map-get($def-settings, break);
|
120
|
+
|
121
|
+
@include break-between($min-break, $max-break) {
|
122
|
+
font-size : if(unitless($def-size), addUnit($def-size/11, vw), addUnit($def-size));
|
123
|
+
line-height:$def-lineheight;
|
124
|
+
}
|
125
|
+
}
|
126
|
+
}
|
@@ -0,0 +1,134 @@
|
|
1
|
+
$default-gallery-settings : (
|
2
|
+
id : null, // To define the scope of the gallery, add a class or id (with their appropriate prefixes, # or .)
|
3
|
+
animation : gallery-animation, // Name of the keyframe animation that will effect each image one at a time
|
4
|
+
first : true, // On load, fade the first image in, or have it show immediately.
|
5
|
+
loop : infinite, // How many times you want it to loop. Use 'infinite' for... infinite
|
6
|
+
autoplay : true, // Do you want the slides to start on load
|
7
|
+
limit : 10, // Max amount of images. Keep this as low as possible. Bigger numbers, means excessive css markup.
|
8
|
+
duration : 4, // How long each image will display for
|
9
|
+
speed : 1, // Speed of transition
|
10
|
+
ease : ease-in-out, // Ease method
|
11
|
+
);
|
12
|
+
|
13
|
+
@mixin gallery($gallery-settings:null) {
|
14
|
+
|
15
|
+
$settings : ();
|
16
|
+
|
17
|
+
// If a map has not been passed, give error
|
18
|
+
@if not is-map($gallery-settings) and $gallery-settings != null {
|
19
|
+
|
20
|
+
@error "Gallery settings need to be passed as a map";
|
21
|
+
|
22
|
+
} @else {
|
23
|
+
|
24
|
+
// If absolutely no settings have been passed, just use all the defaults.
|
25
|
+
@if $gallery-settings == null {
|
26
|
+
|
27
|
+
$settings : $default-gallery-settings;
|
28
|
+
|
29
|
+
} @else {
|
30
|
+
|
31
|
+
// Create a list of keys for the current settings that have been passed
|
32
|
+
$existing-gallery-settings : map-keys($gallery-settings);
|
33
|
+
|
34
|
+
// Add existing settings to the new-settings map
|
35
|
+
@each $setting in $existing-gallery-settings {
|
36
|
+
// Only allow settings exist in the $default-gallery-settings
|
37
|
+
@if contains(map-keys($default-gallery-settings), $setting) {
|
38
|
+
|
39
|
+
$set : null;
|
40
|
+
|
41
|
+
// Check is certain strings are valid
|
42
|
+
@if is-string(map-get($gallery-settings, $setting)) {
|
43
|
+
@if contains(id animation loop ease, $setting) {
|
44
|
+
@if $setting != loop {
|
45
|
+
$set : $setting;
|
46
|
+
} @elseif $setting == loop and map-get($gallery-settings, loop) == infinite {
|
47
|
+
// Special check for loop, incase the default gets changed
|
48
|
+
$set : $setting;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
// Check is certain booleans are valid
|
54
|
+
@elseif is-bool(map-get($gallery-settings, $setting)) {
|
55
|
+
@if contains(first autoplay, $setting) {
|
56
|
+
$set : $setting;
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
// Check is certain numbers are valid
|
61
|
+
@elseif is-number(map-get($gallery-settings, $setting)) {
|
62
|
+
@if contains(limit loop duration speed, $setting) {
|
63
|
+
$set : $setting;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
// Add setting to new settings if it has passed validation
|
68
|
+
@if $set != null {
|
69
|
+
$settings : map-set($settings, $setting, map-get($gallery-settings, $setting));
|
70
|
+
}
|
71
|
+
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
// Check which ones are missing, and add defaults
|
76
|
+
@each $setting in map-keys($default-gallery-settings) {
|
77
|
+
@if not map-has-key($settings, $setting) {
|
78
|
+
$settings : map-set($settings, $setting, map-get($default-gallery-settings, $setting));
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
}
|
83
|
+
|
84
|
+
$id : map-get($settings, id);
|
85
|
+
$animation : map-get($settings, animation);
|
86
|
+
$first : map-get($settings, first);
|
87
|
+
$loop : map-get($settings, loop);
|
88
|
+
$autoplay : map-get($settings, autoplay);
|
89
|
+
$limit : map-get($settings, limit);
|
90
|
+
$duration : map-get($settings, duration);
|
91
|
+
$speed : map-get($settings, speed);
|
92
|
+
$ease : map-get($settings, ease);
|
93
|
+
|
94
|
+
gallery-container#{$id} {
|
95
|
+
|
96
|
+
&.pause {
|
97
|
+
gallery-image { @include prefixer(animation-play-state, paused); }
|
98
|
+
}
|
99
|
+
|
100
|
+
// Set a few custom properties for javascript
|
101
|
+
@include custom-property((
|
102
|
+
gallery-duration : $duration,
|
103
|
+
gallery-speed : $speed,
|
104
|
+
gallery-autoplay : $autoplay,
|
105
|
+
gallery-loop : _min-max-number($loop, 1, 10)
|
106
|
+
));
|
107
|
+
|
108
|
+
@for $count from 1 through $limit {
|
109
|
+
gallery-image:first-child:nth-last-child(#{$count}),
|
110
|
+
gallery-image:first-child:nth-last-child(#{$count}) ~ gallery-image {
|
111
|
+
|
112
|
+
@for $i from (if($first, 1, 2)) through $count {
|
113
|
+
&:nth-of-type(#{$i}) {
|
114
|
+
$delay : ($duration*($i - 1))+($speed*($i - 1));
|
115
|
+
@include prefixer(animation-delay, addUnit($delay, s), webkit);
|
116
|
+
@include prefixer(animation-duration, addUnit($speed, s), webkit);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
gallery-image {
|
124
|
+
@if $autoplay == false { animation-play-state:paused; }
|
125
|
+
@include prefixer(animation-name, $animation, webkit);
|
126
|
+
@include prefixer(animation-timing-function, $ease, webkit);
|
127
|
+
@include prefixer(animation-fill-mode, both, webkit);
|
128
|
+
// animation-iteration-count : $loop;
|
129
|
+
&:last-of-type { }
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
}
|
134
|
+
}
|