Files
element-web/src/@types/global.d.ts
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

206 lines
7.8 KiB
TypeScript
Raw Normal View History

2020-04-19 12:06:56 +01:00
/*
2024-09-09 14:57:16 +01:00
Copyright 2024 New Vector Ltd.
Copyright 2020, 2021 The Matrix.org Foundation C.I.C.
2020-04-19 12:06:56 +01:00
2024-09-09 14:57:16 +01:00
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
Please see LICENSE files in the repository root for full details.
2020-04-19 12:06:56 +01:00
*/
// eslint-disable-next-line no-restricted-imports
import "matrix-js-sdk/src/@types/global"; // load matrix-js-sdk's type extensions first
import "@types/modernizr";
2020-05-24 15:47:52 +01:00
import ContentMessages from "../ContentMessages";
2020-05-25 16:06:05 -06:00
import { IMatrixClientPeg } from "../MatrixClientPeg";
import ToastStore from "../stores/ToastStore";
2020-05-22 12:54:03 +01:00
import DeviceListener from "../DeviceListener";
import { RoomListStore } from "../stores/room-list/Interface";
2020-07-02 22:42:28 +01:00
import { PlatformPeg } from "../PlatformPeg";
import RoomListLayoutStore from "../stores/room-list/RoomListLayoutStore";
import { IntegrationManagers } from "../integrations/IntegrationManagers";
import { ModalManager } from "../Modal";
2020-07-29 10:57:14 -06:00
import SettingsStore from "../settings/SettingsStore";
import { Notifier } from "../Notifier";
import type { Renderer } from "react-dom";
2022-01-05 16:14:44 +01:00
import RightPanelStore from "../stores/right-panel/RightPanelStore";
2020-09-08 10:19:51 +01:00
import WidgetStore from "../stores/WidgetStore";
import LegacyCallHandler from "../LegacyCallHandler";
2020-10-13 17:40:34 +01:00
import UserActivity from "../UserActivity";
import { ModalWidgetStore } from "../stores/ModalWidgetStore";
import { WidgetLayoutStore } from "../stores/widgets/WidgetLayoutStore";
2021-02-12 20:55:54 +00:00
import VoipUserMapper from "../VoipUserMapper";
2021-11-11 13:07:41 +00:00
import { SpaceStoreClass } from "../stores/spaces/SpaceStore";
2021-04-06 12:26:50 +01:00
import TypingStore from "../stores/TypingStore";
import { EventIndexPeg } from "../indexing/EventIndexPeg";
import { VoiceRecordingStore } from "../stores/VoiceRecordingStore";
2021-05-19 10:07:02 +01:00
import PerformanceMonitor from "../performance";
2021-05-27 12:36:16 +01:00
import UIStore from "../stores/UIStore";
2021-06-14 20:58:20 +01:00
import { SetupEncryptionStore } from "../stores/SetupEncryptionStore";
2021-07-03 12:17:38 +01:00
import { RoomScrollStateStore } from "../stores/RoomScrollStateStore";
2021-09-26 16:04:28 +02:00
import { ConsoleLogger, IndexedDBLogStore } from "../rageshake/rageshake";
2021-09-26 19:57:02 +02:00
import ActiveWidgetStore from "../stores/ActiveWidgetStore";
import AutoRageshakeStore from "../stores/AutoRageshakeStore";
import { IConfigOptions } from "../IConfigOptions";
import { MatrixDispatcher } from "../dispatcher/dispatcher";
import { DeepReadonly } from "./common";
2020-04-19 12:06:56 +01:00
/* eslint-disable @typescript-eslint/naming-convention */
2020-04-19 12:06:56 +01:00
declare global {
interface Window {
matrixChat: ReturnType<Renderer>;
2020-05-25 16:06:05 -06:00
mxMatrixClientPeg: IMatrixClientPeg;
mxReactSdkConfig: DeepReadonly<IConfigOptions>;
2021-05-06 21:38:48 -06:00
// Needed for Safari, unknown to TypeScript
webkitAudioContext: typeof AudioContext;
2021-12-13 11:22:53 +00:00
// https://docs.microsoft.com/en-us/previous-versions/hh772328(v=vs.85)
// we only ever check for its existence, so we can ignore its actual type
MSStream?: unknown;
// https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1029#issuecomment-869224737
// https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas
OffscreenCanvas?: {
new (width: number, height: number): OffscreenCanvas;
};
2020-07-20 20:43:49 +01:00
mxContentMessages: ContentMessages;
mxToastStore: ToastStore;
mxDeviceListener: DeviceListener;
mxRoomListStore: RoomListStore;
2020-07-20 20:43:49 +01:00
mxRoomListLayoutStore: RoomListLayoutStore;
mxPlatformPeg: PlatformPeg;
mxIntegrationManagers: typeof IntegrationManagers;
2020-07-12 21:13:28 +01:00
singletonModalManager: ModalManager;
2020-07-29 10:57:14 -06:00
mxSettingsStore: SettingsStore;
2020-08-05 11:07:10 +01:00
mxNotifier: typeof Notifier;
2020-08-28 10:46:29 +01:00
mxRightPanelStore: RightPanelStore;
mxWidgetStore: WidgetStore;
mxWidgetLayoutStore: WidgetLayoutStore;
mxLegacyCallHandler: LegacyCallHandler;
2020-10-13 17:40:34 +01:00
mxUserActivity: UserActivity;
mxModalWidgetStore: ModalWidgetStore;
2021-02-12 20:55:54 +00:00
mxVoipUserMapper: VoipUserMapper;
mxSpaceStore: SpaceStoreClass;
mxVoiceRecordingStore: VoiceRecordingStore;
2021-04-06 12:26:50 +01:00
mxTypingStore: TypingStore;
mxEventIndexPeg: EventIndexPeg;
2021-05-19 10:07:02 +01:00
mxPerformanceMonitor: PerformanceMonitor;
mxPerformanceEntryNames: any;
2021-05-27 12:36:16 +01:00
mxUIStore: UIStore;
2021-06-14 20:58:20 +01:00
mxSetupEncryptionStore?: SetupEncryptionStore;
2021-07-03 12:17:38 +01:00
mxRoomScrollStateStore?: RoomScrollStateStore;
2021-09-26 19:57:02 +02:00
mxActiveWidgetStore?: ActiveWidgetStore;
mxOnRecaptchaLoaded?: () => void;
2022-02-11 13:03:51 +00:00
electron?: Electron;
mxSendSentryReport: (userText: string, issueUrl: string, error: Error) => Promise<void>;
mxLoginWithAccessToken: (hsUrl: string, accessToken: string) => Promise<void>;
mxAutoRageshakeStore?: AutoRageshakeStore;
mxDispatcher: MatrixDispatcher;
}
2022-02-11 13:03:51 +00:00
interface Electron {
// will be extended by element-web downstream
}
2021-09-02 14:10:28 +02:00
interface DesktopCapturerSource {
id: string;
name: string;
thumbnailURL: string;
}
interface GetSourcesOptions {
types: Array<string>;
thumbnailSize?: {
height: number;
width: number;
};
fetchWindowIcons?: boolean;
}
2020-04-19 12:06:56 +01:00
interface Document {
2020-10-29 17:56:24 +00:00
// Safari & IE11 only have this prefixed: we used prefixed versions
// previously so let's continue to support them for now
webkitExitFullscreen(): Promise<void>;
msExitFullscreen(): Promise<void>;
readonly webkitFullscreenElement: Element | null;
readonly msFullscreenElement: Element | null;
2020-04-19 12:06:56 +01:00
}
2020-07-02 23:15:08 +01:00
interface Navigator {
userLanguage?: string;
}
2020-04-19 12:06:56 +01:00
interface StorageEstimate {
usageDetails?: { [key: string]: number };
2020-04-19 12:06:56 +01:00
}
2020-04-22 13:08:33 +01:00
2020-10-29 17:56:24 +00:00
interface Element {
// Safari & IE11 only have this prefixed: we used prefixed versions
// previously so let's continue to support them for now
webkitRequestFullScreen(options?: FullscreenOptions): Promise<void>;
msRequestFullscreen(options?: FullscreenOptions): Promise<void>;
2024-08-01 17:14:28 +01:00
// scrollIntoView(arg?: boolean | _ScrollIntoViewOptions): void;
2020-10-29 17:56:24 +00:00
}
2021-04-19 21:54:08 -06:00
// https://github.com/microsoft/TypeScript/issues/28308#issuecomment-650802278
interface AudioWorkletProcessor {
readonly port: MessagePort;
process(inputs: Float32Array[][], outputs: Float32Array[][], parameters: Record<string, Float32Array>): boolean;
}
// https://github.com/microsoft/TypeScript/issues/28308#issuecomment-650802278
const AudioWorkletProcessor: {
prototype: AudioWorkletProcessor;
new (options?: AudioWorkletNodeOptions): AudioWorkletProcessor;
};
2021-12-13 11:22:53 +00:00
// https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1029#issuecomment-881509595
interface AudioParamDescriptor {
readonly port: MessagePort;
}
/**
* In future, browsers will support focusVisible option.
* See https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#focusvisible
*/
interface FocusOptions {
focusVisible: boolean;
}
2021-04-19 21:54:08 -06:00
// https://github.com/microsoft/TypeScript/issues/28308#issuecomment-650802278
function registerProcessor(
name: string,
processorCtor: (new (options?: AudioWorkletNodeOptions) => AudioWorkletProcessor) & {
parameterDescriptors?: AudioParamDescriptor[];
},
2023-02-13 11:39:16 +00:00
): void;
// eslint-disable-next-line no-var
var grecaptcha:
| undefined
| {
reset: (id: string) => void;
render: (
divId: string,
options: {
sitekey: string;
2021-07-19 16:27:39 +02:00
callback: (response: string) => void;
2021-07-19 16:34:07 +02:00
},
) => string;
isReady: () => boolean;
};
2021-09-26 16:04:28 +02:00
// eslint-disable-next-line no-var, camelcase
var mx_rage_logger: ConsoleLogger;
// eslint-disable-next-line no-var, camelcase
var mx_rage_initPromise: Promise<void>;
// eslint-disable-next-line no-var, camelcase
var mx_rage_initStoragePromise: Promise<void>;
// eslint-disable-next-line no-var, camelcase
var mx_rage_store: IndexedDBLogStore;
2020-04-19 12:06:56 +01:00
}
/* eslint-enable @typescript-eslint/naming-convention */