Merge remote-tracking branch 'origin/main' into dbkr/widget-toggles-api
This commit is contained in:
@@ -8,6 +8,7 @@ import { ComponentType } from 'react';
|
||||
import { IWidget } from 'matrix-widget-api';
|
||||
import { JSX } from 'react';
|
||||
import { ModuleApi } from '@matrix-org/react-sdk-module-api';
|
||||
import { ReactNode } from 'react';
|
||||
import { Root } from 'react-dom/client';
|
||||
import { RuntimeModule } from '@matrix-org/react-sdk-module-api';
|
||||
|
||||
@@ -51,6 +52,8 @@ export interface Api extends LegacyModuleApiExtension, LegacyCustomisationsApiEx
|
||||
// @alpha
|
||||
readonly customComponents: CustomComponentsApi;
|
||||
// @alpha
|
||||
readonly customisations: CustomisationsApi;
|
||||
// @alpha
|
||||
readonly extras: ExtrasApi;
|
||||
readonly i18n: I18nApi;
|
||||
readonly navigation: NavigationApi;
|
||||
@@ -115,10 +118,34 @@ export type Container = "top" | "right" | "center";
|
||||
|
||||
// @alpha
|
||||
export interface CustomComponentsApi {
|
||||
registerLoginComponent(renderer: CustomLoginRenderFunction): void;
|
||||
registerMessageRenderer(eventTypeOrFilter: string | ((mxEvent: MatrixEvent) => boolean), renderer: CustomMessageRenderFunction, hints?: CustomMessageRenderHints): void;
|
||||
registerRoomPreviewBar(renderer: CustomRoomPreviewBarRenderFunction): void;
|
||||
}
|
||||
|
||||
// @alpha
|
||||
export interface CustomisationsApi {
|
||||
registerShouldShowComponent(fn: (this: void, component: UIComponent) => boolean | void): void;
|
||||
}
|
||||
|
||||
// @alpha
|
||||
export type CustomLoginComponentProps = {
|
||||
serverConfig: CustomLoginComponentPropsServerConfig;
|
||||
fragmentAfterLogin?: string;
|
||||
children?: ReactNode;
|
||||
onLoggedIn(data: AccountAuthInfo): void;
|
||||
onServerConfigChange(config: CustomLoginComponentPropsServerConfig): void;
|
||||
};
|
||||
|
||||
// @alpha
|
||||
export interface CustomLoginComponentPropsServerConfig {
|
||||
hsName: string;
|
||||
hsUrl: string;
|
||||
}
|
||||
|
||||
// @alpha
|
||||
export type CustomLoginRenderFunction = ExtendablePropsRenderFunction<CustomLoginComponentProps>;
|
||||
|
||||
// @alpha
|
||||
export type CustomMessageComponentProps = {
|
||||
mxEvent: MatrixEvent;
|
||||
@@ -177,10 +204,15 @@ export interface DirectoryCustomisations {
|
||||
requireCanonicalAliasAccessToPublish?(): boolean;
|
||||
}
|
||||
|
||||
// @alpha
|
||||
export type ExtendablePropsRenderFunction<BaseProps> = <P extends BaseProps>(
|
||||
props: P,
|
||||
originalComponent: (props: P) => JSX.Element) => JSX.Element;
|
||||
|
||||
// @alpha
|
||||
export interface ExtrasApi {
|
||||
addRoomHeaderButtonCallback(cb: RoomHeaderButtonsCallback): void;
|
||||
getVisibleRoomBySpaceKey(spaceKey: string, cb: () => string[]): void;
|
||||
setRoomHeaderButtonCallback(cb: RoomHeaderButtonsCallback): void;
|
||||
setSpacePanelItem(spaceKey: string, props: SpacePanelItemProps): void;
|
||||
}
|
||||
|
||||
@@ -412,6 +444,17 @@ export type Translations = Record<string, {
|
||||
[ietfLanguageTag: string]: string;
|
||||
}>;
|
||||
|
||||
// @alpha
|
||||
export const enum UIComponent {
|
||||
AddIntegrations = "UIComponent.addIntegrations",
|
||||
CreateRooms = "UIComponent.roomCreation",
|
||||
CreateSpaces = "UIComponent.spaceCreation",
|
||||
ExploreRooms = "UIComponent.exploreRooms",
|
||||
FilterContainer = "UIComponent.filterContainer",
|
||||
InviteUsers = "UIComponent.sendInvites",
|
||||
RoomOptionsMenu = "UIComponent.roomOptionsMenu"
|
||||
}
|
||||
|
||||
// @alpha @deprecated (undocumented)
|
||||
export interface UserIdentifierCustomisations {
|
||||
getDisplayUserIdentifier(userId: string, opts: {
|
||||
|
||||
Reference in New Issue
Block a user