@caweb/framework 1.9.17 → 1.9.18
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 +65 -14
- 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 +65 -14
- 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 +65 -14
- 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 +65 -14
- 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 +65 -14
- 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 +65 -14
- 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 +65 -14
- 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 +65 -14
- 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 +65 -14
- 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 +65 -14
- 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 +65 -14
- 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 +65 -14
- 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/header.js +71 -14
package/build/shasta.asset.php
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<?php return array('dependencies' => array(), 'version' => '
|
|
1
|
+
<?php return array('dependencies' => array(), 'version' => 'e7912ff13df88bf12424');
|
package/build/shasta.js
CHANGED
|
@@ -6372,23 +6372,76 @@ window.addEventListener('load', () => {
|
|
|
6372
6372
|
return total;
|
|
6373
6373
|
}, 0);
|
|
6374
6374
|
};
|
|
6375
|
+
|
|
6376
|
+
// get the total height of all elements above the header with a fixed position.
|
|
6377
|
+
const getTopOffset = () => {
|
|
6378
|
+
let current = header;
|
|
6379
|
+
let offset = 0;
|
|
6380
|
+
while (current) {
|
|
6381
|
+
// if current element has a fixed position, add its height to the topOffset.
|
|
6382
|
+
if (current instanceof HTMLElement && window.getComputedStyle(current).position === 'fixed') {
|
|
6383
|
+
offset += current.clientHeight;
|
|
6384
|
+
}
|
|
6385
|
+
current = current.previousElementSibling;
|
|
6386
|
+
}
|
|
6387
|
+
return offset;
|
|
6388
|
+
};
|
|
6375
6389
|
let compactedElementsHeight = getCompactedElementsHeight();
|
|
6390
|
+
let topOffset = getTopOffset();
|
|
6376
6391
|
|
|
6377
|
-
// resize observer function to watch if compacted elements
|
|
6392
|
+
// resize observer function to watch if compacted elements were resized,
|
|
6393
|
+
// so we can update variables when they change.
|
|
6394
|
+
let observedElements = [];
|
|
6378
6395
|
const clientHeightObserver = entries => {
|
|
6379
|
-
|
|
6380
|
-
|
|
6396
|
+
let hasChanges = false;
|
|
6397
|
+
|
|
6398
|
+
// The callback receives an array of entries, one for each element that resized
|
|
6399
|
+
for (let entry of entries) {
|
|
6400
|
+
// we check if the entry was already saved once
|
|
6401
|
+
if (entry.target.dataset.observer) {
|
|
6402
|
+
let previousEntryIndex = observedElements.findIndex(observedEntry => observedEntry.target.dataset.observer === entry.target.dataset.observer);
|
|
6403
|
+
let previousEntry = observedElements[previousEntryIndex];
|
|
6404
|
+
let previousHeight = previousEntry instanceof ResizeObserverEntry ? previousEntry.contentBoxSize[0].blockSize : previousEntry.target.style.height;
|
|
6405
|
+
let currentHeight = entry instanceof ResizeObserverEntry ? entry.contentBoxSize[0].blockSize : entry.target.style.height;
|
|
6406
|
+
|
|
6407
|
+
// if the entry's height has changed, we set hasChanges to true, so we can update the compacted elements height and top offset.
|
|
6408
|
+
if (previousHeight !== currentHeight) {
|
|
6409
|
+
observedElements[previousEntryIndex] = entry;
|
|
6410
|
+
hasChanges = true;
|
|
6411
|
+
}
|
|
6412
|
+
} else {
|
|
6413
|
+
// if not, we save the entry in a data attribute, so we can identify it in future callbacks and avoid unnecessary calculations when an entry changes.
|
|
6414
|
+
entry.target.dataset.observer = crypto.randomUUID();
|
|
6415
|
+
|
|
6416
|
+
// save the entry
|
|
6417
|
+
observedElements.push(entry);
|
|
6418
|
+
}
|
|
6419
|
+
}
|
|
6420
|
+
|
|
6421
|
+
// if changes detected, we perform updates
|
|
6422
|
+
if (hasChanges) {
|
|
6423
|
+
topOffset = getTopOffset();
|
|
6381
6424
|
compactedElementsHeight = getCompactedElementsHeight();
|
|
6425
|
+
updateScrollMarginTop();
|
|
6426
|
+
compactHeader();
|
|
6382
6427
|
}
|
|
6383
6428
|
};
|
|
6384
6429
|
|
|
6385
6430
|
// observe compacted elements for height changes, so we can update the compacted elements height when they change.
|
|
6386
6431
|
compactedElements.forEach(element => {
|
|
6387
6432
|
if (element instanceof HTMLElement) {
|
|
6388
|
-
|
|
6389
|
-
|
|
6433
|
+
// we add a data-observer attribute to the element, so we can identify it in the callback and avoid unnecessary calculations when an entry changes.
|
|
6434
|
+
new ResizeObserver(clientHeightObserver).observe(element);
|
|
6390
6435
|
}
|
|
6391
6436
|
});
|
|
6437
|
+
let current = header;
|
|
6438
|
+
while (current) {
|
|
6439
|
+
// if current element has a fixed position add a resize observer
|
|
6440
|
+
if (current instanceof HTMLElement && window.getComputedStyle(current).position === 'fixed') {
|
|
6441
|
+
new ResizeObserver(clientHeightObserver).observe(current);
|
|
6442
|
+
}
|
|
6443
|
+
current = current.previousElementSibling;
|
|
6444
|
+
}
|
|
6392
6445
|
|
|
6393
6446
|
// scroll to target
|
|
6394
6447
|
if (location_hash) {
|
|
@@ -6411,12 +6464,12 @@ window.addEventListener('load', () => {
|
|
|
6411
6464
|
// downscroll code passed the header height
|
|
6412
6465
|
if (document.body.scrollTop >= header.offsetHeight || document.documentElement.scrollTop >= header.offsetHeight) {
|
|
6413
6466
|
// move the header up to hide the compacted elements height, minus the top offset.
|
|
6414
|
-
header.style.top = `-${compactedElementsHeight}px`;
|
|
6467
|
+
header.style.top = `-${compactedElementsHeight - topOffset}px`;
|
|
6415
6468
|
} else {
|
|
6416
6469
|
// reset header to initial position
|
|
6417
6470
|
// we need to set the header's top to the offset.
|
|
6418
6471
|
if (header) {
|
|
6419
|
-
header.style.top =
|
|
6472
|
+
header.style.top = `${topOffset}px`;
|
|
6420
6473
|
}
|
|
6421
6474
|
}
|
|
6422
6475
|
};
|
|
@@ -6434,18 +6487,16 @@ window.addEventListener('load', () => {
|
|
|
6434
6487
|
if (element.offsetTop > scrollMarginHeight + scrollMarginHeight / 2) {
|
|
6435
6488
|
scrollMarginHeight -= compactedElementsHeight;
|
|
6436
6489
|
}
|
|
6437
|
-
element.style.scrollMarginTop = `${scrollMarginHeight}px`;
|
|
6490
|
+
element.style.scrollMarginTop = `${scrollMarginHeight + topOffset}px`;
|
|
6438
6491
|
}
|
|
6439
6492
|
});
|
|
6440
6493
|
};
|
|
6441
6494
|
|
|
6442
|
-
// if there are alerts add a mutation observer to watch for changes in the alerts
|
|
6495
|
+
// if there are alerts add a mutation observer to watch for changes in the alerts
|
|
6443
6496
|
if (alerts) {
|
|
6444
|
-
// so we can update the compacted elements height when an alert is closed or
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
updateScrollMarginTop();
|
|
6448
|
-
}).observe(alerts, {
|
|
6497
|
+
// so we can update the compacted elements height when an alert is closed or
|
|
6498
|
+
// when entering mobile ( class .d-none is added/removed).
|
|
6499
|
+
new MutationObserver(clientHeightObserver).observe(alerts, {
|
|
6449
6500
|
attributes: true,
|
|
6450
6501
|
childList: true
|
|
6451
6502
|
});
|