@open-orpheus/plugin-api 0.0.0-stage → 0.0.0
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/dist/host/_native/open-orpheus__database.d.ts +50 -0
- package/dist/host/_native/open-orpheus__window.d.ts +266 -0
- package/dist/host/src/constants.d.ts +6 -0
- package/dist/host/src/main/afp.d.ts +1 -0
- package/dist/host/src/main/arguments.d.ts +4 -0
- package/dist/host/src/main/audio/ChunkTracker.d.ts +23 -0
- package/dist/host/src/main/audio/DownloadScheduler.d.ts +53 -0
- package/dist/host/src/main/audio/MediaEngine.d.ts +47 -0
- package/dist/host/src/main/audio/OnlineStreamer.d.ts +66 -0
- package/dist/host/src/main/audio/StorageManager.d.ts +18 -0
- package/dist/host/src/main/audio.d.ts +6 -0
- package/dist/host/src/main/av3a/Av3aEngine.d.ts +24 -0
- package/dist/host/src/main/av3a/Av3aM4aSession.d.ts +101 -0
- package/dist/host/src/main/av3a/Av3aPlaybackProcess.d.ts +52 -0
- package/dist/host/src/main/av3a/detect.d.ts +6 -0
- package/dist/host/src/main/av3a/sources.d.ts +13 -0
- package/dist/host/src/main/av3a/types.d.ts +54 -0
- package/dist/host/src/main/bridge/modules/inputRegion.d.ts +1 -0
- package/dist/host/src/main/bridge/modules/lyrics.d.ts +1 -0
- package/dist/host/src/main/bridge/modules/settings.d.ts +1 -0
- package/dist/host/src/main/bridge/register.d.ts +9 -0
- package/dist/host/src/main/cache/HttpCacheStorage.d.ts +10 -0
- package/dist/host/src/main/cache/LyricCahceManager.d.ts +21 -0
- package/dist/host/src/main/cache/PlayCacheManager.d.ts +72 -0
- package/dist/host/src/main/cache.d.ts +7 -0
- package/dist/host/src/main/calls/app.d.ts +1 -0
- package/dist/host/src/main/calls/audioeffect.d.ts +1 -0
- package/dist/host/src/main/calls/browser.d.ts +1 -0
- package/dist/host/src/main/calls/desktop.d.ts +2 -0
- package/dist/host/src/main/calls/desktoppet.d.ts +1 -0
- package/dist/host/src/main/calls/download.d.ts +1 -0
- package/dist/host/src/main/calls/index.d.ts +16 -0
- package/dist/host/src/main/calls/musiclibrary.d.ts +1 -0
- package/dist/host/src/main/calls/network.d.ts +1 -0
- package/dist/host/src/main/calls/os.d.ts +1 -0
- package/dist/host/src/main/calls/player.d.ts +22 -0
- package/dist/host/src/main/calls/process.d.ts +1 -0
- package/dist/host/src/main/calls/rtc.d.ts +1 -0
- package/dist/host/src/main/calls/storage.d.ts +1 -0
- package/dist/host/src/main/calls/trayicon.d.ts +1 -0
- package/dist/host/src/main/calls/update.d.ts +1 -0
- package/dist/host/src/main/calls/winhelper.d.ts +1 -0
- package/dist/host/src/main/calls.d.ts +5 -0
- package/dist/host/src/main/channel.d.ts +1 -0
- package/dist/host/src/main/cookie.d.ts +13 -0
- package/dist/host/src/main/crypto.d.ts +46 -0
- package/dist/host/src/main/database/KeyvSqliteDriver.d.ts +6 -0
- package/dist/host/src/main/database.d.ts +5 -0
- package/dist/host/src/main/dawn.d.ts +31 -0
- package/dist/host/src/main/device.d.ts +3 -0
- package/dist/host/src/main/download.d.ts +40 -0
- package/dist/host/src/main/error.d.ts +1 -0
- package/dist/host/src/main/folders.d.ts +18 -0
- package/dist/host/src/main/fonts.d.ts +1 -0
- package/dist/host/src/main/gui.d.ts +4 -0
- package/dist/host/src/main/id3.d.ts +42 -0
- package/dist/host/src/main/lifecycle.d.ts +118 -0
- package/dist/host/src/main/logger.d.ts +12 -0
- package/dist/host/src/main/lyrics/DbusLyricsService.d.ts +115 -0
- package/dist/host/src/main/lyrics/LyricsDispatcher.d.ts +26 -0
- package/dist/host/src/main/lyrics/dbus.d.ts +16 -0
- package/dist/host/src/main/lyrics/parse.d.ts +21 -0
- package/dist/host/src/main/lyrics.d.ts +2 -0
- package/dist/host/src/main/mediaSession.d.ts +42 -0
- package/dist/host/src/main/menu/AppMenu.d.ts +35 -0
- package/dist/host/src/main/menu/anchor.d.ts +13 -0
- package/dist/host/src/main/menu/backend/DesktopWindowBackend.d.ts +30 -0
- package/dist/host/src/main/menu/backend/MenuBackend.d.ts +28 -0
- package/dist/host/src/main/menu/backend/WaylandOverlayBackend.d.ts +15 -0
- package/dist/host/src/main/menu/backend/WaylandPopupBackend.d.ts +31 -0
- package/dist/host/src/main/menu/constants.d.ts +12 -0
- package/dist/host/src/main/menu/index.d.ts +2 -0
- package/dist/host/src/main/menu/native-popup.d.ts +16 -0
- package/dist/host/src/main/menu/patch.d.ts +3 -0
- package/dist/host/src/main/menu/skin.d.ts +3 -0
- package/dist/host/src/main/menu/surface/BaseWindowMenuSurface.d.ts +69 -0
- package/dist/host/src/main/menu/surface/MenuSurface.d.ts +29 -0
- package/dist/host/src/main/menu/surface/MenuSurfacePath.d.ts +29 -0
- package/dist/host/src/main/menu/surface/SurfacePool.d.ts +15 -0
- package/dist/host/src/main/menu/workaround.d.ts +6 -0
- package/dist/host/src/main/ncae.d.ts +8 -0
- package/dist/host/src/main/network/handler.d.ts +3 -0
- package/dist/host/src/main/network/interceptor.d.ts +2 -0
- package/dist/host/src/main/network/interceptors/anonymous.d.ts +2 -0
- package/dist/host/src/main/network/pipeline.d.ts +8 -0
- package/dist/host/src/main/network/types.d.ts +70 -0
- package/dist/host/src/main/orpheus.d.ts +10 -0
- package/dist/host/src/main/pack.d.ts +27 -0
- package/dist/host/src/main/packs/Pack.d.ts +12 -0
- package/dist/host/src/main/packs/SkinPack.d.ts +6 -0
- package/dist/host/src/main/packs/WebPack.d.ts +6 -0
- package/dist/host/src/main/playback/PlaybackController.d.ts +57 -0
- package/dist/host/src/main/playback/PlayerCommandRouter.d.ts +85 -0
- package/dist/host/src/main/playback/adapters/MediaSessionAdapter.d.ts +61 -0
- package/dist/host/src/main/playback/adapters/MprisAdapter.d.ts +48 -0
- package/dist/host/src/main/playback/adapters/NowPlayingAdapter.d.ts +23 -0
- package/dist/host/src/main/playback/adapters/SmtcAdapter.d.ts +23 -0
- package/dist/host/src/main/playback/artwork.d.ts +47 -0
- package/dist/host/src/main/playback/modes.d.ts +8 -0
- package/dist/host/src/main/playback/types.d.ts +39 -0
- package/dist/host/src/main/plugin/discover.d.ts +36 -0
- package/dist/host/src/main/plugin/index.d.ts +12 -0
- package/dist/host/src/main/plugin/loader.d.ts +43 -0
- package/dist/host/src/main/plugin/manager.d.ts +15 -0
- package/dist/host/src/main/plugin/metadata.d.ts +24 -0
- package/dist/host/src/main/plugin/state.d.ts +17 -0
- package/dist/host/src/main/plugin/tree.d.ts +13 -0
- package/dist/host/src/main/plugin/types.d.ts +18 -0
- package/dist/host/src/main/protocol.d.ts +4 -0
- package/dist/host/src/main/request.d.ts +16 -0
- package/dist/host/src/main/settings.d.ts +6 -0
- package/dist/host/src/main/shortcuts.d.ts +10 -0
- package/dist/host/src/main/shutdown.d.ts +32 -0
- package/dist/host/src/main/skin/color.d.ts +2 -0
- package/dist/host/src/main/skin/dui.d.ts +15 -0
- package/dist/host/src/main/tray.d.ts +8 -0
- package/dist/host/src/main/update.d.ts +2 -0
- package/dist/host/src/main/util/display.d.ts +3 -0
- package/dist/host/src/main/util/env.d.ts +1 -0
- package/dist/host/src/main/util/fs.d.ts +21 -0
- package/dist/host/src/main/util/image.d.ts +1 -0
- package/dist/host/src/main/util/musicFile.d.ts +1 -0
- package/dist/host/src/main/util/musicPicture.d.ts +2 -0
- package/dist/host/src/main/util/path.d.ts +2 -0
- package/dist/host/src/main/util/send.d.ts +13 -0
- package/dist/host/src/main/util/url.d.ts +19 -0
- package/dist/host/src/main/util/window.d.ts +2 -0
- package/dist/host/src/main/window.d.ts +294 -0
- package/dist/host/src/main/windows/desktop-lyrics.d.ts +12 -0
- package/dist/host/src/main/windows/desktop-pet.d.ts +8 -0
- package/dist/host/src/main/windows/main.d.ts +6 -0
- package/dist/host/src/main/windows/manage.d.ts +2 -0
- package/dist/host/src/main/windows/mini-player.d.ts +16 -0
- package/dist/host/src/main/windows/music-desktop.d.ts +13 -0
- package/dist/host/src/main/windows/package-download.d.ts +2 -0
- package/dist/host/src/main/windows/plugin-manager.d.ts +5 -0
- package/dist/host/src/main/xeapi.d.ts +53 -0
- package/dist/host/src/preload/AudioEffectManager.d.ts +124 -0
- package/dist/host/src/preload/PlaybackBackend.d.ts +34 -0
- package/dist/host/src/preload/Player.d.ts +221 -0
- package/dist/host/src/preload/av3a/Av3aPcmPlayer.d.ts +84 -0
- package/dist/host/src/preload/av3a/bridge.d.ts +21 -0
- package/dist/host/src/preload/av3a/channel.d.ts +40 -0
- package/dist/host/src/preload/av3a/detect.d.ts +6 -0
- package/dist/host/src/preload/backends/Av3aPlaybackBackend.d.ts +32 -0
- package/dist/host/src/preload/backends/MediaPlaybackBackend.d.ts +25 -0
- package/dist/host/src/shared/CallDispatcher.d.ts +12 -0
- package/dist/host/src/shared/contracts/av3a-api.d.ts +50 -0
- package/dist/host/src/shared/contracts/av3a-process.d.ts +56 -0
- package/dist/host/src/shared/contracts/desktop-lyrics-api.d.ts +23 -0
- package/dist/host/src/shared/contracts/input-region-api.d.ts +6 -0
- package/dist/host/src/shared/contracts/lyrics-api.d.ts +11 -0
- package/dist/host/src/shared/contracts/manage-api.d.ts +33 -0
- package/dist/host/src/shared/contracts/mini-player-api.d.ts +19 -0
- package/dist/host/src/shared/contracts/plugin-manager-api.d.ts +34 -0
- package/dist/host/src/shared/contracts/settings-api.d.ts +15 -0
- package/dist/host/src/shared/playbackMode.d.ts +2 -0
- package/dist/host/src/shared/plugin/registry.d.ts +32 -0
- package/dist/host/src/shared/types/desktop-lyrics.d.ts +44 -0
- package/dist/host/src/shared/types/dui.d.ts +37 -0
- package/dist/host/src/shared/types/input-region.d.ts +6 -0
- package/dist/host/src/shared/types/lyrics.d.ts +15 -0
- package/dist/host/src/shared/types/manage.d.ts +14 -0
- package/dist/host/src/shared/types/menu-surface.d.ts +43 -0
- package/dist/host/src/shared/types/menu.d.ts +29 -0
- package/dist/host/src/shared/types/mini-player.d.ts +90 -0
- package/dist/host/src/shared/types/ncae.d.ts +21 -0
- package/dist/host/src/shared/types/package-download.d.ts +6 -0
- package/dist/host/src/shared/types/playback-mode.d.ts +3 -0
- package/dist/host/src/shared/types/settings.d.ts +9 -0
- package/dist/host/src/shared/types/update.d.ts +6 -0
- package/dist/host/src/shared/util.d.ts +22 -0
- package/dist/index.d.ts +7 -0
- package/dist/preload/host/src/constants.d.ts +6 -0
- package/dist/preload/host/src/main/network/types.d.ts +70 -0
- package/dist/preload/host/src/preload/AudioEffectManager.d.ts +124 -0
- package/dist/preload/host/src/preload/MusicRecognizer.d.ts +25 -0
- package/dist/preload/host/src/preload/PlaybackBackend.d.ts +34 -0
- package/dist/preload/host/src/preload/Player.d.ts +221 -0
- package/dist/preload/host/src/preload/YunxinIM.d.ts +15 -0
- package/dist/preload/host/src/preload/audioplayer.d.ts +4 -0
- package/dist/preload/host/src/preload/av3a/Av3aPcmPlayer.d.ts +84 -0
- package/dist/preload/host/src/preload/av3a/bridge.d.ts +21 -0
- package/dist/preload/host/src/preload/av3a/channel.d.ts +40 -0
- package/dist/preload/host/src/preload/av3a/detect.d.ts +6 -0
- package/dist/preload/host/src/preload/backends/Av3aPlaybackBackend.d.ts +32 -0
- package/dist/preload/host/src/preload/backends/MediaPlaybackBackend.d.ts +25 -0
- package/dist/preload/host/src/preload/calls/app.d.ts +1 -0
- package/dist/preload/host/src/preload/calls/audioeffect.d.ts +1 -0
- package/dist/preload/host/src/preload/calls/audioplayer.d.ts +1 -0
- package/dist/preload/host/src/preload/calls/im.d.ts +1 -0
- package/dist/preload/host/src/preload/calls/index.d.ts +6 -0
- package/dist/preload/host/src/preload/calls/network.d.ts +1 -0
- package/dist/preload/host/src/preload/calls/nimsys.d.ts +1 -0
- package/dist/preload/host/src/preload/calls/os.d.ts +1 -0
- package/dist/preload/host/src/preload/calls/player.d.ts +1 -0
- package/dist/preload/host/src/preload/calls/update.d.ts +1 -0
- package/dist/preload/host/src/preload/calls.d.ts +4 -0
- package/dist/preload/host/src/preload/channel.d.ts +1 -0
- package/dist/preload/host/src/preload/playbackMode.d.ts +13 -0
- package/dist/preload/host/src/preload/plugin/types.d.ts +18 -0
- package/dist/preload/host/src/preload/util.d.ts +1 -0
- package/dist/preload/host/src/shared/CallDispatcher.d.ts +12 -0
- package/dist/preload/host/src/shared/contracts/av3a-api.d.ts +50 -0
- package/dist/preload/host/src/shared/contracts/av3a-process.d.ts +56 -0
- package/dist/preload/host/src/shared/playbackMode.d.ts +2 -0
- package/dist/preload/host/src/shared/plugin/registry.d.ts +32 -0
- package/dist/preload/host/src/shared/types/ncae.d.ts +21 -0
- package/dist/preload/host/src/shared/types/playback-mode.d.ts +3 -0
- package/dist/preload/host/src/shared/util.d.ts +22 -0
- package/dist/preload/index.d.ts +7 -0
- package/dist/preload/registry-map.d.ts +36 -0
- package/dist/registry-map.d.ts +145 -0
- package/package.json +58 -4
- package/README.md +0 -3
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { BrowserWindow } from "electron";
|
|
2
|
+
import Emittery from "emittery";
|
|
3
|
+
export type StartupTask = {
|
|
4
|
+
type: "openFile";
|
|
5
|
+
file: string;
|
|
6
|
+
} | {
|
|
7
|
+
type: "openUrl";
|
|
8
|
+
url: string;
|
|
9
|
+
};
|
|
10
|
+
export declare let startupTask: StartupTask | null;
|
|
11
|
+
export declare function setStartupTask(task: StartupTask): void;
|
|
12
|
+
export declare enum LifecycleState {
|
|
13
|
+
Starting = 0,
|
|
14
|
+
MainWindowCreated = 1,
|
|
15
|
+
MainWindowLoaded = 2,
|
|
16
|
+
Started = 3,
|
|
17
|
+
Quitting = 4
|
|
18
|
+
}
|
|
19
|
+
export type LifecycleEvents = {
|
|
20
|
+
/**
|
|
21
|
+
* This event fires when main window has just been created, and the content
|
|
22
|
+
* is not loaded yet.
|
|
23
|
+
*
|
|
24
|
+
* Note that in this event, `mainWindow` is not set yet, but you can get it
|
|
25
|
+
* in the event data.
|
|
26
|
+
*/
|
|
27
|
+
mainwindowcreated: BrowserWindow;
|
|
28
|
+
mainwindowloaded: BrowserWindow;
|
|
29
|
+
/**
|
|
30
|
+
* This event fires when app is fully started and ready.
|
|
31
|
+
*
|
|
32
|
+
* At this point, `mainWindow` should be fully available to use, if not,
|
|
33
|
+
* something's seriously wrong.
|
|
34
|
+
*/
|
|
35
|
+
started: undefined;
|
|
36
|
+
quitting: undefined;
|
|
37
|
+
};
|
|
38
|
+
declare const STATE_EVENT_MAP: {
|
|
39
|
+
readonly 1: "mainwindowcreated";
|
|
40
|
+
readonly 2: "mainwindowloaded";
|
|
41
|
+
readonly 3: "started";
|
|
42
|
+
readonly 4: "quitting";
|
|
43
|
+
};
|
|
44
|
+
export declare const events: Emittery<LifecycleEvents>;
|
|
45
|
+
export declare let state: LifecycleState;
|
|
46
|
+
type StateEventData = {
|
|
47
|
+
[K in keyof typeof STATE_EVENT_MAP]: LifecycleEvents[(typeof STATE_EVENT_MAP)[K] & keyof LifecycleEvents];
|
|
48
|
+
};
|
|
49
|
+
export declare function setLifecycleState<K extends LifecycleState>(lifecycleState: K, ...args: K extends keyof StateEventData ? [undefined] extends [StateEventData[K]] ? [eventData?: StateEventData[K]] : [eventData: StateEventData[K]] : []): void;
|
|
50
|
+
export interface LifecycleOptions {
|
|
51
|
+
/**
|
|
52
|
+
* Upper bound on the whole shutdown sequence, in milliseconds.
|
|
53
|
+
*
|
|
54
|
+
* Overridable so the bounds below can be exercised by tests without waiting
|
|
55
|
+
* out the real budget. This is not a user-facing setting.
|
|
56
|
+
*/
|
|
57
|
+
shutdownDeadlineMs?: number;
|
|
58
|
+
/** Default per-task timeout, in milliseconds. */
|
|
59
|
+
taskTimeoutMs?: number;
|
|
60
|
+
/**
|
|
61
|
+
* Per-finalizer timeout, in milliseconds. Finalizers are outside the shutdown
|
|
62
|
+
* deadline, so this is the only bound they have.
|
|
63
|
+
*/
|
|
64
|
+
finalizerTimeoutMs?: number;
|
|
65
|
+
}
|
|
66
|
+
export interface ShutdownTask {
|
|
67
|
+
/** Stable identifier, used for logging only. */
|
|
68
|
+
name: string;
|
|
69
|
+
/**
|
|
70
|
+
* The work to run. `signal` is aborted when this task's own timeout, or the
|
|
71
|
+
* overall shutdown deadline, is reached, so tasks that own cancellable I/O
|
|
72
|
+
* can stop it instead of being abandoned mid-flight.
|
|
73
|
+
*/
|
|
74
|
+
run: (signal: AbortSignal) => void | Promise<void>;
|
|
75
|
+
/** Defaults to `DEFAULT_TASK_TIMEOUT_MS`. */
|
|
76
|
+
timeoutMs?: number;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Register work to run when the app shuts down.
|
|
80
|
+
*
|
|
81
|
+
* Tasks run in reverse registration order, so a resource registered later is
|
|
82
|
+
* torn down first.
|
|
83
|
+
*/
|
|
84
|
+
export declare function registerShutdownTask(task: ShutdownTask): void;
|
|
85
|
+
/**
|
|
86
|
+
* A last action that must happen however the tasks went.
|
|
87
|
+
*
|
|
88
|
+
* The deadline above exists so that quitting stays bounded, which means a slow
|
|
89
|
+
* task can skip the tasks behind it. For work that is the *point* of the
|
|
90
|
+
* shutdown rather than cleanup — powering the machine off at the end of an
|
|
91
|
+
* auto-exit countdown, say — being skipped silently turns the feature into a
|
|
92
|
+
* lie, so it is registered here instead: finalizers run after every task and
|
|
93
|
+
* after the log buffer is flushed, and the overall deadline does not apply to
|
|
94
|
+
* them.
|
|
95
|
+
*/
|
|
96
|
+
export interface ShutdownFinalizer {
|
|
97
|
+
/** Stable identifier, used for logging only. */
|
|
98
|
+
name: string;
|
|
99
|
+
/**
|
|
100
|
+
* The work to run. Keep it quick and self-contained: everything else is
|
|
101
|
+
* already done by this point, and it is bounded only by `finalizerTimeoutMs`.
|
|
102
|
+
*/
|
|
103
|
+
run: () => void | Promise<void>;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Register a finalizer, described by {@link ShutdownFinalizer}.
|
|
107
|
+
*
|
|
108
|
+
* They run in reverse registration order, like the tasks.
|
|
109
|
+
*/
|
|
110
|
+
export declare function registerShutdownFinalizer(finalizer: ShutdownFinalizer): void;
|
|
111
|
+
/**
|
|
112
|
+
* Wire quitting and signals into the shutdown sequence. Idempotent.
|
|
113
|
+
*
|
|
114
|
+
* Call this as early as possible: it is what makes a signal arriving during
|
|
115
|
+
* startup, before any task is registered, still exit with the right code.
|
|
116
|
+
*/
|
|
117
|
+
export declare function installLifecycle(options?: LifecycleOptions): void;
|
|
118
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import pino from "pino";
|
|
2
|
+
declare const logger: pino.Logger<never, boolean>;
|
|
3
|
+
/**
|
|
4
|
+
* Flush records still buffered in the log transport's worker.
|
|
5
|
+
*
|
|
6
|
+
* The transport writes from a worker thread, so records can still be in flight
|
|
7
|
+
* when the process starts to exit. Synchronous on purpose: it has to work from
|
|
8
|
+
* the shutdown path, where there is no time left to await anything.
|
|
9
|
+
*/
|
|
10
|
+
export declare function flushLogs(): void;
|
|
11
|
+
export default logger;
|
|
12
|
+
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { LyricsStore } from "../../shared/types/lyrics";
|
|
2
|
+
import type { TrackInfo } from "../playback/types";
|
|
3
|
+
/**
|
|
4
|
+
* The shape NAPI expects for a single timed word.
|
|
5
|
+
*
|
|
6
|
+
* The native struct uses snake_case Rust fields, which napi-rs reports as
|
|
7
|
+
* camelCase properties on the JS side. The conversion helpers below bridge the
|
|
8
|
+
* app's snake_case `LyricsStore` fields to this boundary.
|
|
9
|
+
*/
|
|
10
|
+
export interface DbusLyricsWord {
|
|
11
|
+
text: string;
|
|
12
|
+
startTime: number;
|
|
13
|
+
duration: number;
|
|
14
|
+
}
|
|
15
|
+
/** The shape NAPI expects for a single lyric line. */
|
|
16
|
+
export interface DbusLyricsLine {
|
|
17
|
+
startTime: number;
|
|
18
|
+
endTime: number;
|
|
19
|
+
words: DbusLyricsWord[];
|
|
20
|
+
}
|
|
21
|
+
/** The shape NAPI expects for `setLyrics`. */
|
|
22
|
+
export interface DbusLyricsDocument {
|
|
23
|
+
regular: DbusLyricsLine[];
|
|
24
|
+
perWord?: DbusLyricsLine[];
|
|
25
|
+
translate?: DbusLyricsLine[];
|
|
26
|
+
roma?: DbusLyricsLine[];
|
|
27
|
+
}
|
|
28
|
+
/** The shape NAPI expects for `setTrack`. Duration is in milliseconds. */
|
|
29
|
+
export interface DbusLyricsTrack {
|
|
30
|
+
id: string;
|
|
31
|
+
title: string;
|
|
32
|
+
artist: string;
|
|
33
|
+
album: string;
|
|
34
|
+
duration?: number;
|
|
35
|
+
}
|
|
36
|
+
/** The subset of the native `LyricsService` this adapter needs. */
|
|
37
|
+
export interface LyricsServiceHandle {
|
|
38
|
+
setTrack(track?: DbusLyricsTrack | null): Promise<void>;
|
|
39
|
+
setLyrics(lyrics?: DbusLyricsDocument | null, slogan?: string | null): Promise<void>;
|
|
40
|
+
dispose(): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
/** The lyrics state this adapter reads from. */
|
|
43
|
+
export interface LyricsSource {
|
|
44
|
+
readonly lyrics: LyricsStore | null;
|
|
45
|
+
readonly slogan: string | null;
|
|
46
|
+
on(event: "lyricsupdate" | "sloganupdate", listener: (event: {
|
|
47
|
+
name: string;
|
|
48
|
+
data: unknown;
|
|
49
|
+
}) => void): () => void;
|
|
50
|
+
}
|
|
51
|
+
/** The playback state this adapter reads from. */
|
|
52
|
+
export interface PlaybackSource {
|
|
53
|
+
readonly snapshot: {
|
|
54
|
+
readonly track: TrackInfo | null;
|
|
55
|
+
readonly duration: number | null;
|
|
56
|
+
};
|
|
57
|
+
on(event: "trackchanged" | "durationchanged", listener: (event: {
|
|
58
|
+
name: string;
|
|
59
|
+
data: unknown;
|
|
60
|
+
}) => void): () => void;
|
|
61
|
+
}
|
|
62
|
+
export interface DbusLyricsServiceOptions {
|
|
63
|
+
service: LyricsServiceHandle;
|
|
64
|
+
lyrics: LyricsSource;
|
|
65
|
+
playback: PlaybackSource;
|
|
66
|
+
/** Reports a failed native update without stopping later updates. */
|
|
67
|
+
onError?: (error: unknown, operation: string) => void;
|
|
68
|
+
}
|
|
69
|
+
/** Map `LyricsStore` onto the native document, preserving optional variants. */
|
|
70
|
+
export declare function toDbusLyricsDocument(store: LyricsStore | null): DbusLyricsDocument | null;
|
|
71
|
+
/** Map a track and its duration (seconds) onto the native track (milliseconds). */
|
|
72
|
+
export declare function toDbusLyricsTrack(track: TrackInfo | null, durationSeconds: number | null): DbusLyricsTrack | null;
|
|
73
|
+
/**
|
|
74
|
+
* Mirrors the current lyrics/track state into the native D-Bus lyrics service.
|
|
75
|
+
*
|
|
76
|
+
* Only existing `LyricsDispatcher` / `PlaybackController` events are used; the
|
|
77
|
+
* adapter never touches the player or the renderer. Writes are serialized so a
|
|
78
|
+
* burst of events cannot land out of order, and identical state is not pushed
|
|
79
|
+
* again.
|
|
80
|
+
*/
|
|
81
|
+
export default class DbusLyricsService {
|
|
82
|
+
private readonly service;
|
|
83
|
+
private readonly lyrics;
|
|
84
|
+
private readonly playback;
|
|
85
|
+
private readonly onError;
|
|
86
|
+
private readonly unsubscribers;
|
|
87
|
+
private queue;
|
|
88
|
+
private disposePromise;
|
|
89
|
+
/** `undefined` is the "never pushed" sentinel. */
|
|
90
|
+
private lastLyrics;
|
|
91
|
+
private lastSlogan;
|
|
92
|
+
private lastTrackKey;
|
|
93
|
+
constructor({ service, lyrics, playback, onError }: DbusLyricsServiceOptions);
|
|
94
|
+
/** Stop listening and close the native service. Idempotent. */
|
|
95
|
+
dispose(): Promise<void>;
|
|
96
|
+
private disposeOnce;
|
|
97
|
+
private refreshLyrics;
|
|
98
|
+
/**
|
|
99
|
+
* Forget the previous track's lyrics before the new track is published.
|
|
100
|
+
*
|
|
101
|
+
* The renderer only sends lyrics while a lyrics consumer is active, so the
|
|
102
|
+
* dispatcher can still hold the previous song's lyrics when the track
|
|
103
|
+
* changes. The dispatcher clears them too, but that happens from its own
|
|
104
|
+
* event listener; clearing here synchronously guarantees the D-Bus writes
|
|
105
|
+
* are queued in the safe order: clear first, then the new track.
|
|
106
|
+
*/
|
|
107
|
+
private clearLyrics;
|
|
108
|
+
private refreshTrack;
|
|
109
|
+
/**
|
|
110
|
+
* Append a write to the serial queue. A failure is reported and swallowed so
|
|
111
|
+
* one broken update cannot wedge every later one.
|
|
112
|
+
*/
|
|
113
|
+
private enqueue;
|
|
114
|
+
private reportError;
|
|
115
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Emittery from "emittery";
|
|
2
|
+
import { LyricsStore } from "../../shared/types/lyrics";
|
|
3
|
+
export type LyricsDispatcherEvents = {
|
|
4
|
+
lyricsupdate: LyricsStore | null;
|
|
5
|
+
sloganupdate: string | null;
|
|
6
|
+
playstateupdate: boolean;
|
|
7
|
+
timeupdate: number;
|
|
8
|
+
playbackratechange: number;
|
|
9
|
+
};
|
|
10
|
+
export default class LyricsDispatcher extends Emittery<LyricsDispatcherEvents> {
|
|
11
|
+
private _lyrics;
|
|
12
|
+
private _slogan;
|
|
13
|
+
private _playState;
|
|
14
|
+
private _time;
|
|
15
|
+
private _playbackRate;
|
|
16
|
+
get lyrics(): LyricsStore | null;
|
|
17
|
+
set lyrics(value: LyricsStore | null);
|
|
18
|
+
get slogan(): string | null;
|
|
19
|
+
set slogan(value: string | null);
|
|
20
|
+
get playState(): boolean;
|
|
21
|
+
set playState(value: boolean);
|
|
22
|
+
get time(): number;
|
|
23
|
+
set time(value: number);
|
|
24
|
+
get playbackRate(): number;
|
|
25
|
+
set playbackRate(value: number);
|
|
26
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import DbusLyricsService from "./DbusLyricsService";
|
|
2
|
+
/** The well-known name that owns the app's custom D-Bus services. */
|
|
3
|
+
export declare const DBUS_LYRICS_BUS_NAME = "io.github.yucling.OpenOrpheus";
|
|
4
|
+
/** The object path of the lyrics service. */
|
|
5
|
+
export declare const DBUS_LYRICS_OBJECT_PATH = "/io/github/yucling/OpenOrpheus/Lyrics";
|
|
6
|
+
/** The lyrics D-Bus interface. */
|
|
7
|
+
export declare const DBUS_LYRICS_INTERFACE = "io.github.yucling.OpenOrpheus.Lyrics";
|
|
8
|
+
/**
|
|
9
|
+
* Start the D-Bus lyrics service.
|
|
10
|
+
*
|
|
11
|
+
* Linux only: `@open-orpheus/dbus` is a Linux native module. The listener
|
|
12
|
+
* wiring is event-driven, so an idle app does no periodic work. Failures are
|
|
13
|
+
* logged and reported as `null` rather than aborting startup — the rest of the
|
|
14
|
+
* app (and MPRIS) must keep working without a session bus.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createDbusLyricsService(): Promise<DbusLyricsService | null>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Lyrics } from "../../shared/types/lyrics";
|
|
2
|
+
/**
|
|
3
|
+
* Parse an LRC string into {@link Lyrics}.
|
|
4
|
+
*
|
|
5
|
+
* Each `[mm:ss.xx]` line becomes a {@link LyricsLine} with a single
|
|
6
|
+
* {@link LyricWord} spanning the entire line (plain LRC has no per-word
|
|
7
|
+
* timing). `end_time` is inferred from the next line's `start_time`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseLrc(lrc: string): Lyrics;
|
|
10
|
+
/**
|
|
11
|
+
* Parse a YRC (per-character lyrics) string into {@link Lyrics}.
|
|
12
|
+
*
|
|
13
|
+
* Format:
|
|
14
|
+
* `[line_start_ms, line_duration_ms](char_start_ms, char_duration_ms, flag)字...`
|
|
15
|
+
*
|
|
16
|
+
* Each line opens with a `[start, duration]` header (both in milliseconds)
|
|
17
|
+
* followed by zero or more per-character `(start, duration, flag)` tuples.
|
|
18
|
+
* The character itself immediately follows the closing parenthesis.
|
|
19
|
+
* `start_time` on each {@link LyricWord} is stored relative to its line.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseYrc(yrc: string): Lyrics;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import PlaybackController from "./playback/PlaybackController";
|
|
2
|
+
/**
|
|
3
|
+
* Track metadata passed through the frozen `player.setInfo` seam.
|
|
4
|
+
*
|
|
5
|
+
* Album art is deliberately not part of this seam: it is reported separately,
|
|
6
|
+
* per song, through `player.setCover` (see {@link mediaSession.setCover}).
|
|
7
|
+
*/
|
|
8
|
+
export interface Metadata {
|
|
9
|
+
id: string;
|
|
10
|
+
title: string;
|
|
11
|
+
artist: string;
|
|
12
|
+
album: string;
|
|
13
|
+
}
|
|
14
|
+
/** Unique play ID for current track play session. */
|
|
15
|
+
export declare let playId: string | null;
|
|
16
|
+
/** Single source of truth for playback state (see playback/PlaybackController). */
|
|
17
|
+
export declare const playbackController: PlaybackController;
|
|
18
|
+
export declare function createMediaSession(): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Release the platform media session (e.g. the MPRIS D-Bus name) at shutdown.
|
|
21
|
+
*
|
|
22
|
+
* The adapter is created by {@link createMediaSession}, so when loading it
|
|
23
|
+
* failed the no-op adapter is still in place and this does nothing.
|
|
24
|
+
*/
|
|
25
|
+
export declare function disposeMediaSession(): void;
|
|
26
|
+
export declare const mediaSession: {
|
|
27
|
+
/**
|
|
28
|
+
* Track metadata for the current song. The renderer calls this twice per song
|
|
29
|
+
* change — once before and once after `player.setCover` — so a cover attached
|
|
30
|
+
* by {@link setCover} must survive a same-id `setMetadata`. The cover is
|
|
31
|
+
* cleared only when a different playId arrives (one playId = one song).
|
|
32
|
+
*/
|
|
33
|
+
setMetadata(metadata: Metadata | null): void;
|
|
34
|
+
/**
|
|
35
|
+
* Album art for the current song (`player.setCover`). The raw URL is resolved
|
|
36
|
+
* into something the OS media sessions can consume (a remote URL passes
|
|
37
|
+
* through; an `orpheus://localmusic/pic?<path>` cover is extracted to a local
|
|
38
|
+
* `file://` file), then pushed to the adapters as an art-only update — it is
|
|
39
|
+
* not a track change.
|
|
40
|
+
*/
|
|
41
|
+
setCover(rawUrl: string | null): Promise<void>;
|
|
42
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { BrowserWindow } from "electron";
|
|
2
|
+
import Emittery from "emittery";
|
|
3
|
+
import type { AppMenuItem } from "../../shared/types/menu";
|
|
4
|
+
import type { ElementTemplate } from "../skin/dui";
|
|
5
|
+
export type AppMenuEvents = {
|
|
6
|
+
close: undefined;
|
|
7
|
+
};
|
|
8
|
+
type MenuClickHandler = (menuId: string | null) => void;
|
|
9
|
+
export default class AppMenu extends Emittery<AppMenuEvents> {
|
|
10
|
+
items: AppMenuItem[];
|
|
11
|
+
private onClick;
|
|
12
|
+
private closed;
|
|
13
|
+
private started;
|
|
14
|
+
private showPromise;
|
|
15
|
+
private readonly lifetimeAbort;
|
|
16
|
+
private backend;
|
|
17
|
+
private context;
|
|
18
|
+
private readonly parentCleanups;
|
|
19
|
+
private parentDismissTimer;
|
|
20
|
+
private parentTouchToken;
|
|
21
|
+
/** style path → parsed template, preloaded from skin pack */
|
|
22
|
+
templates: Record<string, ElementTemplate>;
|
|
23
|
+
constructor(items: AppMenuItem[]);
|
|
24
|
+
setClickHandler(handler: MenuClickHandler): void;
|
|
25
|
+
loadTemplates(): Promise<void>;
|
|
26
|
+
show(parentWindow?: BrowserWindow): Promise<void>;
|
|
27
|
+
private open;
|
|
28
|
+
private watchParent;
|
|
29
|
+
private scheduleParentDismiss;
|
|
30
|
+
private clearParentWatch;
|
|
31
|
+
private selectBackend;
|
|
32
|
+
close(): void;
|
|
33
|
+
update(patchItems: AppMenuItem[]): void;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BrowserWindow } from "electron";
|
|
2
|
+
export interface AnchorSelection {
|
|
3
|
+
window: BrowserWindow;
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Resolve the popup parent and anchor from native state.
|
|
9
|
+
*
|
|
10
|
+
* The latest press must belong to the activated window. Mouse presses also
|
|
11
|
+
* require the pointer to remain inside it; touch presses expire after a while.
|
|
12
|
+
*/
|
|
13
|
+
export declare function selectAnchorCandidate(): AnchorSelection | null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { MenuUpdate } from "../../../shared/types/menu-surface";
|
|
2
|
+
import type { MenuBackend, MenuBackendContext } from "./MenuBackend";
|
|
3
|
+
/** Desktop window host for X11, Windows and macOS. */
|
|
4
|
+
export declare class DesktopWindowBackend implements MenuBackend {
|
|
5
|
+
private readonly context;
|
|
6
|
+
private readonly path;
|
|
7
|
+
private readonly positions;
|
|
8
|
+
private readonly childGenerations;
|
|
9
|
+
private readonly surfaceItems;
|
|
10
|
+
private readonly openingChildren;
|
|
11
|
+
private lastChildCloseAt;
|
|
12
|
+
private readonly pool;
|
|
13
|
+
private closed;
|
|
14
|
+
private pendingRoot;
|
|
15
|
+
private blurTimer;
|
|
16
|
+
constructor(context: MenuBackendContext);
|
|
17
|
+
open(): Promise<void>;
|
|
18
|
+
isFocused(): boolean;
|
|
19
|
+
hasChildren(): boolean;
|
|
20
|
+
update(update: MenuUpdate): void;
|
|
21
|
+
close(): Promise<void>;
|
|
22
|
+
private createSurface;
|
|
23
|
+
private openChild;
|
|
24
|
+
private constrainPosition;
|
|
25
|
+
private scheduleBlurClose;
|
|
26
|
+
private cursorOverMenu;
|
|
27
|
+
private closeChildren;
|
|
28
|
+
private configFor;
|
|
29
|
+
private cursorPoint;
|
|
30
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { BrowserWindow } from "electron";
|
|
2
|
+
import type { ElementTemplate } from "../../../shared/types/dui";
|
|
3
|
+
import type { AppMenuItem, MenuSkin } from "../../../shared/types/menu";
|
|
4
|
+
import type { MenuAnchor, MenuUpdate } from "../../../shared/types/menu-surface";
|
|
5
|
+
export interface MenuBackendContext {
|
|
6
|
+
readonly items: AppMenuItem[];
|
|
7
|
+
readonly templates: Record<string, ElementTemplate>;
|
|
8
|
+
readonly colors: MenuSkin;
|
|
9
|
+
readonly parentWindow?: BrowserWindow;
|
|
10
|
+
readonly shadowInset: number;
|
|
11
|
+
readonly anchor: (MenuAnchor & {
|
|
12
|
+
surfaceId?: string;
|
|
13
|
+
}) | null;
|
|
14
|
+
onItemClick(menuId: string | null): void;
|
|
15
|
+
onButtonClick(btnId: string): void;
|
|
16
|
+
onClose(): void;
|
|
17
|
+
}
|
|
18
|
+
export interface MenuBackend {
|
|
19
|
+
open(): Promise<void>;
|
|
20
|
+
update(update: MenuUpdate): void;
|
|
21
|
+
isFocused(): boolean;
|
|
22
|
+
hasChildren(): boolean;
|
|
23
|
+
close(): void | Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export declare class NoPopupAnchorError extends Error {
|
|
26
|
+
readonly reason: string;
|
|
27
|
+
constructor(reason?: string);
|
|
28
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MenuBackend, MenuBackendContext } from "./MenuBackend";
|
|
2
|
+
/** Fullscreen Wayland overlay; the renderer owns the panel path. */
|
|
3
|
+
export declare class WaylandOverlayBackend implements MenuBackend {
|
|
4
|
+
private readonly context;
|
|
5
|
+
private surface;
|
|
6
|
+
private closed;
|
|
7
|
+
constructor(context: MenuBackendContext);
|
|
8
|
+
open(): Promise<void>;
|
|
9
|
+
isFocused(): boolean;
|
|
10
|
+
hasChildren(): boolean;
|
|
11
|
+
update(update: Parameters<NonNullable<MenuBackend["update"]>>[0]): void;
|
|
12
|
+
close(): void;
|
|
13
|
+
private configFor;
|
|
14
|
+
private captureCursor;
|
|
15
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { MenuUpdate } from "../../../shared/types/menu-surface";
|
|
2
|
+
import { type MenuBackend, type MenuBackendContext } from "./MenuBackend";
|
|
3
|
+
/**
|
|
4
|
+
* Native Wayland popup host. The backend owns the surface path; the renderer
|
|
5
|
+
* never sees it.
|
|
6
|
+
*/
|
|
7
|
+
export declare class WaylandPopupBackend implements MenuBackend {
|
|
8
|
+
private readonly context;
|
|
9
|
+
private readonly path;
|
|
10
|
+
private readonly pool;
|
|
11
|
+
private readonly childGenerations;
|
|
12
|
+
private readonly surfaceItems;
|
|
13
|
+
private readonly openingChildren;
|
|
14
|
+
private lastChildCloseAt;
|
|
15
|
+
private closed;
|
|
16
|
+
private pendingRoot;
|
|
17
|
+
private blurTimer;
|
|
18
|
+
constructor(context: MenuBackendContext);
|
|
19
|
+
open(): Promise<void>;
|
|
20
|
+
isFocused(): boolean;
|
|
21
|
+
hasChildren(): boolean;
|
|
22
|
+
update(update: MenuUpdate): void;
|
|
23
|
+
close(): Promise<void>;
|
|
24
|
+
private createSurface;
|
|
25
|
+
private openChild;
|
|
26
|
+
private scheduleBlurClose;
|
|
27
|
+
private cursorOverMenu;
|
|
28
|
+
private closeChildren;
|
|
29
|
+
private configFor;
|
|
30
|
+
private parentWindowId;
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Root surface renderer-ready and measurement bound. */
|
|
2
|
+
export declare const SURFACE_READY_TIMEOUT_MS = 10000;
|
|
3
|
+
/** openChild waits for the child to be visible, not merely created. */
|
|
4
|
+
export declare const CHILD_OPEN_TIMEOUT_MS = 2000;
|
|
5
|
+
/** Parent-window blur dismissal delay. */
|
|
6
|
+
export declare const PARENT_BLUR_DISMISS_MS = 50;
|
|
7
|
+
/** Popup/submenu surface blur dismissal delay. */
|
|
8
|
+
export declare const SURFACE_BLUR_DISMISS_MS = 100;
|
|
9
|
+
/** Cursor capture bound. */
|
|
10
|
+
export declare const DEFAULT_CURSOR_CAPTURE_TIMEOUT_MS = 100;
|
|
11
|
+
/** Touch presses stop anchoring after this age. */
|
|
12
|
+
export declare const TOUCH_ANCHOR_MAX_AGE_MS = 1000;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type PopupPolicyResult = {
|
|
2
|
+
ok: true;
|
|
3
|
+
} | {
|
|
4
|
+
ok: false;
|
|
5
|
+
reason: "no-hooks" | "not-wayland" | "invalid-size" | "invalid-inset" | "invalid-anchor" | "policy-refused";
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Register a popup policy for a menu surface.
|
|
9
|
+
*
|
|
10
|
+
* The target window is named by its decorated title. Failures are typed so the
|
|
11
|
+
* caller can use the overlay.
|
|
12
|
+
*/
|
|
13
|
+
export declare function registerNativeWaylandPopup(parentWindowId: string, targetWindowId: string, width: number, height: number, anchor: {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
} | undefined, shadowInset: number, anchorRectWidth?: number): PopupPolicyResult;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { WebContentsView } from "electron";
|
|
2
|
+
import type { MenuChildOpenRequest } from "../../../shared/types/menu-surface";
|
|
3
|
+
import type { MenuMeasurement, MenuSurfaceConfig, MenuSurfaceId, MenuUpdate } from "../../../shared/types/menu-surface";
|
|
4
|
+
import type { MenuSurface } from "./MenuSurface";
|
|
5
|
+
export interface WindowSurfaceOptions {
|
|
6
|
+
route?: string;
|
|
7
|
+
fullscreen?: boolean;
|
|
8
|
+
maximize?: boolean;
|
|
9
|
+
/** False for the overlay: it renders its own panels and reports no size. */
|
|
10
|
+
measure?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface MenuSurfaceHandlers {
|
|
13
|
+
onItemClick(menuId: string | null): void;
|
|
14
|
+
onButtonClick(btnId: string): void;
|
|
15
|
+
onClose(): void;
|
|
16
|
+
onOpenChild(request: MenuChildOpenRequest): void | Promise<void>;
|
|
17
|
+
onCloseChildren(parentId: MenuSurfaceId): void;
|
|
18
|
+
onBlur?(surfaceId: MenuSurfaceId): void;
|
|
19
|
+
onMeasurement?(surfaceId: MenuSurfaceId, measurement: MenuMeasurement): void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* One BaseWindow + WebContentsView menu surface.
|
|
23
|
+
*
|
|
24
|
+
* The view is created immediately and loaded while warm; the BaseWindow is
|
|
25
|
+
* created only in `present()` after the renderer reports its measured size.
|
|
26
|
+
*/
|
|
27
|
+
export declare class BaseWindowMenuSurface implements MenuSurface {
|
|
28
|
+
private readonly handlers;
|
|
29
|
+
readonly id: MenuSurfaceId;
|
|
30
|
+
readonly view: WebContentsView;
|
|
31
|
+
private readonly host;
|
|
32
|
+
private window;
|
|
33
|
+
private pendingInputRegions;
|
|
34
|
+
private measurement;
|
|
35
|
+
private requestId;
|
|
36
|
+
private prepared;
|
|
37
|
+
private presentation;
|
|
38
|
+
private backgroundColor;
|
|
39
|
+
private visibleRequest;
|
|
40
|
+
private measurementRequest;
|
|
41
|
+
private rendererReady;
|
|
42
|
+
private closed;
|
|
43
|
+
private blurArmed;
|
|
44
|
+
private readonly options;
|
|
45
|
+
constructor(handlers: MenuSurfaceHandlers, options?: WindowSurfaceOptions);
|
|
46
|
+
private registerIpc;
|
|
47
|
+
prepare(config: MenuSurfaceConfig, timeoutMs?: number): Promise<MenuMeasurement>;
|
|
48
|
+
private applyInputRegions;
|
|
49
|
+
private applyMeasurement;
|
|
50
|
+
present(): void;
|
|
51
|
+
sendCursor(position: {
|
|
52
|
+
x: number;
|
|
53
|
+
y: number;
|
|
54
|
+
fallback?: boolean;
|
|
55
|
+
}): void;
|
|
56
|
+
isFocused(): boolean;
|
|
57
|
+
focus(): void;
|
|
58
|
+
getBounds(): {
|
|
59
|
+
x: number;
|
|
60
|
+
y: number;
|
|
61
|
+
width: number;
|
|
62
|
+
height: number;
|
|
63
|
+
} | null;
|
|
64
|
+
setPosition(x: number, y: number): void;
|
|
65
|
+
show(timeoutMs?: number): Promise<void>;
|
|
66
|
+
update(update: MenuUpdate): void;
|
|
67
|
+
close(): void;
|
|
68
|
+
private get presented();
|
|
69
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { MenuMeasurement, MenuSurfaceConfig, MenuSurfaceId, MenuUpdate } from "../../../shared/types/menu-surface";
|
|
2
|
+
/**
|
|
3
|
+
* One menu surface. The implementation owns the `WebContentsView` and the
|
|
4
|
+
* `BaseWindow`; the open path is external.
|
|
5
|
+
*/
|
|
6
|
+
export interface MenuSurface {
|
|
7
|
+
readonly id: MenuSurfaceId;
|
|
8
|
+
/** Reset internal state and apply the presentation config; returns the measured size. */
|
|
9
|
+
prepare(config: MenuSurfaceConfig, timeoutMs?: number): Promise<MenuMeasurement>;
|
|
10
|
+
present(): void;
|
|
11
|
+
/** Resolves when the renderer acknowledges visible. */
|
|
12
|
+
show(timeoutMs?: number): Promise<void>;
|
|
13
|
+
isFocused(): boolean;
|
|
14
|
+
focus(): void;
|
|
15
|
+
setPosition(x: number, y: number): void;
|
|
16
|
+
getBounds(): {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
} | null;
|
|
22
|
+
update(update: MenuUpdate): void;
|
|
23
|
+
/** Idempotent; destroys the window and releases view ownership. */
|
|
24
|
+
close(): void;
|
|
25
|
+
}
|
|
26
|
+
export interface SurfaceFactory {
|
|
27
|
+
/** Create a bare, loaded, mode-agnostic surface. No menu config applied yet. */
|
|
28
|
+
create(): Promise<MenuSurface>;
|
|
29
|
+
}
|