This commit is contained in:
Michael Telatynski
2025-01-29 08:35:40 +00:00
parent 505533a5f5
commit b0c81d53d9
3 changed files with 22 additions and 7 deletions
+16 -1
View File
@@ -53,4 +53,19 @@ export function isModule(module: unknown): module is ModuleExport {
);
}
export interface Api extends LegacyModuleApiExtension, LegacyCustomisationsApiExtension {}
export interface Config {
// The branding name of the application
brand: string;
// Other config options are available but not specified in the types as that would make it difficult to change for element-web
// they are accessible at runtime all the same, see list at https://github.com/element-hq/element-web/blob/develop/docs/config.md
}
export interface ConfigApi {
get(): Config;
get<K extends keyof Config>(key: K): Config[K];
get<K extends keyof Config = never>(key?: K): Config | Config[K];
}
export interface Api extends LegacyModuleApiExtension, LegacyCustomisationsApiExtension {
config: ConfigApi;
}
+1 -1
View File
@@ -6,6 +6,6 @@ Please see LICENSE files in the repository root for full details.
*/
export { ModuleLoader, ModuleIncompatibleError } from "./loader";
export type { Api, Module, ModuleFactory } from "./api";
export type { Api, Module, ModuleFactory, Config, ConfigApi } from "./api";
export type * from "./legacy-modules";
export type * from "./legacy-customisations";
@@ -77,12 +77,12 @@ export interface Media {
downloadSource(): Promise<Response>;
}
export interface MediaContructable<Thumbnail, File> {
new (prepared: { mxc: string; thumbnail?: Thumbnail; file?: File }): Media;
export interface MediaContructable<PreparedMedia> {
new (prepared: PreparedMedia): Media;
}
export interface MediaCustomisations<Content, Client, Thumbnail, File> {
readonly Media: MediaContructable<Thumbnail, File>;
export interface MediaCustomisations<Content, Client, PreparedMedia> {
readonly Media: MediaContructable<PreparedMedia>;
mediaFromContent(content: Content, client?: Client): Media;
mediaFromMxc(mxc?: string, client?: Client): Media;
}
@@ -182,7 +182,7 @@ export interface LegacyCustomisationsApiExtension {
/**
* @deprecated
*/
readonly _registerLegacyMediaCustomisations: LegacyCustomisations<MediaCustomisations<never, never, never, never>>;
readonly _registerLegacyMediaCustomisations: LegacyCustomisations<MediaCustomisations<never, never, never>>;
/**
* @deprecated
*/