js.foresight 1.1.2 → 1.1.3
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/README.md +9 -6
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -12,11 +12,11 @@ ForesightJS is a lightweight JavaScript library that predicts user intent based
|
|
|
12
12
|
## Download
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
npm install
|
|
15
|
+
npm install js.foresight
|
|
16
16
|
# or
|
|
17
|
-
yarn add
|
|
17
|
+
yarn add js.foresight
|
|
18
18
|
# or
|
|
19
|
-
pnpm add
|
|
19
|
+
pnpm add js.foresight
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
## Why Use ForesightJS?
|
|
@@ -77,18 +77,21 @@ const { isTouchDevice, unregister } = ForesightManager.instance.register({
|
|
|
77
77
|
// Later, when done with this element:
|
|
78
78
|
unregister()
|
|
79
79
|
```
|
|
80
|
-
|
|
80
|
+
|
|
81
|
+
## What about touch devices?
|
|
82
|
+
|
|
81
83
|
ForesightJS focuses on using mouse movement for prefetching, so you'll need your own approach for touch devices like phones and tablets. The `ForesightManager.instance.register()` method returns an `isTouchDevice` boolean that you can use to create this separate logic. You can safely call `register()` even on touch devices, as the Foresight manager will bounce touch devices to avoid unnecessary processing.
|
|
82
84
|
|
|
83
85
|
An example of what to do with touch devices can be found in the [Next.JS](https://foresightjs.com/docs/integrations/nextjs) or [React Router](https://foresightjs.com/docs/integrations/react) ForesightLink components.
|
|
84
86
|
|
|
85
87
|
## Integrations
|
|
88
|
+
|
|
86
89
|
Since ForesightJS is framework agnostic, it can be integrated with any JavaScript framework. While I haven't yet built integrations for every framework, ready-to-use implementations for [React Router](https://foresightjs.com/docs/integrations/react) and [Next.js](https://foresightjs.com/docs/integrations/nextjs) are already available. Sharing integrations for other frameworks/packages is highly appreciated!
|
|
87
90
|
|
|
88
91
|
## Configuration
|
|
89
|
-
ForesightJS can be used bare-bones but also can be configured. For all configuration possibilities you can reference the [docs](https://foresightjs.com/docs/config).
|
|
90
92
|
|
|
93
|
+
ForesightJS can be used bare-bones but also can be configured. For all configuration possibilities you can reference the [docs](https://foresightjs.com/docs/config).
|
|
91
94
|
|
|
92
95
|
## Debugging visualization
|
|
93
|
-
ForesightJS includes a [Visual Debugging](https://foresightjs.com/docs/debugging) system that helps you understand and tune how foresight is working in your application. This is particularly helpful when setting up ForesightJS for the first time or when fine-tuning for specific UI components.
|
|
94
96
|
|
|
97
|
+
ForesightJS includes a [Visual Debugging](https://foresightjs.com/docs/debugging) system that helps you understand and tune how foresight is working in your application. This is particularly helpful when setting up ForesightJS for the first time or when fine-tuning for specific UI components.
|
package/package.json
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js.foresight",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Predicts mouse trajectory to trigger actions as users approach elements, enabling anticipatory UI updates or pre-loading. Made with vanilla javascript and usable in every framework.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc --build --clean && tsc",
|
|
10
|
+
"test": "cd ./test_project && pnpm dev",
|
|
11
|
+
"rollup": "rollup -c --bundleConfigAsCjs"
|
|
12
|
+
},
|
|
8
13
|
"exports": {
|
|
9
14
|
".": {
|
|
10
15
|
"types": "./dist/index.d.ts",
|
|
@@ -46,10 +51,5 @@
|
|
|
46
51
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
47
52
|
"rollup-plugin-postcss": "^4.0.2",
|
|
48
53
|
"tslib": "^2.8.1"
|
|
49
|
-
},
|
|
50
|
-
"scripts": {
|
|
51
|
-
"build": "tsc --build --clean && tsc",
|
|
52
|
-
"test": "cd ./test_project && pnpm dev",
|
|
53
|
-
"rollup": "rollup -c --bundleConfigAsCjs"
|
|
54
54
|
}
|
|
55
|
-
}
|
|
55
|
+
}
|