@webqit/webflo 0.11.18 → 0.11.19

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013-present, Yuxi (Evan) You
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md CHANGED
@@ -165,7 +165,7 @@ With [npm available on your terminal](https://docs.npmjs.com/downloading-and-ins
165
165
  > System Requirements: Node.js 14.0 or later
166
166
 
167
167
  ```shell
168
- $ npm i @webqit/webflo
168
+ npm i @webqit/webflo
169
169
  ```
170
170
 
171
171
  The installation automatically creates a `package.json` file at project root, containing `@webqit/webflo` as a project dependency.
@@ -1490,7 +1490,7 @@ On the UI, this could be used to show/hide cute error elements.
1490
1490
 
1491
1491
  This property tells when a client-side redirect is ongoing - see [Scenario 4: Single Page Navigation Requests and Responses](#scenario-4-single-page-navigation-requests-and-responses) - in which case it exposes the destination URL.
1492
1492
 
1493
- On the UI, this could be used to prevent further interactions with the outgoing page.
1493
+ On the UI, this could be used to mark the current page as stale and prevent further interactions.
1494
1494
 
1495
1495
  ```html
1496
1496
  <body>
@@ -1526,13 +1526,13 @@ Here are some additional examples with the [Observer API](#the-observer-api).
1526
1526
 
1527
1527
  ```js
1528
1528
  // Visualize the network state
1529
- let onlineVisualizer = changes => {
1529
+ let networkVisualizer = changes => {
1530
1530
  changes.forEach(e => {
1531
1531
  console.log(e.name, ':', e.value);
1532
1532
  });
1533
1533
  };
1534
- Observer.observe(document.state.network, onlineVisualizer);
1535
- // Or: Observer.observe(document, [ ['state', 'network'] ], onlineVisualizer, { subtree: true });
1534
+ Observer.observe(document.state.network, networkVisualizer);
1535
+ // Or: Observer.observe(document, [ ['state', 'network'] ], networkVisualizer, { subtree: true });
1536
1536
  ```
1537
1537
  </details>
1538
1538
 
@@ -1700,7 +1700,7 @@ This strategy tells the Service Worker to always fetch given resources from the
1700
1700
  </details>
1701
1701
  </details>
1702
1702
 
1703
- In all cases above, the convention for specifying URLs for a strategy accepts an [URL patterns](https://developer.mozilla.org/en-US/docs/Web/API/URLPattern) - against which URLs can be matched on the fly. For example, to place all files in an `/image` directory (and subdirectories) on the *Cache First* strategy, the pattern `/image/*` can be used. To place all `.svg` files in an `/icons` directory (including subdirectories) on the *Cache Only* strategy, the pattern `/icons/*.svg` can be used. (Specifically for the *Cache Only* strategy, patterns are resolved at Service Worker build-time, and each pattern must match, at least, a file.)
1703
+ In all cases above, the convention for specifying URLs for a strategy accepts an [URL pattern](https://developer.mozilla.org/en-US/docs/Web/API/URLPattern) - against which URLs can be matched on the fly. For example, to place all files in an `/image` directory (and subdirectories) on the *Cache First* strategy, the pattern `/image/*` can be used. To place all `.svg` files in an `/icons` directory (including subdirectories) on the *Cache Only* strategy, the pattern `/icons/*.svg` can be used. (Specifically for the *Cache Only* strategy, patterns are resolved at Service Worker build-time, and each pattern must match, at least, a file.)
1704
1704
 
1705
1705
  <details>
1706
1706
  <summary>Example...</summary>
@@ -1716,7 +1716,7 @@ A couple APIs exists in browsers for establishing a two-way communication channe
1716
1716
 
1717
1717
  ###### The `workport` API
1718
1718
 
1719
- This is an object with simple methods for working with *cross-thread* messages, UI and Push Notifications.
1719
+ This is an object with simple methods for working with *cross-thread* messages, UI Notifications, and Push Notifications.
1720
1720
 
1721
1721
  On both the client and worker side of your application, the `workport` object is accessible from route handlers as `this.runtime.workport`.
1722
1722
 
@@ -1805,12 +1805,12 @@ workport.nofitications.fire(title, options).then(event => {
1805
1805
  </details>
1806
1806
 
1807
1807
  <details>
1808
- <summary>Method: <code>.nofitications.listen()</code></summary>
1808
+ <summary>Method: <code>.nofitications.handle()</code></summary>
1809
1809
 
1810
- The `.nofitications.listen()` method (in Service-Workers) is used for listening to [`notificationclick`](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/notificationclick_event) events. (Handlers are called each time a notification is clicked.)
1810
+ The `.nofitications.handle()` method (in Service-Workers) is used for handling [`notificationclick`](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/notificationclick_event) events. (Handlers are called each time a notification is clicked.)
1811
1811
 
1812
1812
  ```js
1813
- workport.nofitications.listen(event => {
1813
+ workport.nofitications.handle(event => {
1814
1814
  console.log(event.action);
1815
1815
  });
1816
1816
  ```
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.11.18",
15
+ "version": "0.11.19",
16
16
  "license": "MIT",
17
17
  "repository": {
18
18
  "type": "git",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@octokit/webhooks": "^7.15.1",
39
- "@webqit/backpack": "^0.1.0",
39
+ "@webqit/backpack": "^0.1.2",
40
40
  "@webqit/oohtml-ssr": "^1.1.0",
41
41
  "@webqit/util": "^0.8.9",
42
42
  "client-sessions": "^0.8.0",
@@ -41,12 +41,13 @@ export default class Router {
41
41
  async route(method, event, arg, _default, remoteFetch = null) {
42
42
 
43
43
  const $this = this;
44
+ const $runtime = this.cx.runtime;
44
45
 
45
46
  // ----------------
46
47
  // The loop
47
48
  // ----------------
48
49
  const next = async function(thisTick) {
49
- const thisContext = { };
50
+ const thisContext = { runtime: $runtime };
50
51
  if (!thisTick.trail || thisTick.trail.length < thisTick.destination.length) {
51
52
  thisTick = await $this.readTick(thisTick);
52
53
  // -------------
@@ -15,4 +15,9 @@ export async function start(clientCallback = null) {
15
15
  return new Runtime(Context.create(cx), ( ...args ) => {
16
16
  return clientCallback ? clientCallback( ...args.concat( defaultClientCallback ) ) : defaultClientCallback( ...args );
17
17
  });
18
- }
18
+ }
19
+
20
+ /**
21
+ * @APIS
22
+ */
23
+ export * as APIS from './Runtime.js';
@@ -3,9 +3,21 @@
3
3
  * @imports
4
4
  */
5
5
  import { _any } from '@webqit/util/arr/index.js';
6
- import { HttpEvent, Request, Response, Observer } from '../Runtime.js';
7
6
  import { urlPattern } from '../../util.js';
8
7
  import Workport from './Workport.js';
8
+ import { HttpEvent, Request, Response, Observer } from '../Runtime.js';
9
+ export {
10
+ URL,
11
+ FormData,
12
+ ReadableStream,
13
+ RequestHeaders,
14
+ ResponseHeaders,
15
+ Request,
16
+ Response,
17
+ fetch,
18
+ HttpEvent,
19
+ Observer,
20
+ } from '../Runtime.js';
9
21
 
10
22
  /**
11
23
  * ---------------------------
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * @imports
4
4
  */
5
- import Router from '../Router.js';
5
+ import Router from './Worker.js';
6
6
 
7
7
  export default class WorkerClient {
8
8
 
@@ -56,7 +56,7 @@ export default class Workport {
56
56
  notification.addEventListener('close', res);
57
57
  });
58
58
  },
59
- listen: callback => {
59
+ handle: callback => {
60
60
  self.addEventListener('notificationclick', callback);
61
61
  return this.notifications;
62
62
  },
@@ -15,4 +15,9 @@ export async function start(clientCallback = null) {
15
15
  return new Worker(Context.create(cx), ( ...args ) => {
16
16
  return clientCallback ? clientCallback( ...args.concat( defaultClientCallback ) ) : defaultClientCallback( ...args );
17
17
  });
18
- }
18
+ }
19
+
20
+ /**
21
+ * @APIS
22
+ */
23
+ export * as APIS from './Worker.js';
@@ -6,20 +6,6 @@ import Context from './Context.js';
6
6
  import RuntimeClient from './RuntimeClient.js';
7
7
  import Runtime from './Runtime.js';
8
8
 
9
- /**
10
- * @desc
11
- */
12
- export const desc = {
13
- config: {
14
- headers: 'Configure automatic http headers.',
15
- prerendering: 'Configure prerendering.',
16
- redirects: 'Configure automatic redirects.',
17
- server: 'Configure server settings.',
18
- vhosts: 'Configure virtual hosts.',
19
- },
20
- start: 'Starts the Webflo server.',
21
- };
22
-
23
9
  /**
24
10
  * @start
25
11
  */
@@ -32,10 +18,6 @@ export async function start(clientCallback = null) {
32
18
  }
33
19
 
34
20
  /**
35
- * @exports
21
+ * @APIS
36
22
  */
37
- export {
38
- Context,
39
- RuntimeClient,
40
- Runtime,
41
- }
23
+ export * as APIS from './Runtime.js';