Add bot-driven room app UI via im.paarrot.ui state.
Trigger cinny-mobile / dispatch (push) Successful in 2s
Trigger cinny-mobile / dispatch (push) Successful in 2s
Bots can publish a declarative panel UI that takes over a room; user actions are sent as im.paarrot.ui.action timeline events.
This commit is contained in:
@@ -48,6 +48,9 @@ export enum StateEvent {
|
||||
/** Paarrot room classification marker for custom room behaviors */
|
||||
PaarrotRoomKind = 'im.paarrot.room.kind',
|
||||
|
||||
/** Bot-driven declarative room UI (takes over room view) */
|
||||
PaarrotUi = 'im.paarrot.ui',
|
||||
|
||||
/** Matrix RTC call membership (MSC3401) */
|
||||
CallMember = 'org.matrix.msc3401.call.member',
|
||||
}
|
||||
@@ -61,8 +64,114 @@ export enum MessageEvent {
|
||||
|
||||
/** Relay emoji confetti burst tied to a target message */
|
||||
RelayEmojiConfetti = 'app.relay.emoji_confetti',
|
||||
|
||||
/** User interaction with bot-driven room UI (im.paarrot.ui) */
|
||||
PaarrotUiAction = 'im.paarrot.ui.action',
|
||||
}
|
||||
|
||||
/** Declarative UI node types for im.paarrot.ui */
|
||||
export type PaarrotUiNodeType =
|
||||
| 'panel'
|
||||
| 'row'
|
||||
| 'text'
|
||||
| 'button'
|
||||
| 'input'
|
||||
| 'select'
|
||||
| 'image'
|
||||
| 'spacer';
|
||||
|
||||
export type PaarrotUiNodeBase = {
|
||||
type: PaarrotUiNodeType;
|
||||
id: string;
|
||||
};
|
||||
|
||||
export type PaarrotUiPanelNode = PaarrotUiNodeBase & {
|
||||
type: 'panel';
|
||||
children?: PaarrotUiNode[];
|
||||
};
|
||||
|
||||
export type PaarrotUiRowNode = PaarrotUiNodeBase & {
|
||||
type: 'row';
|
||||
children?: PaarrotUiNode[];
|
||||
};
|
||||
|
||||
export type PaarrotUiTextNode = PaarrotUiNodeBase & {
|
||||
type: 'text';
|
||||
text?: string;
|
||||
className?: string;
|
||||
};
|
||||
|
||||
export type PaarrotUiButtonNode = PaarrotUiNodeBase & {
|
||||
type: 'button';
|
||||
label: string;
|
||||
action: string;
|
||||
value?: string | number | boolean;
|
||||
disabled?: boolean;
|
||||
variant?: 'Primary' | 'Secondary' | 'Success' | 'Warning' | 'Critical';
|
||||
};
|
||||
|
||||
export type PaarrotUiInputNode = PaarrotUiNodeBase & {
|
||||
type: 'input';
|
||||
name?: string;
|
||||
label?: string;
|
||||
placeholder?: string;
|
||||
value?: string;
|
||||
inputType?: 'text' | 'number' | 'password';
|
||||
};
|
||||
|
||||
export type PaarrotUiSelectOption = {
|
||||
label: string;
|
||||
value: string;
|
||||
};
|
||||
|
||||
export type PaarrotUiSelectNode = PaarrotUiNodeBase & {
|
||||
type: 'select';
|
||||
name?: string;
|
||||
label?: string;
|
||||
options?: PaarrotUiSelectOption[];
|
||||
value?: string;
|
||||
};
|
||||
|
||||
export type PaarrotUiImageNode = PaarrotUiNodeBase & {
|
||||
type: 'image';
|
||||
src: string;
|
||||
alt?: string;
|
||||
width?: number;
|
||||
height?: number;
|
||||
};
|
||||
|
||||
export type PaarrotUiSpacerNode = PaarrotUiNodeBase & {
|
||||
type: 'spacer';
|
||||
size?: number;
|
||||
};
|
||||
|
||||
export type PaarrotUiNode =
|
||||
| PaarrotUiPanelNode
|
||||
| PaarrotUiRowNode
|
||||
| PaarrotUiTextNode
|
||||
| PaarrotUiButtonNode
|
||||
| PaarrotUiInputNode
|
||||
| PaarrotUiSelectNode
|
||||
| PaarrotUiImageNode
|
||||
| PaarrotUiSpacerNode;
|
||||
|
||||
/** Content of state event im.paarrot.ui */
|
||||
export type PaarrotUiContent = {
|
||||
version: number;
|
||||
title?: string;
|
||||
css?: string;
|
||||
root: PaarrotUiNode;
|
||||
};
|
||||
|
||||
/** Content of timeline event im.paarrot.ui.action */
|
||||
export type PaarrotUiActionContent = {
|
||||
action: string;
|
||||
component_id: string;
|
||||
value?: string | number | boolean;
|
||||
values?: Record<string, string>;
|
||||
ui_event_id?: string;
|
||||
};
|
||||
|
||||
export enum RoomType {
|
||||
Space = 'm.space',
|
||||
Forum = 'm.forum',
|
||||
|
||||
Reference in New Issue
Block a user