feat(wails): move the frontend onto v3's generated bindings
frontend/wailsjs/ is deleted and frontend/bindings/ takes its place — a real TypeScript module tree nested by Go import path, generated by wails3's static analyser rather than by building the app and running it. The @go alias absorbs the constant prefix, so a call site imports '@go/library/library.js' and the codemod over all 93 sites was a specifier rewrite plus splitting @go/models' namespaces into one import per package. The 12 SetContext bindings and the fake `context` model are gone, as Phase 2's ServiceStartup port promised: 272 methods across 12 services, none of them plumbing. @runtime/runtime is now a local shim (src/wails/runtime.ts) over @wailsio/runtime, so the 22 EventsOn imports are untouched. It unwraps v3's WailsEvent into v2's callback shape, which is exact here: nothing in backend/events passes more than one data argument, and v3 only packs arguments into a slice when there is more than one. v3 tells the truth about two things v2 lied about, and that is most of the diff. A Go nil slice really does arrive as JSON null, and a Go named string type really is an enum; v2 typed them as T[] and string. utils/binding.ts states the app's actual contract — an absent list is an empty list — once, at the boundary where it is true, and also drops the CancellablePromise the app never cancels. Four test fixtures widen an enum field back to its value union. Not done, and Phase 5's to fix: frontend/test/support/wails-fake.ts still fakes window.go, which v3 does not have, so `make ui-test` is broken and harness.test.ts fails to compile on EventsEmit. That test also asserts v2 ordering that no longer holds — v3's Events.Emit calls the backend and does not notify in-page listeners at all. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UDCbcCZQepnpSQYJ6SxxZm
This commit is contained in:
@@ -0,0 +1,182 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
/**
|
||||
* Player handles audio playback and state management.
|
||||
*
|
||||
* Lock ordering: always acquire p.mu BEFORE speaker.Lock().
|
||||
* The beep playback-finished callback dispatches to a new goroutine
|
||||
* so it never holds p.mu while the speaker lock is held.
|
||||
* @module
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import { Call as $Call, CancellablePromise as $CancellablePromise } from "@wailsio/runtime";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as mediacontrols$0 from "../mediacontrols/models.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore: Unused imports
|
||||
import * as $models from "./models.js";
|
||||
|
||||
/**
|
||||
* ChangeVolume adjusts the volume by a relative amount.
|
||||
*/
|
||||
export function ChangeVolume(deltaVolume: number): $CancellablePromise<void> {
|
||||
return $Call.ByID(742861629, deltaVolume);
|
||||
}
|
||||
|
||||
/**
|
||||
* CurrentPosition returns the playback position as a percentage
|
||||
* (0-100).
|
||||
*/
|
||||
export function CurrentPosition(): $CancellablePromise<number> {
|
||||
return $Call.ByID(2723620683);
|
||||
}
|
||||
|
||||
/**
|
||||
* CurrentPositionSeconds returns the current playback position in
|
||||
* display seconds.
|
||||
*/
|
||||
export function CurrentPositionSeconds(): $CancellablePromise<number> {
|
||||
return $Call.ByID(1423359008);
|
||||
}
|
||||
|
||||
/**
|
||||
* EmitCurrentState pushes the current player state to the frontend.
|
||||
* This is intended to be called after the frontend is ready to
|
||||
* receive events, separately from RestoreState which does the heavy
|
||||
* lifting during OnStartup.
|
||||
*/
|
||||
export function EmitCurrentState(): $CancellablePromise<void> {
|
||||
return $Call.ByID(2143346946);
|
||||
}
|
||||
|
||||
/**
|
||||
* GetCurrentTrackInfo returns information about the currently
|
||||
* loaded track.
|
||||
*/
|
||||
export function GetCurrentTrackInfo(): $CancellablePromise<$models.TrackInfo> {
|
||||
return $Call.ByID(2615351053);
|
||||
}
|
||||
|
||||
/**
|
||||
* InitSpeaker initializes the audio output device. This is
|
||||
* separated from NewPlayer so the player struct can be created
|
||||
* before wails.Run (for binding registration) while deferring
|
||||
* hardware initialization to OnStartup.
|
||||
*/
|
||||
export function InitSpeaker(): $CancellablePromise<void> {
|
||||
return $Call.ByID(3317123670);
|
||||
}
|
||||
|
||||
/**
|
||||
* IsPlaying reports whether the player is currently playing audio.
|
||||
*/
|
||||
export function IsPlaying(): $CancellablePromise<boolean> {
|
||||
return $Call.ByID(1219303535);
|
||||
}
|
||||
|
||||
/**
|
||||
* LoadFile opens and decodes an audio file for playback.
|
||||
*/
|
||||
export function LoadFile(filePath: string): $CancellablePromise<void> {
|
||||
return $Call.ByID(2214941041, filePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* MuteToggle toggles the mute state.
|
||||
*/
|
||||
export function MuteToggle(): $CancellablePromise<void> {
|
||||
return $Call.ByID(2840614678);
|
||||
}
|
||||
|
||||
/**
|
||||
* Muted reports whether playback is currently silenced.
|
||||
*/
|
||||
export function Muted(): $CancellablePromise<boolean> {
|
||||
return $Call.ByID(2954670878);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pause pauses the current playback.
|
||||
*/
|
||||
export function Pause(): $CancellablePromise<void> {
|
||||
return $Call.ByID(1402758839);
|
||||
}
|
||||
|
||||
/**
|
||||
* Play starts or resumes audio playback.
|
||||
*/
|
||||
export function Play(): $CancellablePromise<void> {
|
||||
return $Call.ByID(3327176373);
|
||||
}
|
||||
|
||||
/**
|
||||
* RestoreState loads the persisted player state from the database.
|
||||
*/
|
||||
export function RestoreState(): $CancellablePromise<void> {
|
||||
return $Call.ByID(318202560);
|
||||
}
|
||||
|
||||
/**
|
||||
* SaveState persists the current player state to the database and
|
||||
* waits for the write. This is called during shutdown to capture the
|
||||
* final state, which is the one case that cannot be deferred.
|
||||
*/
|
||||
export function SaveState(): $CancellablePromise<void> {
|
||||
return $Call.ByID(3845072215);
|
||||
}
|
||||
|
||||
/**
|
||||
* Seek jumps to a specific position in seconds.
|
||||
*/
|
||||
export function Seek(targetSeconds: number): $CancellablePromise<void> {
|
||||
return $Call.ByID(829056707, targetSeconds);
|
||||
}
|
||||
|
||||
/**
|
||||
* SetMediaControls provides an OS media controls handler. When set,
|
||||
* the player pushes metadata, playback state, volume, and seek
|
||||
* notifications to the OS media overlay.
|
||||
*/
|
||||
export function SetMediaControls(h: mediacontrols$0.Handler): $CancellablePromise<void> {
|
||||
return $Call.ByID(1896286877, h);
|
||||
}
|
||||
|
||||
/**
|
||||
* SetPlaybackFinishedHandler sets a callback invoked when a track
|
||||
* finishes naturally. This allows the queue to drive auto-advance
|
||||
* without circular imports.
|
||||
*/
|
||||
export function SetPlaybackFinishedHandler(handler: any): $CancellablePromise<void> {
|
||||
return $Call.ByID(2023377546, handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* SetVolume sets the playback volume (0-100), emits a
|
||||
* VolumeChanged event, and persists the new level.
|
||||
*/
|
||||
export function SetVolume(desiredVolume: $models.UserVolume): $CancellablePromise<void> {
|
||||
return $Call.ByID(1375836663, desiredVolume);
|
||||
}
|
||||
|
||||
/**
|
||||
* TrackLengthInSeconds returns the duration of the current track.
|
||||
*/
|
||||
export function TrackLengthInSeconds(): $CancellablePromise<number> {
|
||||
return $Call.ByID(3749851426);
|
||||
}
|
||||
|
||||
/**
|
||||
* UnloadTrack tears down the current track, releasing the file and
|
||||
* streamer chain. The player returns to the initial "no track
|
||||
* loaded" state and emits events so the frontend clears its
|
||||
* current-track display.
|
||||
*/
|
||||
export function UnloadTrack(): $CancellablePromise<void> {
|
||||
return $Call.ByID(3127425467);
|
||||
}
|
||||
Reference in New Issue
Block a user