@webqit/webflo 0.20.41 → 0.20.43

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
@@ -12,7 +12,7 @@
12
12
  "vanila-javascript"
13
13
  ],
14
14
  "homepage": "https://webqit.io/tooling/webflo",
15
- "version": "0.20.41",
15
+ "version": "0.20.43",
16
16
  "license": "MIT",
17
17
  "repository": {
18
18
  "type": "git",
@@ -13,7 +13,7 @@ export class DeviceViewport {
13
13
  };
14
14
 
15
15
  constructor() {
16
- const initialState = { _isInitial: true };
16
+ const initialState = { _priority: 1 };
17
17
 
18
18
  // 1. Ingest Viewport
19
19
  const vMeta = document.querySelector('meta[name="viewport"]');
@@ -152,10 +152,17 @@ export class DeviceViewport {
152
152
  return [k.replace(/-([a-z])/g, g => g[1].toUpperCase()), v || true];
153
153
  }));
154
154
 
155
- push(id, config) {
155
+ push(id, config, priority = 1) {
156
156
  if (!id) throw new Error("push() requires a unique ID");
157
157
  if (this.#stack.some(e => e.id === id)) return;
158
- this.#stack.push({ ...this.peek(), ...config, id, _isInitial: false });
158
+
159
+ const peek = this.peek();
160
+ if (peek._priority - priority >= 0.2) {
161
+ this.#stack.push({ ...config, ...peek, id, _priority: priority });
162
+ } else {
163
+ this.#stack.push({ ...peek, ...config, id, _priority: priority });
164
+ }
165
+
159
166
  this.#scheduleRender();
160
167
  }
161
168
 
@@ -498,8 +498,6 @@ export class ModalElement extends BaseElement {
498
498
  };
499
499
 
500
500
  const observer = new IntersectionObserver((entries) => {
501
- if (!this.#userScrolled) return;
502
-
503
501
  for (const entry of entries) {
504
502
  // Minmax events
505
503
  if (entry.target === this.#spacingElement) {
@@ -508,7 +506,8 @@ export class ModalElement extends BaseElement {
508
506
  }
509
507
 
510
508
  // For auto-closing
511
- if (entry.target === this.#sentinelElement
509
+ if (this.#userScrolled
510
+ && entry.target === this.#sentinelElement
512
511
  && entry.isIntersecting
513
512
  && entry.intersectionRatio >= 0.8) {
514
513
  this.hidePopover();