@open-orpheus/plugin-api 0.0.0-stage → 0.21.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/LICENSE +7 -0
- package/README.md +191 -2
- package/dist/client/index.d.ts +37 -0
- package/dist/client/index.js +53 -0
- package/dist/client/index.js.map +1 -0
- package/dist/configuration/host/src/shared/plugin/configuration/index.d.ts +21 -0
- package/dist/configuration/index.d.ts +5 -0
- package/dist/host/_native/open-orpheus__database.d.ts +50 -0
- package/dist/host/_native/open-orpheus__window.d.ts +284 -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/assets.d.ts +2 -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/ipc-main-bridge.d.ts +24 -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/bridge/window.d.ts +7 -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 +127 -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/WaylandLayerShellBackend.d.ts +35 -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 +14 -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 +81 -0
- package/dist/host/src/main/menu/surface/CaptureLayerSurface.d.ts +22 -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 +12 -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 +59 -0
- package/dist/host/src/main/plugin/assets.d.ts +8 -0
- package/dist/host/src/main/plugin/catalog.d.ts +42 -0
- package/dist/host/src/main/plugin/discover.d.ts +33 -0
- package/dist/host/src/main/plugin/index.d.ts +15 -0
- package/dist/host/src/main/plugin/loader.d.ts +90 -0
- package/dist/host/src/main/plugin/manager.d.ts +61 -0
- package/dist/host/src/main/plugin/metadata.d.ts +34 -0
- package/dist/host/src/main/plugin/state.d.ts +27 -0
- package/dist/host/src/main/plugin/tree.d.ts +13 -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 +21 -0
- package/dist/host/src/main/shortcuts.d.ts +10 -0
- package/dist/host/src/main/shutdown.d.ts +50 -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/color.d.ts +7 -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 +316 -0
- package/dist/host/src/main/windows/color-picker.d.ts +3 -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-events.d.ts +7 -0
- package/dist/host/src/main/windows/plugin-manager.d.ts +5 -0
- package/dist/host/src/main/xeapi.d.ts +48 -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 +229 -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/bridge/constants.d.ts +2 -0
- package/dist/host/src/shared/bridge/endpoint.d.ts +29 -0
- package/dist/host/src/shared/bridge/hub.d.ts +136 -0
- package/dist/host/src/shared/bridge/protocol.d.ts +91 -0
- package/dist/host/src/shared/bridge/realm.d.ts +14 -0
- package/dist/host/src/shared/bridge/routes.d.ts +37 -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/color-picker-api.d.ts +17 -0
- package/dist/host/src/shared/contracts/desktop-lyrics-api.d.ts +22 -0
- package/dist/host/src/shared/contracts/input-region-api.d.ts +5 -0
- package/dist/host/src/shared/contracts/lyrics-api.d.ts +11 -0
- package/dist/host/src/shared/contracts/manage-api.d.ts +31 -0
- package/dist/host/src/shared/contracts/menu-surface-api.d.ts +35 -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 +223 -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/cache-bust.d.ts +8 -0
- package/dist/host/src/shared/plugin/lifecycle.d.ts +217 -0
- package/dist/host/src/shared/plugin/realms/main/index.d.ts +18 -0
- package/dist/host/src/shared/plugin/registry.d.ts +69 -0
- package/dist/host/src/shared/plugin/runtime-state.d.ts +4 -0
- package/dist/host/src/shared/settings/defaults.d.ts +35 -0
- package/dist/host/src/shared/settings/index.d.ts +3 -0
- package/dist/host/src/shared/settings/keys.d.ts +21 -0
- package/dist/host/src/shared/settings/values.d.ts +13 -0
- package/dist/host/src/shared/types/desktop-lyrics.d.ts +61 -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 +97 -0
- package/dist/host/src/shared/types/ncae.d.ts +29 -0
- package/dist/host/src/shared/types/package-download.d.ts +14 -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/plugin-manager/host/src/preload/logger.d.ts +10 -0
- package/dist/plugin-manager/host/src/preload/util.d.ts +1 -0
- package/dist/plugin-manager/host/src/shared/bridge/constants.d.ts +2 -0
- package/dist/plugin-manager/host/src/shared/bridge/endpoint.d.ts +29 -0
- package/dist/plugin-manager/host/src/shared/bridge/hub.d.ts +136 -0
- package/dist/plugin-manager/host/src/shared/bridge/protocol.d.ts +91 -0
- package/dist/plugin-manager/host/src/shared/bridge/routes.d.ts +37 -0
- package/dist/plugin-manager/host/src/shared/contracts/plugin-manager-api.d.ts +223 -0
- package/dist/plugin-manager/host/src/shared/plugin/lifecycle.d.ts +217 -0
- package/dist/plugin-manager/host/src/shared/plugin/realms/common/index.d.ts +34 -0
- package/dist/plugin-manager/host/src/shared/plugin/realms/plugin-manager/index.d.ts +11 -0
- package/dist/plugin-manager/host/src/shared/plugin/registry.d.ts +69 -0
- package/dist/plugin-manager/host/src/shared/util.d.ts +22 -0
- package/dist/plugin-manager/index.d.ts +7 -0
- package/dist/plugin-manager/registry-map.d.ts +16 -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 +229 -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/logger.d.ts +10 -0
- package/dist/preload/host/src/preload/playbackMode.d.ts +13 -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/bridge/endpoint.d.ts +29 -0
- package/dist/preload/host/src/shared/bridge/hub.d.ts +136 -0
- package/dist/preload/host/src/shared/bridge/protocol.d.ts +91 -0
- package/dist/preload/host/src/shared/bridge/routes.d.ts +37 -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/contracts/plugin-manager-api.d.ts +223 -0
- package/dist/preload/host/src/shared/playbackMode.d.ts +2 -0
- package/dist/preload/host/src/shared/plugin/lifecycle.d.ts +217 -0
- package/dist/preload/host/src/shared/plugin/realms/common/index.d.ts +34 -0
- package/dist/preload/host/src/shared/plugin/realms/preload/index.d.ts +11 -0
- package/dist/preload/host/src/shared/plugin/registry.d.ts +69 -0
- package/dist/preload/host/src/shared/types/ncae.d.ts +29 -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 +43 -0
- package/dist/registry-map.d.ts +164 -0
- package/package.json +73 -3
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import PlaybackController from "./playback/PlaybackController.js";
|
|
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.js";
|
|
4
|
+
import type { ElementTemplate } from "../skin/dui.js";
|
|
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 backendCandidates;
|
|
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.js";
|
|
2
|
+
import type { MenuBackend, MenuBackendContext } from "./MenuBackend.js";
|
|
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.js";
|
|
3
|
+
import type { AppMenuItem, MenuSkin } from "../../../shared/types/menu.js";
|
|
4
|
+
import type { MenuAnchor, MenuUpdate } from "../../../shared/types/menu-surface.js";
|
|
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,35 @@
|
|
|
1
|
+
import type { MenuUpdate } from "../../../shared/types/menu-surface.js";
|
|
2
|
+
import type { MenuBackend, MenuBackendContext } from "./MenuBackend.js";
|
|
3
|
+
/**
|
|
4
|
+
* Menu host for compositors with `zwlr_layer_shell_v1`.
|
|
5
|
+
*
|
|
6
|
+
* The cursor position comes from a short-lived transparent layer capture
|
|
7
|
+
* window. The menu itself is an ordinary layer surface created at its final
|
|
8
|
+
* bounds, and submenus are xdg_popups of it.
|
|
9
|
+
*/
|
|
10
|
+
export declare class WaylandLayerShellBackend implements MenuBackend {
|
|
11
|
+
private readonly context;
|
|
12
|
+
private readonly path;
|
|
13
|
+
private readonly pool;
|
|
14
|
+
private readonly childGenerations;
|
|
15
|
+
private readonly surfaceItems;
|
|
16
|
+
private readonly openingChildren;
|
|
17
|
+
private closed;
|
|
18
|
+
private pendingRoot;
|
|
19
|
+
private root;
|
|
20
|
+
private captureSurface;
|
|
21
|
+
private focusLossPending;
|
|
22
|
+
constructor(context: MenuBackendContext);
|
|
23
|
+
open(): Promise<void>;
|
|
24
|
+
isFocused(): boolean;
|
|
25
|
+
hasChildren(): boolean;
|
|
26
|
+
update(update: MenuUpdate): void;
|
|
27
|
+
close(): Promise<void>;
|
|
28
|
+
private createSurface;
|
|
29
|
+
/** Convert the capture result and measured size into layer-surface options. */
|
|
30
|
+
private layerOptions;
|
|
31
|
+
private openChild;
|
|
32
|
+
private closeChildren;
|
|
33
|
+
private handleFocusLoss;
|
|
34
|
+
private configFor;
|
|
35
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MenuBackend, MenuBackendContext } from "./MenuBackend.js";
|
|
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.js";
|
|
2
|
+
import { type MenuBackend, type MenuBackendContext } from "./MenuBackend.js";
|
|
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,14 @@
|
|
|
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
|
+
/** The proxy's capture surface has to map and configure before the pointer arrives. */
|
|
12
|
+
export declare const LAYER_CAPTURE_TIMEOUT_MS = 300;
|
|
13
|
+
/** Touch presses stop anchoring after this age. */
|
|
14
|
+
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,81 @@
|
|
|
1
|
+
import { WebContentsView } from "electron";
|
|
2
|
+
import type { LayerShellOptions } from "../../../../_native/open-orpheus__window.js";
|
|
3
|
+
import type { MenuChildOpenRequest } from "../../../shared/types/menu-surface.js";
|
|
4
|
+
import type { MenuMeasurement, MenuSurfaceConfig, MenuSurfaceId, MenuUpdate } from "../../../shared/types/menu-surface.js";
|
|
5
|
+
import type { MenuSurface } from "./MenuSurface.js";
|
|
6
|
+
export interface WindowSurfaceOptions {
|
|
7
|
+
route?: string;
|
|
8
|
+
fullscreen?: boolean;
|
|
9
|
+
maximize?: boolean;
|
|
10
|
+
/** False for the overlay: it renders its own panels and reports no size. */
|
|
11
|
+
measure?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface MenuSurfaceHandlers {
|
|
14
|
+
onItemClick(menuId: string | null): void;
|
|
15
|
+
onButtonClick(btnId: string): void;
|
|
16
|
+
onClose(): void;
|
|
17
|
+
onOpenChild(request: MenuChildOpenRequest): void | Promise<void>;
|
|
18
|
+
onCloseChildren(parentId: MenuSurfaceId): void;
|
|
19
|
+
onBlur?(surfaceId: MenuSurfaceId): void;
|
|
20
|
+
onFocus?(surfaceId: MenuSurfaceId): void;
|
|
21
|
+
onMeasurement?(surfaceId: MenuSurfaceId, measurement: MenuMeasurement): void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* One BaseWindow + WebContentsView menu surface.
|
|
25
|
+
*
|
|
26
|
+
* The view is created immediately and loaded while warm; the BaseWindow is
|
|
27
|
+
* created only in `present()` after the renderer reports its measured size.
|
|
28
|
+
*/
|
|
29
|
+
export declare class BaseWindowMenuSurface implements MenuSurface {
|
|
30
|
+
private readonly handlers;
|
|
31
|
+
readonly id: MenuSurfaceId;
|
|
32
|
+
readonly view: WebContentsView;
|
|
33
|
+
private readonly host;
|
|
34
|
+
private window;
|
|
35
|
+
private layerShellOptions;
|
|
36
|
+
private appliedLayerSize;
|
|
37
|
+
private pendingInputRegions;
|
|
38
|
+
private measurement;
|
|
39
|
+
private requestId;
|
|
40
|
+
private prepared;
|
|
41
|
+
private presentation;
|
|
42
|
+
private backgroundColor;
|
|
43
|
+
private visibleRequest;
|
|
44
|
+
private measurementRequest;
|
|
45
|
+
private rendererReady;
|
|
46
|
+
private closed;
|
|
47
|
+
private blurArmed;
|
|
48
|
+
private readonly options;
|
|
49
|
+
private mount;
|
|
50
|
+
constructor(handlers: MenuSurfaceHandlers, options?: WindowSurfaceOptions);
|
|
51
|
+
private registerIpc;
|
|
52
|
+
prepare(config: MenuSurfaceConfig, timeoutMs?: number): Promise<MenuMeasurement>;
|
|
53
|
+
private applyInputRegions;
|
|
54
|
+
private applyMeasurement;
|
|
55
|
+
/**
|
|
56
|
+
* Create this surface as a layer surface.
|
|
57
|
+
*
|
|
58
|
+
* Must be called before `present()`: the policy has to be registered before
|
|
59
|
+
* the window (and therefore its first role object) exists.
|
|
60
|
+
*/
|
|
61
|
+
setLayerShell(options: LayerShellOptions): void;
|
|
62
|
+
present(): void;
|
|
63
|
+
sendCursor(position: {
|
|
64
|
+
x: number;
|
|
65
|
+
y: number;
|
|
66
|
+
fallback?: boolean;
|
|
67
|
+
}): void;
|
|
68
|
+
isFocused(): boolean;
|
|
69
|
+
focus(): void;
|
|
70
|
+
getBounds(): {
|
|
71
|
+
x: number;
|
|
72
|
+
y: number;
|
|
73
|
+
width: number;
|
|
74
|
+
height: number;
|
|
75
|
+
} | null;
|
|
76
|
+
setPosition(x: number, y: number): void;
|
|
77
|
+
show(timeoutMs?: number): Promise<void>;
|
|
78
|
+
update(update: MenuUpdate): void;
|
|
79
|
+
close(): void;
|
|
80
|
+
private get presented();
|
|
81
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface LayerCaptureResult {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
displayId: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* A transparent fullscreen layer window whose only job is to receive the
|
|
8
|
+
* pointer enter Wayland will not report without a surface.
|
|
9
|
+
*
|
|
10
|
+
* The compositor chooses the output because the policy omits `output`; the
|
|
11
|
+
* proxy reports which output the surface entered, so placement can use that
|
|
12
|
+
* display's bounds without guessing from the global cursor.
|
|
13
|
+
*/
|
|
14
|
+
export declare class CaptureLayerSurface {
|
|
15
|
+
private readonly host;
|
|
16
|
+
private closed;
|
|
17
|
+
private released;
|
|
18
|
+
constructor();
|
|
19
|
+
capture(timeoutMs?: number): Promise<LayerCaptureResult>;
|
|
20
|
+
close(): void;
|
|
21
|
+
private waitForDisplayId;
|
|
22
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { MenuMeasurement, MenuSurfaceConfig, MenuSurfaceId, MenuUpdate } from "../../../shared/types/menu-surface.js";
|
|
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
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { MenuSurface } from "./MenuSurface.js";
|
|
2
|
+
import type { MenuSurfaceId } from "../../../shared/types/menu-surface.js";
|
|
3
|
+
/**
|
|
4
|
+
* The open menu surfaces, root -> leaf. Only one branch is ever open.
|
|
5
|
+
*
|
|
6
|
+
* This is separate from the menu item data tree.
|
|
7
|
+
*/
|
|
8
|
+
export declare class MenuSurfacePath {
|
|
9
|
+
private readonly entries;
|
|
10
|
+
get surfaces(): readonly MenuSurface[];
|
|
11
|
+
get leaf(): MenuSurface | null;
|
|
12
|
+
get size(): number;
|
|
13
|
+
get(id: MenuSurfaceId): MenuSurface | undefined;
|
|
14
|
+
depthOf(id: MenuSurfaceId): number;
|
|
15
|
+
parentOf(id: MenuSurfaceId): MenuSurface | undefined;
|
|
16
|
+
openRoot(surface: MenuSurface): void;
|
|
17
|
+
/**
|
|
18
|
+
* Append a child for `parentId`. Everything after the parent is truncated
|
|
19
|
+
* first, so opening a sibling replaces the previous child path.
|
|
20
|
+
*/
|
|
21
|
+
openChild(parentId: MenuSurfaceId, surface: MenuSurface): void;
|
|
22
|
+
/**
|
|
23
|
+
* Remove `id` and every descendant. Returns removed surfaces leaf-first so
|
|
24
|
+
* callers can close them in teardown order.
|
|
25
|
+
*/
|
|
26
|
+
closeFrom(id: MenuSurfaceId): MenuSurface[];
|
|
27
|
+
/** Remove everything, leaf-first. */
|
|
28
|
+
closeAll(): MenuSurface[];
|
|
29
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MenuSurface, SurfaceFactory } from "./MenuSurface.js";
|
|
2
|
+
export declare class SurfacePool {
|
|
3
|
+
private readonly factory;
|
|
4
|
+
private readonly onError;
|
|
5
|
+
private idle;
|
|
6
|
+
private pending;
|
|
7
|
+
private lock;
|
|
8
|
+
private closed;
|
|
9
|
+
constructor(factory: SurfaceFactory, onError?: (error: unknown) => void);
|
|
10
|
+
acquire(): Promise<MenuSurface>;
|
|
11
|
+
get idleCount(): number;
|
|
12
|
+
close(): Promise<void>;
|
|
13
|
+
private refill;
|
|
14
|
+
private withLock;
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare let workaroundFlags: number;
|
|
2
|
+
export declare function workaroundEnabled(workaround: WorkaroundFlags): boolean;
|
|
3
|
+
export declare const WorkaroundFlags: {
|
|
4
|
+
readonly OverlayNoFullscreen: 1;
|
|
5
|
+
readonly OverlayNoMaximize: 2;
|
|
6
|
+
readonly [x: number]: string;
|
|
7
|
+
};
|
|
8
|
+
export type WorkaroundFlags = 1 | 2;
|
|
9
|
+
export declare namespace WorkaroundFlags {
|
|
10
|
+
type OverlayNoFullscreen = 1;
|
|
11
|
+
type OverlayNoMaximize = 2;
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Ncae } from "../shared/types/ncae.js";
|
|
2
|
+
/**
|
|
3
|
+
* Decode a complete NCAE buffer.
|
|
4
|
+
*
|
|
5
|
+
* @returns An {@link Ncae} whose `payload` is a JSON **string** for
|
|
6
|
+
* type-1 files or a `Buffer` of RIFF/WAVE data for type-2 files.
|
|
7
|
+
*/
|
|
8
|
+
export declare function decodeNcae(buf: Buffer): Promise<Ncae>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { InterceptorState, NetworkFetchRequest, NetworkFetchResponse } from "./types.js";
|
|
2
|
+
export declare const DEFAULT_RETRY_COUNT = 1;
|
|
3
|
+
export declare function executeNetworkRequest(request: NetworkFetchRequest, state: InterceptorState): Promise<Partial<NetworkFetchResponse>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InterceptorState, NetworkExecutor, NetworkInterceptor, NetworkFetchRequest, NetworkFetchResponse } from "./types.js";
|
|
2
|
+
export declare class NetworkInterceptorPipeline {
|
|
3
|
+
private interceptors;
|
|
4
|
+
use(interceptor: NetworkInterceptor): this;
|
|
5
|
+
unuse(name: string): this;
|
|
6
|
+
list(): ReadonlyArray<NetworkInterceptor>;
|
|
7
|
+
run(request: NetworkFetchRequest, state: InterceptorState, executor: NetworkExecutor): Promise<NetworkFetchResponse>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export interface NetworkFetchRequest {
|
|
2
|
+
url: string;
|
|
3
|
+
method: string;
|
|
4
|
+
headers?: Record<string, string>;
|
|
5
|
+
body?: string | Buffer;
|
|
6
|
+
isDecrypt?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* How many retries the network client may perform after the first attempt.
|
|
9
|
+
* `0` disables retries; omit it to use the default.
|
|
10
|
+
*
|
|
11
|
+
* The client only retries idempotent methods (GET, HEAD, …): `POST` requests
|
|
12
|
+
* are never retried, so this field has no effect on them.
|
|
13
|
+
*/
|
|
14
|
+
retryCount?: number;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
export interface NetworkFetchResponse {
|
|
18
|
+
code: number;
|
|
19
|
+
error: string;
|
|
20
|
+
blob: string;
|
|
21
|
+
headers: Record<string, string>;
|
|
22
|
+
status: number;
|
|
23
|
+
retryTimes: number;
|
|
24
|
+
globalSucCount: number;
|
|
25
|
+
globalFailCount: number;
|
|
26
|
+
}
|
|
27
|
+
export interface GlobalStats {
|
|
28
|
+
globalSucCount: number;
|
|
29
|
+
globalFailCount: number;
|
|
30
|
+
}
|
|
31
|
+
export interface InterceptorState {
|
|
32
|
+
stats: GlobalStats;
|
|
33
|
+
tags: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
export interface RequestContext {
|
|
36
|
+
request: NetworkFetchRequest;
|
|
37
|
+
state: InterceptorState;
|
|
38
|
+
/**
|
|
39
|
+
* Perform the request now, bypassing the rest of the request pipeline.
|
|
40
|
+
*
|
|
41
|
+
* The pipeline reuses the most recent execution as its response instead of
|
|
42
|
+
* running the request a second time, unless a `respondWith` response is set
|
|
43
|
+
* (a later `respondWith` overrides it). Only the last call is reused; earlier
|
|
44
|
+
* executions are not cancelled.
|
|
45
|
+
*
|
|
46
|
+
* Catching a rejection here does not make the request succeed: the pipeline
|
|
47
|
+
* still fails unless `respondWith` provides a fallback response.
|
|
48
|
+
*/
|
|
49
|
+
execute(this: void, req?: NetworkFetchRequest): Promise<Partial<NetworkFetchResponse>>;
|
|
50
|
+
/** Respond with a synthetic response; the pipeline stops running further interceptors. */
|
|
51
|
+
respondWith(this: void, response: Partial<NetworkFetchResponse>): void;
|
|
52
|
+
}
|
|
53
|
+
export interface ResponseContext {
|
|
54
|
+
request: NetworkFetchRequest;
|
|
55
|
+
state: InterceptorState;
|
|
56
|
+
response: NetworkFetchResponse;
|
|
57
|
+
synthetic: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface ErrorContext {
|
|
60
|
+
request: NetworkFetchRequest;
|
|
61
|
+
state: InterceptorState;
|
|
62
|
+
error: unknown;
|
|
63
|
+
}
|
|
64
|
+
export interface NetworkInterceptor {
|
|
65
|
+
name: string;
|
|
66
|
+
onRequest?(ctx: RequestContext): Promise<void> | void;
|
|
67
|
+
onResponse?(ctx: ResponseContext): Promise<void> | void;
|
|
68
|
+
onError?(ctx: ErrorContext): Promise<void> | void;
|
|
69
|
+
}
|
|
70
|
+
export type NetworkExecutor = (request: NetworkFetchRequest, state: InterceptorState) => Promise<Partial<NetworkFetchResponse>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Protocol } from "electron";
|
|
2
|
+
type SimpleResponse = {
|
|
3
|
+
status?: number;
|
|
4
|
+
content: BodyInit;
|
|
5
|
+
contentType?: string;
|
|
6
|
+
cacheable?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function loadFromOrpheusUrl(url: string): Promise<SimpleResponse>;
|
|
9
|
+
export default function registerOrpheusScheme(protocol: Protocol): void;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import Emittery from "emittery";
|
|
2
|
+
import type Pack from "./packs/Pack.js";
|
|
3
|
+
export declare const NO_WEBPACK_ERROR_MESSAGE = "No usable web pack file found";
|
|
4
|
+
export type DownloadPackageProgress = {
|
|
5
|
+
step: "downloading" | "extracting" | "saving" | "completed";
|
|
6
|
+
downloadedBytes?: number;
|
|
7
|
+
totalBytes?: number;
|
|
8
|
+
progress?: number;
|
|
9
|
+
file?: string;
|
|
10
|
+
fileIndex?: number;
|
|
11
|
+
fileCount?: number;
|
|
12
|
+
};
|
|
13
|
+
export type PackManagerEvents = Record<`${string}packloaded`, {
|
|
14
|
+
name: string;
|
|
15
|
+
pack: Pack;
|
|
16
|
+
file?: string;
|
|
17
|
+
}>;
|
|
18
|
+
export declare class PackManager extends Emittery<PackManagerEvents> {
|
|
19
|
+
readonly packs: Map<string, Pack>;
|
|
20
|
+
loadWebPack(): Promise<void>;
|
|
21
|
+
loadSkinPack(name: string, name2: string): Promise<void>;
|
|
22
|
+
getPack<T extends Pack>(pack: string): T;
|
|
23
|
+
getOrWaitPack<T extends Pack>(pack: string, signal?: AbortSignal): Promise<T>;
|
|
24
|
+
downloadPackage(onProgress?: (progress: DownloadPackageProgress) => void, signal?: AbortSignal): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
declare const packManager: PackManager;
|
|
27
|
+
export default packManager;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import unzipper from "unzipper";
|
|
2
|
+
export default abstract class Pack {
|
|
3
|
+
protected path: string;
|
|
4
|
+
protected files: Record<string, unzipper.File>;
|
|
5
|
+
protected _isLoaded: boolean;
|
|
6
|
+
get fileList(): string[];
|
|
7
|
+
get isLoaded(): boolean;
|
|
8
|
+
constructor(path: string);
|
|
9
|
+
protected normalizePath(path: string): string;
|
|
10
|
+
abstract readPack(verify?: boolean): Promise<void>;
|
|
11
|
+
abstract readFile(path: string): Promise<Buffer>;
|
|
12
|
+
}
|