shevy 1.0.1 → 2.0.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.
@@ -1,123 +0,0 @@
1
- //////////////////////////////
2
- // Shevy Mixins
3
- //////////////////////////////
4
-
5
- // Headings
6
- //////////////////////////////
7
- @mixin headings($map: $shevy) {
8
- // Merge defaults with provided map,
9
- $_current_map: map-merge($shevy-defaults, $map);
10
-
11
- // create private vars for map settings
12
- $_base-font-unit: unit(map-get($_current_map, 'base-font-size'));
13
- $_base-unit-multiplier: base-unit-multiplier($_base-font-unit);
14
- $_base-font-size: map-get($_current_map, 'base-font-size');
15
- $_base-line-height: map-get($_current_map, 'base-line-height');
16
- $_base-spacing: $_base-font-size * $_base-line-height;
17
- $_font-scale-length: length(map-get($_current_map, 'base-font-scale'));
18
- $_margin_bottom_bool: map-get($_current_map, 'margin-bottom');
19
-
20
- @for $i from 1 through $_font-scale-length {
21
- h#{$i} {
22
- // Font size is base-font-size * font-scale[index]
23
- font-size: $_base-font-size * get-font-scale-value($i, $_current_map);
24
-
25
- // Line-height calculation for pxs and rems is different than ems
26
- @if $_base-font-unit == 'px' or $_base-font-unit == 'rem' {
27
-
28
- // if font-size is greater than base-spacing
29
- // more base-spacing will be necessary
30
- @if ((get-font-scale-value($i, $_current_map) * $_base-font-size) <= $_base-spacing) {
31
- line-height: $_base-spacing;
32
- } @else {
33
- $x: 1; // simple counter
34
- // Half increments, while technically breaking the baseline, are more aesthetically pleasing and still mathematically useful
35
- @while ($_base-spacing * ($x * .5)) <= (get-font-scale-value($i, $_current_map) * $_base-font-size) {
36
- $x: $x + 1; // increment counter
37
- }
38
- // Half increments, while technically breaking the baseline, are more aesthetically pleasing and still mathematically useful
39
- line-height: ($_base-spacing * ($x * .5));
40
- }
41
- } @else if $_base-font-unit == 'em' {
42
-
43
- // if font-size is greater than base spacing
44
- // more base-spacing will be necessary
45
- @if ((get-font-scale-value($i, $_current_map) * $_base-unit-multiplier) <= $_base-spacing) {
46
- line-height: $_base-spacing / (get-font-scale-value($i, $_current_map) * $_base-unit-multiplier); // * $_base-unit-multiplier removes base unit
47
- } @else {
48
- $y: 1; // simple counter, but Sass keeps vars in global scope, so we can't use $x
49
- // Half increments, while technically breaking the baseline, are more aesthetically pleasing and still mathematically useful
50
- @while ($_base-spacing * ($y * .5)) <= (get-font-scale-value($i, $_current_map) * $_base-unit-multiplier) {
51
- $y: $y + 1; // increment counter
52
- }
53
- // Half increments, while technically breaking the baseline, are more aesthetically pleasing and still mathematically useful
54
- line-height: ($_base-spacing * ($y * .5)) / (get-font-scale-value($i, $_current_map) * $_base-unit-multiplier); // * $_base-unit-multiplier removes base unit
55
- }
56
- } @else {
57
- @warn "Sorry, but that's an unsupported unit of measure.";
58
- }
59
-
60
- // Margin-bottom
61
- @if $_margin-bottom-bool {
62
- @if $_base-font-unit == 'px' or $_base-font-unit == 'rem' {
63
- margin-bottom: $_base-spacing;
64
- } @else if $_base-font-unit == 'em' {
65
- margin-bottom: $_base-spacing / get-font-scale-value($i, $_current_map);
66
- } @else {
67
- @warn "Sorry, but that's an unsupported unit of measure.";
68
- }
69
- } @else {
70
- margin-bottom: 0;
71
- }
72
- }
73
- }
74
- }
75
-
76
- // Paragraphs
77
- //////////////////////////////
78
- @mixin paragraph($supplied-map-for-paragraphs: $shevy) {
79
- // Merge defaults with provided map,
80
- $_current_map: map-merge($shevy-defaults, $supplied-map-for-paragraphs);
81
-
82
- // create private vars for map settings
83
- $_base-font-unit: unit(map-get($_current_map, 'base-font-size'));
84
- $_base-font-size: map-get($_current_map, 'base-font-size');
85
- $_base-line-height: map-get($_current_map, 'base-line-height');
86
- $_base-spacing: $_base-font-size * $_base-line-height;
87
- $_font-scale-length: length(map-get($_current_map, 'base-font-scale'));
88
- $_paragraph-scale: map-get($_current_map, 'paragraph-scale');
89
- $_margin_bottom_bool: map-get($_current_map, 'margin-bottom');
90
-
91
- @if $_paragraph-scale == false {
92
- $_paragraph-scale: get-font-scale-value($_font-scale-length, $_current_map);
93
- } @else {
94
- $_paragraph-scale: map-get($_current_map, 'paragraph-scale');
95
- }
96
-
97
- p {
98
- // We use the last supplied font-size in the current map
99
- font-size: $_base-font-size * $_paragraph-scale;
100
-
101
- // Line Height
102
- @if $_base-font-unit == 'px' or $_base-font-unit == 'rem' {
103
- line-height: $_base-spacing;
104
- } @else if $_base-font-unit == 'em' {
105
- line-height: $_base-spacing / get-font-scale-value($_font-scale-length, $_current_map);
106
- } @else {
107
- @warn "Sorry, but that's an unsupported unit of measure.";
108
- }
109
-
110
- // Margin Bottom
111
- @if $_margin-bottom-bool {
112
- @if $_base-font-unit == 'px' or $_base-font-unit == 'rem' {
113
- margin-bottom: $_base-spacing;
114
- } @else if $_base-font-unit == 'em' {
115
- margin-bottom: $_base-spacing / get-font-scale-value($_font-scale-length, $_current_map);
116
- } @else {
117
- @warn "Sorry, but that's an unsupported unit of measure.";
118
- }
119
- } @else {
120
- margin-bottom: 0;
121
- }
122
- }
123
- }
@@ -1,18 +0,0 @@
1
- //////////////////////////////
2
- // Shevy Variables
3
- //////////////////////////////
4
-
5
- // Default settings
6
- $shevy-defaults: (
7
- base-font-size: 1em,
8
- base-line-height: 1.5,
9
- base-font-scale: (3, 2.5, 2, 1.5, 1.25, 1),
10
- paragraph-scale: false,
11
- margin-bottom: true
12
- );
13
-
14
- // Empty $shevy set as default in case one is not supplied by user
15
- $shevy: () !default;
16
-
17
- // Merge defaults with $shevy to create base level map
18
- $shevy: map-merge($shevy-defaults, $shevy);