@webqit/webflo 0.20.42 → 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.42",
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