@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.
Files changed (215) hide show
  1. package/dist/host/_native/open-orpheus__database.d.ts +50 -0
  2. package/dist/host/_native/open-orpheus__window.d.ts +266 -0
  3. package/dist/host/src/constants.d.ts +6 -0
  4. package/dist/host/src/main/afp.d.ts +1 -0
  5. package/dist/host/src/main/arguments.d.ts +4 -0
  6. package/dist/host/src/main/audio/ChunkTracker.d.ts +23 -0
  7. package/dist/host/src/main/audio/DownloadScheduler.d.ts +53 -0
  8. package/dist/host/src/main/audio/MediaEngine.d.ts +47 -0
  9. package/dist/host/src/main/audio/OnlineStreamer.d.ts +66 -0
  10. package/dist/host/src/main/audio/StorageManager.d.ts +18 -0
  11. package/dist/host/src/main/audio.d.ts +6 -0
  12. package/dist/host/src/main/av3a/Av3aEngine.d.ts +24 -0
  13. package/dist/host/src/main/av3a/Av3aM4aSession.d.ts +101 -0
  14. package/dist/host/src/main/av3a/Av3aPlaybackProcess.d.ts +52 -0
  15. package/dist/host/src/main/av3a/detect.d.ts +6 -0
  16. package/dist/host/src/main/av3a/sources.d.ts +13 -0
  17. package/dist/host/src/main/av3a/types.d.ts +54 -0
  18. package/dist/host/src/main/bridge/modules/inputRegion.d.ts +1 -0
  19. package/dist/host/src/main/bridge/modules/lyrics.d.ts +1 -0
  20. package/dist/host/src/main/bridge/modules/settings.d.ts +1 -0
  21. package/dist/host/src/main/bridge/register.d.ts +9 -0
  22. package/dist/host/src/main/cache/HttpCacheStorage.d.ts +10 -0
  23. package/dist/host/src/main/cache/LyricCahceManager.d.ts +21 -0
  24. package/dist/host/src/main/cache/PlayCacheManager.d.ts +72 -0
  25. package/dist/host/src/main/cache.d.ts +7 -0
  26. package/dist/host/src/main/calls/app.d.ts +1 -0
  27. package/dist/host/src/main/calls/audioeffect.d.ts +1 -0
  28. package/dist/host/src/main/calls/browser.d.ts +1 -0
  29. package/dist/host/src/main/calls/desktop.d.ts +2 -0
  30. package/dist/host/src/main/calls/desktoppet.d.ts +1 -0
  31. package/dist/host/src/main/calls/download.d.ts +1 -0
  32. package/dist/host/src/main/calls/index.d.ts +16 -0
  33. package/dist/host/src/main/calls/musiclibrary.d.ts +1 -0
  34. package/dist/host/src/main/calls/network.d.ts +1 -0
  35. package/dist/host/src/main/calls/os.d.ts +1 -0
  36. package/dist/host/src/main/calls/player.d.ts +22 -0
  37. package/dist/host/src/main/calls/process.d.ts +1 -0
  38. package/dist/host/src/main/calls/rtc.d.ts +1 -0
  39. package/dist/host/src/main/calls/storage.d.ts +1 -0
  40. package/dist/host/src/main/calls/trayicon.d.ts +1 -0
  41. package/dist/host/src/main/calls/update.d.ts +1 -0
  42. package/dist/host/src/main/calls/winhelper.d.ts +1 -0
  43. package/dist/host/src/main/calls.d.ts +5 -0
  44. package/dist/host/src/main/channel.d.ts +1 -0
  45. package/dist/host/src/main/cookie.d.ts +13 -0
  46. package/dist/host/src/main/crypto.d.ts +46 -0
  47. package/dist/host/src/main/database/KeyvSqliteDriver.d.ts +6 -0
  48. package/dist/host/src/main/database.d.ts +5 -0
  49. package/dist/host/src/main/dawn.d.ts +31 -0
  50. package/dist/host/src/main/device.d.ts +3 -0
  51. package/dist/host/src/main/download.d.ts +40 -0
  52. package/dist/host/src/main/error.d.ts +1 -0
  53. package/dist/host/src/main/folders.d.ts +18 -0
  54. package/dist/host/src/main/fonts.d.ts +1 -0
  55. package/dist/host/src/main/gui.d.ts +4 -0
  56. package/dist/host/src/main/id3.d.ts +42 -0
  57. package/dist/host/src/main/lifecycle.d.ts +118 -0
  58. package/dist/host/src/main/logger.d.ts +12 -0
  59. package/dist/host/src/main/lyrics/DbusLyricsService.d.ts +115 -0
  60. package/dist/host/src/main/lyrics/LyricsDispatcher.d.ts +26 -0
  61. package/dist/host/src/main/lyrics/dbus.d.ts +16 -0
  62. package/dist/host/src/main/lyrics/parse.d.ts +21 -0
  63. package/dist/host/src/main/lyrics.d.ts +2 -0
  64. package/dist/host/src/main/mediaSession.d.ts +42 -0
  65. package/dist/host/src/main/menu/AppMenu.d.ts +35 -0
  66. package/dist/host/src/main/menu/anchor.d.ts +13 -0
  67. package/dist/host/src/main/menu/backend/DesktopWindowBackend.d.ts +30 -0
  68. package/dist/host/src/main/menu/backend/MenuBackend.d.ts +28 -0
  69. package/dist/host/src/main/menu/backend/WaylandOverlayBackend.d.ts +15 -0
  70. package/dist/host/src/main/menu/backend/WaylandPopupBackend.d.ts +31 -0
  71. package/dist/host/src/main/menu/constants.d.ts +12 -0
  72. package/dist/host/src/main/menu/index.d.ts +2 -0
  73. package/dist/host/src/main/menu/native-popup.d.ts +16 -0
  74. package/dist/host/src/main/menu/patch.d.ts +3 -0
  75. package/dist/host/src/main/menu/skin.d.ts +3 -0
  76. package/dist/host/src/main/menu/surface/BaseWindowMenuSurface.d.ts +69 -0
  77. package/dist/host/src/main/menu/surface/MenuSurface.d.ts +29 -0
  78. package/dist/host/src/main/menu/surface/MenuSurfacePath.d.ts +29 -0
  79. package/dist/host/src/main/menu/surface/SurfacePool.d.ts +15 -0
  80. package/dist/host/src/main/menu/workaround.d.ts +6 -0
  81. package/dist/host/src/main/ncae.d.ts +8 -0
  82. package/dist/host/src/main/network/handler.d.ts +3 -0
  83. package/dist/host/src/main/network/interceptor.d.ts +2 -0
  84. package/dist/host/src/main/network/interceptors/anonymous.d.ts +2 -0
  85. package/dist/host/src/main/network/pipeline.d.ts +8 -0
  86. package/dist/host/src/main/network/types.d.ts +70 -0
  87. package/dist/host/src/main/orpheus.d.ts +10 -0
  88. package/dist/host/src/main/pack.d.ts +27 -0
  89. package/dist/host/src/main/packs/Pack.d.ts +12 -0
  90. package/dist/host/src/main/packs/SkinPack.d.ts +6 -0
  91. package/dist/host/src/main/packs/WebPack.d.ts +6 -0
  92. package/dist/host/src/main/playback/PlaybackController.d.ts +57 -0
  93. package/dist/host/src/main/playback/PlayerCommandRouter.d.ts +85 -0
  94. package/dist/host/src/main/playback/adapters/MediaSessionAdapter.d.ts +61 -0
  95. package/dist/host/src/main/playback/adapters/MprisAdapter.d.ts +48 -0
  96. package/dist/host/src/main/playback/adapters/NowPlayingAdapter.d.ts +23 -0
  97. package/dist/host/src/main/playback/adapters/SmtcAdapter.d.ts +23 -0
  98. package/dist/host/src/main/playback/artwork.d.ts +47 -0
  99. package/dist/host/src/main/playback/modes.d.ts +8 -0
  100. package/dist/host/src/main/playback/types.d.ts +39 -0
  101. package/dist/host/src/main/plugin/discover.d.ts +36 -0
  102. package/dist/host/src/main/plugin/index.d.ts +12 -0
  103. package/dist/host/src/main/plugin/loader.d.ts +43 -0
  104. package/dist/host/src/main/plugin/manager.d.ts +15 -0
  105. package/dist/host/src/main/plugin/metadata.d.ts +24 -0
  106. package/dist/host/src/main/plugin/state.d.ts +17 -0
  107. package/dist/host/src/main/plugin/tree.d.ts +13 -0
  108. package/dist/host/src/main/plugin/types.d.ts +18 -0
  109. package/dist/host/src/main/protocol.d.ts +4 -0
  110. package/dist/host/src/main/request.d.ts +16 -0
  111. package/dist/host/src/main/settings.d.ts +6 -0
  112. package/dist/host/src/main/shortcuts.d.ts +10 -0
  113. package/dist/host/src/main/shutdown.d.ts +32 -0
  114. package/dist/host/src/main/skin/color.d.ts +2 -0
  115. package/dist/host/src/main/skin/dui.d.ts +15 -0
  116. package/dist/host/src/main/tray.d.ts +8 -0
  117. package/dist/host/src/main/update.d.ts +2 -0
  118. package/dist/host/src/main/util/display.d.ts +3 -0
  119. package/dist/host/src/main/util/env.d.ts +1 -0
  120. package/dist/host/src/main/util/fs.d.ts +21 -0
  121. package/dist/host/src/main/util/image.d.ts +1 -0
  122. package/dist/host/src/main/util/musicFile.d.ts +1 -0
  123. package/dist/host/src/main/util/musicPicture.d.ts +2 -0
  124. package/dist/host/src/main/util/path.d.ts +2 -0
  125. package/dist/host/src/main/util/send.d.ts +13 -0
  126. package/dist/host/src/main/util/url.d.ts +19 -0
  127. package/dist/host/src/main/util/window.d.ts +2 -0
  128. package/dist/host/src/main/window.d.ts +294 -0
  129. package/dist/host/src/main/windows/desktop-lyrics.d.ts +12 -0
  130. package/dist/host/src/main/windows/desktop-pet.d.ts +8 -0
  131. package/dist/host/src/main/windows/main.d.ts +6 -0
  132. package/dist/host/src/main/windows/manage.d.ts +2 -0
  133. package/dist/host/src/main/windows/mini-player.d.ts +16 -0
  134. package/dist/host/src/main/windows/music-desktop.d.ts +13 -0
  135. package/dist/host/src/main/windows/package-download.d.ts +2 -0
  136. package/dist/host/src/main/windows/plugin-manager.d.ts +5 -0
  137. package/dist/host/src/main/xeapi.d.ts +53 -0
  138. package/dist/host/src/preload/AudioEffectManager.d.ts +124 -0
  139. package/dist/host/src/preload/PlaybackBackend.d.ts +34 -0
  140. package/dist/host/src/preload/Player.d.ts +221 -0
  141. package/dist/host/src/preload/av3a/Av3aPcmPlayer.d.ts +84 -0
  142. package/dist/host/src/preload/av3a/bridge.d.ts +21 -0
  143. package/dist/host/src/preload/av3a/channel.d.ts +40 -0
  144. package/dist/host/src/preload/av3a/detect.d.ts +6 -0
  145. package/dist/host/src/preload/backends/Av3aPlaybackBackend.d.ts +32 -0
  146. package/dist/host/src/preload/backends/MediaPlaybackBackend.d.ts +25 -0
  147. package/dist/host/src/shared/CallDispatcher.d.ts +12 -0
  148. package/dist/host/src/shared/contracts/av3a-api.d.ts +50 -0
  149. package/dist/host/src/shared/contracts/av3a-process.d.ts +56 -0
  150. package/dist/host/src/shared/contracts/desktop-lyrics-api.d.ts +23 -0
  151. package/dist/host/src/shared/contracts/input-region-api.d.ts +6 -0
  152. package/dist/host/src/shared/contracts/lyrics-api.d.ts +11 -0
  153. package/dist/host/src/shared/contracts/manage-api.d.ts +33 -0
  154. package/dist/host/src/shared/contracts/mini-player-api.d.ts +19 -0
  155. package/dist/host/src/shared/contracts/plugin-manager-api.d.ts +34 -0
  156. package/dist/host/src/shared/contracts/settings-api.d.ts +15 -0
  157. package/dist/host/src/shared/playbackMode.d.ts +2 -0
  158. package/dist/host/src/shared/plugin/registry.d.ts +32 -0
  159. package/dist/host/src/shared/types/desktop-lyrics.d.ts +44 -0
  160. package/dist/host/src/shared/types/dui.d.ts +37 -0
  161. package/dist/host/src/shared/types/input-region.d.ts +6 -0
  162. package/dist/host/src/shared/types/lyrics.d.ts +15 -0
  163. package/dist/host/src/shared/types/manage.d.ts +14 -0
  164. package/dist/host/src/shared/types/menu-surface.d.ts +43 -0
  165. package/dist/host/src/shared/types/menu.d.ts +29 -0
  166. package/dist/host/src/shared/types/mini-player.d.ts +90 -0
  167. package/dist/host/src/shared/types/ncae.d.ts +21 -0
  168. package/dist/host/src/shared/types/package-download.d.ts +6 -0
  169. package/dist/host/src/shared/types/playback-mode.d.ts +3 -0
  170. package/dist/host/src/shared/types/settings.d.ts +9 -0
  171. package/dist/host/src/shared/types/update.d.ts +6 -0
  172. package/dist/host/src/shared/util.d.ts +22 -0
  173. package/dist/index.d.ts +7 -0
  174. package/dist/preload/host/src/constants.d.ts +6 -0
  175. package/dist/preload/host/src/main/network/types.d.ts +70 -0
  176. package/dist/preload/host/src/preload/AudioEffectManager.d.ts +124 -0
  177. package/dist/preload/host/src/preload/MusicRecognizer.d.ts +25 -0
  178. package/dist/preload/host/src/preload/PlaybackBackend.d.ts +34 -0
  179. package/dist/preload/host/src/preload/Player.d.ts +221 -0
  180. package/dist/preload/host/src/preload/YunxinIM.d.ts +15 -0
  181. package/dist/preload/host/src/preload/audioplayer.d.ts +4 -0
  182. package/dist/preload/host/src/preload/av3a/Av3aPcmPlayer.d.ts +84 -0
  183. package/dist/preload/host/src/preload/av3a/bridge.d.ts +21 -0
  184. package/dist/preload/host/src/preload/av3a/channel.d.ts +40 -0
  185. package/dist/preload/host/src/preload/av3a/detect.d.ts +6 -0
  186. package/dist/preload/host/src/preload/backends/Av3aPlaybackBackend.d.ts +32 -0
  187. package/dist/preload/host/src/preload/backends/MediaPlaybackBackend.d.ts +25 -0
  188. package/dist/preload/host/src/preload/calls/app.d.ts +1 -0
  189. package/dist/preload/host/src/preload/calls/audioeffect.d.ts +1 -0
  190. package/dist/preload/host/src/preload/calls/audioplayer.d.ts +1 -0
  191. package/dist/preload/host/src/preload/calls/im.d.ts +1 -0
  192. package/dist/preload/host/src/preload/calls/index.d.ts +6 -0
  193. package/dist/preload/host/src/preload/calls/network.d.ts +1 -0
  194. package/dist/preload/host/src/preload/calls/nimsys.d.ts +1 -0
  195. package/dist/preload/host/src/preload/calls/os.d.ts +1 -0
  196. package/dist/preload/host/src/preload/calls/player.d.ts +1 -0
  197. package/dist/preload/host/src/preload/calls/update.d.ts +1 -0
  198. package/dist/preload/host/src/preload/calls.d.ts +4 -0
  199. package/dist/preload/host/src/preload/channel.d.ts +1 -0
  200. package/dist/preload/host/src/preload/playbackMode.d.ts +13 -0
  201. package/dist/preload/host/src/preload/plugin/types.d.ts +18 -0
  202. package/dist/preload/host/src/preload/util.d.ts +1 -0
  203. package/dist/preload/host/src/shared/CallDispatcher.d.ts +12 -0
  204. package/dist/preload/host/src/shared/contracts/av3a-api.d.ts +50 -0
  205. package/dist/preload/host/src/shared/contracts/av3a-process.d.ts +56 -0
  206. package/dist/preload/host/src/shared/playbackMode.d.ts +2 -0
  207. package/dist/preload/host/src/shared/plugin/registry.d.ts +32 -0
  208. package/dist/preload/host/src/shared/types/ncae.d.ts +21 -0
  209. package/dist/preload/host/src/shared/types/playback-mode.d.ts +3 -0
  210. package/dist/preload/host/src/shared/util.d.ts +22 -0
  211. package/dist/preload/index.d.ts +7 -0
  212. package/dist/preload/registry-map.d.ts +36 -0
  213. package/dist/registry-map.d.ts +145 -0
  214. package/package.json +58 -4
  215. package/README.md +0 -3
