@inizioevoke/astro-core 2.0.2 → 2.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inizioevoke/astro-core",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "",
@@ -212,12 +212,13 @@ function getAnimationDuration(element: HTMLElement = document.body) {
212
212
  document.addEventListener('DOMContentLoaded', (e) => {
213
213
  bindTriggers();
214
214
 
215
- if (!getOverlay()) {
216
- const overlay = document.createElement('div');
215
+ let overlay = getOverlay();
216
+ if (!overlay) {
217
+ overlay = document.createElement('div');
217
218
  overlay.classList.add(CSS_OVERLAY);
218
- overlay.addEventListener('click', () => {
219
- hideModals();
220
- }, { passive: true });
221
219
  document.body.append(overlay);
222
220
  }
221
+ overlay.addEventListener('click', () => {
222
+ hideModals();
223
+ }, { passive: true });
223
224
  }, { passive: true });
@@ -175,9 +175,15 @@ export class EvoScrollContainerElement extends HTMLElement implements IEvoScroll
175
175
  const scrollHeight = this.#content.scrollHeight - getPaddingY(this.#content);
176
176
  const containerHeight = this.clientHeight - getPaddingY(this);
177
177
  const trackHeight = this.#trackVert.clientHeight;
178
+ const trackStyle = getComputedStyle(this.#trackVert);
179
+ const trackTop = parseInt(trackStyle.getPropertyValue('--evo-scroll-container-track-vert-top'), 10);
180
+ const trackBot = parseInt(trackStyle.getPropertyValue('--evo-scroll-container-track-vert-bottom'), 10);
181
+ const trackOffset = parseInt(trackStyle.getPropertyValue('--evo-scroll-container-height-offset'), 10);
182
+ const trackAdjust = (!isNaN(trackTop) ? trackTop : 0) + (!isNaN(trackBot) ? trackBot : 0) + (!isNaN(trackOffset) ? trackOffset : 0);
178
183
 
179
- const visibleRatioVert = containerHeight / scrollHeight;
184
+ const visibleRatioVert = (containerHeight - trackAdjust) / scrollHeight;
180
185
  const thumbHeight = visibleRatioVert * trackHeight;
186
+
181
187
  if (this.#scrollbarSettings.thumbHeight != undefined) {
182
188
  this.#thumbVert.style.height = `${Math.max(0, Math.min(this.#scrollbarSettings.thumbHeight, trackHeight))}px`;
183
189
  } else {
@@ -194,8 +200,13 @@ export class EvoScrollContainerElement extends HTMLElement implements IEvoScroll
194
200
  const scrollWidth = this.#content.scrollWidth - getPaddingX(this.#content);
195
201
  const containerWidth = this.clientWidth - getPaddingX(this);
196
202
  const trackWidth = this.#trackHorz.clientWidth;
203
+ const trackStyle = getComputedStyle(this.#trackHorz);
204
+ const trackLeft = parseInt(trackStyle.getPropertyValue('--evo-scroll-container-track-horz-left'), 10);
205
+ const trackRight = parseInt(trackStyle.getPropertyValue('--evo-scroll-container-track-horz-right'), 10);
206
+ const trackOffset = parseInt(trackStyle.getPropertyValue('--evo-scroll-container-width-offset'), 10);
207
+ const trackAdjust = (!isNaN(trackLeft) ? trackLeft : 0) + (!isNaN(trackRight) ? trackRight : 0) + (!isNaN(trackOffset) ? trackOffset : 0);
197
208
 
198
- const visibleRatioHorz = containerWidth / scrollWidth;
209
+ const visibleRatioHorz = (containerWidth - trackAdjust) / scrollWidth;
199
210
  const thumbWidth = visibleRatioHorz * trackWidth;
200
211
  this.#thumbHorz.style.width = `${Math.min(thumbWidth > 20 ? thumbWidth : 20, trackWidth)}px`;
201
212
  if (this.#scrollbarSettings.trackVisible !== undefined) {