@canopycanopycanopy/b-ber-theme-serif 2.0.0 → 3.0.2
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.
- package/_settings.scss +12 -86
- package/application.scss +11 -71
- package/layout/{base/_container.scss → _container.scss} +30 -15
- package/layout/{base/_figure.scss → _figure.scss} +2 -2
- package/layout/_helpers.scss +34 -0
- package/layout/_layout.scss +9 -49
- package/layout/{base/_list.scss → _list.scss} +5 -5
- package/layout/{base/_media.scss → _media.scss} +0 -0
- package/layout/{base/_print.scss → _print.scss} +0 -0
- package/layout/{base/_reader.scss → _reader.scss} +2 -3
- package/layout/{base/_table.scss → _table.scss} +2 -2
- package/layout/{base/_text.scss → _text.scss} +35 -35
- package/layout/{base/_web.scss → _web.scss} +38 -38
- package/layout/index.scss +10 -0
- package/mixins/_elements.scss +45 -0
- package/mixins/_fonts.scss +21 -0
- package/mixins/_media-queries.scss +51 -0
- package/{_mixins.scss → mixins/_old.scss} +2 -2
- package/mixins/_text.scss +51 -0
- package/mixins/_util.scss +73 -0
- package/mixins/_vertical-rhythm.scss +169 -0
- package/mixins/index.scss +8 -0
- package/package.json +7 -8
- package/typography/index.scss +4 -0
- package/layout/base/_layout.scss +0 -10
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
// Returns a unitless line-height value, relative to an element's font size.
|
|
2
|
+
// Calculated by using the global `$line-height-base`
|
|
3
|
+
// @example line-height(11.390625em) // => 1.037037037
|
|
4
|
+
@function line-height($font-size) {
|
|
5
|
+
@return $line-height-base * 1em * math.div($line-height-base, $font-size);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// Returns a value for a single line-height unit in `em`s, relative to the
|
|
9
|
+
// element's font-size. Useful for consistently spacing top/bottom
|
|
10
|
+
// margin/padding
|
|
11
|
+
// @example adjust-line-height-value(0) // => 1.3125em
|
|
12
|
+
// @example adjust-line-height-value(6) // => 0.1152263374em
|
|
13
|
+
@function adjust-line-height-value($value) {
|
|
14
|
+
@return math.div($line-height-base, strip-unit(ms($value))) + 0em;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Returns relative em value representing the base font size that is
|
|
18
|
+
// adjusted for the elements font size. Examples below assume the
|
|
19
|
+
// $font-size-base is 1.6em
|
|
20
|
+
// @example adjust-font-size-value(0) => 1em // 16px
|
|
21
|
+
// @example adjust-font-size-value(-1) => 1.066666667em // 16px
|
|
22
|
+
// @example adjust-font-size-value(-2) => 1.1377777785em // 16px
|
|
23
|
+
@function adjust-font-size-value($value) {
|
|
24
|
+
@return math.div(strip-unit($font-size-base), strip-unit(ms($value))) + 0em;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Compose typographic styles
|
|
28
|
+
@mixin type-settings($value) {
|
|
29
|
+
font-size: ms($value);
|
|
30
|
+
line-height: line-height(ms($value));
|
|
31
|
+
|
|
32
|
+
@if $vertical-space == true {
|
|
33
|
+
margin-bottom: adjust-line-height-value($value);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Abstract wrappers for element spacing
|
|
38
|
+
// @param $n int How many spaces?
|
|
39
|
+
// @param $value int The modular scale index of the element
|
|
40
|
+
@function n-lines($n, $value) {
|
|
41
|
+
@return adjust-line-height-value($value) * $n + 0em;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@function n-ems($n, $value) {
|
|
45
|
+
@return adjust-font-size-value($value) * $n + 0em;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Convenience wrappers for element spacing.
|
|
49
|
+
// @param $value int The modular scale index of the element
|
|
50
|
+
// @example margin-top: one-line(0); // => margin-top: 1.3125em;
|
|
51
|
+
@function one-line($value) {
|
|
52
|
+
@return n-lines(1, $value);
|
|
53
|
+
}
|
|
54
|
+
@function two-lines($value) {
|
|
55
|
+
@return n-lines(2, $value);
|
|
56
|
+
}
|
|
57
|
+
@function three-lines($value) {
|
|
58
|
+
@return n-lines(3, $value);
|
|
59
|
+
}
|
|
60
|
+
@function four-lines($value) {
|
|
61
|
+
@return n-lines(4, $value);
|
|
62
|
+
}
|
|
63
|
+
@function five-lines($value) {
|
|
64
|
+
@return n-lines(5, $value);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// @param $value int The modular scale index of the element
|
|
68
|
+
// @example margin-top: one-em(0); // => margin-top: 1em;
|
|
69
|
+
@function one-em($value) {
|
|
70
|
+
@return n-ems(1, $value);
|
|
71
|
+
}
|
|
72
|
+
@function two-ems($value) {
|
|
73
|
+
@return n-ems(2, $value);
|
|
74
|
+
}
|
|
75
|
+
@function three-ems($value) {
|
|
76
|
+
@return n-ems(3, $value);
|
|
77
|
+
}
|
|
78
|
+
@function four-ems($value) {
|
|
79
|
+
@return n-ems(4, $value);
|
|
80
|
+
}
|
|
81
|
+
@function five-ems($value) {
|
|
82
|
+
@return n-ems(5, $value);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Add padding and margins programmatically based on font-size
|
|
86
|
+
// @param $value string Elements type-settings name
|
|
87
|
+
// @param $top[, $left[, $bottom[, $right]]] int, int, int, int Number of line-height/font-size units
|
|
88
|
+
@function spacing($value, $args) {
|
|
89
|
+
$result: ();
|
|
90
|
+
|
|
91
|
+
@if length($args) > 4 {
|
|
92
|
+
@error "`*-margin' and `*-padding' mixins expect maximum four arguments";
|
|
93
|
+
} @else if length($args) == 1 {
|
|
94
|
+
$y: adjust-line-height-value($value) * nth($args, 1) + 0em;
|
|
95
|
+
$x: adjust-font-size-value($value) * nth($args, 1) + 0em;
|
|
96
|
+
|
|
97
|
+
$result: ($y $x $y $x);
|
|
98
|
+
} @else if length($args) == 2 {
|
|
99
|
+
$y: adjust-line-height-value($value) * nth($args, 1) + 0em;
|
|
100
|
+
$x: adjust-font-size-value($value) * nth($args, 2) + 0em;
|
|
101
|
+
|
|
102
|
+
$result: ($y $x $y $x);
|
|
103
|
+
} @else if length($args) == 3 {
|
|
104
|
+
$y1: adjust-line-height-value($value) * nth($args, 1) + 0em;
|
|
105
|
+
$x: adjust-font-size-value($value) * nth($args, 2) + 0em;
|
|
106
|
+
$y2: adjust-line-height-value($value) * nth($args, 3) + 0em;
|
|
107
|
+
|
|
108
|
+
$result: ($y1 $x $y2 0);
|
|
109
|
+
} @else {
|
|
110
|
+
$y1: adjust-line-height-value($value) * nth($args, 1) + 0em;
|
|
111
|
+
$x1: adjust-font-size-value($value) * nth($args, 2) + 0em;
|
|
112
|
+
$y2: adjust-line-height-value($value) * nth($args, 3) + 0em;
|
|
113
|
+
$x2: adjust-font-size-value($value) * nth($args, 4) + 0em;
|
|
114
|
+
|
|
115
|
+
$result: ($y1 $x1 $y2 $x2);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@return $result;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Type settings for specific elements
|
|
122
|
+
@mixin caption-text {
|
|
123
|
+
@include type-settings(-7);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@mixin table-text {
|
|
127
|
+
@include type-settings(-6);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@mixin sup-text {
|
|
131
|
+
@include type-settings(-8);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Generic type settings
|
|
135
|
+
@mixin text-large {
|
|
136
|
+
@include type-settings(0);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@mixin text-medium {
|
|
140
|
+
@include type-settings(-1);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@mixin text-small {
|
|
144
|
+
@include type-settings(-2);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@mixin text-xsmall {
|
|
148
|
+
@include type-settings(-4);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
$type-settings-map: (
|
|
152
|
+
'text-large': 0,
|
|
153
|
+
'text-medium': -1,
|
|
154
|
+
'text-small': -2,
|
|
155
|
+
'text-xsmall': -4,
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
// @example @include margin('text-small', 0, 1); // => margin: 0em 1em 0em 1em;
|
|
159
|
+
// @example @include margin('text-small', 1); // => margin: 1em 1em 1em 1em;
|
|
160
|
+
// @example @include margin('text-small', 0, 1, 1); // => margin: 0em 1em 1em 0em;
|
|
161
|
+
@mixin margin($name, $args...) {
|
|
162
|
+
$numeric-value: map-get($type-settings-map, $name);
|
|
163
|
+
margin: spacing($numeric-value, $args);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
@mixin padding($name, $args...) {
|
|
167
|
+
$numeric-value: map-get($type-settings-map, $name);
|
|
168
|
+
padding: spacing($numeric-value, $args);
|
|
169
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canopycanopycanopy/b-ber-theme-serif",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "A serif theme for b-ber projects",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Triple Canopy <b-ber@canopycanopycanopy.com> (https://triplecanopy.github.io/)",
|
|
@@ -17,17 +17,16 @@
|
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
20
|
-
"clean": "echo OK"
|
|
20
|
+
"clean": "echo OK",
|
|
21
|
+
"sass": "sass",
|
|
22
|
+
"watch:sass": "sass --watch application.scss application.css",
|
|
23
|
+
"build:sass": "sass application.scss application.css"
|
|
21
24
|
},
|
|
22
25
|
"dependencies": {
|
|
23
|
-
"lodash": "^4.17.21",
|
|
24
26
|
"modularscale-sass": "^3.0.10"
|
|
25
27
|
},
|
|
26
28
|
"devDependencies": {
|
|
27
|
-
"
|
|
28
|
-
"@babel/core": "^7.10.5",
|
|
29
|
-
"@babel/preset-env": "^7.10.4",
|
|
30
|
-
"browserslist": "^4.17.4"
|
|
29
|
+
"sass": "^1.49.8"
|
|
31
30
|
},
|
|
32
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "1ec8ab9a4030fb59839d347beb04ab7605e3d5dd"
|
|
33
32
|
}
|