File tree Expand file tree Collapse file tree 5 files changed +51
-0
lines changed
packages/element-web-module-api/src Expand file tree Collapse file tree 5 files changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ Copyright 2025 New Vector Ltd.
3+
4+ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
5+ Please see LICENSE files in the repository root for full details.
6+ */
7+
8+ export interface RoomViewProps {
9+ roomId ?: string ;
10+ }
11+
12+ /**
13+ * Exposes components that are part of Element Web to allow modules to render them
14+ * as part of their custom components (because they can't import the components from
15+ * Element Web since it would cause a dependency cycle)
16+ */
17+ export interface BuiltinsApi {
18+ getRoomViewComponent ( ) : React . ComponentType < RoomViewProps > ;
19+ }
Original file line number Diff line number Diff line change 1+ /*
2+ Copyright 2025 New Vector Ltd.
3+
4+ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
5+ Please see LICENSE files in the repository root for full details.
6+ */
7+
8+ import { JSX } from "react" ;
9+
10+ interface SpacePanelItemProps {
11+ isPanelCollapsed : boolean ;
12+ }
13+
14+ export type SpacePanelItemRenderFunction = ( props : SpacePanelItemProps ) => JSX . Element ;
15+
16+ export interface ExtrasApi {
17+ addSpacePanelItem ( renderer : SpacePanelItemRenderFunction ) : void ;
18+ }
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ import { NavigationApi } from "./navigation.ts";
1515import { DialogApiExtension } from "./dialog.ts" ;
1616import { AccountAuthApiExtension } from "./auth.ts" ;
1717import { ProfileApiExtension } from "./profile.ts" ;
18+ import { ExtrasApi } from "./extras.ts" ;
19+ import { BuiltinsApi } from "./builtins.ts" ;
1820
1921/**
2022 * Module interface for modules to implement.
@@ -103,12 +105,16 @@ export interface Api
103105 */
104106 readonly customComponents : CustomComponentsApi ;
105107
108+ readonly builtins : BuiltinsApi ;
109+
106110 /**
107111 * API to navigate the application.
108112 * @public
109113 */
110114 readonly navigation : NavigationApi ;
111115
116+ readonly extras : ExtrasApi ;
117+
112118 /**
113119 * Create a ReactDOM root for rendering React components.
114120 * Exposed to allow modules to avoid needing to bundle their own ReactDOM.
Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
55Please see LICENSE files in the repository root for full details.
66*/
77
8+ import { JSX } from "react" ;
9+
10+ export type LocationRenderFunction = ( ) => JSX . Element ;
11+
812/**
913 * API methods to navigate the application.
1014 * @public
@@ -16,4 +20,6 @@ export interface NavigationApi {
1620 * @param join - If true, the user will be made to attempt to join the room/space if they are not already a member.
1721 */
1822 toMatrixToLink ( link : string , join ?: boolean ) : Promise < void > ;
23+
24+ registerLocationRenderer ( path : string , renderer : LocationRenderFunction ) : void ;
1925}
Original file line number Diff line number Diff line change @@ -11,10 +11,12 @@ export type { Config, ConfigApi } from "./api/config";
1111export type { I18nApi , Variables , Translations } from "./api/i18n" ;
1212export type * from "./models/event" ;
1313export type * from "./api/custom-components" ;
14+ export type * from "./api/extras" ;
1415export type * from "./api/legacy-modules" ;
1516export type * from "./api/legacy-customisations" ;
1617export type * from "./api/auth" ;
1718export type * from "./api/dialog" ;
1819export type * from "./api/profile" ;
1920export type * from "./api/navigation" ;
21+ export type * from "./api/builtins" ;
2022export * from "./api/watchable" ;
You can’t perform that action at this time.
0 commit comments