diff --git a/src/common/pages/code.js b/src/common/pages/code.js index b763f079..8dc1a455 100644 --- a/src/common/pages/code.js +++ b/src/common/pages/code.js @@ -222,7 +222,7 @@ export function handleBuildFormSubmit() { const importBtn = document.querySelector("#import-button"); const importInput = document.querySelector("#import-input"); - importBtn?.addEventListener("click", () => importInput?.click()); + importBtn?.addEventListener("click", () => /** @type {HTMLElement} */ (importInput)?.click()); importInput?.addEventListener("change", async (event) => { const file = /** @type {HTMLInputElement} */ (event.target).files?.[0]; diff --git a/src/components/engine/audio/element.js b/src/components/engine/audio/element.js index 9bcc105a..d75d8455 100644 --- a/src/components/engine/audio/element.js +++ b/src/components/engine/audio/element.js @@ -623,6 +623,9 @@ class AudioEngineItem extends BroadcastableDiffuseElement { /** * @override + * @param {string} name + * @param {string} oldValue + * @param {string} newValue */ attributeChangedCallback(name, oldValue, newValue) { super.attributeChangedCallback(name, oldValue, newValue); diff --git a/src/components/orchestrator/media-session/element.js b/src/components/orchestrator/media-session/element.js index 9c5565aa..5750a50b 100644 --- a/src/components/orchestrator/media-session/element.js +++ b/src/components/orchestrator/media-session/element.js @@ -8,6 +8,8 @@ import { /** * @import {OutputElement} from "~/components/output/types.d.ts" * @import ArtworkOrchestrator from "~/components/orchestrator/artwork/element.js" + * @import {default as AudioEngine} from "~/components/engine/audio/element.js" + * @import {default as QueueEngine} from "~/components/engine/queue/element.js" */ //////////////////////////////////////////// @@ -36,9 +38,13 @@ class MediaSessionOrchestrator extends BroadcastableDiffuseElement { if (!("mediaSession" in navigator)) return; + /** @type {AudioEngine} */ this.audio = query(this, "audio-engine-selector"); + /** @type {QueueEngine} */ this.queue = query(this, "queue-engine-selector"); + /** @type {OutputElement | null} */ this.output = queryOptional(this, "output-selector"); + /** @type {ArtworkOrchestrator | null} */ this.artwork = queryOptional(this, "artwork-selector"); await Promise.all([ diff --git a/src/facets/themes/winamp/window-manager/element.js b/src/facets/themes/winamp/window-manager/element.js index d10c2a34..14c9b38a 100644 --- a/src/facets/themes/winamp/window-manager/element.js +++ b/src/facets/themes/winamp/window-manager/element.js @@ -88,7 +88,7 @@ class WindowManager extends DiffuseElement { const target = mutation.target; if (!(target instanceof HTMLElement) || !target.id) continue; const isOpen = target.hasAttribute("open"); - const state = this.#loadState(target.id) ?? {}; + const state = this.#loadState(target.id) ?? /** @type {{ left: string; top: string; width?: string; height?: string; open?: boolean }} */ ({}); this.#saveState( target.id, state.left ?? target.style.left, @@ -120,7 +120,7 @@ class WindowManager extends DiffuseElement { if (!initialized) { initialized = true; return; } const { width, height } = body.getBoundingClientRect(); if (width === 0 || height === 0) return; - const state = this.#loadState(w.id) ?? {}; + const state = this.#loadState(w.id) ?? /** @type {{ left: string; top: string; width?: string; height?: string; open?: boolean }} */ ({}); this.#saveState( w.id, state.left ?? w.style.left, @@ -251,7 +251,7 @@ class WindowManager extends DiffuseElement { const target = ogEvent.detail.element; if (target instanceof HTMLElement && target.id) { - const state = this.#loadState(target.id) ?? {}; + const state = this.#loadState(target.id) ?? /** @type {{ left: string; top: string; width?: string; height?: string; open?: boolean }} */ ({}); this.#saveState(target.id, target.style.left, target.style.top, state.width, state.height, state.open); } }; @@ -302,7 +302,7 @@ class WindowManager extends DiffuseElement { const stagger = index * 12; w.style.left = `${Math.round(Math.max(0, (window.innerWidth - width) / 2) + stagger)}px`; w.style.top = `${Math.round(Math.max(0, (window.innerHeight - height) / 2) + stagger)}px`; - const state = this.#loadState(id) ?? {}; + const state = this.#loadState(id) ?? /** @type {{ left: string; top: string; width?: string; height?: string; open?: boolean }} */ ({}); this.#saveState(id, w.style.left, w.style.top, state.width, state.height, state.open); }; requestAnimationFrame(placeWindow); diff --git a/src/oauth/lock.js b/src/oauth/lock.js index 3a62a47f..d0cc8448 100644 --- a/src/oauth/lock.js +++ b/src/oauth/lock.js @@ -9,6 +9,7 @@ // This lock serialises all library operations so only one module at a time // owns the global state. +/** @type {Promise} */ let _chain = Promise.resolve(); /**