diff --git a/package-lock.json b/package-lock.json index 3dd62dd..b93db3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,6 +38,7 @@ "@ivanv/vue-collapse-transition": "^1.0.2", "@rushstack/eslint-patch": "^1.7.2", "@types/lz-string": "^1.5.0", + "@types/node": "^22.7.6", "@typescript-eslint/parser": "^7.2.0", "@vue/eslint-config-prettier": "^9.0.0", "@vue/eslint-config-typescript": "^13.0.0", @@ -2060,6 +2061,15 @@ "lz-string": "*" } }, + "node_modules/@types/node": { + "version": "22.7.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.6.tgz", + "integrity": "sha512-/d7Rnj0/ExXDMcioS78/kf1lMzYk4BZV8MZGTBKzTGZ6/406ukkbYlIsZmMPhcR5KlkunDHQLrtAVmSq7r+mSw==", + "devOptional": true, + "dependencies": { + "undici-types": "~6.19.2" + } + }, "node_modules/@types/offscreencanvas": { "version": "2019.7.3", "resolved": "https://registry.npmjs.org/@types/offscreencanvas/-/offscreencanvas-2019.7.3.tgz", @@ -6860,6 +6870,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "devOptional": true + }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.1.tgz", diff --git a/package.json b/package.json index 4b82572..5994292 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "@ivanv/vue-collapse-transition": "^1.0.2", "@rushstack/eslint-patch": "^1.7.2", "@types/lz-string": "^1.5.0", + "@types/node": "^22.7.6", "@typescript-eslint/parser": "^7.2.0", "@vue/eslint-config-prettier": "^9.0.0", "@vue/eslint-config-typescript": "^13.0.0", diff --git a/src/components/fields/FeedbackButton.vue b/src/components/fields/FeedbackButton.vue index 42dcdaa..2dcaafd 100644 --- a/src/components/fields/FeedbackButton.vue +++ b/src/components/fields/FeedbackButton.vue @@ -15,13 +15,13 @@ const emit = defineEmits<{ }>(); const activated = ref(false); -const activatedTimeout = ref(null); +const activatedTimeout = ref(null); function click() { emit("click"); // Give feedback to user - if (activatedTimeout.value) { + if (activatedTimeout.value != null) { clearTimeout(activatedTimeout.value); } activated.value = false; diff --git a/src/game/boards/board.tsx b/src/game/boards/board.tsx index 5b27d02..8a8e955 100644 --- a/src/game/boards/board.tsx +++ b/src/game/boards/board.tsx @@ -1,5 +1,3 @@ -import Board from "./Board.vue"; -import Draggable from "./Draggable.vue"; import { Component, GatherProps, GenericComponent, jsx } from "features/feature"; import { globalBus } from "game/events"; import { Persistent, persistent } from "game/persistence"; @@ -11,6 +9,9 @@ import { VueFeature } from "util/vue"; import type { ComponentPublicInstance, Ref } from "vue"; import { computed, nextTick, ref, unref, watchEffect } from "vue"; import panZoom from "vue-panzoom"; +import { JSX } from "vue/jsx-runtime"; +import Board from "./Board.vue"; +import Draggable from "./Draggable.vue"; // Register panzoom so it can be used in Board.vue globalBus.on("setupVue", app => panZoom.install(app)); diff --git a/src/game/gameLoop.ts b/src/game/gameLoop.ts index f43aae7..0b8933d 100644 --- a/src/game/gameLoop.ts +++ b/src/game/gameLoop.ts @@ -8,7 +8,7 @@ import { watch } from "vue"; import player from "./player"; import state from "./state"; -let intervalID: NodeJS.Timer | null = null; +let intervalID: NodeJS.Timeout | null = null; function update() { const now = Date.now(); diff --git a/src/util/galaxy.ts b/src/util/galaxy.ts index 6f7c717..b2a4d04 100644 --- a/src/util/galaxy.ts +++ b/src/util/galaxy.ts @@ -172,6 +172,7 @@ function syncSaves( const localSave = localStorage.getItem(id) ?? ""; const parsedLocalSave = JSON.parse(decodeSave(localSave) ?? ""); const slot = availableSlots.values().next().value; + if (slot == null) return; galaxy.value ?.save(slot, localSave, parsedLocalSave.name) .then(() => syncedSaves.value.push(parsedLocalSave.id)) diff --git a/src/util/vue.tsx b/src/util/vue.tsx index e19eb31..d5bd1bb 100644 --- a/src/util/vue.tsx +++ b/src/util/vue.tsx @@ -126,17 +126,17 @@ export function setupHoldToClick( stop: VoidFunction; handleHolding: VoidFunction; } { - const interval = ref(null); + const interval = ref(null); const event = ref(undefined); function start(e: MouseEvent | TouchEvent) { - if (!interval.value) { + if (interval.value == null) { interval.value = setInterval(handleHolding, 250); } event.value = e; } function stop() { - if (interval.value) { + if (interval.value != null) { clearInterval(interval.value); interval.value = null; } @@ -245,11 +245,8 @@ export function trackHover(element: VueFeature): Ref { } export function kebabifyObject(object: Record) { - return Object.keys(object).reduce( - (acc, curr) => { - acc[camelToKebab(curr)] = object[curr]; - return acc; - }, - {} as Record - ); + return Object.keys(object).reduce((acc, curr) => { + acc[camelToKebab(curr)] = object[curr]; + return acc; + }, {} as Record); }