@caweb/framework 1.9.13 → 1.9.15
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.js +23 -27
- package/build/delta.js.map +1 -1
- package/build/delta.min.asset.php +1 -1
- package/build/delta.min.js +1 -1
- package/build/delta.min.js.map +1 -1
- package/build/eureka.asset.php +1 -1
- package/build/eureka.js +23 -27
- package/build/eureka.js.map +1 -1
- package/build/eureka.min.asset.php +1 -1
- package/build/eureka.min.js +1 -1
- package/build/eureka.min.js.map +1 -1
- package/build/mono.asset.php +1 -1
- package/build/mono.js +23 -27
- package/build/mono.js.map +1 -1
- package/build/mono.min.asset.php +1 -1
- package/build/mono.min.js +1 -1
- package/build/mono.min.js.map +1 -1
- package/build/oceanside.asset.php +1 -1
- package/build/oceanside.js +23 -27
- package/build/oceanside.js.map +1 -1
- package/build/oceanside.min.asset.php +1 -1
- package/build/oceanside.min.js +1 -1
- package/build/oceanside.min.js.map +1 -1
- package/build/orangecounty.asset.php +1 -1
- package/build/orangecounty.js +23 -27
- package/build/orangecounty.js.map +1 -1
- package/build/orangecounty.min.asset.php +1 -1
- package/build/orangecounty.min.js +1 -1
- package/build/orangecounty.min.js.map +1 -1
- package/build/pasorobles.asset.php +1 -1
- package/build/pasorobles.js +23 -27
- package/build/pasorobles.js.map +1 -1
- package/build/pasorobles.min.asset.php +1 -1
- package/build/pasorobles.min.js +1 -1
- package/build/pasorobles.min.js.map +1 -1
- package/build/sacramento.asset.php +1 -1
- package/build/sacramento.js +23 -27
- package/build/sacramento.js.map +1 -1
- package/build/sacramento.min.asset.php +1 -1
- package/build/sacramento.min.js +1 -1
- package/build/sacramento.min.js.map +1 -1
- package/build/santabarbara.asset.php +1 -1
- package/build/santabarbara.js +23 -27
- package/build/santabarbara.js.map +1 -1
- package/build/santabarbara.min.asset.php +1 -1
- package/build/santabarbara.min.js +1 -1
- package/build/santabarbara.min.js.map +1 -1
- package/build/santacruz.asset.php +1 -1
- package/build/santacruz.js +23 -27
- package/build/santacruz.js.map +1 -1
- package/build/santacruz.min.asset.php +1 -1
- package/build/santacruz.min.js +1 -1
- package/build/santacruz.min.js.map +1 -1
- package/build/shasta.asset.php +1 -1
- package/build/shasta.js +23 -27
- package/build/shasta.js.map +1 -1
- package/build/shasta.min.asset.php +1 -1
- package/build/shasta.min.js +1 -1
- package/build/shasta.min.js.map +1 -1
- package/build/sierra.asset.php +1 -1
- package/build/sierra.js +23 -27
- package/build/sierra.js.map +1 -1
- package/build/sierra.min.asset.php +1 -1
- package/build/sierra.min.js +1 -1
- package/build/sierra.min.js.map +1 -1
- package/build/trinity.asset.php +1 -1
- package/build/trinity.js +23 -27
- package/build/trinity.js.map +1 -1
- package/build/trinity.min.asset.php +1 -1
- package/build/trinity.min.js +1 -1
- package/build/trinity.min.js.map +1 -1
- package/package.json +1 -1
- package/src/scripts/components/dark-mode.js +1 -1
- package/src/scripts/components/external-link.js +2 -2
- package/src/scripts/components/header.js +25 -26
- package/src/scripts/components/mobile-controls.js +1 -1
- package/src/scripts/components/return-top.js +2 -2
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
document.addEventListener( '
|
|
1
|
+
document.addEventListener( 'load', () => {
|
|
2
2
|
// Set is-dark-mode class if user has requested dark mode.
|
|
3
3
|
if ( window.matchMedia( '(prefers-color-scheme: dark)' ).matches ){
|
|
4
4
|
document.documentElement.setAttribute('data-bs-theme', 'dark');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
|
|
3
3
|
/* EXTERNAL LINK ICON */
|
|
4
|
-
window.addEventListener('
|
|
4
|
+
window.addEventListener('load', () => {
|
|
5
5
|
const ext = '<span class="ca-gov-icon-external-link" aria-hidden="true"></span><span class="sr-only">opens in a new window</span>';
|
|
6
6
|
|
|
7
7
|
// Add any exceptions to not render here
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
window.addEventListener('
|
|
1
|
+
|
|
2
|
+
window.addEventListener('load', () => {
|
|
3
3
|
let location_hash = window.location.hash.replace(/(\|)/g, "\\$1");
|
|
4
4
|
|
|
5
5
|
const header = document.querySelector('header') ;
|
|
6
6
|
const pageContainer = document.querySelector('#page-container');
|
|
7
7
|
|
|
8
|
+
const alerts = header?.querySelector('.alerts');
|
|
9
|
+
const utilityHeader = header?.querySelector('.utility-header');
|
|
10
|
+
|
|
8
11
|
// array of elements that are compacted
|
|
9
12
|
const compactedElements = [
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
alerts,
|
|
14
|
+
utilityHeader,
|
|
12
15
|
].filter(Boolean);
|
|
13
16
|
|
|
14
17
|
const getCompactedElementsHeight = () => {
|
|
@@ -21,21 +24,24 @@ window.addEventListener('DOMContentLoaded', () => {
|
|
|
21
24
|
|
|
22
25
|
}, 0);
|
|
23
26
|
}
|
|
24
|
-
|
|
27
|
+
|
|
25
28
|
let compactedElementsHeight = getCompactedElementsHeight();
|
|
26
29
|
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// if current element has a fixed position, add its height to the topOffset.
|
|
33
|
-
if( current instanceof HTMLElement && window.getComputedStyle(current).position === 'fixed' ){
|
|
34
|
-
topOffset += current.clientHeight ;
|
|
35
|
-
}
|
|
36
|
-
current = current.previousElementSibling;
|
|
30
|
+
// resize observer function to watch if compacted elements change height, so we can update the compacted elements height when they change.
|
|
31
|
+
const clientHeightObserver = (entries) => {
|
|
32
|
+
for(const entry of entries) {
|
|
33
|
+
// update the compacted elements height when the compacted entry changes., which can happen when google translate loads and changes the height of the utility header or when items wrap
|
|
34
|
+
compactedElementsHeight = getCompactedElementsHeight();
|
|
37
35
|
}
|
|
38
|
-
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// observe compacted elements for height changes, so we can update the compacted elements height when they change.
|
|
39
|
+
compactedElements.forEach((element) => {
|
|
40
|
+
if( element instanceof HTMLElement ){
|
|
41
|
+
const observer = new ResizeObserver(clientHeightObserver);
|
|
42
|
+
observer.observe(element);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
39
45
|
|
|
40
46
|
// scroll to target
|
|
41
47
|
if( location_hash ){
|
|
@@ -53,7 +59,6 @@ window.addEventListener('DOMContentLoaded', () => {
|
|
|
53
59
|
if (!header) {
|
|
54
60
|
return;
|
|
55
61
|
}
|
|
56
|
-
|
|
57
62
|
|
|
58
63
|
const compactHeader = () => {
|
|
59
64
|
// downscroll code passed the header height
|
|
@@ -61,20 +66,15 @@ window.addEventListener('DOMContentLoaded', () => {
|
|
|
61
66
|
document.documentElement.scrollTop >= header.offsetHeight
|
|
62
67
|
) {
|
|
63
68
|
// move the header up to hide the compacted elements height, minus the top offset.
|
|
64
|
-
header.style.top = `-${(compactedElementsHeight
|
|
69
|
+
header.style.top = `-${(compactedElementsHeight)}px`;
|
|
65
70
|
|
|
66
71
|
} else {
|
|
67
72
|
// reset header to initial position
|
|
68
73
|
// we need to set the header's top to the offset.
|
|
69
74
|
if( header ){
|
|
70
|
-
header.style.top =
|
|
75
|
+
header.style.top = 0;
|
|
71
76
|
}
|
|
72
77
|
|
|
73
|
-
// if we have a page container, we need to set its top padding to the offset
|
|
74
|
-
if( pageContainer && pageContainer instanceof HTMLElement ){
|
|
75
|
-
// pageContainer.style.paddingTop = `${topOffset}px`;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
};
|
|
@@ -89,9 +89,8 @@ window.addEventListener('DOMContentLoaded', () => {
|
|
|
89
89
|
|
|
90
90
|
// for each element with an id we add the scroll-margin-top
|
|
91
91
|
const updateScrollMarginTop = (/** @type Element */ element) => {
|
|
92
|
+
|
|
92
93
|
if( element instanceof HTMLElement ){
|
|
93
|
-
let scrollMarginHeight = header.clientHeight + topOffset;
|
|
94
|
-
|
|
95
94
|
// if the elements offsetTop is greater than twice the header size,
|
|
96
95
|
// we can assume the header is compacted
|
|
97
96
|
// so we need to subtract the compacted elements height from the scroll margin.
|