@foeewni/web-core 2.2.6 → 2.2.9
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.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 +48 -55
- package/src/components/tools/data-defer-src.scss +5 -19
- package/src/components/tools/rubik-tracking.js +2 -1
- package/src/fonts.js +2 -1
- package/src/utils/js/screen.service.js +2 -0
- package/src/utils/scss/helpers/_variables.scss +5 -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,75 @@
|
|
|
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);
|
|
34
|
-
|
|
35
|
-
if (Screen.elementInViewport(el)) {
|
|
36
|
-
const thisUrl = $defer.attr('data-defer-src');
|
|
37
|
-
$defer
|
|
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
|
|
37
|
+
(() => {
|
|
38
|
+
const elements = document.querySelectorAll('[data-defer-src]');
|
|
42
39
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
elements.forEach((el) => {
|
|
41
|
+
let isVisible = false;
|
|
42
|
+
const source = el.dataset.deferSrc;
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
if (!isWrapped && !isImage) {
|
|
49
|
-
$defer.wrap('<div class="js-defer-loader"></div>');
|
|
50
|
-
}
|
|
44
|
+
el.classList.add('js-defer-is-loading');
|
|
51
45
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
// Remove class on load.
|
|
47
|
+
el.addEventListener('load', () => {
|
|
48
|
+
el.classList.remove('js-defer-is-loading');
|
|
49
|
+
});
|
|
56
50
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const thisUrl = $defer.attr('data-defer-src');
|
|
51
|
+
const observer = new IntersectionObserver((entries) => {
|
|
52
|
+
entries.forEach((entry) => {
|
|
53
|
+
if (!isVisible && entry.intersectionRatio > 0) {
|
|
54
|
+
isVisible = true;
|
|
55
|
+
if (el.tagName === 'IFRAME') {
|
|
56
|
+
el.contentWindow.location.replace(source);
|
|
57
|
+
} else {
|
|
58
|
+
el.src = source;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
68
61
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
62
|
+
if (el.hasAttribute('data-defer-dispose') && isVisible && entry.intersectionRatio === 0) {
|
|
63
|
+
isVisible = false;
|
|
64
|
+
if (el.tagName === 'IFRAME') {
|
|
65
|
+
el.contentWindow.location.replace('about:blank');
|
|
66
|
+
} else {
|
|
67
|
+
el.removeAttribute('src');
|
|
75
68
|
}
|
|
69
|
+
el.classList.add('js-defer-is-loading');
|
|
76
70
|
}
|
|
77
|
-
};
|
|
71
|
+
});
|
|
72
|
+
});
|
|
78
73
|
|
|
79
|
-
|
|
80
|
-
$(window).on('scroll', checkAndLoadSrc);
|
|
81
|
-
}
|
|
74
|
+
observer.observe(el);
|
|
82
75
|
});
|
|
83
|
-
})(
|
|
76
|
+
})();
|
|
@@ -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
|
}
|
|
@@ -302,7 +302,8 @@ import * as store from 'local-storage';
|
|
|
302
302
|
trackingData.internal.page_type = getMeta('foe:page-type');
|
|
303
303
|
|
|
304
304
|
// Drupal node ID
|
|
305
|
-
trackingData.nid = $('[data-
|
|
305
|
+
trackingData.nid = $('[data-history-node-id]').attr('data-history-node-id')
|
|
306
|
+
|| $('[data-nid]').attr('data-nid')
|
|
306
307
|
|| $('[id*="node"]').attr('id')
|
|
307
308
|
|| null;
|
|
308
309
|
if (typeof trackingData.nid === 'string') {
|
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();
|
|
@@ -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;
|