loomcss 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/.nvmrc +1 -0
- data/.stylelintrc +6 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +161 -0
- data/Rakefile +2 -0
- data/assets/loom/10-global-settings/_box-sizing.scss +5 -0
- data/assets/loom/10-global-settings/_breakpoints.scss +22 -0
- data/assets/loom/10-global-settings/_color.scss +79 -0
- data/assets/loom/10-global-settings/_icons.scss +5 -0
- data/assets/loom/10-global-settings/_misc.scss +89 -0
- data/assets/loom/10-global-settings/_spacing.scss +20 -0
- data/assets/loom/10-global-settings/_typography.scss +201 -0
- data/assets/loom/20-tools/_color.scss +22 -0
- data/assets/loom/20-tools/_grid-columns.scss +23 -0
- data/assets/loom/20-tools/_icons.scss +16 -0
- data/assets/loom/20-tools/_misc.scss +12 -0
- data/assets/loom/20-tools/_mq.scss +126 -0
- data/assets/loom/20-tools/_spacing.scss +14 -0
- data/assets/loom/20-tools/_transition.scss +10 -0
- data/assets/loom/20-tools/_type-checking.scss +52 -0
- data/assets/loom/20-tools/_typography.scss +130 -0
- data/assets/loom/20-tools/_z-index.scss +16 -0
- data/assets/loom/30-generic/_box-sizing.scss +9 -0
- data/assets/loom/30-generic/_normalize.scss +461 -0
- data/assets/loom/30-generic/_reset.scss +48 -0
- data/assets/loom/40-base-elements/_form-items.scss +50 -0
- data/assets/loom/40-base-elements/_images.scss +5 -0
- data/assets/loom/40-base-elements/_typography.scss +138 -0
- data/assets/loom/50-layout/_grid.scss +37 -0
- data/assets/loom/60-objects/_absolute-center.scss +18 -0
- data/assets/loom/60-objects/_absolute-cover.scss +19 -0
- data/assets/loom/60-objects/_button.scss +93 -0
- data/assets/loom/60-objects/_clearfix.scss +19 -0
- data/assets/loom/60-objects/_container.scss +34 -0
- data/assets/loom/60-objects/_fixed-ratio.scss +42 -0
- data/assets/loom/60-objects/_headings.scss +28 -0
- data/assets/loom/60-objects/_hide-visually.scss +23 -0
- data/assets/loom/60-objects/_icon.scss +30 -0
- data/assets/loom/60-objects/_list-inline.scss +37 -0
- data/assets/loom/60-objects/_list-reset.scss +25 -0
- data/assets/loom/60-objects/_media.scss +35 -0
- data/assets/loom/60-objects/_vertical-center.scss +18 -0
- data/assets/loom/70-ui-components/_example.scss +22 -0
- data/assets/loom/80-utilities/_background-color.scss +13 -0
- data/assets/loom/80-utilities/_border.scss +10 -0
- data/assets/loom/80-utilities/_color.scss +13 -0
- data/assets/loom/80-utilities/_display.scss +31 -0
- data/assets/loom/80-utilities/_font-family.scss +20 -0
- data/assets/loom/80-utilities/_font-size.scss +24 -0
- data/assets/loom/80-utilities/_font-style.scss +15 -0
- data/assets/loom/80-utilities/_font-weight.scss +15 -0
- data/assets/loom/80-utilities/_line-height.scss +0 -0
- data/assets/loom/80-utilities/_margin.scss +33 -0
- data/assets/loom/80-utilities/_padding.scss +32 -0
- data/assets/loom/80-utilities/_position.scss +15 -0
- data/assets/loom/80-utilities/_text-align.scss +19 -0
- data/assets/loom/80-utilities/_text-transform.scss +19 -0
- data/assets/loom/80-utilities/_vertical-align.scss +26 -0
- data/assets/loom/80-utilities/_white-space.scss +27 -0
- data/assets/loom/80-utilities/_width.scss +11 -0
- data/assets/loom/90-trumps/.keepfile +0 -0
- data/assets/loom/_10-global-settings.scss +7 -0
- data/assets/loom/_20-tools.scss +10 -0
- data/assets/loom/_30-generic.scss +2 -0
- data/assets/loom/_40-base-elements.scss +3 -0
- data/assets/loom/_50-layout.scss +1 -0
- data/assets/loom/_60-objects.scss +13 -0
- data/assets/loom/_70-ui-components.scss +0 -0
- data/assets/loom/_80-utilities.scss +17 -0
- data/assets/loom/_90-trumps.scss +0 -0
- data/assets/main-shorthand.scss +44 -0
- data/assets/main.scss +108 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/gulpfile.js +24 -0
- data/index.html +97 -0
- data/lib/loomcss.rb +2 -0
- data/lib/loomcss/engine.rb +9 -0
- data/lib/loomcss/version.rb +3 -0
- data/loomcss.gemspec +32 -0
- data/main.css +1298 -0
- data/package.json +36 -0
- data/public/docs/assets/images/favicon.png +0 -0
- data/public/docs/assets/images/logo_full_compact.svg +1 -0
- data/public/docs/assets/images/logo_full_inline.svg +1 -0
- data/public/docs/assets/images/logo_light_compact.svg +1 -0
- data/public/docs/assets/images/logo_light_inline.svg +1 -0
- data/public/docs/assets/js/main.js +56 -0
- data/public/docs/assets/js/main.min.js +1 -0
- data/public/docs/assets/js/search.js +146 -0
- data/public/docs/assets/js/sidebar.js +163 -0
- data/public/docs/assets/js/vendor/fuse.min.js +20 -0
- data/public/docs/assets/js/vendor/jquery.min.js +4 -0
- data/public/docs/assets/js/vendor/prism.min.js +9 -0
- data/public/docs/index.html +314 -0
- metadata +172 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/// The default global font stack for your site.
|
|
2
|
+
/// Each font stack has a default and a webfont version.
|
|
3
|
+
///
|
|
4
|
+
/// Fonts are called using get-font-family().
|
|
5
|
+
///
|
|
6
|
+
/// @group 10-global-settings
|
|
7
|
+
/// @type map
|
|
8
|
+
/// @example scss - Get fonts example
|
|
9
|
+
/// .class {
|
|
10
|
+
/// font-family: get-font-family(primary);
|
|
11
|
+
/// }
|
|
12
|
+
$LOOM-font-list: (
|
|
13
|
+
'primary': (
|
|
14
|
+
'default': sans-serif,
|
|
15
|
+
'webfont': sans-serif
|
|
16
|
+
),
|
|
17
|
+
'secondary': (
|
|
18
|
+
'default': serif,
|
|
19
|
+
'webfont': serif
|
|
20
|
+
)
|
|
21
|
+
) !default;
|
|
22
|
+
|
|
23
|
+
/// Use your own font map as the default global font list for use by the get-font-family() function.
|
|
24
|
+
///
|
|
25
|
+
/// @group 10-global-settings
|
|
26
|
+
$LOOM-fonts: $LOOM-font-list !default;
|
|
27
|
+
|
|
28
|
+
/// The classname name to use to place loaded webfonts behind.
|
|
29
|
+
///
|
|
30
|
+
/// If set to 'false' webfont strategies in Loom will be disabled.
|
|
31
|
+
///
|
|
32
|
+
/// @group 10-global-settings
|
|
33
|
+
/// @type string | boolean
|
|
34
|
+
/// @link https://fontfaceobserver.com/ See examples of how to use with Fontfaceobserver
|
|
35
|
+
$LOOM-fonts-loaded: 'fonts-loaded' !default;
|
|
36
|
+
|
|
37
|
+
// --- FONT WEIGHTS AND STYLES ---
|
|
38
|
+
// NOTE: These are abstracted so that we may easily switch between keywords and numbers as a project demands.
|
|
39
|
+
|
|
40
|
+
/// Set the default bold weight value
|
|
41
|
+
///
|
|
42
|
+
/// @group 10-global-settings
|
|
43
|
+
/// @type string
|
|
44
|
+
$LOOM-font-weight-bold: bold !default;
|
|
45
|
+
|
|
46
|
+
/// Set the default normal weight value
|
|
47
|
+
///
|
|
48
|
+
/// @group 10-global-settings
|
|
49
|
+
/// @type string
|
|
50
|
+
$LOOM-font-weight-normal: normal !default;
|
|
51
|
+
|
|
52
|
+
/// Set the default italic style value
|
|
53
|
+
///
|
|
54
|
+
/// @group 10-global-settings
|
|
55
|
+
/// @type string
|
|
56
|
+
$LOOM-font-style-italic: italic !default;
|
|
57
|
+
|
|
58
|
+
/// Set the default normal style value
|
|
59
|
+
///
|
|
60
|
+
/// @group 10-global-settings
|
|
61
|
+
/// @type string
|
|
62
|
+
$LOOM-font-style-normal: normal !default;
|
|
63
|
+
|
|
64
|
+
/// Set the default line-height.
|
|
65
|
+
///
|
|
66
|
+
/// @group 10-global-settings
|
|
67
|
+
/// @type number
|
|
68
|
+
$LOOM-line-height: 1.5 !default;
|
|
69
|
+
|
|
70
|
+
/// Defines the font sizes to be used in your site.
|
|
71
|
+
/// Each font size has a smaller-viewport and a larger-viewport version,
|
|
72
|
+
/// as generally fonts need to be slightly large on mobile devices.
|
|
73
|
+
///
|
|
74
|
+
/// There should always ideally be an "default" font that defines the base size
|
|
75
|
+
/// for the site.
|
|
76
|
+
///
|
|
77
|
+
/// Fonts are called using get-font-size().
|
|
78
|
+
///
|
|
79
|
+
/// @group 10-global-settings
|
|
80
|
+
/// @type map
|
|
81
|
+
$LOOM-font-sizes: (
|
|
82
|
+
'default': (
|
|
83
|
+
'smaller-viewport': ('font-size': 18px, 'line-height': 1.5),
|
|
84
|
+
'larger-viewport': ('font-size': 16px, 'line-height': 1.5)
|
|
85
|
+
),
|
|
86
|
+
'alpha': (
|
|
87
|
+
'smaller-viewport': ('font-size': 36px, 'line-height': 1.5),
|
|
88
|
+
'larger-viewport': ('font-size': 32px, 'line-height': 1.5)
|
|
89
|
+
),
|
|
90
|
+
'beta': (
|
|
91
|
+
'smaller-viewport': ('font-size': 30px, 'line-height': 1.5),
|
|
92
|
+
'larger-viewport': ('font-size': 28px, 'line-height': 1.5)
|
|
93
|
+
),
|
|
94
|
+
'gamma': (
|
|
95
|
+
'smaller-viewport': ('font-size': 26px, 'line-height': 1.5),
|
|
96
|
+
'larger-viewport': ('font-size': 24px, 'line-height': 1.5)
|
|
97
|
+
),
|
|
98
|
+
'delta': (
|
|
99
|
+
'smaller-viewport': ('font-size': 22px, 'line-height': 1.5),
|
|
100
|
+
'larger-viewport': ('font-size': 20px, 'line-height': 1.5)
|
|
101
|
+
),
|
|
102
|
+
'epsilon': (
|
|
103
|
+
'smaller-viewport': ('font-size': 20px, 'line-height': 1.5),
|
|
104
|
+
'larger-viewport': ('font-size': 18px, 'line-height': 1.5)
|
|
105
|
+
),
|
|
106
|
+
'zeta': (
|
|
107
|
+
'smaller-viewport': ('font-size': 18px, 'line-height': 1.5),
|
|
108
|
+
'larger-viewport': ('font-size': 16px, 'line-height': 1.5)
|
|
109
|
+
)
|
|
110
|
+
) !default;
|
|
111
|
+
|
|
112
|
+
/// Sizes that are applied to base HTML element headings
|
|
113
|
+
///
|
|
114
|
+
/// @group 10-global-settings
|
|
115
|
+
/// @type map
|
|
116
|
+
$LOOM-h-element-sizes: (
|
|
117
|
+
'h1': 'alpha',
|
|
118
|
+
'h2': 'beta',
|
|
119
|
+
'h3': 'gamma',
|
|
120
|
+
'h4': 'delta',
|
|
121
|
+
'h5': 'epsilon',
|
|
122
|
+
'h6': 'zeta'
|
|
123
|
+
) !default;
|
|
124
|
+
|
|
125
|
+
/// If set to TRUE, base headings will receive default sizes and will appear
|
|
126
|
+
/// as "traditional" headings. If FALSE, base headings will receive the same
|
|
127
|
+
/// sizing and styling as the body text.
|
|
128
|
+
///
|
|
129
|
+
/// @group 10-global-settings
|
|
130
|
+
/// @type boolean
|
|
131
|
+
$LOOM-generate-sizes-for-default-headings: true !default;
|
|
132
|
+
|
|
133
|
+
/// If this list is defined, the following sizes will be generated as object
|
|
134
|
+
/// classes (`.o-alpha {}`).
|
|
135
|
+
///
|
|
136
|
+
/// Objects be also consumed directly with '@include font-size($name)';
|
|
137
|
+
///
|
|
138
|
+
/// @group 10-global-settings
|
|
139
|
+
/// @type list
|
|
140
|
+
$LOOM-h-object-sizes: (
|
|
141
|
+
'alpha',
|
|
142
|
+
'beta',
|
|
143
|
+
'gamma',
|
|
144
|
+
'delta',
|
|
145
|
+
'epsilon',
|
|
146
|
+
'zeta'
|
|
147
|
+
) !default;
|
|
148
|
+
|
|
149
|
+
/// At what breakpoint does the typography switch from fonts sizes appropiate
|
|
150
|
+
/// for smaller devices to font sizes appropiate for larger devices?
|
|
151
|
+
///
|
|
152
|
+
/// Must match one of the breakpoints in $LOOM-mq-breakpoints.
|
|
153
|
+
///
|
|
154
|
+
/// @group 10-global-settings
|
|
155
|
+
/// @type boolean
|
|
156
|
+
/// @see $LOOM-mq-breakpoints
|
|
157
|
+
$LOOM-typography-breakpoint: medium !default;
|
|
158
|
+
|
|
159
|
+
/// Default value for when primary base fonts are called.
|
|
160
|
+
///
|
|
161
|
+
/// Intended to be overriden by user choices.
|
|
162
|
+
///
|
|
163
|
+
/// @group 10-global-settings
|
|
164
|
+
/// @access private
|
|
165
|
+
$LOOM-font-family-primary-default: sans-serif !default;
|
|
166
|
+
|
|
167
|
+
/// Default value for when primary web fonts are called.
|
|
168
|
+
///
|
|
169
|
+
/// Intended to be overriden by user choices.
|
|
170
|
+
///
|
|
171
|
+
/// @group 10-global-settings
|
|
172
|
+
/// @access private
|
|
173
|
+
$LOOM-font-family-primary-webfont: sans-serif !default;
|
|
174
|
+
|
|
175
|
+
/// Default value for when secondary base fonts are called.
|
|
176
|
+
///
|
|
177
|
+
/// Intended to be overriden by user choices.
|
|
178
|
+
///
|
|
179
|
+
/// @group 10-global-settings
|
|
180
|
+
/// @access private
|
|
181
|
+
$LOOM-font-family-seconday-default: serif !default;
|
|
182
|
+
|
|
183
|
+
/// Default value for when secondary web fonts are called.
|
|
184
|
+
///
|
|
185
|
+
/// Intended to be overriden by user choices.
|
|
186
|
+
///
|
|
187
|
+
/// @group 10-global-settings
|
|
188
|
+
/// @access private
|
|
189
|
+
$LOOM-font-family-seconday-webfont: serif !default;
|
|
190
|
+
|
|
191
|
+
/// Default base font size, small screen devices.
|
|
192
|
+
///
|
|
193
|
+
/// Intended to be overridden by user choices.
|
|
194
|
+
/// @group 10-global-settings
|
|
195
|
+
$LOOM-font-size-on-smaller-screens: 18px !default;
|
|
196
|
+
|
|
197
|
+
/// Default font size, large screen devices.
|
|
198
|
+
///
|
|
199
|
+
/// Intended to be overridden by user choices.
|
|
200
|
+
/// @group 10-global-settings
|
|
201
|
+
$LOOM-font-size-on-larger-screens: 16px !default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// Extract a color value from a map.
|
|
2
|
+
///
|
|
3
|
+
/// @group 20-tools
|
|
4
|
+
/// @parameter {string} $color-name - The key name for a colour key/value pair.
|
|
5
|
+
/// @parameter {map} $color-list - A map of spacing key/value pairs to use. Defaults to $LOOM-colors-list.
|
|
6
|
+
@function get-color($color-name, $color-list: $LOOM-colors-list) {
|
|
7
|
+
$color-name: inspect($color-name); // Force value to a string, as if a key value happens to match a CSS colour value, it will be imported as a Sass colour, not a string, causing an error in map-get().
|
|
8
|
+
|
|
9
|
+
@if map-has-key($color-list, $color-name) {
|
|
10
|
+
$output: map-get($color-list, $color-name);
|
|
11
|
+
|
|
12
|
+
@if type-of($output) != color {
|
|
13
|
+
@error $color-name " could not be found in the global colour list.";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@return $output;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@else {
|
|
20
|
+
@return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// Generate grid columns. The column widths will be calculated automatically.
|
|
2
|
+
///
|
|
3
|
+
/// @group 20-tools
|
|
4
|
+
/// @parameter {number} $columns - The number of columns to generate.
|
|
5
|
+
/// @parameter {string} $breakpoint - If defined, each column will have this breakpoint name appended at the end.
|
|
6
|
+
@mixin grid-columns($columns, $breakpoint: null) {
|
|
7
|
+
@each $column-item in $columns {
|
|
8
|
+
@if ($columns == 1) {
|
|
9
|
+
.l-col-1-of-1#{$breakpoint} {
|
|
10
|
+
flex-basis: 0;
|
|
11
|
+
flex-grow: 1;
|
|
12
|
+
max-width: 100%;
|
|
13
|
+
}
|
|
14
|
+
} @else { // stylelint-disable-line
|
|
15
|
+
@for $i from 1 to ($column-item + 1) {
|
|
16
|
+
.l-col-#{$i}-of-#{$column-item}#{$breakpoint} {
|
|
17
|
+
flex-basis: ($i / $column-item) * 100%;
|
|
18
|
+
max-width: ($i / $column-item) * 100%;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// Get an icon size from a name.
|
|
2
|
+
///
|
|
3
|
+
/// @group 20-tools
|
|
4
|
+
/// @parameter {string} $icon-name - An icon size name, corresponding to a key in $icon-size-map
|
|
5
|
+
/// @parameter {map} $icon-size-map - A map of icon names to sizes.
|
|
6
|
+
@function get-icon-size($icon-name: default, $icon-size-map: $LOOM-icon-sizes) {
|
|
7
|
+
@if map-has-key($icon-size-map, $icon-name) {
|
|
8
|
+
@return map-get($icon-size-map, $icon-name);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@else {
|
|
12
|
+
@warn "#{$icon-name} not found in get-icon-size";
|
|
13
|
+
|
|
14
|
+
@return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// Get a value from a nested sass map.
|
|
2
|
+
///
|
|
3
|
+
/// @group 20-tools
|
|
4
|
+
/// @parameter {map} $map - A multi-level Sass map.
|
|
5
|
+
/// @parameter {arglist} $keys - A list of keys, representing a traversel of the nested Sass map.
|
|
6
|
+
@function get-map-deep($map, $keys...) {
|
|
7
|
+
@each $key in $keys {
|
|
8
|
+
$map: map-get($map, $key);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@return $map;
|
|
12
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Lovingly repurposed from https://github.com/sass-mq/sass-mq
|
|
2
|
+
|
|
3
|
+
@charset "UTF-8";
|
|
4
|
+
// Fixes an issue where Ruby locale is not set properly
|
|
5
|
+
// See https://github.com/sass-mq/sass-mq/pull/10
|
|
6
|
+
|
|
7
|
+
/// Get a breakpoint's width
|
|
8
|
+
///
|
|
9
|
+
/// @param {String} $name - Name of the breakpoint. One of $LOOM-mq-breakpoints
|
|
10
|
+
///
|
|
11
|
+
/// @example scss
|
|
12
|
+
/// $tablet-width: get-breakpoint(tablet);
|
|
13
|
+
/// @media (min-width: get-breakpoint(desktop)) {}
|
|
14
|
+
///
|
|
15
|
+
/// @requires {Variable} $LOOM-mq-breakpoints
|
|
16
|
+
/// @group 20-tools
|
|
17
|
+
/// @returns {Number} Value in pixels
|
|
18
|
+
@function get-breakpoint($name, $breakpoints: $LOOM-mq-breakpoints) {
|
|
19
|
+
@if map-has-key($breakpoints, $name) {
|
|
20
|
+
@return map-get($breakpoints, $name);
|
|
21
|
+
} @else { // stylelint-disable-line
|
|
22
|
+
@warn "Breakpoint #{$name} wasn't found in $breakpoints.";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/// Media Query mixin
|
|
27
|
+
///
|
|
28
|
+
/// Lovingly repurposed from https://github.com/sass-mq/sass-mq
|
|
29
|
+
///
|
|
30
|
+
/// @parameter {String | Boolean} $from (false) - One of $LOOM-mq-breakpoints
|
|
31
|
+
/// @parameter {String | Boolean} $until (false) - One of $LOOM-mq-breakpoints
|
|
32
|
+
/// @parameter {String | Boolean} $and (false) - Additional media query parameters
|
|
33
|
+
/// @parameter {String} $media-type ($LOOM-mq-media-type) - Media type: screen, print…
|
|
34
|
+
///
|
|
35
|
+
/// @ignore Undocumented API, for advanced use only:
|
|
36
|
+
/// @ignore @param {Map} $breakpoints ($LOOM-mq-breakpoints)
|
|
37
|
+
///
|
|
38
|
+
///
|
|
39
|
+
/// @requires {Variable} $LOOM-mq-media-type
|
|
40
|
+
/// @requires {Variable} $LOOM-mq-breakpoints
|
|
41
|
+
/// @requires {function} convert-px-to-em
|
|
42
|
+
/// @requires {function} get-breakpoint
|
|
43
|
+
///
|
|
44
|
+
/// @example scss
|
|
45
|
+
/// .element {
|
|
46
|
+
/// @include mq($from: mobile) {
|
|
47
|
+
/// color: red;
|
|
48
|
+
/// }
|
|
49
|
+
/// @include mq($until: tablet) {
|
|
50
|
+
/// color: blue;
|
|
51
|
+
/// }
|
|
52
|
+
/// @include mq(mobile, tablet) {
|
|
53
|
+
/// color: green;
|
|
54
|
+
/// }
|
|
55
|
+
/// @include mq($from: tablet, $and: '(orientation: landscape)') {
|
|
56
|
+
/// color: teal;
|
|
57
|
+
/// }
|
|
58
|
+
/// @include mq(950px) {
|
|
59
|
+
/// color: hotpink;
|
|
60
|
+
/// }
|
|
61
|
+
/// @include mq(tablet, $media-type: screen) {
|
|
62
|
+
/// color: hotpink;
|
|
63
|
+
/// }
|
|
64
|
+
/// }
|
|
65
|
+
/// @group 20-tools
|
|
66
|
+
@mixin mq(
|
|
67
|
+
$from: false,
|
|
68
|
+
$until: false,
|
|
69
|
+
$and: false,
|
|
70
|
+
$media-type: $LOOM-mq-media-type,
|
|
71
|
+
$breakpoints: $LOOM-mq-breakpoints
|
|
72
|
+
) {
|
|
73
|
+
$min-width: 0;
|
|
74
|
+
$max-width: 0;
|
|
75
|
+
$media-query: '';
|
|
76
|
+
|
|
77
|
+
// From: this breakpoint (inclusive)
|
|
78
|
+
@if $from {
|
|
79
|
+
@if type-of($from) == number {
|
|
80
|
+
$min-width: convert-px-to-em($from);
|
|
81
|
+
} @else { // stylelint-disable-line
|
|
82
|
+
$min-width: convert-px-to-em(get-breakpoint($from, $breakpoints));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Until: that breakpoint (exclusive)
|
|
87
|
+
@if $until {
|
|
88
|
+
@if type-of($until) == number {
|
|
89
|
+
$max-width: convert-px-to-em($until);
|
|
90
|
+
} @else { // stylelint-disable-line
|
|
91
|
+
$max-width: convert-px-to-em(get-breakpoint($until, $breakpoints)) - 0.01em;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@if $min-width != 0 { $media-query: '#{$media-query} and (min-width: #{$min-width})'; }
|
|
96
|
+
|
|
97
|
+
@if $max-width != 0 { $media-query: '#{$media-query} and (max-width: #{$max-width})'; }
|
|
98
|
+
|
|
99
|
+
@if $and { $media-query: '#{$media-query} and #{$and}'; }
|
|
100
|
+
|
|
101
|
+
// Remove unnecessary media query prefix 'all and '
|
|
102
|
+
@if ($media-type == 'all' and $media-query != '') {
|
|
103
|
+
$media-type: '';
|
|
104
|
+
$media-query: str-slice(unquote($media-query), 6);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@media #{$media-type + $media-query} {
|
|
108
|
+
@content;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/// Add a breakpoint
|
|
113
|
+
///
|
|
114
|
+
/// @param {String} $name - Name of the breakpoint
|
|
115
|
+
/// @param {Number} $width - Width of the breakpoint
|
|
116
|
+
///
|
|
117
|
+
/// @requires {Variable} $LOOM-mq-breakpoints
|
|
118
|
+
///
|
|
119
|
+
/// @example scss
|
|
120
|
+
/// @include add-breakpoint(tvscreen, 1920px);
|
|
121
|
+
/// @include mq(tvscreen) {}
|
|
122
|
+
/// @group 20-tools
|
|
123
|
+
@mixin add-breakpoint($name, $width) {
|
|
124
|
+
$new-breakpoint: ($name: $width);
|
|
125
|
+
$LOOM-mq-breakpoints: map-merge($LOOM-mq-breakpoints, $new-breakpoint) !global;
|
|
126
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// Retrieve a spacing value.
|
|
2
|
+
///
|
|
3
|
+
/// @group 20-tools
|
|
4
|
+
/// @parameter {string} $spacing-name - The key for a spacing pair. Defaults to "default".
|
|
5
|
+
/// @parameter {map} $spacing-list - A map of spacing key/value pairs to use. Defaults to $LOOM-spacing.
|
|
6
|
+
@function get-spacing($spacing-name: default, $spacing-list: $LOOM-spacing) {
|
|
7
|
+
@if map-has-key($spacing-list, $spacing-name) {
|
|
8
|
+
@return map-get($LOOM-spacing, $spacing-name);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@else {
|
|
12
|
+
@return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// Retrieve a CSS transition
|
|
2
|
+
///
|
|
3
|
+
/// @group 20-tools
|
|
4
|
+
/// @parameter {string} $transition-property-name - Which property to animate. Defaults to "all".
|
|
5
|
+
/// @parameter {time} $transition-duration - How long should the animation take.
|
|
6
|
+
/// @parameter {string} $transition-timing-function - What timing/easing function should be used.
|
|
7
|
+
/// @parameter {time} $transition-delay - What delay is at the start of the transition.
|
|
8
|
+
@function get-transition($transition-property-name: all, $transition-duration: $LOOM-transition-duration, $transition-timing-function: $LOOM-transition-timing-function, $transition-delay: 0s) {
|
|
9
|
+
@return $transition-property-name $transition-duration $transition-timing-function $transition-delay;
|
|
10
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
////
|
|
2
|
+
/// A collection of function for advanced type checking
|
|
3
|
+
/// @author Hugo Giraudel
|
|
4
|
+
////
|
|
5
|
+
|
|
6
|
+
@function is-number($value) {
|
|
7
|
+
@return type-of($value) == 'number';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@function is-time($value) {
|
|
11
|
+
@return is-number($value) and index('ms' 's', unit($value)) != null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@function is-duration($value) {
|
|
15
|
+
@return is-time($value);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@function is-angle($value) {
|
|
19
|
+
@return is-number($value) and index('deg' 'rad' 'grad' 'turn', unit($value)) != null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@function is-frequency($value) {
|
|
23
|
+
@return is-number($value) and index('Hz' 'kHz', unit($value)) != null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@function is-integer($value) {
|
|
27
|
+
@return is-number($value) and round($value) == $value;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@function is-relative-length($value) {
|
|
31
|
+
@return is-number($value) and index('em' 'ex' 'ch' 'rem' 'vw' 'vh' 'vmin' 'vmax', unit($value)) != null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@function is-absolute-length($value) {
|
|
35
|
+
@return is-number($value) and index('cm' 'mm' 'in' 'px' 'pt' 'pc', unit($value)) != null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@function is-percentage($value) {
|
|
39
|
+
@return is-number($value) and unit($value) == '%';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@function is-length($value) {
|
|
43
|
+
@return is-relative-length($value) or is-absolute-length($value);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@function is-resolution($value) {
|
|
47
|
+
@return is-number($value) and index('dpi' 'dpcm' 'dppx', unit($value)) != null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@function is-position($value) {
|
|
51
|
+
@return is-length($value) or is-percentage($value) or index('top' 'right' 'bottom' 'left' 'center', $value) != null;
|
|
52
|
+
}
|