@@ -0,0 +1,12 @@
1
+ import { PluginLoader } from "./loader";
2
+ import { PluginManager } from "./manager";
3
+ /** The installed plugin manager, or `null` when the plugin system is disabled. */
4
+ export declare function getPluginManager(): PluginManager | null;
5
+ /**
6
+ * Install the plugin system.
7
+ *
8
+ * Called once, after the startup services are initialized and before the main
9
+ * window is created. Returns the loader so the caller can run `activateAll`
10
+ * once the main window exists, or `null` when plugins are disabled.
11
+ */
12
+ export declare function installPluginSystem(): Promise<PluginLoader | null>;
@@ -0,0 +1,43 @@
1
+ import type { DiscoveredPlugin } from "./discover";
2
+ import { type Registry } from "../../shared/plugin/registry";
3
+ import type { PluginModule } from "./types";
4
+ export declare enum PluginStatus {
5
+ Pending = "pending",
6
+ Active = "active",
7
+ Failed = "failed"
8
+ }
9
+ export interface PluginRecord {
10
+ plugin: DiscoveredPlugin;
11
+ status: PluginStatus;
12
+ error?: unknown;
13
+ module?: PluginModule;
14
+ }
15
+ export interface PluginLoaderOptions {
16
+ registry: Registry;
17
+ plugins: DiscoveredPlugin[];
18
+ /** Only plugins for which this returns true are activated by `activateAll`. */
19
+ isEnabled?: (id: string) => boolean;
20
+ /** Injectable for tests; defaults to a dynamic ESM import. */
21
+ importModule?: (entryPath: string) => Promise<unknown>;
22
+ }
23
+ /**
24
+ * Loads, activates and deactivates plugin trees.
25
+ *
26
+ * Each plugin is isolated: one failing import or hook cannot stop the others or
27
+ * the host. Module evaluation is deferred to activation, so a discovered plugin
28
+ * has no side effects until the host activates it.
29
+ */
30
+ export declare class PluginLoader {
31
+ private readonly records;
32
+ private readonly ids;
33
+ private readonly runtime;
34
+ private readonly importModule;
35
+ private readonly pluginRegistry;
36
+ private readonly isEnabled;
37
+ constructor(options: PluginLoaderOptions);
38
+ get plugins(): ReadonlyArray<PluginRecord>;
39
+ activateAll(): Promise<void>;
40
+ activate(id: string): Promise<void>;
41
+ deactivate(id: string): Promise<void>;
42
+ deactivateAll(): Promise<void>;
43
+ }
@@ -0,0 +1,15 @@
1
+ import { type PluginManagerState } from "../../shared/contracts/plugin-manager-api";
2
+ import { type PluginLoader } from "./loader";
3
+ import type { PluginStateStore } from "./state";
4
+ /** Combines the persisted enable intent with the loader's runtime status. */
5
+ export declare class PluginManager {
6
+ private readonly loader;
7
+ private readonly state;
8
+ constructor(loader: PluginLoader, state: PluginStateStore);
9
+ list(): PluginManagerState;
10
+ setEnabled(id: string, enabled: boolean): Promise<PluginManagerState>;
11
+ /** Whether the plugin should be activated (used for the preload manifest). */
12
+ isEnabled(id: string): boolean;
13
+ private find;
14
+ private toEntry;
15
+ }
@@ -0,0 +1,24 @@
1
+ import { z } from "zod";
2
+ declare function createMetadataSchema(base: string): z.ZodObject<{
3
+ id: z.ZodString;
4
+ name: z.ZodString;
5
+ version: z.ZodString;
6
+ description: z.ZodOptional<z.ZodString>;
7
+ author: z.ZodOptional<z.ZodString>;
8
+ homepage: z.ZodOptional<z.ZodString>;
9
+ license: z.ZodOptional<z.ZodString>;
10
+ icon: z.ZodOptional<z.ZodString>;
11
+ realms: z.ZodObject<{
12
+ main: z.ZodString;
13
+ preload: z.ZodOptional<z.ZodString>;
14
+ }, z.core.$strip>;
15
+ }, z.core.$strip>;
16
+ export type PluginMetadata = z.infer<ReturnType<typeof createMetadataSchema>>;
17
+ /**
18
+ * Validate a parsed `metadata.json`.
19
+ *
20
+ * Unknown fields are ignored. The error message names the plugin source and
21
+ * lists every failing field.
22
+ */
23
+ export declare function parsePluginMetadata(raw: unknown, source: string): PluginMetadata;
24
+ export {};
@@ -0,0 +1,17 @@
1
+ import { PluginKind } from "../../shared/contracts/plugin-manager-api";
2
+ export interface PluginStateStore {
3
+ isEnabled(id: string, kind: PluginKind): boolean;
4
+ setEnabled(id: string, enabled: boolean): Promise<void>;
5
+ }
6
+ /**
7
+ * Persisted enable overrides.
8
+ *
9
+ * Built-in plugins default to enabled, user plugins to disabled; only explicit
10
+ * toggles are stored.
11
+ */
12
+ export declare class PluginState implements PluginStateStore {
13
+ private overrides;
14
+ load(): Promise<void>;
15
+ isEnabled(id: string, kind: PluginKind): boolean;
16
+ setEnabled(id: string, enabled: boolean): Promise<void>;
17
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A plugin tree is a directory on disk or an `.asar` archive.
3
+ *
4
+ * Electron's `fs` and ESM loader treat an asar as a virtual directory, so both
5
+ * are read in place: there is no extraction, cache, or materialization step.
6
+ */
7
+ export interface PluginTree {
8
+ /** The original source (directory or asar path). */
9
+ readonly source: string;
10
+ has(relativePath: string): Promise<boolean>;
11
+ readFile(relativePath: string): Promise<Buffer>;
12
+ }
13
+ export declare function openPluginTree(source: string): Promise<PluginTree>;
@@ -0,0 +1,18 @@
1
+ import type { PluginRegistry, Registry } from "../../shared/plugin/registry";
2
+ /** Everything a plugin's main-realm module is handed. */
3
+ export type PluginRuntime = {
4
+ /** The generated interface registry for the main realm. */
5
+ registry: Registry;
6
+ /** The main realm's plugin-contributed exports, keyed by plugin id. */
7
+ plugins: PluginRegistry;
8
+ };
9
+ /**
10
+ * The named exports a plugin's main-realm entry must provide.
11
+ *
12
+ * Identity (id, name, version) lives in the plugin's `metadata.json`; the
13
+ * module only implements the lifecycle.
14
+ */
15
+ export interface PluginModule {
16
+ activate(runtime: PluginRuntime): void | Promise<void>;
17
+ deactivate?(): void | Promise<void>;
18
+ }
@@ -0,0 +1,4 @@
1
+ export declare const isProtocolClient: () => boolean;
2
+ export declare const getProtocolClientName: () => string;
3
+ export declare function unregisterAsProtocolClient(): boolean;
4
+ export default function registerAsProtocolClient(force?: boolean): boolean;
@@ -0,0 +1,16 @@
1
+ import { type Agents, type Got } from "got";
2
+ export type ProxyTypes = "none" | "ie" | "http" | "socks4" | "socks5";
3
+ export type ProxyServer = {
4
+ Host: string;
5
+ Port: string;
6
+ UserName: string;
7
+ Password: string;
8
+ };
9
+ export type ProxyConfiguration = {
10
+ Type: ProxyTypes;
11
+ } & Partial<Record<ProxyTypes, ProxyServer>>;
12
+ export declare function getProxyURL(proto: string, server: ProxyServer): URL;
13
+ export declare function getProxyAgent(config?: ProxyConfiguration): Promise<Agents | undefined>;
14
+ export declare let client: Got;
15
+ export declare function setProxy(agents: Agents | undefined): void;
16
+ export declare function setupRequestInterceptors(): void;
@@ -0,0 +1,6 @@
1
+ import Emittery from "emittery";
2
+ import { Keyv } from "keyv";
3
+ import { SettingsEvents } from "../shared/types/settings";
4
+ export declare let kv: Keyv;
5
+ export declare let events: Emittery<SettingsEvents>;
6
+ export declare function initialize(): void;
@@ -0,0 +1,10 @@
1
+ export interface VkToElectronResult {
2
+ accelerator: string | null;
3
+ unsupportedVkCodes: number[];
4
+ }
5
+ /**
6
+ * Convert legacy VK/keyCode values (e.g. 17,18,76) into an Electron accelerator.
7
+ */
8
+ export declare function vkCodesToElectronAccelerator(vkCodes: readonly number[]): VkToElectronResult;
9
+ export declare function registerGlobalShortcut(name: string, keys: string[], callback: () => void): boolean;
10
+ export declare function unregisterGlobalShortcut(name: string): void;
@@ -0,0 +1,32 @@
1
+ export declare enum ScheduleShutdownStatus {
2
+ /** The requested state is now in effect. */
3
+ Ok = 0,
4
+ /** This platform, or the system, cannot schedule a shutdown. */
5
+ NotAvailable = 1,
6
+ /** The requested state already held, so nothing changed. */
7
+ AlreadySet = 2,
8
+ /**
9
+ * Another application owns the system's shutdown schedule. Only logind lets us
10
+ * see one: Windows cannot report a pending shutdown, so a request that clashes
11
+ * with one it cannot report fails at the deadline instead.
12
+ */
13
+ ManagedExternally = 3,
14
+ /** The request could not be completed (e.g. the bus is unreachable). */
15
+ Failed = 4
16
+ }
17
+ /** Provide that handler. `calls/os.ts` is the only caller. */
18
+ export declare function setPowerOffFailureHandler(handler: () => void): void;
19
+ /** Whether this app owns a scheduled shutdown (or is busy creating one). */
20
+ export declare function hasManagedScheduledShutdown(): boolean;
21
+ /**
22
+ * Set the machine shutdown this app manages, or cancel it when `time` is
23
+ * omitted.
24
+ *
25
+ * Requests run one at a time, in the order they arrive, so the last request
26
+ * always wins even while an earlier one is still waiting on the system bus.
27
+ * Failures are reported as {@link ScheduleShutdownStatus.Failed} rather than
28
+ * rejected, so callers (including IPC handlers) always get an answer.
29
+ */
30
+ export declare function setScheduledShutdown(time?: Date): Promise<ScheduleShutdownStatus>;
31
+ /** Mark that the pending quit is performing the scheduled shutdown. */
32
+ export declare function keepScheduledShutdownOnExit(): void;
@@ -0,0 +1,2 @@
1
+ import type photon from "@silvia-odwyer/photon-node";
2
+ export declare function extractColor(image: photon.PhotonImage): Promise<string>;
@@ -0,0 +1,15 @@
1
+ import type { BtnImages, BtnState, ElementTemplate, LayoutNode } from "../../shared/types/dui";
2
+ export type { ElementTemplate, LayoutNode };
3
+ export declare function parseElementTemplate(xml: string): ElementTemplate | null;
4
+ /** Convert #AARRGGBB (ARGB) to CSS #RRGGBBAA. */
5
+ export declare function argbToCss(c: string): string;
6
+ /** Convert #AABBGGRR (ABGR) to CSS #RRGGBBAA. */
7
+ export declare function abgrToCss(c: string): string;
8
+ /** Parse a single state attribute string like file='btn/play.svg' svg_color='#ff483228'. */
9
+ export declare function parseBtnState(attrs: string): BtnState | null;
10
+ /**
11
+ * Parse a DUI attribute string like:
12
+ * normalimage="file='btn/play.svg' svg_color='#ff483228'" hotimage="..."
13
+ * into structured BtnImages.
14
+ */
15
+ export declare function parseBtnUrl(url: string): BtnImages | null;
@@ -0,0 +1,8 @@
1
+ import { NativeImage } from "electron";
2
+ export declare let trayInstalled: boolean;
3
+ export declare function setIcon(newIcon: NativeImage): void;
4
+ export declare function setTooltip(newTooltip: string): void;
5
+ export declare function install(): void;
6
+ export declare function uninstall(): void;
7
+ /** Destroy the tray icon on shutdown. */
8
+ export declare function destroyTray(): void;
@@ -0,0 +1,2 @@
1
+ import type { UpdateInfo } from "../shared/types/update";
2
+ export declare function checkUpdate(ignoreCache?: boolean): Promise<UpdateInfo | null>;
@@ -0,0 +1,3 @@
1
+ import { Display } from "electron";
2
+ export declare function getDisplayUniqueId(display: Display): string;
3
+ export declare function displayFromUniqueId(id: string | null): Display | null;
@@ -0,0 +1 @@
1
+ export declare function checkEnvFlagPresent(name: string): boolean;
@@ -0,0 +1,21 @@
1
+ export declare function isFileNotFound(err: unknown): boolean;
2
+ /**
3
+ * Asynchronous version of {@link existsSync}
4
+ *
5
+ * @param path Path to file
6
+ */
7
+ export declare function fileExists(path: string): Promise<boolean>;
8
+ /**
9
+ * Whether `path` exists and can actually be written to, tested by creating
10
+ * (then removing) a uniquely named probe directory. When `create` is true the
11
+ * directory is created first if it does not exist.
12
+ *
13
+ * @param path Path to the directory to test
14
+ * @param create Whether to create the directory if it does not exist
15
+ */
16
+ export declare function isWritableDir(path: string, create?: boolean): Promise<boolean>;
17
+ /**
18
+ * Try move file or folder with the least efforts.
19
+ */
20
+ export declare function move(src: string | URL, dest: string | URL): Promise<void>;
21
+ export declare function calculateDbSize(db: string): Promise<number>;
@@ -0,0 +1 @@
1
+ export declare function pngFromIco(icoData: Uint8Array): Uint8Array;
@@ -0,0 +1 @@
1
+ export declare function isMusicFile(fileOrPath: string): boolean;
@@ -0,0 +1,2 @@
1
+ import type { MetaPicture } from "music-tag-native";
2
+ export declare function selectBestMusicPic(pics: MetaPicture[]): MetaPicture | null;
@@ -0,0 +1,2 @@
1
+ export declare function normalizePath(...paths: string[]): string;
2
+ export declare function sanitizeRelativePath(base: string, path: string): string | false;
@@ -0,0 +1,13 @@
1
+ import type { BrowserWindow, WebContents } from "electron";
2
+ /**
3
+ * Send an IPC message only when its target is still alive.
4
+ *
5
+ * `webContents.send()` throws when either the window or its web contents has
6
+ * been destroyed, which is easy to hit from timers, event listeners, file
7
+ * watchers, and other callbacks that outlive the window. Check at send time so
8
+ * a guard before an `await` cannot go stale.
9
+ *
10
+ * @returns `true` when the message was handed to Electron, `false` when the
11
+ * target was missing or destroyed.
12
+ */
13
+ export declare function sendIfAlive(target: BrowserWindow | WebContents | null | undefined, channel: string, ...args: unknown[]): boolean;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Whether a URL safe internal app URL.
3
+ */
4
+ export declare function isAppUrl(url: string | URL): boolean;
5
+ /**
6
+ * Whether `hostname` is exactly `domain` or one of its subdomains.
7
+ *
8
+ * Rejects lookalikes such as `evilmusic.163.com` for `music.163.com`.
9
+ */
10
+ export declare function isHostOrSubdomain(hostname: string, domain: string): boolean;
11
+ /**
12
+ * Whether a URL is Netease Cloud Music's.
13
+ */
14
+ export declare function isNCMUrl(url: string | URL): boolean;
15
+ /**
16
+ * Whether a URL belongs to one of the SSO hosts whose cookies the app patches
17
+ * (Netease Cloud Music, QQ, Weibo).
18
+ */
19
+ export declare function isSsoUrl(url: string | URL): boolean;
@@ -0,0 +1,2 @@
1
+ import { type BrowserWindow } from "electron";
2
+ export declare function getWindowScaleFactor(wnd: BrowserWindow): number;
@@ -0,0 +1,294 @@
1
+ import { BaseWindow, BrowserWindow } from "electron";
2
+ import type { BrowserWindowConstructorOptions } from "electron";
3
+ import Emittery from "emittery";
4
+ import type { LayerShellOptions } from "../../_native/open-orpheus__window";
5
+ export type { LayerShellOptions };
6
+ import type AppMenu from "./menu";
7
+ type AnyManagedWindow = ManagedWindow<any, any>;
8
+ type BrowserManagedWindow = ManagedWindow<any, BrowserWindow>;
9
+ type BaseWindowManaged = ManagedWindow<any, BaseWindow>;
10
+ export declare let mainWindow: BrowserWindow | null;
11
+ export declare function setMainWindow(wnd: BrowserWindow): void;
12
+ export interface InputRegion {
13
+ x: number;
14
+ y: number;
15
+ width: number;
16
+ height: number;
17
+ }
18
+ export interface WindowEvents<TWindow extends BrowserWindow | BaseWindow = BrowserWindow> {
19
+ /** Window is created or is being bound with current ManagedWindow */
20
+ bind: TWindow;
21
+ /** Window is closed or is being unbound with current ManagedWindow */
22
+ unbind: TWindow;
23
+ show: TWindow;
24
+ hide: TWindow;
25
+ /**
26
+ * The compositor refused the layer-shell role for this window.
27
+ *
28
+ * A surface's role is never released, so this happens when the window's
29
+ * surface took an ordinary toplevel role before its policy was seen. It
30
+ * cannot be fixed on that surface: whatever handles this has to re-create the
31
+ * window, which is the only way to get a surface that can still take the
32
+ * role.
33
+ */
34
+ layerShellRefused: TWindow;
35
+ }
36
+ export type WindowData = {
37
+ name: string;
38
+ maximumSize: {
39
+ x: number;
40
+ y: number;
41
+ };
42
+ minimumSize: {
43
+ x: number;
44
+ y: number;
45
+ };
46
+ alwaysOnTop: boolean;
47
+ menu: AppMenu | undefined;
48
+ };
49
+ /**
50
+ * URL for a frontend route, honouring the Vite dev server when one is running.
51
+ *
52
+ * `route` is a path within the renderer, e.g. `/mini-player`.
53
+ */
54
+ export declare function guiUrl(route?: string): string;
55
+ export declare abstract class ManagedWindow<Data extends WindowData = WindowData, TWindow extends BrowserWindow | BaseWindow = BrowserWindow> extends Emittery<WindowEvents<TWindow>> {
56
+ /** The name the native layer knows this window by. */
57
+ readonly id: string;
58
+ private _window;
59
+ private _data;
60
+ private _title;
61
+ private _lastOnClosedListener;
62
+ private _closeNotifier;
63
+ private _menuCloseUnsubscribe;
64
+ /**
65
+ * The window this wrapper owns.
66
+ *
67
+ * Assigning binds the window (wiring it up and emitting `bind`); assigning
68
+ * `null` releases it. Every managed window is created by
69
+ * [`createBrowserWindow`], so a wrapper holds at most one live window.
70
+ */
71
+ protected set window(value: TWindow | null);
72
+ get window(): TWindow | null;
73
+ protected bindWindow(value: TWindow): void;
74
+ /** The window's title. The window itself is never asked for it. */
75
+ get title(): string;
76
+ /**
77
+ * Set the window's title.
78
+ *
79
+ * This is the only way the title is ever written: the native layer keys the
80
+ * window on the id that rides in front of it, so a title written straight to
81
+ * the `BrowserWindow` would drop that id and with it the window's name.
82
+ */
83
+ setTitle(title: string): void;
84
+ /** What the native layer expects to see on the wire for this window. */
85
+ private decoratedTitle;
86
+ private applyTitle;
87
+ /**
88
+ * The page must not write the window title on Wayland.
89
+ *
90
+ * The managed id rides in the title, so a page title would either carry no id
91
+ * or carry someone else's; it is taken, prevented, and written back by this
92
+ * module instead. Attached only where the title is decorated.
93
+ */
94
+ private readonly _pageTitleListener;
95
+ private readonly _maximizeListener;
96
+ private readonly _unmaximizeListener;
97
+ private readonly _enterFullScreenListener;
98
+ private readonly _leaveFullScreenListener;
99
+ private readonly _resizeListener;
100
+ private readonly _showListener;
101
+ private readonly _hideListener;
102
+ private readonly _closeListener;
103
+ constructor();
104
+ /**
105
+ * Attach the listeners this wrapper owns. Called synchronously from the
106
+ * window setter: `Emittery` delivers its events in a later microtask, which
107
+ * is too late for wiring that must exist before the window is used.
108
+ */
109
+ private attachWindowListeners;
110
+ /**
111
+ * Apply the state this wrapper recorded to `wnd`.
112
+ *
113
+ * Called when a window is bound, and again when state moves to a window that
114
+ * is already bound: a policy switch creates its replacement eagerly, so the
115
+ * state arrives after that window exists.
116
+ */
117
+ private applyRecordedState;
118
+ private detachWindowListeners;
119
+ /**
120
+ * The only place a `BrowserWindow` is constructed.
121
+ *
122
+ * Subclasses call this instead of `new BrowserWindow` so that ownership,
123
+ * lifetime and native state all stay in one place. A window class that is a
124
+ * layer surface registers its policy with [`setLayerShell`] before calling
125
+ * this, so the policy is in place before the window — and therefore its first
126
+ * role object — exists.
127
+ */
128
+ protected createBrowserWindow(options: BrowserWindowConstructorOptions): BrowserWindow;
129
+ /** Whether the compositor can take layer surfaces at all. */
130
+ static isLayerShellAvailable(): boolean;
131
+ /**
132
+ * Register the layer-shell policy this window should take, or clear it with
133
+ * `null`.
134
+ *
135
+ * Call this before the window is created: the native layer keys the policy on
136
+ * this window's id and consults it once, when the surface's role is decided,
137
+ * and a role can be taken inside `new BrowserWindow` when the window is
138
+ * created shown. A compositor assigns a surface's role once and never changes
139
+ * it, so a window that is already a layer surface stays one for as long as its
140
+ * surface lives, and `null` only takes effect once the window is recreated.
141
+ *
142
+ * The wrapper keeps no copy: the native layer owns the state, and
143
+ * [`transferStateTo`] re-keys it when a policy switch replaces the window.
144
+ *
145
+ * Returns whether the policy could be sent at all; `false` means the
146
+ * compositor cannot take layer surfaces or the options are unsendable, and
147
+ * this window will be an ordinary toplevel.
148
+ */
149
+ setLayerShell(options: LayerShellOptions | null): boolean;
150
+ /**
151
+ * Release the native state this wrapper recorded (its layer-shell policy and
152
+ * input region).
153
+ *
154
+ * Call it when the wrapper will not be used again. A window that merely hides
155
+ * and is shown later keeps its id and must not call this: the native layer
156
+ * needs the record for the surface it creates next. A discarded wrapper is
157
+ * released automatically when it is collected; this is for callers that want
158
+ * it to happen now.
159
+ */
160
+ releaseNativeState(): void;
161
+ /** The bound window, or `null` once it is gone. Never a destroyed window. */
162
+ protected liveWindow(): TWindow | null;
163
+ /**
164
+ * Whether the window is on screen or has been asked to appear.
165
+ *
166
+ * A policy switch asks this rather than `isVisible()`: an on-demand window
167
+ * that was shown but has not reached `ready-to-show` yet is not visible, and
168
+ * treating that as "hidden" would drop the request along with the old window.
169
+ */
170
+ wantsToBeVisible(): boolean;
171
+ /** Load a renderer route, using the dev server when one is configured. */
172
+ protected loadGuiRoute(route?: string): void;
173
+ protected hideMenuBar(): void;
174
+ /**
175
+ * Ask the application before closing instead of closing directly.
176
+ *
177
+ * Quitting the app and dismissing the window still bypass the request, so
178
+ * `OnDemandWindow.hide()` and `app.quit()` keep working.
179
+ */
180
+ protected requestCloseApproval(notify: () => void): void;
181
+ /** Whether a close request should be held back for [`onCloseRequested`]. */
182
+ protected preventsCloseRequest(): boolean;
183
+ /** Called when the user asks to close a window that prevents it. */
184
+ protected onCloseRequested(): void;
185
+ /** Whether the application itself is taking the window down. */
186
+ protected isBeingDismissed(): boolean;
187
+ /** Called (synchronously) when the bound window reports that it was hidden. */
188
+ protected onWindowHidden(): void;
189
+ private releaseWindow;
190
+ /**
191
+ * Whether the session is Wayland.
192
+ */
193
+ private isWayland;
194
+ setData<K extends keyof Data>(key: K, data: Data[K]): void;
195
+ setData<T = unknown>(key: string, data: T): void;
196
+ getData<K extends keyof Data>(key: K): Data[K] | undefined;
197
+ getData<T = unknown>(key: string): T | undefined;
198
+ /** Replace the menu owned by this window and dispose the previous one. */
199
+ setMenu(menu: AppMenu | undefined): void;
200
+ private enableSizeConstraints;
201
+ private disableSizeConstraints;
202
+ setMaximumSize(x: number, y: number): void;
203
+ setMinimumSize(x: number, y: number): void;
204
+ setAlwaysOnTop(flag: boolean): void;
205
+ /**
206
+ * Set the regions this window receives input in.
207
+ *
208
+ * Only available on Linux; on Windows and macOS use Electron's
209
+ * `BrowserWindow.setIgnoreMouseEvents`.
210
+ *
211
+ * On Wayland the native layer owns the region: it records it against the
212
+ * window id and emits it immediately before the surface's next commit, since
213
+ * a `set_input_region` is only adopted at a commit. The return value
214
+ * therefore means "recorded", not "already in effect".
215
+ */
216
+ setWindowInputRegion(regions: InputRegion[]): boolean;
217
+ send(channel: string, ...args: unknown[]): boolean;
218
+ show(): void | Promise<void>;
219
+ hide(): void | Promise<void>;
220
+ /** Dismiss the bound window, bypassing the close policy. */
221
+ destroy(): void;
222
+ /**
223
+ * Hand everything this wrapper recorded to `target`.
224
+ *
225
+ * Move semantics: the source keeps nothing, so a discarded wrapper can no
226
+ * longer be found by [`ManagedWindow.fromName`] or re-apply stale state.
227
+ * Event subscribers are not carried over; consumers follow the module's live
228
+ * `window` binding instead.
229
+ */
230
+ transferStateTo(target: ManagedWindow<any, BrowserWindow> | ManagedWindow<any, BaseWindow> | ManagedWindow): void;
231
+ static fromBrowserWindow(browserWindow: BrowserWindow): BrowserManagedWindow | undefined;
232
+ static fromBaseWindow(baseWindow: BaseWindow): BaseWindowManaged | undefined;
233
+ static fromWindow(window: BrowserWindow | BaseWindow): AnyManagedWindow | undefined;
234
+ static fromId(id: string): AnyManagedWindow | undefined;
235
+ static fromName(name: string): any;
236
+ }
237
+ export interface OnDemandWindowState {
238
+ alive: boolean;
239
+ }
240
+ /**
241
+ * A managed window this module did not create.
242
+ *
243
+ * Managed windows are constructed by [`ManagedWindow.createBrowserWindow`] and
244
+ * are bound synchronously; this wrapper only exists for windows Electron itself
245
+ * produced.
246
+ */
247
+ export declare class SimpleManagedWindow extends ManagedWindow {
248
+ constructor(window: BrowserWindow);
249
+ }
250
+ /**
251
+ * A managed window with no lifecycle policy of its own.
252
+ *
253
+ * For short-lived windows (a `chrome://` info window, a renderer-requested
254
+ * URL) that only need to be created through the wrapper.
255
+ */
256
+ export declare class BasicManagedWindow extends ManagedWindow {
257
+ constructor(options: BrowserWindowConstructorOptions);
258
+ }
259
+ /** Managed `BaseWindow` host; the creator owns the `WebContentsView`. */
260
+ export declare class BaseWindowManagedWindow extends ManagedWindow<WindowData, BaseWindow> {
261
+ attach(window: BaseWindow): void;
262
+ }
263
+ export declare abstract class OnDemandWindow<T extends WindowData = WindowData> extends ManagedWindow<T> {
264
+ /** State bound to the single BrowserWindow */
265
+ protected windowState: OnDemandWindowState | null;
266
+ protected isBeingDismissed(): boolean;
267
+ /**
268
+ * A pending first show counts: the window exists, it is just not on screen
269
+ * yet, and the show request is what a policy switch has to carry over.
270
+ */
271
+ wantsToBeVisible(): boolean;
272
+ protected onWindowHidden(): void;
273
+ show(): Promise<void> | undefined;
274
+ hide(): void;
275
+ abstract createWindow(state: OnDemandWindowState): BrowserWindow;
276
+ }
277
+ /**
278
+ * Move a window to the other lifecycle policy.
279
+ *
280
+ * The bound window is dismissed and recreated by `create`; everything the
281
+ * wrapper recorded (`name`, size limits, always-on-top, native input regions)
282
+ * moves to the replacement, and so do the position and size it currently has —
283
+ * a window the user moved or resized comes back where it was. A window that was
284
+ * on screen, or was waiting to appear, is shown again, so the switch is only
285
+ * visible as a re-created window, not as a disappearing one.
286
+ *
287
+ * The layer-shell policy moves with the rest. A window class that registers its
288
+ * own policy does it for the surface it creates, so the replacement is a layer
289
+ * surface right away; policy registered on the discarded wrapper is carried
290
+ * over to the replacement's id, and can only take effect on the surface the
291
+ * replacement creates afterwards, because `create` has already built one by the
292
+ * time the hand-off happens.
293
+ */
294
+ export declare function switchWindowPolicy(current: ManagedWindow | null, create: () => ManagedWindow): ManagedWindow;
@@ -0,0 +1,12 @@
1
+ import { DesktopLyricsPlayInfo, LyricsStyle } from "../../shared/types/desktop-lyrics";
2
+ import { ManagedWindow } from "../window";
3
+ export declare const lyricsStyle: LyricsStyle;
4
+ export declare function refreshLyricsStyle(): boolean;
5
+ export declare let lyricsOffset: number;
6
+ export declare function setLyricsOffset(offset: number): boolean;
7
+ export declare let lyricsLocked: boolean;
8
+ export declare function setLyricsLocked(locked: boolean): boolean;
9
+ export declare function updateLyricsPlayInfo(info: DesktopLyricsPlayInfo | null): boolean;
10
+ export declare let window: ManagedWindow;
11
+ export default function createDesktopLyricsWindow(): Promise<void>;
12
+ export declare function createDesktopLyricsPreview(style: LyricsStyle, text: string): Promise<[Buffer, [number, number]]>;