doggystyle 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +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,34 @@
|
|
|
1
|
+
/// Update a key deeply nested
|
|
2
|
+
///
|
|
3
|
+
/// @author Hugo Giraudel
|
|
4
|
+
///
|
|
5
|
+
/// @link http://www.sitepoint.com/extra-map-functions-sass
|
|
6
|
+
///
|
|
7
|
+
/// @access public
|
|
8
|
+
///
|
|
9
|
+
/// @param {map} $map - Map to update
|
|
10
|
+
///
|
|
11
|
+
/// @param {arglist} $keys - Keys to access to value to update
|
|
12
|
+
///
|
|
13
|
+
/// @param {*} $value - New value (last member of `$keys`)
|
|
14
|
+
///
|
|
15
|
+
/// @return {map} - Updated map
|
|
16
|
+
|
|
17
|
+
@function map-deep-set($map, $keys.../*, $value */) {
|
|
18
|
+
$map-list: ($map,);
|
|
19
|
+
$result: null;
|
|
20
|
+
|
|
21
|
+
@if length($keys) == 2 {
|
|
22
|
+
@return map-merge($map, (nth($keys, 1): nth($keys, -1)));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@for $i from 1 through length($keys) - 2 {
|
|
26
|
+
$map-list: append($map-list, map-get(nth($map-list, -1), nth($keys, $i)));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@for $i from length($map-list) through 1 {
|
|
30
|
+
$result: map-merge(nth($map-list, $i), (nth($keys, $i): if($i == length($map-list), nth($keys, -1), $result)));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@return $result;
|
|
34
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// Compute the maximum depth of a map
|
|
2
|
+
///
|
|
3
|
+
/// @author Hugo Giraudel
|
|
4
|
+
///
|
|
5
|
+
/// @link http://www.sitepoint.com/extra-map-functions-sass
|
|
6
|
+
///
|
|
7
|
+
/// @access public
|
|
8
|
+
///
|
|
9
|
+
/// @param {map} $map
|
|
10
|
+
///
|
|
11
|
+
/// @return {number} max depth of `$map`
|
|
12
|
+
|
|
13
|
+
@function map-depth($map) {
|
|
14
|
+
$level: 1;
|
|
15
|
+
|
|
16
|
+
@each $key, $value in $map {
|
|
17
|
+
@if type-of($value) == "map" {
|
|
18
|
+
$level: max(map-depth($value) + 1, $level);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@return $level;
|
|
23
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/// jQuery-style extend function
|
|
2
|
+
///
|
|
3
|
+
/// @author Hugo Giraudel
|
|
4
|
+
///
|
|
5
|
+
/// @link http://www.sitepoint.com/extra-map-functions-sass
|
|
6
|
+
///
|
|
7
|
+
/// @access public
|
|
8
|
+
///
|
|
9
|
+
/// @param {map} $map - first map
|
|
10
|
+
///
|
|
11
|
+
/// @param {arglist} $maps - other maps
|
|
12
|
+
///
|
|
13
|
+
/// @param {bool} $deep - recursive mode
|
|
14
|
+
///
|
|
15
|
+
/// @return {map}
|
|
16
|
+
|
|
17
|
+
@function map-extend($map, $maps.../*, $deep */) {
|
|
18
|
+
$last: nth($maps, -1);
|
|
19
|
+
$deep: $last == true;
|
|
20
|
+
$max: if($deep, length($maps) - 1, length($maps));
|
|
21
|
+
|
|
22
|
+
// Loop through all maps in $maps...
|
|
23
|
+
@for $i from 1 through $max {
|
|
24
|
+
// Store current map
|
|
25
|
+
$current: nth($maps, $i);
|
|
26
|
+
|
|
27
|
+
// If not in deep mode, simply merge current map with map
|
|
28
|
+
@if not $deep {
|
|
29
|
+
$map: map-merge($map, $current);
|
|
30
|
+
} @else {
|
|
31
|
+
// If in deep mode, loop through all tuples in current map
|
|
32
|
+
@each $key, $value in $current {
|
|
33
|
+
|
|
34
|
+
// If value is a nested map and same key from map is a nested map as well
|
|
35
|
+
@if type-of($value) == "map" and type-of(map-get($map, $key)) == "map" {
|
|
36
|
+
// Recursive extend
|
|
37
|
+
$value: map-extend(map-get($map, $key), $value, true);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Merge current tuple with map
|
|
41
|
+
$map: map-merge($map, ($key: $value));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@return $map;
|
|
47
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// Test if map got all `$keys` at first level
|
|
2
|
+
///
|
|
3
|
+
/// @author Hugo Giraudel
|
|
4
|
+
///
|
|
5
|
+
/// @link http://www.sitepoint.com/extra-map-functions-sass
|
|
6
|
+
///
|
|
7
|
+
/// @access public
|
|
8
|
+
///
|
|
9
|
+
/// @param {map} $map - Map
|
|
10
|
+
///
|
|
11
|
+
/// @param {arglist} $keys - Keys to test
|
|
12
|
+
///
|
|
13
|
+
/// @return {bool}
|
|
14
|
+
|
|
15
|
+
@function map-has-keys($map, $keys...) {
|
|
16
|
+
@each $key in $keys {
|
|
17
|
+
@if not map-has-key($map, $key) {
|
|
18
|
+
@return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@return true;
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// Test if map got all `$keys` nested with each others
|
|
2
|
+
///
|
|
3
|
+
/// @author Hugo Giraudel
|
|
4
|
+
///
|
|
5
|
+
/// @link http://www.sitepoint.com/extra-map-functions-sass
|
|
6
|
+
///
|
|
7
|
+
/// @access public
|
|
8
|
+
///
|
|
9
|
+
/// @param {map} $map - Map
|
|
10
|
+
///
|
|
11
|
+
/// @param {arglist} $keys - Keys to test
|
|
12
|
+
///
|
|
13
|
+
/// @return {bool}
|
|
14
|
+
|
|
15
|
+
@function map-has-nested-keys($map, $keys...) {
|
|
16
|
+
@each $key in $keys {
|
|
17
|
+
@if not map-has-key($map, $key) {
|
|
18
|
+
@return false;
|
|
19
|
+
}
|
|
20
|
+
$map: map-get($map, $key);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@return true;
|
|
24
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/// An equivalent of `zip` function but for maps.
|
|
2
|
+
/// I wrote my own version of this before realising Hugo had done something similar.
|
|
3
|
+
/// I have kept the name, but used my own.
|
|
4
|
+
///
|
|
5
|
+
/// @author Mark Notton
|
|
6
|
+
///
|
|
7
|
+
/// @link http://www.sitepoint.com/extra-map-functions-sass
|
|
8
|
+
/// @link http://sass-lang.com/documentation/Sass/Script/Functions.html#zip-instance_method
|
|
9
|
+
///
|
|
10
|
+
/// @access public
|
|
11
|
+
///
|
|
12
|
+
/// @param {list} $list1 - Keys for map
|
|
13
|
+
///
|
|
14
|
+
/// @param {list} $list2 - Values for map
|
|
15
|
+
///
|
|
16
|
+
/// @param {bool} $swappable - Swap variables around so list1 has the most values. Default is true.
|
|
17
|
+
///
|
|
18
|
+
/// @return {map} Freshly created map
|
|
19
|
+
|
|
20
|
+
@function map-zip($list1, $list2, $swappable:true) {
|
|
21
|
+
|
|
22
|
+
$map : ();
|
|
23
|
+
|
|
24
|
+
$list1-size : length($list1);
|
|
25
|
+
$list2-size : length($list2);
|
|
26
|
+
|
|
27
|
+
$count : if($list1-size < $list2-size, $list1-size, $list2-size);
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@if ($list1-size < $list2-size and $swappable) {
|
|
31
|
+
$temp : $list1;
|
|
32
|
+
$list1 : $list2;
|
|
33
|
+
$list2 : $temp;
|
|
34
|
+
@if $warnings { @warn(($list2-size - $list1-size)+' value'+ if($list2-size - $list1-size != 1, 's', '') +' has not been added to the map because the list sizes did not match.'); }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@if $warnings {
|
|
38
|
+
@if ($list1-size < $list2-size) {
|
|
39
|
+
@warn('The second list had '+($list2-size - $list1-size)+' more value'+ if($list2-size - $list1-size != 1, 's', '') +' than the first list');
|
|
40
|
+
} @elseif ($list1-size > $list2-size) {
|
|
41
|
+
@warn('The first list had '+($list1-size - $list2-size)+' more value'+ if($list1-size - $list2-size != 1, 's', '') +' than the second list');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@for $i from 1 through $count {
|
|
46
|
+
$map : map-set($map, nth($list1, $i), nth($list2, $i));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@return $map;
|
|
50
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/// Adds a default unit if one is not used.
|
|
2
|
+
///
|
|
3
|
+
/// @author Mark Notton
|
|
4
|
+
///
|
|
5
|
+
/// @param {number} $value
|
|
6
|
+
///
|
|
7
|
+
/// @param {string} $unit - If a value is unitless add the default unit.
|
|
8
|
+
///
|
|
9
|
+
/// @param {bool} $convert - If the value already has a unit, and a different unit was specifically
|
|
10
|
+
/// supplied, this boolean desides wether to replace the unit.
|
|
11
|
+
///
|
|
12
|
+
/// @require {variable} default-unit
|
|
13
|
+
/// @require {variable} $relative-lengths
|
|
14
|
+
/// @require {variable} $abolute-lengths
|
|
15
|
+
/// @require {function} is-unit
|
|
16
|
+
/// @require {function} is-number
|
|
17
|
+
/// @require {function} strip
|
|
18
|
+
///
|
|
19
|
+
/// @example scss - Usage
|
|
20
|
+
/// addUnit(50)
|
|
21
|
+
/// addUnit(50px)
|
|
22
|
+
/// addUnit(50, %)
|
|
23
|
+
/// addUnit(50px, %)
|
|
24
|
+
///
|
|
25
|
+
/// @example scss - Output
|
|
26
|
+
/// 50px
|
|
27
|
+
/// 50px
|
|
28
|
+
/// 50%
|
|
29
|
+
/// 50%
|
|
30
|
+
|
|
31
|
+
// @function addUnit($value, $unit:$default-unit) {
|
|
32
|
+
// @if is-number($value) and unitless($value) {
|
|
33
|
+
// @return strip($value) + $unit;
|
|
34
|
+
// } @else {
|
|
35
|
+
// @return $value;
|
|
36
|
+
// }
|
|
37
|
+
// }
|
|
38
|
+
|
|
39
|
+
@function addUnit($value, $unit:null, $replace:false) {
|
|
40
|
+
@if is-number($value) {
|
|
41
|
+
@if unitless($value) {
|
|
42
|
+
@return $value + if($unit == null, $default-unit, $unit);
|
|
43
|
+
}
|
|
44
|
+
@elseif is-unit($value) {
|
|
45
|
+
@if $replace and $unit != null {
|
|
46
|
+
@return strip($value) + $unit;
|
|
47
|
+
} @else {
|
|
48
|
+
@return $value;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
} @else {
|
|
52
|
+
@return $value;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// Padding is generated relative to the default text size.
|
|
2
|
+
/// Using this globally allows gutters, padding, margins, etc to be consistant throughout.
|
|
3
|
+
///
|
|
4
|
+
/// @param {Number} $size
|
|
5
|
+
/// Enter the amount of times you want to multiply the default padding variable
|
|
6
|
+
///
|
|
7
|
+
/// @require {Variable} $padding
|
|
8
|
+
/// Can be found in the yello/_settings.scss file. May be overwritten in the project _variables.scss file
|
|
9
|
+
///
|
|
10
|
+
/// @example scss - Usage
|
|
11
|
+
/// margin:0 pad(3);
|
|
12
|
+
///
|
|
13
|
+
/// @return {Number} with units
|
|
14
|
+
@function pad($size:1) {
|
|
15
|
+
@return if($size == 0, to-number(addUnit($padding/2, px)), to-number(addUnit($padding*$size, px)));
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// Padding is generated relative to the default text size.
|
|
2
|
+
/// Using this globally allows gutters, padding, margins, etc to be consistant throughout.
|
|
3
|
+
///
|
|
4
|
+
/// @param {Number} $size
|
|
5
|
+
/// Enter the amount of times you want to multiply the default padding variable
|
|
6
|
+
///
|
|
7
|
+
/// @require {Variable} $padding
|
|
8
|
+
/// Can be found in the yello/_settings.scss file. May be overwritten in the project _variables.scss file
|
|
9
|
+
///
|
|
10
|
+
/// @example scss - Usage
|
|
11
|
+
/// margin:0 pad(3);
|
|
12
|
+
///
|
|
13
|
+
/// @return {Number} with units
|
|
14
|
+
@function spacer($size:1) {
|
|
15
|
+
@return if($size == 0, to-number(addUnit($spacing/2, vh)), to-number(addUnit($spacing*$size, vh)));
|
|
16
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// Strips any units from a number
|
|
2
|
+
///
|
|
3
|
+
/// @author Hugo Giraudel
|
|
4
|
+
///
|
|
5
|
+
/// @link https://css-tricks.com/snippets/sass/strip-unit-function/
|
|
6
|
+
///
|
|
7
|
+
/// @param {string} $number
|
|
8
|
+
///
|
|
9
|
+
/// @return {number}
|
|
10
|
+
///
|
|
11
|
+
/// @require {function} is-number
|
|
12
|
+
/// @require {function} to-number
|
|
13
|
+
///
|
|
14
|
+
/// @example scss - Usage
|
|
15
|
+
/// strip(50px)
|
|
16
|
+
///
|
|
17
|
+
/// @example scss - Output
|
|
18
|
+
/// 50
|
|
19
|
+
|
|
20
|
+
@function strip($number) {
|
|
21
|
+
@if not is-number($number) {
|
|
22
|
+
$number : to-number($number);
|
|
23
|
+
}
|
|
24
|
+
@if is-number($number) and not unitless($number) {
|
|
25
|
+
@return ($number / ($number * 0 + 1));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@return $number;
|
|
29
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// Return a unit of measurment with a function to avoid the messy '#{xx}' interpolation syntax when concatonating variables or numbers with units
|
|
2
|
+
///
|
|
3
|
+
/// @example scss - Usage
|
|
4
|
+
/// height:$someNumber + px;
|
|
5
|
+
///
|
|
6
|
+
/// @return {String}
|
|
7
|
+
@function cm() { @return #{cm} }
|
|
8
|
+
@function em() { @return #{em} }
|
|
9
|
+
@function ex() { @return #{ex} }
|
|
10
|
+
@function in() { @return #{in} }
|
|
11
|
+
@function mm() { @return #{mm} }
|
|
12
|
+
@function pc() { @return #{pc} }
|
|
13
|
+
@function pt() { @return #{pt} }
|
|
14
|
+
@function px() { @return #{px} }
|
|
15
|
+
@function vh() { @return #{vh} }
|
|
16
|
+
@function vw() { @return #{vw} }
|
|
17
|
+
@function vmin() { @return #{vmin} }
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/// Create a svg background image with dots.
|
|
2
|
+
///
|
|
3
|
+
/// @author Mark Notton
|
|
4
|
+
///
|
|
5
|
+
/// @access public
|
|
6
|
+
///
|
|
7
|
+
/// @param {list} $settings
|
|
8
|
+
/// In any order and without comma delimination, add any of the follwing settings
|
|
9
|
+
/// {color} - The first instance of a colour will be used for top left and bottom right dots. Default is black.
|
|
10
|
+
/// The second instance will be used for bottom left and top right dots. Default is null.
|
|
11
|
+
/// {number} - The first instance of a number will be used for dot size. In 'px'; Default is 4px.
|
|
12
|
+
/// The second instance of a number will be used for dot spacing. In 'px'; Default is 0px.
|
|
13
|
+
///
|
|
14
|
+
/// @todo Add the ability to chose a direction by degrees
|
|
15
|
+
/// @todo Add the option to choose a shape, eg: circles
|
|
16
|
+
///
|
|
17
|
+
/// @require {function} is-colour
|
|
18
|
+
/// @require {function} is-number
|
|
19
|
+
/// @require {function} colour
|
|
20
|
+
/// @require {function} svg
|
|
21
|
+
/// @require {function} strip
|
|
22
|
+
/// @require {function} first
|
|
23
|
+
/// @require {function} second
|
|
24
|
+
///
|
|
25
|
+
/// @example scss - Usage
|
|
26
|
+
/// Red dots at 8px in width and height. Alternative dots don't exist:
|
|
27
|
+
/// background:dots(red 8);
|
|
28
|
+
///
|
|
29
|
+
/// Red dots at 4px in width and height. Alternative dots are the same, but green:
|
|
30
|
+
/// background:dots(red green);
|
|
31
|
+
///
|
|
32
|
+
/// Red dots at 10px in width and height. Alternative dots are the same, but green. All dots are spaced 5px apart:
|
|
33
|
+
/// background:dots(red green 10 5);
|
|
34
|
+
///
|
|
35
|
+
/// @return {String}
|
|
36
|
+
|
|
37
|
+
@function dots($settings:null) {
|
|
38
|
+
|
|
39
|
+
$size : null;
|
|
40
|
+
$spacing : 0;
|
|
41
|
+
$colours : ();
|
|
42
|
+
$colour1 : black;
|
|
43
|
+
$colour2 : null;
|
|
44
|
+
|
|
45
|
+
@each $setting in $settings {
|
|
46
|
+
|
|
47
|
+
@if is-colour($setting) and length($colours) <= 1 {
|
|
48
|
+
$colours : append($colours, $setting);
|
|
49
|
+
}
|
|
50
|
+
@elseif is-number($setting) {
|
|
51
|
+
@if $size == null {
|
|
52
|
+
$size : strip($setting);
|
|
53
|
+
}
|
|
54
|
+
@else {
|
|
55
|
+
$spacing : strip($setting);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@if $size == null {
|
|
61
|
+
$size : 4;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@if length($colours) == 1 {
|
|
65
|
+
$colour1 : colour(first($colours), true);
|
|
66
|
+
}
|
|
67
|
+
@elseif length($colours) == 2 {
|
|
68
|
+
$colour1 : colour(first($colours), true);
|
|
69
|
+
$colour2 : colour(second($colours), true);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
$dots : "<svg xmlns='http://www.w3.org/2000/svg' width='"+($size*2 + $spacing*2)+"' height='"+($size*2 + $spacing*2)+"' viewBox='0 0 "+($size*2 + $spacing*2)+" "+($size*2 + $spacing*2)+"'>";
|
|
73
|
+
$dots : $dots + "<rect fill='"+$colour1+"' y='0' x='0' width='"+$size+"' height='"+$size+"'/>";
|
|
74
|
+
$dots : $dots + "<rect fill='"+$colour1+"' y='"+($size + $spacing)+"' x='"+($size + $spacing)+"' width='"+$size+"' height='"+$size+"'/>";
|
|
75
|
+
|
|
76
|
+
@if length($colours) > 1 {
|
|
77
|
+
$dots : $dots + "<rect fill='"+$colour2+"' y='"+($size + $spacing)+"' x='0' width='"+$size+"' height='"+$size+"'/>";
|
|
78
|
+
$dots : $dots + "<rect fill='"+$colour2+"' y='0' x='"+($size + $spacing)+"' width='"+$size+"' height='"+$size+"'/>";
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
$dots : $dots + "</svg>";
|
|
82
|
+
|
|
83
|
+
@return svg($dots);
|
|
84
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/// Create a set of border-radius svg sprites with advance settings
|
|
2
|
+
///
|
|
3
|
+
/// @author Mark Notton
|
|
4
|
+
///
|
|
5
|
+
/// @access public
|
|
6
|
+
|
|
7
|
+
@mixin fake-radius($settings...) {
|
|
8
|
+
|
|
9
|
+
/*$count : 0;
|
|
10
|
+
|
|
11
|
+
$corner-settings: (
|
|
12
|
+
top-left : (
|
|
13
|
+
color : null,
|
|
14
|
+
width : null,
|
|
15
|
+
height : null
|
|
16
|
+
),
|
|
17
|
+
top-right : (
|
|
18
|
+
color : null,
|
|
19
|
+
width : null,
|
|
20
|
+
height : null
|
|
21
|
+
),
|
|
22
|
+
bottom-left : (
|
|
23
|
+
color : null,
|
|
24
|
+
width : null,
|
|
25
|
+
height : null
|
|
26
|
+
),
|
|
27
|
+
bottom-right : (
|
|
28
|
+
color : null,
|
|
29
|
+
width : null,
|
|
30
|
+
height : null
|
|
31
|
+
),
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
$corners : to-list($corner-settings, keys);
|
|
35
|
+
|
|
36
|
+
@debug $corners;
|
|
37
|
+
|
|
38
|
+
@each $settings in _arglist-to-list($settings...) {
|
|
39
|
+
$count : $count + 1;
|
|
40
|
+
|
|
41
|
+
@each $setting in $settings {
|
|
42
|
+
|
|
43
|
+
// If the settings contains one of the corners types, only focus on that one corner for the remaining settings.
|
|
44
|
+
@if is-string($setting) and contains($corners, $setting) {
|
|
45
|
+
$corner : $setting;
|
|
46
|
+
|
|
47
|
+
@each $setting in $settings {
|
|
48
|
+
@if is-colour($setting) and map-deep-get($corner-settings, $corner, color) == null {
|
|
49
|
+
$corner-settings : map-deep-set($corner-settings, $corner, color, colour($setting, true));
|
|
50
|
+
}
|
|
51
|
+
@elseif is-number($setting) {
|
|
52
|
+
@if map-deep-get($corner-settings, $corner, width) == null {
|
|
53
|
+
$corner-settings : map-deep-set($corner-settings, $corner, width, $setting);
|
|
54
|
+
} @else {
|
|
55
|
+
$corner-settings : map-deep-set($corner-settings, $corner, height, $setting);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Default colour if not supplied
|
|
61
|
+
@if map-deep-get($corner-settings, $corner, color) == null {
|
|
62
|
+
$corner-settings : map-deep-set($corner-settings, $corner, color, colour(red, true));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// If not units were found at all, revert the width back to a default radius setting
|
|
66
|
+
@if map-deep-get($corner-settings, $corner, width) == null {
|
|
67
|
+
$corner-settings : map-deep-set($corner-settings, $corner, width, $border-radius);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// If a second unit was not supplied, the height would be set to null. As a fallback, set height to width
|
|
71
|
+
@if map-deep-get($corner-settings, $corner, height) == null {
|
|
72
|
+
$corner-settings : map-deep-set($corner-settings, $corner, height, map-deep-get($corner-settings, $corner, width));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
@else {
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
@debug $corner-settings;*/
|
|
84
|
+
|
|
85
|
+
$colour : _hash-fix(#ffffff);
|
|
86
|
+
$size : $border-radius;
|
|
87
|
+
$sudo : before;
|
|
88
|
+
|
|
89
|
+
@each $settings in _arglist-to-list($settings...) {
|
|
90
|
+
@each $setting in $settings {
|
|
91
|
+
@if is-colour($setting) {
|
|
92
|
+
$colour : _hash-fix($setting);
|
|
93
|
+
}
|
|
94
|
+
@if is-string($setting) and _sudo($setting) {
|
|
95
|
+
$sudo : $setting;
|
|
96
|
+
}
|
|
97
|
+
@elseif is-number($setting) {
|
|
98
|
+
@if is-percentage($setting) {
|
|
99
|
+
$size : addUnit(_min-max-number(strip($setting))/2, %);
|
|
100
|
+
} @else {
|
|
101
|
+
$size : strip($setting);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
$svg : "<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='100%' height='100%'>";
|
|
108
|
+
$svg : $svg + "<def>";
|
|
109
|
+
$svg : $svg + "<symbol id='corner' viewBox='0 0 10 10'>";
|
|
110
|
+
$svg : $svg + "<path d='M10,0H0v9.9C0,4.1,4.7,0,10,0z'/>";
|
|
111
|
+
$svg : $svg + "</symbol>";
|
|
112
|
+
$svg : $svg + "</def>";
|
|
113
|
+
$svg : $svg + "<path d='M10,0H0v9.9C0,4.1,4.7,0,10,0z'/>";
|
|
114
|
+
$svg : $svg + "<use x='0' y='0%' width='"+$size+"' height='"+$size+"' fill='"+$colour+"' xlink:href='%23corner' />";
|
|
115
|
+
$svg : $svg + "<use x='-100%' y='0%' width='"+$size+"' height='"+$size+"' fill='"+$colour+"' transform='scale(-1,1)' xlink:href='%23corner' />";
|
|
116
|
+
$svg : $svg + "<use x='0%' y='-100%' width='"+$size+"' height='"+$size+"' fill='"+$colour+"' transform='scale(1,-1)' xlink:href='%23corner' />";
|
|
117
|
+
$svg : $svg + "<use x='-100%' y='-100%' width='"+$size+"' height='"+$size+"' fill='"+$colour+"' transform='scale(-1,-1)' xlink:href='%23corner' />";
|
|
118
|
+
$svg : $svg + "</svg>";
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
&#{_sudo($sudo)} {
|
|
122
|
+
@extend %sudo, %nopointerevent;
|
|
123
|
+
background-image:svg($svg); z-index:1;
|
|
124
|
+
@content;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
// xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
|
131
|
+
|