-
-
Notifications
You must be signed in to change notification settings - Fork 19
MSC2790 Modal Widgets #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d5e59e2
Implement Modal Widget stuff
t3chguy 3308d67
clean up AlmostEventEmitter.ts
t3chguy e22791b
Merge branch 'master' of github.com:/matrix-org/matrix-widget-api int…
t3chguy e6d4560
Iterate PR
t3chguy 97cc08e
Use IModalWidgetOpenRequestData
t3chguy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright 2020 The Matrix.org Foundation C.I.C. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
export enum ModalButtonKind { | ||
Primary = "m.primary", | ||
Secondary = "m.secondary", | ||
Warning = "m.warning", | ||
Danger = "m.danger", | ||
Link = "m.link", | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* Copyright 2020 The Matrix.org Foundation C.I.C. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; | ||
import { WidgetApiFromWidgetAction, WidgetApiToWidgetAction } from "./WidgetApiAction"; | ||
import { IWidgetApiAcknowledgeResponseData, IWidgetApiResponse } from "./IWidgetApiResponse"; | ||
import { IWidget } from "./IWidget"; | ||
import { ModalButtonKind } from "./ModalButtonKind"; | ||
|
||
export interface IModalWidgetCreateData extends IWidgetApiRequestData { | ||
[key: string]: unknown; | ||
} | ||
|
||
export interface IModalWidgetReturnData { | ||
[key: string]: unknown; | ||
} | ||
|
||
// Types for a normal modal requesting the opening a modal widget | ||
export interface IModalWidgetOpenRequestDataButton { | ||
id: "m.close" | string; | ||
label: string; | ||
kind: ModalButtonKind | string; | ||
} | ||
|
||
export interface IModalWidgetOpenRequestData extends IModalWidgetCreateData, Omit<IWidget, "id" | "creatorUserId"> { | ||
buttons?: IModalWidgetOpenRequestDataButton[]; | ||
} | ||
|
||
export interface IModalWidgetOpenRequest extends IWidgetApiRequest { | ||
action: WidgetApiFromWidgetAction.OpenModalWidget; | ||
data: IModalWidgetOpenRequestData; | ||
} | ||
|
||
export interface IModalWidgetOpenResponse extends IWidgetApiResponse { | ||
response: IWidgetApiAcknowledgeResponseData; | ||
} | ||
|
||
// Types for a modal widget receiving notifications that its buttons have been pressed | ||
export interface IModalWidgetButtonClickedRequestData extends IWidgetApiRequestData { | ||
id: IModalWidgetOpenRequestDataButton["id"]; | ||
} | ||
|
||
export interface IModalWidgetButtonClickedRequest extends IWidgetApiRequest { | ||
action: WidgetApiToWidgetAction.ButtonClicked; | ||
data: IModalWidgetButtonClickedRequestData; | ||
} | ||
|
||
export interface IModalWidgetButtonClickedResponse extends IWidgetApiResponse { | ||
response: IWidgetApiAcknowledgeResponseData; | ||
} | ||
|
||
// Types for a modal widget requesting close | ||
export interface IModalWidgetCloseRequest extends IWidgetApiRequest { | ||
action: WidgetApiFromWidgetAction.CloseModalWidget; | ||
data: IModalWidgetReturnData; | ||
} | ||
|
||
export interface IModalWidgetCloseResponse extends IWidgetApiResponse { | ||
response: IWidgetApiAcknowledgeResponseData; | ||
} | ||
|
||
// Types for a normal widget being notified that the modal widget it opened has been closed | ||
export interface IModalWidgetCloseNotificationRequest extends IWidgetApiRequest { | ||
action: WidgetApiToWidgetAction.CloseModalWidget; | ||
data: IModalWidgetReturnData; | ||
} | ||
|
||
export interface IModalWidgetCloseNotificationResponse extends IWidgetApiResponse { | ||
response: IWidgetApiAcknowledgeResponseData; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright 2020 The Matrix.org Foundation C.I.C. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { IWidgetApiRequest } from "./IWidgetApiRequest"; | ||
import { WidgetApiToWidgetAction } from "./WidgetApiAction"; | ||
import { IWidgetApiAcknowledgeResponseData, IWidgetApiResponse } from "./IWidgetApiResponse"; | ||
import { IModalWidgetOpenRequestData } from "./ModalWidgetActions"; | ||
|
||
export interface IWidgetConfigRequest extends IWidgetApiRequest { | ||
action: WidgetApiToWidgetAction.WidgetConfig; | ||
data: IModalWidgetOpenRequestData; | ||
} | ||
|
||
export interface IWidgetConfigResponse extends IWidgetApiResponse { | ||
response: IWidgetApiAcknowledgeResponseData; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.