Files
client/native/ui/shell.slint
T
bit9992 87265a3e75
android-ci / android-arm64 (push) Successful in 17m10s
Implement Android Room UI and customizable palette
2026-11-15 12:32:59 +03:00

644 lines
47 KiB
Plaintext

import { ScrollView, ListView, Slider } from "std-widgets.slint";
import { Theme } from "theme.slint";
import { ActionButton, TextField, Choice, RoomIcon, RoomIconButton } from "controls.slint";
import { ChatScreen } from "chat.slint";
import { SettingsScreen, SettingsBridge } from "settings.slint";
export struct ShellRow { id: string, title: string, subtitle: string, depth: int, selected: bool, expanded: bool, expandable: bool, talking: bool, muted: bool, unread: string, disclosure: string }
export struct ShellTab { id: string, title: string, selected: bool, microphone-owner: bool, connected: bool, unread: string }
export struct ShellCommand { id: string, label: string, enabled: bool, reason: string, destructive: bool }
export struct ShellInfo { label: string, value: string }
export struct ShellStream { id: string, title: string, status: string, frame: image, has-frame: bool, has-volume: bool, volume: float, actions: [ShellCommand] }
export global ShellBridge {
in-out property <[ShellTab]> tabs;
in-out property <[ShellRow]> tree;
in-out property <[ShellRow]> bookmarks;
in-out property <[ShellRow]> contacts;
in-out property <[ShellRow]> entries;
in-out property <[ShellInfo]> info;
in-out property <[ShellCommand]> actions;
in-out property <[ShellCommand]> detail-actions;
in-out property <[ShellCommand]> menu-actions;
in-out property <[ShellStream]> streams;
in-out property <[string]> destinations;
in-out property <[string]> connection-names;
in-out property <int> selected-connection: -1;
in-out property <ShellCommand> primary-action;
in-out property <int> destination;
in-out property <int> depth;
in-out property <int> stage;
in-out property <string> title;
in-out property <string> subtitle;
in-out property <string> description;
in-out property <string> status;
in-out property <string> error;
in-out property <string> detail-error;
in-out property <bool> loading;
in-out property <bool> detail-loading;
in-out property <bool> menu-visible;
in-out property <string> menu-title;
in-out property <bool> has-voice;
in-out property <bool> muted;
in-out property <bool> deafened;
in-out property <bool> transmitting;
in-out property <bool> ptt-enabled;
in-out property <string> voice-title;
in-out property <string> voice-status;
in-out property <bool> searchable;
in-out property <string> search;
in-out property <bool> has-previous;
in-out property <bool> has-next;
in-out property <string> label-back;
in-out property <string> label-more;
in-out property <string> label-close;
in-out property <string> label-loading;
in-out property <string> label-empty;
in-out property <string> label-tree-empty;
in-out property <string> label-stream-empty;
in-out property <string> label-stream-waiting;
in-out property <string> label-mute;
in-out property <string> label-deafen;
in-out property <string> label-ptt;
in-out property <string> label-bookmarks;
in-out property <string> label-search;
in-out property <string> label-next;
in-out property <string> label-previous;
in-out property <string> label-volume;
in-out property <string> label-resize;
in-out property <[string]> stages;
in-out property <length> sidebar-width: 270px;
in-out property <length> server-width: 500px;
in-out property <[ShellRow]> participants;
in-out property <[ShellStream]> room-streams;
in-out property <bool> room-connected;
in-out property <int> room-page;
in-out property <string> room-title;
in-out property <string> room-server;
in-out property <string> room-caption;
in-out property <[string]> room-destinations;
in-out property <[string]> room-labels;
in-out property <ShellCommand> room-disconnect;
callback room-navigate(int);
callback navigate(int);
callback back();
callback select(string);
callback expand(string);
callback context(string);
callback menu();
callback close-menu();
callback invoke(string);
callback row-press(string,bool);
callback voice(int);
callback held(bool);
callback search-edited(string);
callback page(bool);
in-out property <string> fullscreen-stream;
callback stream-volume(string,float);
callback resized(float,float);
}
component EntryRow inherits Rectangle {
in property <ShellRow> item;
property <length> indent: Theme.android ? min(item.depth * 14px, max(0px, self.width - 220px)) : item.depth * 14px;
height: max(44px, Theme.touch-target);
border-radius: 9px;
background: item.selected ? Theme.contrast : (touch.has-hover ? Theme.bg : transparent);
border-width: item.selected || focus.has-focus ? 1.5px : 0px;
border-color: Theme.tint;
accessible-role: list-item;
accessible-label: item.title + ". " + item.subtitle;
accessible-item-selectable: true;
accessible-item-selected: item.selected;
accessible-expandable: item.expandable;
accessible-expanded: item.expanded;
accessible-action-expand => { if root.item.expandable { ShellBridge.expand(root.item.id); } }
accessible-action-default => { ShellBridge.select(root.item.id); }
HorizontalLayout {
padding-left: 10px + root.indent; padding-right: 4px; spacing: 8px;
if root.item.expandable: ActionButton { width: Theme.android ? 48px : 44px; text: root.item.expanded ? ShellBridge.label-close : ShellBridge.label-more; clicked => { ShellBridge.expand(root.item.id); } }
Rectangle { width: 6px; height: 6px; border-radius: 3px; background: root.item.talking ? Theme.success : (root.item.muted ? Theme.error : Theme.muted); }
VerticalLayout {
spacing: 0px; alignment: center;
Text { text: root.item.title; color: Theme.fg; font-size: Theme.font-size; overflow: elide; }
if root.item.subtitle != "": Text { text: root.item.subtitle; color: Theme.muted; font-size: Theme.font-size * 0.86; overflow: elide; }
}
if root.item.unread != "": Text { text: root.item.unread; color: Theme.tint; vertical-alignment: center; }
ActionButton { text: ShellBridge.label-more; width: 70px; clicked => { ShellBridge.context(root.item.id); } }
}
focus := FocusScope { key-pressed(e) => { if e.text == "\n" { ShellBridge.select(root.item.id); return accept; } if e.text == Key.F10 && e.modifiers.shift { ShellBridge.context(root.item.id); return accept; } return reject; } }
// Explicit overflow is always available on touch; right click never selects a row.
touch := TouchArea {
x: root.item.expandable ? 10px + (Theme.android ? 48px : 44px) + root.indent : 0px;
width: max(0px,parent.width - self.x - 78px);
clicked => { focus.focus(); ShellBridge.select(root.item.id); }
pointer-event(e) => {
if e.button == PointerEventButton.right && e.kind == PointerEventKind.down { ShellBridge.context(root.item.id); }
if e.button == PointerEventButton.left && e.kind == PointerEventKind.down { ShellBridge.row-press(root.item.id,true); }
if e.kind == PointerEventKind.up || e.kind == PointerEventKind.cancel { ShellBridge.row-press(root.item.id,false); }
if e.kind == PointerEventKind.move && (abs((self.mouse-x - self.pressed-x)/1px)>8 || abs((self.mouse-y - self.pressed-y)/1px)>8) { ShellBridge.row-press(root.item.id,false); }
}
}
}
component CommandList inherits VerticalLayout {
in property <[ShellCommand]> commands;
spacing: Theme.android ? 8px : 4px;
for command in root.commands: VerticalLayout {
ActionButton { text: command.label; enabled: command.enabled; destructive: command.destructive; clicked => { ShellBridge.invoke(command.id); } }
if command.reason != "": Text { text: command.reason; color: Theme.muted; wrap: word-wrap; }
}
}
component StreamTile inherits Rectangle {
in property <ShellStream> item;
min-height: Theme.android ? stream-content.preferred-height : 230px;
vertical-stretch: Theme.android ? 0 : 1;
background: Theme.contrast;
border-radius: 8px;
border-width: 2px;
border-color: Theme.bg;
stream-content := VerticalLayout {
padding: 8px; spacing: 4px;
Text { text: root.item.title; color: Theme.fg; overflow: Theme.android ? clip : elide; wrap: Theme.android ? word-wrap : no-wrap; }
if !Theme.android || root.item.has-frame || root.item.has-volume: Rectangle {
min-height: Theme.android ? max(100px,root.width * 0.5625) : 150px;
if root.item.has-frame: Image { source: root.item.frame; image-fit: contain; }
if !root.item.has-frame: Text { text: root.item.status != "" ? root.item.status : ShellBridge.label-stream-waiting; color: Theme.muted; horizontal-alignment: center; vertical-alignment: center; wrap: word-wrap; }
}
Text { text: root.item.status; color: Theme.muted; overflow: Theme.android ? clip : elide; wrap: Theme.android ? word-wrap : no-wrap; }
if !Theme.android || root.item.has-volume: Slider { min-height: Theme.android ? 48px : 0px; minimum: 0; maximum: 2; value: root.item.volume; accessible-label: ShellBridge.label-volume; changed(value) => { ShellBridge.stream-volume(root.item.id,value); } }
CommandList { commands: root.item.actions; }
}
}
// Touch navigation is structurally separate from the desktop's three fixed slots.
component PhoneIconAction inherits Rectangle {
in property <int> kind;
in property <string> label;
in property <bool> enabled: true;
callback clicked();
width: 48px; min-height: 48px; vertical-stretch: 0;
background: icon-touch.has-hover || icon-focus.has-focus ? Theme.bg : transparent;
border-radius: 8px; border-width: icon-focus.has-focus ? 2px : 0px; border-color: Theme.outline;
opacity: enabled ? 1 : 0.45;
accessible-role: button; accessible-label: label; accessible-enabled: enabled;
accessible-action-default => { if root.enabled { root.clicked(); } }
if root.kind == 0: HorizontalLayout { padding: 15px; spacing: 3px; for dot in 3: Rectangle { width: 4px; height: 4px; border-radius: 2px; background: Theme.fg; } }
if root.kind == 1: Path { x: 12px; y: (parent.height - 24px)/2; width: 24px; height: 24px; commands: "M 15 4 L 7 12 L 15 20 M 7 12 L 22 12"; fill: transparent; stroke: Theme.fg; stroke-width: 2px; }
if root.kind == 2: Path { x: 12px; y: (parent.height - 24px)/2; width: 24px; height: 24px; commands: "M 8 4 L 16 12 L 8 20"; fill: transparent; stroke: Theme.fg; stroke-width: 2px; }
if root.kind == 3: Path { x: 12px; y: (parent.height - 24px)/2; width: 24px; height: 24px; commands: "M 4 8 L 12 16 L 20 8"; fill: transparent; stroke: Theme.fg; stroke-width: 2px; }
icon-focus := FocusScope { enabled: root.enabled; key-pressed(e) => { if e.text == "\n" || e.text == " " { root.clicked(); return accept; } return reject; } }
icon-touch := TouchArea { enabled: root.enabled; clicked => { icon-focus.focus(); root.clicked(); } }
}
component PhoneEntryRow inherits Rectangle {
in property <ShellRow> item;
min-width: 0px;
property <length> indent: min(item.depth * 12px, 48px);
min-height: max(48px, row-content.preferred-height); preferred-height: self.min-height; vertical-stretch: 0;
background: item.selected ? Theme.contrast : transparent;
border-radius: 9px; border-width: item.selected || row-focus.has-focus ? 1.5px : 0px; border-color: Theme.tint;
accessible-role: list-item; accessible-label: item.title + ". " + item.subtitle;
accessible-item-selectable: true; accessible-item-selected: item.selected;
accessible-expandable: item.expandable; accessible-expanded: item.expanded;
accessible-action-default => { ShellBridge.select(root.item.id); }
accessible-action-expand => { if root.item.expandable { ShellBridge.expand(root.item.id); } }
row-content := HorizontalLayout { padding-left: root.indent; spacing: 8px;
if root.item.expandable: PhoneIconAction { kind: root.item.expanded ? 3 : 2; label: root.item.disclosure; clicked => { ShellBridge.expand(root.item.id); } }
Rectangle { width: 6px; height: 6px; border-radius: 3px; background: root.item.talking ? Theme.success : (root.item.muted ? Theme.error : Theme.muted); }
VerticalLayout { padding-top: 8px; padding-bottom: 8px; spacing: 2px; alignment: center; horizontal-stretch: 1;
Text { min-width: 0px; text: root.item.title; color: Theme.fg; font-size: Theme.font-size; wrap: word-wrap; }
if root.item.subtitle != "": Text { min-width: 0px; text: root.item.subtitle; color: Theme.muted; font-size: Theme.font-size * 0.86; wrap: word-wrap; }
}
if root.item.unread != "": Text { text: root.item.unread; color: Theme.tint; vertical-alignment: center; }
PhoneIconAction { kind: 0; label: ShellBridge.label-more + ": " + root.item.title; clicked => { ShellBridge.context(root.item.id); } }
}
row-focus := FocusScope { key-pressed(e) => { if e.text == "\n" { ShellBridge.select(root.item.id); return accept; } if e.text == Key.F10 && e.modifiers.shift { ShellBridge.context(root.item.id); return accept; } return reject; } }
TouchArea {
x: root.indent + (root.item.expandable ? 56px : 0px); width: max(0px,parent.width - self.x - 56px);
clicked => { row-focus.focus(); ShellBridge.select(root.item.id); }
pointer-event(e) => {
if e.button == PointerEventButton.right && e.kind == PointerEventKind.down { ShellBridge.context(root.item.id); }
if e.button == PointerEventButton.left && e.kind == PointerEventKind.down { ShellBridge.row-press(root.item.id,true); }
if e.kind == PointerEventKind.up || e.kind == PointerEventKind.cancel { ShellBridge.row-press(root.item.id,false); }
if e.kind == PointerEventKind.move && (abs((self.mouse-x - self.pressed-x)/1px)>8 || abs((self.mouse-y - self.pressed-y)/1px)>8) { ShellBridge.row-press(root.item.id,false); }
}
}
}
component PhoneServerList inherits Rectangle {
background: Theme.bg; min-width: 0px; min-height: 0px;
VerticalLayout { spacing: 8px; padding: 8px;
if ShellBridge.primary-action.id != "": ActionButton { text: ShellBridge.primary-action.label; primary: true; enabled: ShellBridge.primary-action.enabled; clicked => { ShellBridge.invoke(ShellBridge.primary-action.id); } }
if ShellBridge.tabs.length > 0: HorizontalLayout { spacing: 8px; vertical-stretch: 0;
Choice { horizontal-stretch: 1; values: ShellBridge.connection-names; current-index: ShellBridge.selected-connection; label: ShellBridge.destinations[0]; selected(index) => { if index >= 0 && index < ShellBridge.tabs.length { ShellBridge.select(ShellBridge.tabs[index].id); } } }
PhoneIconAction { kind: 0; label: ShellBridge.label-more; enabled: ShellBridge.selected-connection >= 0; clicked => { ShellBridge.context(ShellBridge.tabs[ShellBridge.selected-connection].id); } }
}
if ShellBridge.bookmarks.length > 0 && ShellBridge.room-page != 6: ActionButton { text: ShellBridge.label-bookmarks; clicked => { ShellBridge.room-navigate(6); } }
if ShellBridge.tree.length > 0 && ShellBridge.room-page != 6: ListView { min-height: 0px; vertical-stretch: 1; for item in ShellBridge.tree: PhoneEntryRow { item: item; } }
if ShellBridge.tree.length == 0 || ShellBridge.room-page == 6: ScrollView { min-height: 0px; vertical-stretch: 1;
VerticalLayout { spacing: 8px;
if ShellBridge.tree.length == 0: Text { text: ShellBridge.label-tree-empty; color: Theme.muted; wrap: word-wrap; }
if ShellBridge.bookmarks.length > 0: Text { text: ShellBridge.label-bookmarks; color: Theme.fg; font-weight: 600; wrap: word-wrap; }
for item in ShellBridge.bookmarks: PhoneEntryRow { item: item; }
}
}
}
}
component PhoneDetail inherits Rectangle {
in property <bool> typing;
preferred-width: 0px; horizontal-stretch: 1;
min-width: 0px; min-height: 0px; background: Theme.shaded;
VerticalLayout { spacing: 4px;
if ShellBridge.destination == 1: ChatScreen { min-height: 0px; }
if ShellBridge.room-page == 5 && ShellBridge.destination != 1: ScrollView { min-height: 0px; vertical-stretch: 1;
VerticalLayout { padding: 8px; spacing: 12px;
if ShellBridge.streams.length == 0: Text { text: ShellBridge.label-stream-empty; color: Theme.muted; wrap: word-wrap; }
for stream in ShellBridge.streams: StreamTile { item: stream; }
CommandList { commands: ShellBridge.detail-actions; }
}
}
if ShellBridge.room-page != 5 && ShellBridge.destination != 1: VerticalLayout { spacing: 8px;
if ShellBridge.searchable: TextField { text: ShellBridge.search; placeholder: ShellBridge.label-search; edited(value) => { ShellBridge.search-edited(value); } }
ScrollView { min-height: 0px; vertical-stretch: 1;
VerticalLayout { padding: 8px; spacing: 12px;
if ShellBridge.detail-loading: Text { text: ShellBridge.label-loading; color: Theme.muted; wrap: word-wrap; }
if ShellBridge.detail-error != "": Text { text: ShellBridge.detail-error; color: Theme.error; wrap: word-wrap; }
if ShellBridge.subtitle != "": Text { text: ShellBridge.subtitle; color: Theme.muted; wrap: word-wrap; }
if ShellBridge.description != "": Text { text: ShellBridge.description; color: Theme.fg; wrap: word-wrap; }
for row in ShellBridge.info: VerticalLayout { spacing: 4px; Text { text: row.label; color: Theme.muted; wrap: word-wrap; } Text { text: row.value; color: Theme.fg; wrap: word-wrap; } }
CommandList { commands: ShellBridge.detail-actions; }
for item in ShellBridge.entries: PhoneEntryRow { item: item; }
if ShellBridge.has-previous || ShellBridge.has-next: HorizontalLayout { spacing: 8px;
ActionButton { min-width: 48px; horizontal-stretch: 1; text: ShellBridge.label-previous; enabled: ShellBridge.has-previous; clicked => { ShellBridge.page(false); } }
ActionButton { min-width: 48px; horizontal-stretch: 1; text: ShellBridge.label-next; enabled: ShellBridge.has-next; clicked => { ShellBridge.page(true); } }
}
}
}
}
}
}
component RoomNavigation inherits Rectangle {
in property <int> index;
property <bool> selected: ShellBridge.room-page == index || (index == 0 && ShellBridge.room-page == 5) || (index == 1 && ShellBridge.room-page == 6) || (index == 3 && ShellBridge.room-page == 4);
min-width: 48px; min-height: max(64px, nav-content.preferred-height); vertical-stretch: 0;
background: transparent;
accessible-role: tab; accessible-label: ShellBridge.room-destinations[index]; accessible-item-selected: selected;
accessible-action-default => { ShellBridge.room-navigate(root.index); }
nav-content := VerticalLayout { padding: 8px; spacing: 4px; alignment: center;
Rectangle { width: 56px; height: 28px; border-radius: 14px; background: root.selected ? Theme.contrast : transparent;
RoomIcon { x: (parent.width - self.width)/2; y: 2px; name: root.index == 0 ? "headphones" : root.index == 1 ? "server" : root.index == 2 ? "chat" : "user"; ink: root.selected ? Theme.tint-text : Theme.muted; }
}
Text { text: ShellBridge.room-destinations[root.index]; color: root.selected ? Theme.tint-text : Theme.fg; font-size: Theme.font-size * 0.86; font-weight: root.selected ? 700 : 400; horizontal-alignment: center; wrap: word-wrap; }
}
border-width: nav-focus.has-focus ? 2px : 0px; border-color: Theme.outline; border-radius: 12px;
nav-focus := FocusScope { key-pressed(e) => { if e.text == "\n" || e.text == " " { ShellBridge.room-navigate(root.index); return accept; } return reject; } }
TouchArea { clicked => { nav-focus.focus(); ShellBridge.room-navigate(root.index); } }
}
component RoomParticipant inherits Rectangle {
in property <ShellRow> item;
min-width: 0px; min-height: max(136px, person-content.preferred-height); preferred-height: self.min-height; vertical-stretch: 0;
background: transparent; border-radius: 12px; border-width: person-focus.has-focus ? 2px : 0px; border-color: Theme.outline;
accessible-role: button; accessible-label: item.title + ". " + item.subtitle + ". " + ShellBridge.label-more;
accessible-action-default => { ShellBridge.context(root.item.id); }
person-content := VerticalLayout { padding: 8px; spacing: 8px; alignment: start;
Rectangle { width: 68px; height: 68px; border-radius: 34px;
background: root.item.talking ? Theme.success.with-alpha(0.14) : Theme.bg;
border-width: root.item.talking ? 2px : 0px; border-color: Theme.success;
RoomIcon { x: 18px; y: 18px; width: 32px; height: 32px; name: root.item.muted ? "mic-off" : "user"; ink: root.item.talking ? Theme.success : (root.item.muted ? Theme.error : Theme.fg); }
}
Text { min-width: 0px; text: root.item.title; color: Theme.fg; font-size: Theme.font-size; font-weight: 600; horizontal-alignment: center; wrap: word-wrap; }
Text { min-width: 0px; text: root.item.subtitle; color: root.item.talking ? Theme.success : Theme.muted; font-size: Theme.font-size * 0.86; horizontal-alignment: center; wrap: word-wrap; }
}
person-focus := FocusScope { key-pressed(e) => { if e.text == "\n" || e.text == " " { ShellBridge.context(root.item.id); return accept; } return reject; } }
TouchArea { clicked => { person-focus.focus(); ShellBridge.context(root.item.id); } }
}
component RoomView inherits Rectangle {
min-width: 0px; min-height: 0px; background: Theme.shaded;
property <int> columns: self.width < 360px || Theme.font-size > 18px ? 2 : 3;
ScrollView { min-height: 0px;
VerticalLayout { padding: 16px; spacing: 24px;
VerticalLayout { padding-top: 24px; padding-bottom: 8px; spacing: 8px;
if ShellBridge.room-server != "": Text { text: ShellBridge.room-server; color: Theme.muted; horizontal-alignment: center; wrap: word-wrap; }
Text { text: ShellBridge.room-title != "" ? ShellBridge.room-title : ShellBridge.room-destinations[0]; color: Theme.fg; font-size: Theme.font-size * 2; font-weight: 700; horizontal-alignment: center; wrap: word-wrap; }
Text { text: ShellBridge.room-connected ? ShellBridge.room-caption : ShellBridge.room-labels[9]; color: Theme.muted; horizontal-alignment: center; wrap: word-wrap; }
HorizontalLayout { alignment: center; ActionButton { text: ShellBridge.room-labels[0]; clicked => { ShellBridge.room-navigate(1); } } }
}
VerticalLayout { spacing: 16px;
for row in ceil(ShellBridge.participants.length / root.columns): HorizontalLayout { spacing: 8px;
for column in root.columns: Rectangle { min-width: 0px; horizontal-stretch: 1; min-height: person.preferred-height;
person := RoomParticipant { visible: row * root.columns + column < ShellBridge.participants.length; item: ShellBridge.participants[row * root.columns + column]; }
}
}
}
for stream in ShellBridge.room-streams: Rectangle { min-height: max(64px,invite.preferred-height); preferred-height: self.min-height; vertical-stretch: 0; border-radius: 16px; background: Theme.bg;
invite := HorizontalLayout { padding: 12px; spacing: 12px;
RoomIcon { name: "screen"; ink: Theme.tint-text; }
VerticalLayout { horizontal-stretch: 1; spacing: 4px;
Text { text: stream.title; color: Theme.fg; font-weight: 600; wrap: word-wrap; }
Text { text: stream.status; color: Theme.muted; wrap: word-wrap; }
}
RoomIconButton { icon: "chevron"; label: ShellBridge.room-labels[10] + ": " + stream.title; clicked => { ShellBridge.room-navigate(5); } }
}
}
ActionButton { text: ShellBridge.room-labels[1]; clicked => { ShellBridge.room-navigate(2); } }
}
}
}
component RoomVoiceToggle inherits Rectangle {
in property <int> kind;
property <bool> active: kind == 0 ? !ShellBridge.muted : !ShellBridge.deafened;
property <string> label: kind == 0 ? (active ? ShellBridge.room-labels[4] : ShellBridge.room-labels[5]) : (active ? ShellBridge.room-labels[6] : ShellBridge.room-labels[7]);
min-width: 48px; min-height: max(48px, toggle-content.preferred-height); preferred-height: self.min-height; vertical-stretch: 0;
background: active ? Theme.bg : Theme.error.with-alpha(0.14); border-radius: 24px;
accessible-role: button; accessible-label: label; accessible-action-default => { ShellBridge.voice(root.kind); }
toggle-content := HorizontalLayout { padding: 12px; spacing: 8px;
RoomIcon { name: root.kind == 0 ? (root.active ? "mic" : "mic-off") : (root.active ? "headphones" : "sound-off"); ink: root.active ? Theme.success : Theme.error; }
Text { min-width: 0px; text: root.label; color: root.active ? Theme.success : Theme.error; font-size: Theme.font-size * 0.86; font-weight: 600; wrap: word-wrap; vertical-alignment: center; }
}
border-width: toggle-focus.has-focus ? 2px : 0px; border-color: Theme.outline;
toggle-focus := FocusScope { key-pressed(e) => { if e.text == "\n" || e.text == " " { ShellBridge.voice(root.kind); return accept; } return reject; } }
TouchArea { clicked => { toggle-focus.focus(); ShellBridge.voice(root.kind); } }
}
component PhoneVoice inherits Rectangle {
in property <bool> typing;
background: Theme.contrast; border-radius: 16px;
min-height: voice-content.preferred-height; preferred-height: self.min-height; vertical-stretch: 0;
voice-content := VerticalLayout { padding: 12px; spacing: 8px;
if !root.typing: HorizontalLayout { spacing: 8px;
RoomIcon { name: "headphones"; ink: ShellBridge.deafened ? Theme.error : Theme.success; }
VerticalLayout { horizontal-stretch: 1; spacing: 2px;
Text { text: ShellBridge.voice-title; color: Theme.fg; font-size: Theme.font-size * 0.86; font-weight: 600; wrap: word-wrap; }
Text { text: ShellBridge.voice-status; color: ShellBridge.transmitting ? Theme.success : Theme.muted; font-size: Theme.font-size * 0.86; wrap: word-wrap; }
}
if ShellBridge.room-disconnect.id != "": RoomIconButton { icon: "leave"; label: ShellBridge.room-labels[8] + ": " + ShellBridge.voice-title; enabled: ShellBridge.room-disconnect.enabled; clicked => { ShellBridge.invoke(ShellBridge.room-disconnect.id); } }
}
HorizontalLayout { spacing: 8px;
if !ShellBridge.ptt-enabled: RoomVoiceToggle { horizontal-stretch: 1; kind: 0; }
if ShellBridge.ptt-enabled: Rectangle {
min-width: 48px; horizontal-stretch: 1; min-height: max(48px,hold-label.preferred-height + 16px); background: ShellBridge.transmitting ? Theme.tint : Theme.bg; border-radius: 24px;
accessible-role: button; accessible-label: ShellBridge.label-ptt;
border-width: hold-focus.has-focus ? 2px : 0px; border-color: Theme.outline;
hold-label := Text { text: ShellBridge.label-ptt; color: ShellBridge.transmitting ? Theme.on-tint : Theme.fg; vertical-alignment: center; horizontal-alignment: center; wrap: word-wrap; }
hold-focus := FocusScope {
changed has-focus => { if !self.has-focus { ShellBridge.held(false); } }
key-pressed(e) => { if e.text == " " || e.text == Key.Return { ShellBridge.held(true); return accept; } return reject; }
key-released(e) => { if e.text == " " || e.text == Key.Return { ShellBridge.held(false); return accept; } return reject; }
}
hold := TouchArea {
pointer-event(e) => { if e.button == PointerEventButton.left && e.kind == PointerEventKind.down { hold-focus.focus(); ShellBridge.held(true); } else if e.kind == PointerEventKind.up || e.kind == PointerEventKind.cancel { ShellBridge.held(false); } }
moved => { if self.pressed && (self.mouse-x < 0px || self.mouse-y < 0px || self.mouse-x > self.width || self.mouse-y > self.height) { ShellBridge.held(false); } }
}
}
RoomVoiceToggle { horizontal-stretch: 1; kind: 1; }
}
}
}
component AndroidShell inherits Rectangle {
property <bool> compact: self.width < 600px;
property <bool> split: self.width >= 840px && !typing;
property <bool> typing: Theme.ime-inset > 0px;
property <length> content-width: max(0px, self.width - (!compact && !typing ? 104px : 0px));
property <string> header: ShellBridge.depth > 0 ? ShellBridge.title : ShellBridge.room-page == 0 ? "TeamsPeach" : ShellBridge.room-page == 1 ? ShellBridge.room-destinations[1] : ShellBridge.room-page == 2 ? ShellBridge.room-title : ShellBridge.room-page == 3 ? (SettingsBridge.panel-open ? SettingsBridge.title : ShellBridge.room-labels[11]) : ShellBridge.room-page == 4 ? ShellBridge.destinations[2] : ShellBridge.room-page == 5 ? ShellBridge.room-labels[10] : ShellBridge.label-bookmarks;
VerticalLayout { spacing: 0px;
if !root.typing: Rectangle { background: Theme.shaded; min-height: app-bar.preferred-height; preferred-height: self.min-height; vertical-stretch: 0;
app-bar := HorizontalLayout { padding: 8px; spacing: 8px;
if ShellBridge.depth > 0 || ShellBridge.room-page != 0: RoomIconButton { icon: "back"; label: ShellBridge.label-back; clicked => { ShellBridge.back(); } }
Text { min-width: 0px; text: root.header; color: Theme.fg; font-size: Theme.font-size * 1.2; font-weight: 700; overflow: elide; horizontal-stretch: 1; vertical-alignment: center; }
RoomIconButton { icon: "more"; label: ShellBridge.label-more; clicked => { ShellBridge.menu(); } }
}
}
if ShellBridge.error != "": Text { text: ShellBridge.error; color: Theme.error; wrap: word-wrap; }
if ShellBridge.loading: Text { text: ShellBridge.label-loading; color: Theme.muted; }
HorizontalLayout { spacing: 0px; min-height: 0px; vertical-stretch: 1;
if !root.compact && !root.typing: Rectangle { width: 104px; background: Theme.header;
ScrollView { VerticalLayout { padding: 8px; spacing: 8px; for index in 4: RoomNavigation { index: index; } } }
}
if ShellBridge.room-page == 3: SettingsScreen { min-width: 0px; min-height: 0px; }
if ShellBridge.room-page == 4 && (root.split || ShellBridge.depth == 0): ScrollView { min-height: 0px; width: root.split ? root.content-width * 0.35 : root.content-width;
VerticalLayout { padding: 16px; spacing: 8px;
if ShellBridge.contacts.length == 0: Text { text: ShellBridge.label-empty; color: Theme.muted; wrap: word-wrap; }
for item in ShellBridge.contacts: PhoneEntryRow { item: item; }
}
}
if ShellBridge.room-page == 4 && ShellBridge.depth > 0: PhoneDetail { typing: root.typing; }
if ShellBridge.room-page == 2: ChatScreen { min-width: 0px; min-height: 0px; }
if ShellBridge.room-page == 5: PhoneDetail { typing: root.typing; }
if ShellBridge.room-page == 0: HorizontalLayout { min-width: 0px; spacing: 0px;
if root.split: PhoneServerList { width: root.content-width * 0.35; }
if ShellBridge.depth == 0: RoomView { horizontal-stretch: 1; }
if ShellBridge.depth > 0: PhoneDetail { typing: root.typing; }
}
if ShellBridge.room-page == 1 || ShellBridge.room-page == 6: HorizontalLayout { spacing: 0px; min-width: 0px;
if !root.typing && (root.split || ShellBridge.depth == 0): PhoneServerList { width: root.split ? root.content-width * 0.4 : root.content-width; }
if root.split: Rectangle { width: 1px; background: Theme.outline; }
if ShellBridge.depth > 0 || root.typing: PhoneDetail { typing: root.typing; }
if root.split && ShellBridge.depth == 0: RoomView { horizontal-stretch: 1; }
}
}
if ShellBridge.has-voice: Rectangle { min-height: dock.preferred-height + 16px; preferred-height: self.min-height; vertical-stretch: 0;
dock := PhoneVoice { x: 12px; y: 8px; width: max(0px,parent.width - 24px); typing: root.typing; }
}
if root.compact && !root.typing: Rectangle { min-height: bottom-nav.preferred-height; preferred-height: self.min-height; vertical-stretch: 0; background: Theme.header;
bottom-nav := HorizontalLayout { spacing: 8px; padding: 4px; for index in 4: RoomNavigation { horizontal-stretch: 1; index: index; } }
}
}
}
export component ShellScreen inherits Rectangle {
background: Theme.shaded;
min-width: 0px; min-height: 0px;
preferred-width: 100%; preferred-height: 100%;
property <bool> compact: self.width < 600px;
property <bool> desktop: self.width >= 1024px;
property <bool> typing: Theme.android && Theme.ime-inset > 0px;
property <length> sidebar-width <=> ShellBridge.sidebar-width;
property <length> server-width <=> ShellBridge.server-width;
property <length> actual-sidebar: desktop ? min(sidebar-width, max(62px,self.width - 515px)) : 0px;
property <length> actual-server: desktop ? min(server-width,max(220px,self.width - actual-sidebar - 295px)) : min(300px,self.width * 0.4);
property <length> main-width: max(0px, self.width - actual-sidebar - (desktop ? 4px : 0px));
property <length> detail-width: max(0px, main-width - (ShellBridge.destination == 0 && !compact ? actual-server + (desktop ? 4px : 0px) : 0px));
if !Theme.android: VerticalLayout {
spacing: 0px;
Rectangle {
height: max(44px, Theme.touch-target); background: Theme.header;
HorizontalLayout {
padding-left: 10px; padding-right: 10px; spacing: 8px;
if !root.desktop: ActionButton { text: ShellBridge.label-back; enabled: ShellBridge.depth > 0 || ShellBridge.destination != 0; clicked => { ShellBridge.back(); } }
Text { text: "TeamsPeach"; color: Theme.fg; font-weight: 600; vertical-alignment: center; }
Rectangle { horizontal-stretch: 1; }
if !root.compact && !root.desktop: HorizontalLayout {
spacing: 8px;
for label[index] in ShellBridge.destinations: ActionButton { text: label; primary: ShellBridge.destination == index; clicked => { ShellBridge.navigate(index); } }
}
ActionButton { text: ShellBridge.label-more; clicked => { ShellBridge.menu(); } }
}
}
if ShellBridge.error != "": Text { text: ShellBridge.error; color: Theme.error; wrap: word-wrap; }
if ShellBridge.loading: Text { text: ShellBridge.label-loading; color: Theme.muted; }
HorizontalLayout {
spacing: 0px;
if root.desktop: Rectangle {
width: root.actual-sidebar; background: Theme.header;
VerticalLayout {
padding: 10px; spacing: 4px;
for label[index] in ShellBridge.destinations: ActionButton { text: label; primary: ShellBridge.destination == index; clicked => { ShellBridge.navigate(index); } }
Text { text: ShellBridge.label-bookmarks; color: Theme.muted; font-size: Theme.font-size * 0.86; }
ListView { for item in ShellBridge.bookmarks: EntryRow { item: item; } }
CommandList { commands: ShellBridge.actions; }
}
}
if root.desktop: Rectangle {
width: 4px; background: split1.pressed ? Theme.tint : Theme.contrast;
accessible-role: slider; accessible-label: ShellBridge.label-resize;
split1 := TouchArea { mouse-cursor: ew-resize; moved => { if self.pressed { root.sidebar-width = clamp(root.sidebar-width + self.mouse-x - self.pressed-x,62px,420px); } } pointer-event(e) => { if e.kind == PointerEventKind.up { if root.sidebar-width < 200px { root.sidebar-width = 62px; } ShellBridge.resized(root.sidebar-width/1px,root.server-width/1px); } } }
}
if ShellBridge.destination == 3: SettingsScreen { width: root.main-width; }
if ShellBridge.destination == 2: Rectangle {
background: Theme.shaded;
VerticalLayout { padding: 12px; Text { text: ShellBridge.destinations[2]; color: Theme.fg; font-size: Theme.font-size * 1.6; font-weight: 700; } ListView { for item in ShellBridge.contacts: EntryRow { item: item; } } if ShellBridge.contacts.length == 0: Text { text: ShellBridge.label-empty; color: Theme.muted; } }
}
if ShellBridge.destination == 0 || ShellBridge.destination == 1: HorizontalLayout {
spacing: 0px;
if ShellBridge.destination == 0 && (!root.compact || ShellBridge.depth == 0): Rectangle {
width: root.compact ? root.width : root.actual-server;
background: Theme.bg;
VerticalLayout {
spacing: 0px;
ScrollView { height: Theme.touch-target; HorizontalLayout { for tab in ShellBridge.tabs: ActionButton {
text: tab.title + (tab.microphone-owner ? " · " + ShellBridge.label-mute : "") + (tab.unread != "" ? " (" + tab.unread + ")" : ""); primary: tab.selected; clicked => { ShellBridge.select(tab.id); }
} } }
if root.compact && ShellBridge.tabs.length == 0 && ShellBridge.bookmarks.length > 0: ListView { max-height: root.height; for item in ShellBridge.bookmarks: EntryRow { item: item; } }
ListView { for item in ShellBridge.tree: EntryRow { item: item; } }
if ShellBridge.tree.length == 0: Text { text: ShellBridge.label-tree-empty; color: Theme.muted; wrap: word-wrap; }
if !root.desktop: CommandList { commands: ShellBridge.actions; }
}
}
if root.desktop && ShellBridge.destination == 0: Rectangle {
width: 4px; background: split2.pressed ? Theme.tint : Theme.contrast;
accessible-role: slider; accessible-label: ShellBridge.label-resize;
split2 := TouchArea { mouse-cursor: ew-resize; moved => { if self.pressed { root.server-width = clamp(root.server-width + self.mouse-x - self.pressed-x,220px,max(220px,root.width - root.actual-sidebar - 295px)); } } pointer-event(e) => { if e.kind == PointerEventKind.up { ShellBridge.resized(root.sidebar-width/1px,root.server-width/1px); } } }
}
if !root.compact || ShellBridge.depth > 0 || ShellBridge.destination == 1: Rectangle {
background: Theme.shaded;
VerticalLayout {
spacing: 4px;
Rectangle { min-height: 71px; background: Theme.shaded;
VerticalLayout { padding: 12px; Text { text: ShellBridge.title; color: Theme.fg; font-size: Theme.font-size * 1.6; font-weight: 700; overflow: elide; } Text { text: ShellBridge.subtitle; color: Theme.muted; overflow: elide; } }
}
HorizontalLayout { for name[index] in ShellBridge.stages: ActionButton { text: name; primary: ShellBridge.stage == index; clicked => { ShellBridge.stage = index; } } }
if ShellBridge.stage == 1 || ShellBridge.destination == 1: ChatScreen { width: root.detail-width; }
if ShellBridge.stage == 2 && ShellBridge.destination != 1: ScrollView {
VerticalLayout { padding: 10px; spacing: 10px;
if ShellBridge.streams.length == 0: Text { text: ShellBridge.label-stream-empty; color: Theme.muted; wrap: word-wrap; }
for stream in ShellBridge.streams: StreamTile { item: stream; }
CommandList { commands: ShellBridge.detail-actions; }
}
}
if ShellBridge.stage == 0 && ShellBridge.destination != 1: VerticalLayout {
if ShellBridge.detail-loading: Text { text: ShellBridge.label-loading; color: Theme.muted; }
if ShellBridge.detail-error != "": Text { text: ShellBridge.detail-error; color: Theme.error; wrap: word-wrap; }
if ShellBridge.searchable: TextField { text: ShellBridge.search; placeholder: ShellBridge.label-search; edited(value) => { ShellBridge.search-edited(value); } }
ScrollView { VerticalLayout { padding: 12px; spacing: 12px;
if ShellBridge.description != "": Text { text: ShellBridge.description; color: Theme.fg; wrap: word-wrap; }
for row in ShellBridge.info: VerticalLayout { Text { text: row.label; color: Theme.muted; } Text { text: row.value; color: Theme.fg; wrap: word-wrap; } }
CommandList { commands: ShellBridge.detail-actions; }
} }
ListView { for item in ShellBridge.entries: EntryRow { item: item; } }
if ShellBridge.has-previous || ShellBridge.has-next: HorizontalLayout {
ActionButton { text: ShellBridge.label-previous; enabled: ShellBridge.has-previous; clicked => { ShellBridge.page(false); } }
ActionButton { text: ShellBridge.label-next; enabled: ShellBridge.has-next; clicked => { ShellBridge.page(true); } }
}
}
}
}
}
}
if ShellBridge.has-voice: Rectangle {
min-height: Theme.touch-target + 12px; background: Theme.contrast;
VerticalLayout {
if !root.typing: Text { text: ShellBridge.voice-title + " · " + ShellBridge.voice-status; color: ShellBridge.transmitting ? Theme.success : Theme.fg; overflow: elide; }
HorizontalLayout {
spacing: 4px;
ActionButton { min-width: 0px; horizontal-stretch: 1; text: ShellBridge.label-mute; destructive: ShellBridge.muted; clicked => { ShellBridge.voice(0); } }
ActionButton { min-width: 0px; horizontal-stretch: 1; text: ShellBridge.label-deafen; destructive: ShellBridge.deafened; clicked => { ShellBridge.voice(1); } }
Rectangle { min-height: Theme.touch-target; background: desktop-ptt.pressed ? Theme.tint : Theme.bg; border-radius: 4px; accessible-role: button; accessible-label: ShellBridge.label-ptt;
Text { text: ShellBridge.label-ptt; color: Theme.fg; vertical-alignment: center; horizontal-alignment: center; wrap: word-wrap; }
desktop-ptt := TouchArea { enabled: ShellBridge.ptt-enabled; pointer-event(e) => { if e.kind == PointerEventKind.down { ShellBridge.held(true); } else if e.kind == PointerEventKind.up || e.kind == PointerEventKind.cancel { ShellBridge.held(false); } } }
}
}
}
}
if ShellBridge.status != "": Text { text: ShellBridge.status; color: Theme.muted; overflow: elide; }
if root.compact: HorizontalLayout { for label[index] in ShellBridge.destinations: ActionButton { min-width: 0px; horizontal-stretch: 1; text: label; primary: ShellBridge.destination == index; clicked => { ShellBridge.navigate(index); } } }
}
if Theme.android: AndroidShell { }
if !Theme.android && ShellBridge.fullscreen-stream != "": Rectangle {
background: Theme.contrast;
VerticalLayout {
ActionButton { text: ShellBridge.label-close; clicked => { ShellBridge.fullscreen-stream = ""; } }
for stream in ShellBridge.streams: StreamTile { visible: stream.id == ShellBridge.fullscreen-stream; height: self.visible ? parent.height - Theme.touch-target : 0px; item: stream; }
}
}
if !Theme.android && ShellBridge.menu-visible: Rectangle {
background: Theme.contrast.with-alpha(0.7);
TouchArea { clicked => { ShellBridge.close-menu(); } }
Rectangle {
width: min(parent.width - 24px,360px); height: min(parent.height - 24px, menu.preferred-height);
x: parent.width - self.width - 12px; y: root.compact ? parent.height - self.height - 12px : 12px;
background: Theme.header; border-radius: 8px; border-width: 1px; border-color: Theme.outline;
menu := VerticalLayout { padding: 12px; spacing: 8px; Text { text: ShellBridge.menu-title; color: Theme.fg; font-weight: 600; wrap: word-wrap; } ScrollView { min-height: 0px; CommandList { commands: ShellBridge.menu-actions; } } ActionButton { text: ShellBridge.label-close; clicked => { ShellBridge.close-menu(); } } }
}
}
if Theme.android && ShellBridge.fullscreen-stream != "": Rectangle {
background: Theme.contrast;
VerticalLayout {
ActionButton { text: ShellBridge.label-close; clicked => { ShellBridge.fullscreen-stream = ""; } }
ScrollView { min-height: 0px; vertical-stretch: 1;
VerticalLayout { padding: 8px; for stream in ShellBridge.streams: VerticalLayout { if stream.id == ShellBridge.fullscreen-stream: StreamTile { item: stream; } } }
}
}
}
if Theme.android && ShellBridge.menu-visible: Rectangle {
background: Theme.contrast.with-alpha(0.7);
TouchArea { clicked => { ShellBridge.close-menu(); } }
Rectangle {
width: min(parent.width - 16px,480px); height: min(parent.height - 16px,phone-menu.preferred-height);
x: (parent.width - self.width)/2; y: parent.height - self.height - 8px;
background: Theme.header; border-radius: 8px; border-width: 1px; border-color: Theme.outline;
phone-menu := VerticalLayout { padding: 12px; spacing: 8px;
menu-title := Text { text: ShellBridge.menu-title; color: Theme.fg; font-weight: 600; wrap: word-wrap; max-height: root.height * 0.2; overflow: elide; }
ScrollView { height: min(phone-commands.preferred-height,max(0px,root.height - menu-title.preferred-height - menu-close.preferred-height - 64px));
phone-commands := VerticalLayout { spacing: 8px;
CommandList { commands: ShellBridge.menu-actions; }
ActionButton { text: ShellBridge.destinations[2]; clicked => { ShellBridge.room-navigate(4); } }
ActionButton { text: ShellBridge.label-bookmarks; clicked => { ShellBridge.room-navigate(6); } }
ActionButton { text: ShellBridge.room-labels[10]; clicked => { ShellBridge.room-navigate(5); } }
}
}
menu-close := ActionButton { text: ShellBridge.label-close; clicked => { ShellBridge.close-menu(); } }
}
}
}
}
export component StreamWindow inherits Window {
in property <ShellStream> item;
title: item.title;
preferred-width: 960px;
preferred-height: 640px;
min-width: 320px;
min-height: 240px;
background: Theme.contrast;
default-font-family: Theme.font-family;
default-font-size: Theme.font-size;
StreamTile { item: root.item; }
}