@webqit/webflo 0.20.42 → 0.20.44

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.44",
16
16
  "license": "MIT",
17
17
  "repository": {
18
18
  "type": "git",
@@ -50,7 +50,7 @@
50
50
  "@webqit/fetch-plus": "^0.1.24",
51
51
  "@webqit/keyval": "^0.2.17",
52
52
  "@webqit/observer": "^3.8.14",
53
- "@webqit/oohtml-ssr": "^2.2.2",
53
+ "@webqit/oohtml-ssr": "^2.2.4",
54
54
  "@webqit/port-plus": "^0.1.19",
55
55
  "@webqit/url-plus": "^0.1.4",
56
56
  "@webqit/use-live": "^0.5.49",
@@ -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
 
@@ -17,6 +17,7 @@ export class WebfloRouter111 {
17
17
  const $this = this;
18
18
  const callWebfloDefault = async (thisContext, thisTick) => {
19
19
  let returnValue;
20
+
20
21
  if (_default) {
21
22
  returnValue = await _default.call(thisContext, thisTick.event, remoteFetch);
22
23
  }
@@ -937,7 +937,7 @@ export class WebfloServer extends AppRuntime {
937
937
  document.body.append(dataScript);
938
938
  }
939
939
 
940
- const rendering = window.toString();
940
+ const rendering = window.document.toString();
941
941
  document.documentElement.remove();
942
942
  document.writeln('');
943
943
 
@@ -88,7 +88,7 @@ export class WebfloWorker extends AppRuntime {
88
88
  // ONFETCH
89
89
  const fetchHandler = (event) => {
90
90
  // Handle special requests
91
- if (!event.request.url.startsWith('http') || event.request.mode === 'navigate') {
91
+ if (!event.request.url.startsWith('http')) {
92
92
  return event.respondWith(fetch(event.request));
93
93
  }
94
94
  // Handle external requests
@@ -96,7 +96,8 @@ export class WebfloWorker extends AppRuntime {
96
96
  return event.respondWith(this.remoteFetch(event.request));
97
97
  }
98
98
  event.respondWith((async (event) => {
99
- const response = await this.navigate(event.request.url, event.request, { event });
99
+ let request = event.request;
100
+ const response = await this.navigate(request.url, request, { event });
100
101
  return response;
101
102
  })(event));
102
103
  };
@@ -278,9 +279,9 @@ export class WebfloWorker extends AppRuntime {
278
279
  }
279
280
 
280
281
  async getRequestCache(request) {
281
- const cacheName = request.headers.get('X-Powered-By') === '@webqit/webflo'
282
- ? this.config.WORKER.cache_name + '_csr'
282
+ const cacheName = request.headers.get('Accept') === 'application/json'
283
+ ? this.config.WORKER.cache_name + '_json'
283
284
  : this.config.WORKER.cache_name;
284
285
  return self.caches.open(cacheName);
285
286
  }
286
- }
287
+ }