Merge pull request #110 from element-hq/midhun/multiroom/stores-api
Allow modules to access RLS from element-web
This commit is contained in:
@@ -54,6 +54,7 @@ export interface Api extends LegacyModuleApiExtension, LegacyCustomisationsApiEx
|
|||||||
readonly i18n: I18nApi;
|
readonly i18n: I18nApi;
|
||||||
readonly navigation: NavigationApi;
|
readonly navigation: NavigationApi;
|
||||||
readonly rootNode: HTMLElement;
|
readonly rootNode: HTMLElement;
|
||||||
|
readonly stores: StoresApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @alpha
|
// @alpha
|
||||||
@@ -337,6 +338,12 @@ export interface RoomListCustomisations<Room> {
|
|||||||
isRoomVisible?(room: Room): boolean;
|
isRoomVisible?(room: Room): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @public
|
||||||
|
export interface RoomListStoreApi {
|
||||||
|
getRooms(): Watchable<Room[]>;
|
||||||
|
waitForReady(): Promise<void>;
|
||||||
|
}
|
||||||
|
|
||||||
// @alpha
|
// @alpha
|
||||||
export interface RoomViewProps {
|
export interface RoomViewProps {
|
||||||
roomId?: string;
|
roomId?: string;
|
||||||
@@ -355,6 +362,11 @@ export interface SpacePanelItemProps {
|
|||||||
tooltip?: string;
|
tooltip?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @public
|
||||||
|
export interface StoresApi {
|
||||||
|
roomListStore: RoomListStoreApi;
|
||||||
|
}
|
||||||
|
|
||||||
// @public
|
// @public
|
||||||
export type Translations = Record<string, {
|
export type Translations = Record<string, {
|
||||||
[ietfLanguageTag: string]: string;
|
[ietfLanguageTag: string]: string;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import { AccountAuthApiExtension } from "./auth.ts";
|
|||||||
import { ProfileApiExtension } from "./profile.ts";
|
import { ProfileApiExtension } from "./profile.ts";
|
||||||
import { ExtrasApi } from "./extras.ts";
|
import { ExtrasApi } from "./extras.ts";
|
||||||
import { BuiltinsApi } from "./builtins.ts";
|
import { BuiltinsApi } from "./builtins.ts";
|
||||||
|
import { StoresApi } from "./stores.ts";
|
||||||
import { ClientApi } from "./client.ts";
|
import { ClientApi } from "./client.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,6 +125,11 @@ export interface Api
|
|||||||
*/
|
*/
|
||||||
readonly extras: ExtrasApi;
|
readonly extras: ExtrasApi;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows modules to access a limited functionality of certain stores from Element Web.
|
||||||
|
*/
|
||||||
|
readonly stores: StoresApi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access some very specific functionality from the client.
|
* Access some very specific functionality from the client.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2025 New Vector Ltd.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||||
|
Please see LICENSE files in the repository root for full details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import type { Room } from "../models/Room";
|
||||||
|
import { Watchable } from "./watchable";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides some basic functionality of the Room List Store from element-web.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export interface RoomListStoreApi {
|
||||||
|
/**
|
||||||
|
* Returns a watchable holding a flat list of sorted room.
|
||||||
|
*/
|
||||||
|
getRooms(): Watchable<Room[]>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a promise that resolves when RLS is ready.
|
||||||
|
*/
|
||||||
|
waitForReady(): Promise<void>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides access to certain stores from element-web.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export interface StoresApi {
|
||||||
|
/**
|
||||||
|
* Use this to access limited functionality of the RLS from element-web.
|
||||||
|
*/
|
||||||
|
roomListStore: RoomListStoreApi;
|
||||||
|
}
|
||||||
@@ -20,5 +20,6 @@ export type * from "./api/dialog";
|
|||||||
export type * from "./api/profile";
|
export type * from "./api/profile";
|
||||||
export type * from "./api/navigation";
|
export type * from "./api/navigation";
|
||||||
export type * from "./api/builtins";
|
export type * from "./api/builtins";
|
||||||
|
export type * from "./api/stores";
|
||||||
export type * from "./api/client";
|
export type * from "./api/client";
|
||||||
export * from "./api/watchable";
|
export * from "./api/watchable";
|
||||||
|
|||||||
Reference in New Issue
Block a user