@foeewni/web-core 2.2.5 → 2.2.8
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/dist/css/foe.critical.min.css +3 -3
- package/dist/css/foe.extras.min.css +1 -1
- package/dist/css/foe.main.min.css +6 -6
- package/dist/js/foe.critical.min.js +1 -1
- package/dist/js/foe.fonts.min.js +1 -1
- package/dist/js/foe.main.min.js +1 -1
- package/package.json +1 -1
- package/src/components/form/buttons.scss +10 -20
- package/src/components/tools/data-defer-src.js +42 -55
- package/src/components/tools/data-defer-src.scss +5 -19
- package/src/components/tools/data-scroll-to.js +12 -5
- package/src/fonts.js +2 -1
- package/src/utils/js/screen.service.js +12 -0
- package/src/utils/scss/exporter.scss +4 -0
- package/src/utils/scss/helpers/_variables.scss +17 -2
|
@@ -9,33 +9,34 @@ Form `type=submit`s, `button`s are by default uncolorized, please use one of the
|
|
|
9
9
|
|
|
10
10
|
```html_example
|
|
11
11
|
<div class="row">
|
|
12
|
-
<div class="col-md-
|
|
12
|
+
<div class="col-md-6">
|
|
13
13
|
<h4>Primary palette</h4>
|
|
14
14
|
<button class="btn btn-primary btn-block">.btn-primary</button>
|
|
15
15
|
<button class="btn btn-secondary btn-block">.btn-secondary</button>
|
|
16
16
|
<button class="btn btn-offwhite btn-block">.btn-offwhite</button>
|
|
17
17
|
<button class="btn btn-dark btn-block">.btn-dark</button>
|
|
18
18
|
<button class="btn btn-extradark btn-block">.btn-extradark</button>
|
|
19
|
+
<button class="btn btn-sunset btn-block">.btn-sunset</button>
|
|
20
|
+
<button class="btn btn-accent btn-block">.btn-accent</button>
|
|
21
|
+
<button class="btn btn-join btn-block">.btn-join</button>
|
|
22
|
+
<button class="btn btn-donate btn-block">.btn-donate</button>
|
|
19
23
|
<a href="#" class="btn btn-primary btn-block">Link as button</a>
|
|
20
24
|
</div>
|
|
21
25
|
|
|
22
|
-
<div class="col-md-
|
|
26
|
+
<div class="col-md-6">
|
|
23
27
|
<h4>Outlined</h4>
|
|
24
28
|
<button class="btn btn-outline-primary btn-block">.btn-outline-primary</button>
|
|
25
29
|
<button class="btn btn-outline-secondary btn-block">.btn-outline-secondary</button>
|
|
26
30
|
<button class="btn btn-outline-offwhite btn-block">.btn-outline-offwhite</button>
|
|
27
31
|
<button class="btn btn-outline-dark btn-block">.btn-outline-dark</button>
|
|
28
32
|
<button class="btn btn-outline-extradark btn-block">.btn-outline-extradark</button>
|
|
33
|
+
<button class="btn btn-outline-sunset btn-block">.btn-outline-sunset</button>
|
|
34
|
+
<button class="btn btn-outline-accent btn-block">.btn-outline-accent</button>
|
|
35
|
+
<button class="btn btn-outline-join btn-block">.btn-outline-join</button>
|
|
36
|
+
<button class="btn btn-outline-donate btn-block">.btn-outline-donate</button>
|
|
29
37
|
<a href="#" class="btn btn-outline-primary btn-block">Link as button</a>
|
|
30
38
|
</div>
|
|
31
39
|
|
|
32
|
-
<div class="col-md-4">
|
|
33
|
-
<h4>Secondary palette</h4>
|
|
34
|
-
<button class="btn btn-accent btn-block">.btn-accent</button>
|
|
35
|
-
<button class="btn btn-join btn-block">.btn-join</button>
|
|
36
|
-
<button class="btn btn-donate btn-block">.btn-donate</button>
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
40
|
</div>
|
|
40
41
|
|
|
41
42
|
```
|
|
@@ -52,9 +53,6 @@ input[type=button],
|
|
|
52
53
|
button {
|
|
53
54
|
&:not(.btn) {
|
|
54
55
|
@extend .btn;
|
|
55
|
-
|
|
56
|
-
text-transform: uppercase;
|
|
57
|
-
font-weight: bold;
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
58
|
|
|
@@ -62,17 +60,9 @@ input[type=reset] {
|
|
|
62
60
|
&:not(.btn) {
|
|
63
61
|
@extend .btn;
|
|
64
62
|
@extend .btn-danger;
|
|
65
|
-
|
|
66
|
-
text-transform: uppercase;
|
|
67
|
-
font-weight: bold;
|
|
68
63
|
}
|
|
69
64
|
}
|
|
70
65
|
|
|
71
|
-
.btn:not(.btn-sm) {
|
|
72
|
-
text-transform: uppercase;
|
|
73
|
-
font-weight: bold;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
66
|
@include media-breakpoint-down(sm) {
|
|
77
67
|
.btn {
|
|
78
68
|
font-size: .8rem;
|
|
@@ -2,82 +2,69 @@
|
|
|
2
2
|
|
|
3
3
|
# Scripts:Core/Iframe Deferrer
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Use the <code>data-defer-src</code> attribute on iframes to defer/lazy load adding a
|
|
6
|
+
helper loading class.
|
|
6
7
|
|
|
7
8
|
Usage:
|
|
8
9
|
```
|
|
9
10
|
<iframe data-defer-src="<target url>"></iframe>
|
|
10
|
-
<
|
|
11
|
+
<iframe data-defer-src="<target url>" data-defer-dispose />
|
|
11
12
|
```
|
|
12
13
|
|
|
13
14
|
```html_example
|
|
14
|
-
<div class="embed-responsive embed-responsive-16by9">
|
|
15
|
-
<iframe class="embed-responsive-item" data-defer-src="https://player.vimeo.com/video/291108273" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
15
|
<div>
|
|
19
|
-
<
|
|
16
|
+
<p>Native <code>loading="lazy"</code>, not widely supported on iframes.</p>
|
|
17
|
+
<div class="mb-4 embed-responsive embed-responsive-16by9">
|
|
18
|
+
<iframe class="embed-responsive-item" src="https://player.vimeo.com/video/291108273" loading="lazy" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<p>Using <code>data-defer-src</code>.</p>
|
|
22
|
+
<div class="mb-4 embed-responsive embed-responsive-16by9">
|
|
23
|
+
<iframe class="embed-responsive-item" data-defer-src="https://player.vimeo.com/video/291108273" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<p>Combining with <code>data-defer-dispose</code> to free up resources when iframe goes out of the screen.</p>
|
|
27
|
+
<div class="embed-responsive embed-responsive-16by9">
|
|
28
|
+
<iframe class="embed-responsive-item" data-defer-dispose data-defer-src="https://player.vimeo.com/video/291108273" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
|
|
29
|
+
</div>
|
|
20
30
|
</div>
|
|
21
31
|
```
|
|
22
32
|
|
|
23
33
|
*/
|
|
24
34
|
|
|
25
|
-
import Screen from '../../utils/js/screen.service';
|
|
26
|
-
|
|
27
35
|
import './data-defer-src.scss';
|
|
28
36
|
|
|
29
|
-
((
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
$defers.each((index, el) => {
|
|
33
|
-
const $defer = $(el);
|
|
37
|
+
(() => {
|
|
38
|
+
const elements = document.querySelectorAll('[data-defer-src]');
|
|
34
39
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
.removeAttr('data-defer-src')
|
|
39
|
-
.attr('src', thisUrl);
|
|
40
|
-
} else {
|
|
41
|
-
// Defer iframe load if the iframe is below the loading point's fold
|
|
40
|
+
elements.forEach((el) => {
|
|
41
|
+
let isVisible = false;
|
|
42
|
+
const source = el.dataset.deferSrc;
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
const isWrapped = $defer.parent().hasClass('js-defer-loader');
|
|
45
|
-
const isImage = ($defer[0].nodeName === 'IMG');
|
|
44
|
+
el.classList.add('js-defer-is-loading');
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
// Remove class on load.
|
|
47
|
+
el.addEventListener('load', () => {
|
|
48
|
+
if (el.hasAttribute('src')) {
|
|
49
|
+
el.classList.remove('js-defer-is-loading');
|
|
50
50
|
}
|
|
51
|
+
});
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (el.hasAttribute('data-defer-src')) {
|
|
59
|
-
if (Screen.elementInViewport(el)) {
|
|
60
|
-
// Detach ASAP
|
|
61
|
-
$(window).off('scroll', checkAndLoadSrc);
|
|
62
|
-
|
|
63
|
-
if (isWrapped) {
|
|
64
|
-
$defer.unwrap();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const thisUrl = $defer.attr('data-defer-src');
|
|
53
|
+
const observer = new IntersectionObserver((entries) => {
|
|
54
|
+
entries.forEach((entry) => {
|
|
55
|
+
if (!isVisible && entry.intersectionRatio > 0) {
|
|
56
|
+
isVisible = true;
|
|
57
|
+
el.src = source;
|
|
58
|
+
}
|
|
68
59
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
$defer.removeClass('js-defer-is-loading');
|
|
74
|
-
});
|
|
75
|
-
}
|
|
60
|
+
if (el.hasAttribute('data-defer-dispose') && isVisible && entry.intersectionRatio === 0) {
|
|
61
|
+
isVisible = false;
|
|
62
|
+
el.removeAttribute('src');
|
|
63
|
+
el.classList.add('js-defer-is-loading');
|
|
76
64
|
}
|
|
77
|
-
};
|
|
65
|
+
});
|
|
66
|
+
});
|
|
78
67
|
|
|
79
|
-
|
|
80
|
-
$(window).on('scroll', checkAndLoadSrc);
|
|
81
|
-
}
|
|
68
|
+
observer.observe(el);
|
|
82
69
|
});
|
|
83
|
-
})(
|
|
70
|
+
})();
|
|
@@ -1,21 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
iframe[data-defer-src] {
|
|
2
|
+
transition: opacity 250ms linear;
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
background: rgba(0, 0, 0, .3);
|
|
7
|
-
// background-image: #{$encoded-spinner};
|
|
8
|
-
background-position: 50% 50%;
|
|
9
|
-
background-repeat: no-repeat;
|
|
10
|
-
position: absolute;
|
|
11
|
-
top: 0;
|
|
12
|
-
left: 0;
|
|
13
|
-
right: 0;
|
|
14
|
-
bottom: 0;
|
|
15
|
-
z-index: 100;
|
|
16
|
-
border: 1px solid rgba($foe-offwhite, .25);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.js-defer-is-loading {
|
|
20
|
-
opacity: 0 !important;
|
|
4
|
+
&.js-defer-is-loading {
|
|
5
|
+
opacity: 0 !important;
|
|
6
|
+
}
|
|
21
7
|
}
|
|
@@ -15,6 +15,7 @@ Usage:
|
|
|
15
15
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
import screenService from '../../utils/js/screen.service';
|
|
18
19
|
|
|
19
20
|
// Enables smooth scrolling between anchors
|
|
20
21
|
(($) => {
|
|
@@ -55,11 +56,17 @@ Usage:
|
|
|
55
56
|
$target = $target.length ? $target : $(`[name="${hash.substr(1)}"]`);
|
|
56
57
|
|
|
57
58
|
if ($target.length) {
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
// Header when scrolled is always compressed, unless if the page is at the very start
|
|
60
|
+
// if we grab the height at the start of the document, it will be bigger than what
|
|
61
|
+
// it will be when the header is compressed.
|
|
62
|
+
|
|
63
|
+
// Grab the value from our scss variables
|
|
64
|
+
const headerHeight = screenService.getHeaderHeight();
|
|
65
|
+
|
|
66
|
+
// See if the target specifies a scroll padding, useful for elements without an internal padding
|
|
67
|
+
const extraPadding = parseInt($target.attr('data-scroll-to-padding') || 20, 10);
|
|
68
|
+
|
|
69
|
+
let finalScrollPosition = ($target.offset().top - (headerHeight + extraPadding));
|
|
63
70
|
|
|
64
71
|
// Compensate admin bars if user is logged in
|
|
65
72
|
if ($('body').hasClass('user-logged-in')) {
|
package/src/fonts.js
CHANGED
|
@@ -20,7 +20,7 @@ Our type system is comprised of two fonts:
|
|
|
20
20
|
To use them on your CSS please import the webfonts through Google Fonts
|
|
21
21
|
|
|
22
22
|
```
|
|
23
|
-
<link id="fonts" rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital@0;1&family=Libre+Franklin:ital,wght@0,400;0,700;1,400;1,700&display=swap" />
|
|
23
|
+
<link id="fonts" rel="stylesheet" crossorigin="anonymous" href="https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital@0;1&family=Libre+Franklin:ital,wght@0,400;0,700;1,400;1,700&display=swap" />
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
@TODO: Document Fontawesome
|
|
@@ -130,6 +130,7 @@ const fonts = window.document.createElement('link');
|
|
|
130
130
|
// eslint-disable-next-line max-len
|
|
131
131
|
const href = 'https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital@0;1&family=Libre+Franklin:ital,wght@0,400;0,700;1,400;1,700&display=swap';
|
|
132
132
|
fonts.setAttribute('rel', 'stylesheet');
|
|
133
|
+
fonts.setAttribute('crossorigin', 'anonymous');
|
|
133
134
|
fonts.setAttribute('href', href);
|
|
134
135
|
document.head.appendChild(fonts);
|
|
135
136
|
|
|
@@ -40,6 +40,8 @@ export default {
|
|
|
40
40
|
return Math.max(document.documentElement.clientHeight, window.innerHeight);
|
|
41
41
|
},
|
|
42
42
|
|
|
43
|
+
// @todo: legacy function, replace with intersection observer
|
|
44
|
+
// after assessing how many things rely on this utility.
|
|
43
45
|
elementInViewport: function elementInViewport(el) {
|
|
44
46
|
const $ = window.jQuery;
|
|
45
47
|
const { top } = $(el).offset();
|
|
@@ -69,4 +71,14 @@ export default {
|
|
|
69
71
|
|
|
70
72
|
return breakpoints[breakpointIndex].size;
|
|
71
73
|
},
|
|
74
|
+
|
|
75
|
+
getHeaderHeight: function getHeaderHeight() {
|
|
76
|
+
const $ = window.jQuery;
|
|
77
|
+
const breakpoint = this.getCurrentBreakpoint();
|
|
78
|
+
|
|
79
|
+
if ($('.foe-header').length) {
|
|
80
|
+
return parseInt(scss[`foe-header-height-${breakpoint}`], 10);
|
|
81
|
+
}
|
|
82
|
+
return 0;
|
|
83
|
+
},
|
|
72
84
|
};
|
|
@@ -13,6 +13,7 @@ $foe-light: #7ae1bd !default;
|
|
|
13
13
|
$foe-secondary: $foe-light !default;
|
|
14
14
|
$foe-dark: #3b867f !default;
|
|
15
15
|
$foe-extradark: #232f4a !default;
|
|
16
|
+
$foe-sunset: #ea5c5c !default;
|
|
16
17
|
|
|
17
18
|
$foe-white: #f3f3f7 !default;
|
|
18
19
|
$foe-gray: #b1b8c0 !default;
|
|
@@ -200,6 +201,7 @@ $theme-colors: map-merge(
|
|
|
200
201
|
"accent": $foe-accent,
|
|
201
202
|
"dark": $foe-dark,
|
|
202
203
|
"extradark": $foe-extradark,
|
|
204
|
+
"sunset": $foe-sunset,
|
|
203
205
|
"donate": $foe-donate,
|
|
204
206
|
"join": $foe-join,
|
|
205
207
|
"offwhite": $foe-offwhite,
|
|
@@ -423,7 +425,8 @@ $font-size-sm: ($font-size-base * .7);
|
|
|
423
425
|
|
|
424
426
|
$font-weight-light: 300;
|
|
425
427
|
$font-weight-normal: 400;
|
|
426
|
-
$font-weight-bold:
|
|
428
|
+
$font-weight-bold: 600;
|
|
429
|
+
$font-weight-heavy: 700;
|
|
427
430
|
|
|
428
431
|
$font-weight-base: $font-weight-normal;
|
|
429
432
|
$line-height-base: 1.5;
|
|
@@ -557,7 +560,7 @@ $btn-line-height-lg: $input-btn-line-height-lg;
|
|
|
557
560
|
|
|
558
561
|
$btn-border-width: $input-btn-border-width;
|
|
559
562
|
|
|
560
|
-
$btn-font-weight: $font-weight-
|
|
563
|
+
$btn-font-weight: $font-weight-bold;
|
|
561
564
|
$btn-box-shadow: inset 0 1px 0 rgba($white, .15), 0 1px 1px rgba($black, .075);
|
|
562
565
|
$btn-focus-width: $input-btn-focus-width;
|
|
563
566
|
$btn-focus-box-shadow: $input-btn-focus-box-shadow;
|
|
@@ -1141,6 +1144,18 @@ $foe-nav-logo-height-medium: $foe-nav-height-medium*3/5;
|
|
|
1141
1144
|
$foe-nav-logo-height-large: $foe-nav-height-large*3/5;
|
|
1142
1145
|
$foe-nav-logo-height-large-scrolled: $foe-nav-height-large-scrolled*3/5; // Hence can be the same size of navbar when scrolled
|
|
1143
1146
|
|
|
1147
|
+
// Manually add in all header variants based on bootstrap-named breakpoints.
|
|
1148
|
+
// Likely prone to change in the Bootstrap 5+ refactor.
|
|
1149
|
+
|
|
1150
|
+
// @TODO / @REFACTOR / @BS5
|
|
1151
|
+
$foe-header-heights: (
|
|
1152
|
+
xs: $foe-nav-height-small,
|
|
1153
|
+
sm: $foe-nav-height-small,
|
|
1154
|
+
md: $foe-nav-height-medium,
|
|
1155
|
+
lg: $foe-nav-height-large-scrolled,
|
|
1156
|
+
xl: $foe-nav-height-large-scrolled,
|
|
1157
|
+
xxl: $foe-nav-height-large-scrolled
|
|
1158
|
+
);
|
|
1144
1159
|
|
|
1145
1160
|
// CTA button
|
|
1146
1161
|
$foe-nav-cta-height-small: 35px;
|