Skip to content

Commit a7bbbfe

Browse files
committed
added licence
1 parent e249824 commit a7bbbfe

File tree

7 files changed

+75
-17
lines changed

7 files changed

+75
-17
lines changed

.github/workflows/publish.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: "20"
18+
registry-url: "https://registry.npmjs.org"
19+
20+
- name: Install pnpm
21+
run: npm install -g pnpm
22+
23+
- name: Install Dependencies
24+
run: pnpm install
25+
26+
- name: Build
27+
run: pnpm build
28+
29+
- name: Publish to npm
30+
run: npm publish
31+
env:
32+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Bart Spaans
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 all
13+
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 THE
21+
SOFTWARE.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "foresightjs",
3-
"version": "-.0.0",
3+
"version": "0.0.0",
44
"description": "",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/ForesightManager/ForesightDebugger.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"use client"
2-
import type { IntentManager } from "./ForesightManager"
2+
import type { ForesightManager } from "./ForesightManager"
33
import type { LinkElement, Point, Rect } from "../types/types" // Forward declaration
44

55
// Define the structure of link data the debugger needs
@@ -12,7 +12,7 @@ type LinkManagerData = {
1212
}
1313

1414
export class IntentDebugger {
15-
private intentManagerInstance: IntentManager
15+
private foresightManagerInstance: ForesightManager
1616
private shadowHost: HTMLElement | null = null
1717
private shadowRoot: ShadowRoot | null = null
1818
private debugContainer: HTMLElement | null = null
@@ -25,8 +25,8 @@ export class IntentDebugger {
2525
private debugControlsContainer: HTMLElement | null = null
2626
private debugStyleElement: HTMLStyleElement | null = null
2727

28-
constructor(intentManager: IntentManager) {
29-
this.intentManagerInstance = intentManager
28+
constructor(foresightManager: ForesightManager) {
29+
this.foresightManagerInstance = foresightManager
3030
}
3131

3232
public initialize(
@@ -265,7 +265,7 @@ export class IntentDebugger {
265265
"#intent-trajectory-enabled"
266266
) as HTMLInputElement
267267
enabledCheckbox.addEventListener("change", () => {
268-
this.intentManagerInstance.setTrajectorySettings({
268+
this.foresightManagerInstance.setTrajectorySettings({
269269
enabled: enabledCheckbox.checked,
270270
})
271271
})
@@ -279,7 +279,7 @@ export class IntentDebugger {
279279
historySlider.addEventListener("input", () => {
280280
const value = parseInt(historySlider.value)
281281
historyValueSpan.textContent = value.toString()
282-
this.intentManagerInstance.setTrajectorySettings({ historySize: value })
282+
this.foresightManagerInstance.setTrajectorySettings({ historySize: value })
283283
})
284284

285285
const predictionSlider = this.debugControlsContainer.querySelector(
@@ -291,7 +291,7 @@ export class IntentDebugger {
291291
predictionSlider.addEventListener("input", () => {
292292
const value = parseInt(predictionSlider.value)
293293
predictionValueSpan.textContent = value.toString()
294-
this.intentManagerInstance.setTrajectorySettings({
294+
this.foresightManagerInstance.setTrajectorySettings({
295295
predictionTime: value,
296296
})
297297
})

src/ForesightManager/ForesightManager.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import type {
1010
Rect,
1111
} from "../types/types"
1212

13-
export class IntentManager {
14-
private static instance: IntentManager
13+
export class ForesightManager {
14+
private static instance: ForesightManager
1515
private links: Map<LinkElement, LinkData> = new Map()
1616

1717
private isSetup: boolean = false
@@ -33,12 +33,12 @@ export class IntentManager {
3333
setInterval(this.checkTrajectoryHitExpiration.bind(this), 100)
3434
}
3535

36-
public static initialize(props?: Partial<IntentManagerProps>): IntentManager {
37-
if (!IntentManager.instance) {
38-
IntentManager.instance = new IntentManager()
36+
public static initialize(props?: Partial<IntentManagerProps>): ForesightManager {
37+
if (!ForesightManager.instance) {
38+
ForesightManager.instance = new ForesightManager()
3939
}
4040
if (props) {
41-
IntentManager.instance.setTrajectorySettings({
41+
ForesightManager.instance.setTrajectorySettings({
4242
historySize: props.positionHistorySize,
4343
predictionTime: props.trajectoryPredictionTime,
4444
enabled: props.enableMouseTrajectory,
@@ -54,14 +54,14 @@ export class IntentManager {
5454
}
5555
}
5656

57-
return IntentManager.instance
57+
return ForesightManager.instance
5858
}
5959

6060
public static getInstance() {
61-
if (!IntentManager.instance) {
61+
if (!ForesightManager.instance) {
6262
return this.initialize()
6363
}
64-
return IntentManager.instance
64+
return ForesightManager.instance
6565
}
6666

6767
private checkTrajectoryHitExpiration(): void {

src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Export the ForesightManager (currently called IntentManager)
2+
export { ForesightManager } from "./ForesightManager/ForesightManager"
3+
// Export any types you need
4+
export * from "./types/types"

0 commit comments

Comments
 (0)