@caweb/framework 1.9.2 → 1.9.4
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/build/delta.asset.php +1 -1
- package/build/delta.css +1 -0
- package/build/delta.js +1 -1
- package/build/eureka.asset.php +1 -1
- package/build/eureka.css +1 -0
- package/build/eureka.js +1 -1
- package/build/mono.asset.php +1 -1
- package/build/mono.css +1 -0
- package/build/mono.js +1 -1
- package/build/oceanside.asset.php +1 -1
- package/build/oceanside.css +1 -0
- package/build/oceanside.js +1 -1
- package/build/orangecounty.asset.php +1 -1
- package/build/orangecounty.css +1 -0
- package/build/orangecounty.js +1 -1
- package/build/pasorobles.asset.php +1 -1
- package/build/pasorobles.css +1 -0
- package/build/pasorobles.js +1 -1
- package/build/sacramento.asset.php +1 -1
- package/build/sacramento.css +1 -0
- package/build/sacramento.js +1 -1
- package/build/santabarbara.asset.php +1 -1
- package/build/santabarbara.css +1 -0
- package/build/santabarbara.js +1 -1
- package/build/santacruz.asset.php +1 -1
- package/build/santacruz.css +1 -0
- package/build/santacruz.js +1 -1
- package/build/shasta.asset.php +1 -1
- package/build/shasta.css +1 -0
- package/build/shasta.js +1 -1
- package/build/sierra.asset.php +1 -1
- package/build/sierra.css +1 -0
- package/build/sierra.js +1 -1
- package/build/trinity.asset.php +1 -1
- package/build/trinity.css +1 -0
- package/build/trinity.js +1 -1
- package/package.json +5 -5
- package/src/scripts/components/header.js +62 -32
- package/src/styles/components/structural/_header.scss +1 -1
- package/src/styles/components/structural/_type.scss +3 -2
- package/src/styles/index.scss +1 -1
- package/build/delta.min.asset.php +0 -1
- package/build/delta.min.css +0 -23
- package/build/delta.min.css.map +0 -1
- package/build/delta.min.js +0 -2
- package/build/delta.min.js.map +0 -1
- package/build/eureka.min.asset.php +0 -1
- package/build/eureka.min.css +0 -23
- package/build/eureka.min.css.map +0 -1
- package/build/eureka.min.js +0 -2
- package/build/eureka.min.js.map +0 -1
- package/build/mono.min.asset.php +0 -1
- package/build/mono.min.css +0 -23
- package/build/mono.min.css.map +0 -1
- package/build/mono.min.js +0 -2
- package/build/mono.min.js.map +0 -1
- package/build/oceanside.min.asset.php +0 -1
- package/build/oceanside.min.css +0 -23
- package/build/oceanside.min.css.map +0 -1
- package/build/oceanside.min.js +0 -2
- package/build/oceanside.min.js.map +0 -1
- package/build/orangecounty.min.asset.php +0 -1
- package/build/orangecounty.min.css +0 -23
- package/build/orangecounty.min.css.map +0 -1
- package/build/orangecounty.min.js +0 -2
- package/build/orangecounty.min.js.map +0 -1
- package/build/pasorobles.min.asset.php +0 -1
- package/build/pasorobles.min.css +0 -23
- package/build/pasorobles.min.css.map +0 -1
- package/build/pasorobles.min.js +0 -2
- package/build/pasorobles.min.js.map +0 -1
- package/build/sacramento.min.asset.php +0 -1
- package/build/sacramento.min.css +0 -23
- package/build/sacramento.min.css.map +0 -1
- package/build/sacramento.min.js +0 -2
- package/build/sacramento.min.js.map +0 -1
- package/build/santabarbara.min.asset.php +0 -1
- package/build/santabarbara.min.css +0 -23
- package/build/santabarbara.min.css.map +0 -1
- package/build/santabarbara.min.js +0 -2
- package/build/santabarbara.min.js.map +0 -1
- package/build/santacruz.min.asset.php +0 -1
- package/build/santacruz.min.css +0 -23
- package/build/santacruz.min.css.map +0 -1
- package/build/santacruz.min.js +0 -2
- package/build/santacruz.min.js.map +0 -1
- package/build/shasta.min.asset.php +0 -1
- package/build/shasta.min.css +0 -23
- package/build/shasta.min.css.map +0 -1
- package/build/shasta.min.js +0 -2
- package/build/shasta.min.js.map +0 -1
- package/build/sierra.min.asset.php +0 -1
- package/build/sierra.min.css +0 -23
- package/build/sierra.min.css.map +0 -1
- package/build/sierra.min.js +0 -2
- package/build/sierra.min.js.map +0 -1
- package/build/trinity.min.asset.php +0 -1
- package/build/trinity.min.css +0 -23
- package/build/trinity.min.css.map +0 -1
- package/build/trinity.min.js +0 -2
- package/build/trinity.min.js.map +0 -1
|
@@ -2,9 +2,36 @@
|
|
|
2
2
|
window.addEventListener('DOMContentLoaded', () => {
|
|
3
3
|
let location_hash = window.location.hash.replace(/(\|)/g, "\\$1");
|
|
4
4
|
|
|
5
|
-
const header = document.querySelector('header');
|
|
6
|
-
const
|
|
7
|
-
|
|
5
|
+
const header = document.querySelector('header') ;
|
|
6
|
+
const pageContainer = document.querySelector('#page-container');
|
|
7
|
+
|
|
8
|
+
// array of elements that are compacted
|
|
9
|
+
const compactedElements = [
|
|
10
|
+
document.querySelector('.alerts'),
|
|
11
|
+
document.querySelector('.utility-header'),
|
|
12
|
+
].filter(Boolean);
|
|
13
|
+
|
|
14
|
+
let compactedElementsHeight = compactedElements.reduce((total, element) => {
|
|
15
|
+
if( element instanceof HTMLElement ){
|
|
16
|
+
return total + element.clientHeight;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return total;
|
|
20
|
+
|
|
21
|
+
}, 0);
|
|
22
|
+
|
|
23
|
+
// lets collect the height of any fixed elements above the header.
|
|
24
|
+
let topOffset = 0;
|
|
25
|
+
let current = header?.previousElementSibling;
|
|
26
|
+
|
|
27
|
+
while( current ){
|
|
28
|
+
// if current element has a fixed position, add its height to the topOffset.
|
|
29
|
+
if( current instanceof HTMLElement && window.getComputedStyle(current).position === 'fixed' ){
|
|
30
|
+
topOffset += current.clientHeight ;
|
|
31
|
+
}
|
|
32
|
+
current = current.previousElementSibling;
|
|
33
|
+
}
|
|
34
|
+
|
|
8
35
|
|
|
9
36
|
// scroll to target
|
|
10
37
|
if( location_hash ){
|
|
@@ -12,61 +39,64 @@ window.addEventListener('DOMContentLoaded', () => {
|
|
|
12
39
|
let target = document.getElementById(location_hash.substring(1));
|
|
13
40
|
|
|
14
41
|
// if the location hash is not empty, we scroll to the target element
|
|
15
|
-
|
|
42
|
+
requestAnimationFrame(() => {
|
|
16
43
|
target?.scrollIntoView({
|
|
17
44
|
behavior: 'smooth'
|
|
18
45
|
});
|
|
19
|
-
}
|
|
46
|
+
});
|
|
20
47
|
}
|
|
21
48
|
|
|
22
49
|
if (!header) {
|
|
23
50
|
return;
|
|
24
51
|
}
|
|
52
|
+
|
|
25
53
|
|
|
26
54
|
const compactHeader = () => {
|
|
27
|
-
let scrollHeights = 0;
|
|
28
|
-
|
|
29
|
-
// lets collect the height of any elements above the header.
|
|
30
|
-
let current = header.previousElementSibling;
|
|
31
|
-
let miscElementHeights = 0;
|
|
32
|
-
|
|
33
|
-
while( current ){
|
|
34
|
-
// if current is a div, add its height to the miscElementHeights.
|
|
35
|
-
if( 'DIV' === current.tagName ){
|
|
36
|
-
miscElementHeights += current.clientHeight ;
|
|
37
|
-
}
|
|
38
|
-
current = current.previousElementSibling;
|
|
39
|
-
}
|
|
40
55
|
|
|
41
56
|
// downscroll code passed the header height
|
|
42
57
|
if (document.body.scrollTop >= header.offsetHeight ||
|
|
43
58
|
document.documentElement.scrollTop >= header.offsetHeight
|
|
44
59
|
) {
|
|
45
|
-
//
|
|
46
|
-
|
|
47
|
-
scrollHeights += alerts.clientHeight;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// lets add the scroll heights of the utility header
|
|
51
|
-
if( utilityHeader ){
|
|
52
|
-
scrollHeights += utilityHeader.clientHeight;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// move the header up to the scroll height, minus any elements above the header
|
|
56
|
-
header.style.top = `-${(scrollHeights - miscElementHeights)}px`;
|
|
60
|
+
// move the header up to hide the compacted elements height, minus the top offset.
|
|
61
|
+
header.style.top = `-${(compactedElementsHeight - topOffset)}px`;
|
|
57
62
|
|
|
58
63
|
} else {
|
|
59
64
|
// reset header to initial position
|
|
60
|
-
header
|
|
65
|
+
// we need to set the header's top to the offset.
|
|
66
|
+
if( header ){
|
|
67
|
+
header.style.top = `${topOffset}px`;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// if we have a page container, we need to set its top padding to the offset
|
|
71
|
+
if( pageContainer && pageContainer instanceof HTMLElement ){
|
|
72
|
+
pageContainer.style.paddingTop = `${topOffset}px`;
|
|
73
|
+
}
|
|
74
|
+
|
|
61
75
|
}
|
|
62
76
|
|
|
63
77
|
};
|
|
78
|
+
|
|
79
|
+
// for each element with an id we add the scroll-margin-top
|
|
80
|
+
document.querySelectorAll('#page-container [id]').forEach((element) => {
|
|
81
|
+
if( element instanceof HTMLElement ){
|
|
82
|
+
let scrollMarginHeight = header.clientHeight + topOffset;
|
|
83
|
+
|
|
84
|
+
// if the elements offsetTop is greater than twice the header size,
|
|
85
|
+
// we can assume the header is compacted
|
|
86
|
+
// so we need to subtract the compacted elements height from the scroll margin.
|
|
87
|
+
if( element.offsetTop > scrollMarginHeight * 2 ){
|
|
88
|
+
scrollMarginHeight -= compactedElementsHeight;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
element.style.scrollMarginTop = `${scrollMarginHeight}px`;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
64
94
|
|
|
65
95
|
// reset position on scroll
|
|
66
96
|
window.addEventListener(
|
|
67
97
|
'scroll', compactHeader
|
|
68
98
|
);
|
|
69
99
|
|
|
70
|
-
compactHeader()
|
|
100
|
+
compactHeader();
|
|
71
101
|
|
|
72
102
|
});
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
----------------------------------------- */
|
|
5
5
|
header.global-header{
|
|
6
6
|
position: sticky;
|
|
7
|
+
top: 0;
|
|
7
8
|
background-color: var(--bs-white, $white);
|
|
8
9
|
z-index: 15;
|
|
9
10
|
transition: all 0.3s ease;
|
|
@@ -78,4 +79,3 @@ header.global-header{
|
|
|
78
79
|
text-align: right;
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
|
-
|
package/src/styles/index.scss
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<?php return array('dependencies' => array(), 'version' => '4a99e034e3eeb401bbdf');
|