@celljs/ta-channels 4.7.0 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,295 +0,0 @@
1
- import { AgentMenu } from './agent-menu';
2
- import { ChannelMenu } from './channel-menu';
3
- import { type Agent, ChannelsUtil, SYSTEM } from './channels-util';
4
- import { AGENT_PAGE, NewChannelDialog, newAgent } from './create';
5
- import { Face, RoomFace } from './faces';
6
- import { ChannelWords } from './i18n';
7
- import { MoreMenu } from './more-menu';
8
- import { React } from './react';
9
- import {
10
- AgentAvatar,
11
- CHANNEL_PAGE,
12
- type ChannelsContext,
13
- ChannelViews,
14
- DOUBLE_PAGE,
15
- membersOf,
16
- SidebarUtil,
17
- useChannels,
18
- useFaces,
19
- useServerCwd,
20
- useUi,
21
- } from './views';
22
-
23
- interface RowProps {
24
- avatar: React.ReactNode;
25
- title: string;
26
- badge?: React.ReactNode;
27
- preview: string;
28
- /** The preview is what is going on now. */
29
- live?: boolean;
30
- time: string;
31
- /** Something new the user has not looked at. */
32
- fresh?: boolean;
33
- hint?: string;
34
- selected: boolean;
35
- onSelect(): void;
36
- /** Over the time while the row is hovered or its menu open: the … of an agent. */
37
- more?: React.ReactNode;
38
- }
39
-
40
- /** A row of the list: the face, the name and a line of what is going on, the time at the right. */
41
- function Row({ avatar, title, badge, preview, live, time, fresh, hint, selected, onSelect, more }: RowProps) {
42
- const row = (
43
- <button type="button" className={`tac-item${selected ? ' tac-selected' : ''}`} aria-current={selected || undefined} title={hint} onClick={onSelect}>
44
- {avatar}
45
- <span className="tac-item-text">
46
- <span className="tac-item-top">
47
- <span className="tac-item-title">{title}</span>
48
- {badge}
49
- <span className="tac-item-time">{time}</span>
50
- </span>
51
- <span className="tac-item-bottom">
52
- <span className={`tac-item-preview${live ? ' tac-live' : ''}`}>{preview}</span>
53
- {fresh && <span className="tac-fresh" />}
54
- </span>
55
- </span>
56
- </button>
57
- );
58
- return more ? (
59
- <div className={`tac-item-row${selected ? ' tac-selected' : ''}`}>
60
- {row}
61
- {more}
62
- </div>
63
- ) : (
64
- row
65
- );
66
- }
67
-
68
- /** The top of the side bar: a search, and + to make an agent or a channel. */
69
- export function SidebarHead({ context }: { context: ChannelsContext }) {
70
- const { pi, ui } = context;
71
- const { query, creating } = useUi(ui);
72
- const w = ChannelViews.words(pi);
73
- const [menu, setMenu] = React.useState(false);
74
- const menuRef = React.useRef<HTMLDivElement>(null);
75
- const Plus = ChannelViews.icon(pi, 'Plus');
76
- const Search = ChannelViews.icon(pi, 'Search');
77
- const X = ChannelViews.icon(pi, 'X');
78
- const Hash = ChannelViews.icon(pi, 'Hash');
79
- const Bot = ChannelViews.icon(pi, 'Bot');
80
- React.useEffect(() => {
81
- if (!menu) {
82
- return;
83
- }
84
- const close = (event: Event) => {
85
- if (!menuRef.current?.contains(event.target as Node)) {
86
- setMenu(false);
87
- }
88
- };
89
- document.addEventListener('pointerdown', close);
90
- return () => document.removeEventListener('pointerdown', close);
91
- }, [menu]);
92
- const begin = (kind: 'agent' | 'channel') => {
93
- setMenu(false);
94
- if (kind === 'agent') {
95
- newAgent(context);
96
- } else {
97
- ui.set({ creating: true });
98
- }
99
- };
100
- return (
101
- <div className="tac-toolbar">
102
- <label className="tac-search">
103
- <Search size={14} />
104
- <input value={query} placeholder={w.search} aria-label={w.search} onChange={event => ui.set({ query: event.target.value })} />
105
- {query && (
106
- <button type="button" className="tac-action" title={w.clear} aria-label={w.clear} onClick={() => ui.set({ query: '' })}>
107
- <X size={12} />
108
- </button>
109
- )}
110
- </label>
111
- <div className="tac-menu-anchor" ref={menuRef}>
112
- <button
113
- type="button"
114
- className="tac-add"
115
- title={w.new}
116
- aria-label={w.new}
117
- aria-haspopup="menu"
118
- aria-expanded={menu}
119
- onClick={() => setMenu(!menu)}
120
- >
121
- <Plus size={16} />
122
- </button>
123
- {menu && (
124
- <div className="tac-menu" role="menu">
125
- <button type="button" role="menuitem" onClick={() => begin('agent')}>
126
- <Bot size={14} />
127
- {w.newAgent}
128
- </button>
129
- <button type="button" role="menuitem" onClick={() => begin('channel')}>
130
- <Hash size={14} />
131
- {w.newChannel}
132
- </button>
133
- </div>
134
- )}
135
- </div>
136
- {creating && <NewChannelDialog context={context} onClose={() => ui.set({ creating: false })} />}
137
- </div>
138
- );
139
- }
140
-
141
- /** The side bar: the double, the channels, then the agents by directory. */
142
- export function AgentsSidebar({ context }: { context: ChannelsContext }) {
143
- const { pi, service, ui } = context;
144
- const state = useChannels(service);
145
- const { query, draft, channelId, fresh } = useUi(ui);
146
- const w = ChannelViews.words(pi);
147
- const faces = useFaces(state.team);
148
- const serverCwd = useServerCwd(pi) ?? '';
149
- const shownSession = pi.ui.useSessionId();
150
- const double = pi.ui.useView(DOUBLE_PAGE);
151
- const channelPage = pi.ui.useView(CHANNEL_PAGE);
152
- const agentPage = pi.ui.useView(AGENT_PAGE);
153
- const [opening, setOpening] = React.useState<string>();
154
- const Folder = ChannelViews.icon(pi, 'Folder');
155
- const Server = ChannelViews.icon(pi, 'Server');
156
- const Avatar = pi.ui.Avatar;
157
- const { team, working } = state;
158
- React.useEffect(() => {
159
- for (const channel of team.channels) {
160
- void service.messages(channel.id).catch(() => undefined);
161
- }
162
- }, [service, team.channels]);
163
- const name = (id: string) => ChannelsUtil.authorName(team, id, { user: w.you, ta: w.ta });
164
- const lastSaid = new Map<string, number>();
165
- for (const messages of Object.values(state.messages)) {
166
- for (const message of messages) {
167
- lastSaid.set(message.author, Math.max(lastSaid.get(message.author) ?? 0, message.at));
168
- }
169
- }
170
- const channels = ChannelsUtil.pinnedFirst(team.channels).filter(channel =>
171
- SidebarUtil.matches(query, channel.name, channel.topic, ...membersOf(team, channel).map(agent => agent.name)),
172
- );
173
- const agents = team.agents.filter(agent => SidebarUtil.matches(query, agent.name, agent.role));
174
- const pageShown = !!double?.shown || !!channelPage?.shown || !!agentPage?.shown;
175
- const openAgent = (agent: Agent) => {
176
- setOpening(agent.id);
177
- ChannelViews.openAgent(context, agent.id)
178
- .catch(error => pi.ui.notify(ChannelViews.message(error), 'error'))
179
- .finally(() => setOpening(undefined));
180
- };
181
- const agentSelected = (agent: Agent) => {
182
- const sessionId = context.sessions.get(agent.id);
183
- return opening === agent.id || (!pageShown && !!sessionId && sessionId === shownSession);
184
- };
185
- return (
186
- <div className="tac-view">
187
- <div className="tac-list">
188
- {double && SidebarUtil.matches(query, double.title, w.myDouble) && (
189
- <div className="tac-double-row">
190
- <button
191
- type="button"
192
- className={`tac-double${double.shown ? ' tac-selected' : ''}`}
193
- aria-current={double.shown || undefined}
194
- onClick={() => pi.ui.showView(DOUBLE_PAGE)}
195
- >
196
- <Avatar size={44} />
197
- <span className="tac-double-name">{double.title}</span>
198
- </button>
199
- {double.menu && (
200
- <MoreMenu
201
- pi={pi}
202
- label={double.title}
203
- items={() =>
204
- (double.menu?.() ?? []).map(section =>
205
- section.map(({ icon: Icon, ...item }) => ({ ...item, icon: Icon && <Icon size={15} /> })),
206
- )
207
- }
208
- />
209
- )}
210
- </div>
211
- )}
212
- {draft && (
213
- <Row
214
- avatar={<Face face={draft.face} size={36} />}
215
- title={draft.name || w.newAgentName}
216
- preview={w.notStarted}
217
- time=""
218
- selected={!!agentPage?.shown}
219
- onSelect={() => pi.ui.showView(AGENT_PAGE)}
220
- />
221
- )}
222
- {state.loaded && team.agents.length === 0 && !draft && <div className="tac-empty">{w.noAgentsYet}</div>}
223
- {state.loaded && team.agents.length > 0 && team.channels.length === 0 && !query && !draft && <div className="tac-empty">{w.empty}</div>}
224
- {query && channels.length === 0 && agents.length === 0 && <div className="tac-empty">{w.noMatch}</div>}
225
- {channels.map(channel => {
226
- const members = membersOf(team, channel);
227
- const busy = working[channel.id] ?? [];
228
- const last = state.messages[channel.id]?.filter(message => message.author !== SYSTEM).at(-1);
229
- const preview =
230
- busy.length > 0
231
- ? ChannelWords.format(w.answeringNow, { name: busy.map(name).join('、') })
232
- : last
233
- ? `${name(last.author)}:${last.text.replace(/\s+/g, ' ')}`
234
- : (channel.topic ?? w.noMessages);
235
- return (
236
- <Row
237
- key={channel.id}
238
- avatar={<RoomFace members={members} faces={faces} size={36} working={busy} />}
239
- title={channel.name}
240
- badge={
241
- <React.Fragment>
242
- {members[0] && (
243
- <span className="tac-lead" title={ChannelWords.format(w.leadOf, { name: members[0].name })}>
244
- {ChannelViews.maybeIcon(pi, 'Crown', null, 11)}
245
- <span>{w.lead}</span>
246
- </span>
247
- )}
248
- {channel.pinned && (
249
- <span className="tac-pinned" title={w.pinned} role="img" aria-label={w.pinned}>
250
- {ChannelViews.maybeIcon(pi, 'Pin', null, 12)}
251
- </span>
252
- )}
253
- </React.Fragment>
254
- }
255
- preview={preview}
256
- live={busy.length > 0}
257
- time={SidebarUtil.time(last?.at ?? channel.createdAt, pi.ui.language)}
258
- fresh={fresh.includes(channel.id)}
259
- hint={channel.topic ? `#${channel.name} · ${channel.topic}` : `#${channel.name}`}
260
- selected={!!channelPage?.shown && channelId === channel.id}
261
- onSelect={() => context.showChannel(channel.id)}
262
- more={<ChannelMenu context={context} channel={channel} working={busy} />}
263
- />
264
- );
265
- })}
266
- {SidebarUtil.byDirectory(agents, serverCwd).map(group => (
267
- <React.Fragment key={group.cwd}>
268
- <div className="tac-folder" title={group.cwd}>
269
- {SidebarUtil.host(group.cwd) ? <Server size={12} /> : <Folder size={12} />}
270
- <span>{SidebarUtil.folder(group.cwd)}</span>
271
- {SidebarUtil.host(group.cwd) && <span className="tac-host">{SidebarUtil.host(group.cwd)}</span>}
272
- </div>
273
- {group.agents.map(agent => {
274
- const where = team.channels.find(channel => working[channel.id]?.includes(agent.id));
275
- return (
276
- <Row
277
- key={agent.id}
278
- avatar={<AgentAvatar agent={agent} faces={faces} size={36} working={!!where} />}
279
- title={agent.name}
280
- preview={where ? ChannelWords.format(w.answeringIn, { channel: where.name }) : w.idle}
281
- live={!!where}
282
- time={SidebarUtil.time(lastSaid.get(agent.id) ?? agent.createdAt, pi.ui.language)}
283
- hint={`@${agent.name} · ${agent.role}`}
284
- selected={agentSelected(agent)}
285
- onSelect={() => openAgent(agent)}
286
- more={<AgentMenu context={context} agent={agent} cwd={agent.cwd ?? serverCwd} working={!!where} />}
287
- />
288
- );
289
- })}
290
- </React.Fragment>
291
- ))}
292
- </div>
293
- </div>
294
- );
295
- }
package/web-src/style.ts DELETED
@@ -1,249 +0,0 @@
1
- /** The styles of the views; only the --ta-* variables of the page, so they follow its theme. */
2
- export const STYLE = `
3
- .tac-view { display: flex; flex-direction: column; height: 100%; min-height: 0; color: var(--ta-text); font-size: 13px; }
4
- .tac-action { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex: none; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--ta-muted); cursor: pointer; }
5
- .tac-action:hover { background: var(--ta-hover); color: var(--ta-text); }
6
- .tac-toolbar { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
7
- .tac-search { position: relative; display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; height: 36px; padding: 0 6px 0 11px; border: 1px solid transparent; border-radius: 10px; background: var(--ta-raised); color: var(--ta-muted); transition: border-color 120ms, background 120ms; box-sizing: border-box; }
8
- .tac-search:focus-within { border-color: var(--ta-border-field); background: var(--ta-input); }
9
- .tac-search input { flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: var(--ta-text); font: inherit; font-size: 13.5px; outline: none; }
10
- .tac-search input::placeholder { color: var(--ta-muted); }
11
- .tac-search .tac-action { width: 20px; height: 20px; }
12
- .tac-menu-anchor { position: relative; flex: none; }
13
- .tac-add { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px; background: var(--ta-raised); color: var(--ta-secondary); cursor: pointer; transition: background 120ms, color 120ms; }
14
- .tac-add:hover, .tac-add[aria-expanded="true"] { background: var(--ta-hover); color: var(--ta-text); }
15
- .tac-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 160px; padding: 4px; border: 1px solid var(--ta-border-muted); border-radius: 10px; background: var(--ta-raised); box-shadow: var(--ta-shadow-pop); }
16
- .tac-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px; background: none; color: var(--ta-body); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
17
- .tac-menu button:hover { background: var(--ta-hover); color: var(--ta-text); }
18
- .tac-menu button svg { color: var(--ta-muted); }
19
- .tac-list { flex: 1; min-height: 0; overflow: auto; padding: 2px 0 12px; }
20
- .tac-list > .tac-view > .tac-form { margin: 2px 10px 8px; }
21
- .tac-double { display: flex; flex-direction: column; align-items: center; gap: 8px; width: calc(100% - 16px); margin: 6px 8px 10px; padding: 14px 10px 12px; border: 0; border-radius: 14px; background: none; color: var(--ta-text); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background 120ms; }
22
- .tac-double:hover { background: var(--ta-hover); }
23
- .tac-double.tac-selected { background: var(--ta-hover-strong); }
24
- .tac-double-row { position: relative; }
25
- .tac-pinned { display: inline-flex; flex: none; color: var(--ta-muted); }
26
- .tac-double-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
27
- .tac-double-row > .tac-item-more { top: 14px; right: 16px; transform: none; }
28
- .tac-double-row:hover .tac-item-more > .tac-action { opacity: 1; }
29
- .tac-item-bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
30
- .tac-item-bottom .tac-item-preview { flex: 1; min-width: 0; }
31
- .tac-fresh { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--ta-green); }
32
- .tac-head { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding-left: 8px; }
33
- .tac-head-title { display: flex; align-items: baseline; gap: 8px; flex: 1; min-width: 0; white-space: nowrap; }
34
- .tac-head-title strong { overflow: hidden; text-overflow: ellipsis; font-size: 14.5px; font-weight: 600; }
35
- .tac-head-count { flex: none; color: var(--ta-muted); font-size: 12px; }
36
- .tac-head-topic { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ta-muted); font-size: 12.5px; }
37
- .tac-head-members { display: flex; align-items: center; flex: none; height: 32px; padding: 0 6px 0 10px; border: 0; border-radius: 999px; background: none; color: inherit; font: inherit; cursor: pointer; transition: background 120ms; }
38
- .tac-head-members:hover, .tac-head-members.tac-on { background: var(--ta-hover); }
39
- .tac-head-members:focus-visible { outline: 1px solid var(--ta-border-focus); outline-offset: -1px; }
40
- .tac-head-face { display: inline-flex; margin-left: -4px; padding: 1px; border-radius: 50%; background: var(--ta-main); }
41
- .tac-head-members:hover .tac-head-face, .tac-head-members.tac-on .tac-head-face { background: var(--ta-hover); }
42
- .tac-head-more { margin-left: 4px; color: var(--ta-muted); font-size: 11.5px; }
43
- .tac-action.tac-on { background: var(--ta-hover-strong); color: var(--ta-text); }
44
- .tac-room-page { display: flex; flex-direction: column; flex: 1; min-height: 0; background: var(--ta-main); color: var(--ta-text); }
45
- .tac-room-none { display: grid; place-items: center; flex: 1; color: var(--ta-muted); font-size: 13px; }
46
- .tac-chat { flex: 1; min-height: 0; overflow-y: auto; }
47
- .tac-chat-col { display: flex; flex-direction: column; gap: 4px; max-width: calc(var(--ta-col) + 48px); margin: 0 auto; padding: 20px 24px 12px; box-sizing: border-box; }
48
- .tac-chat-time { align-self: center; margin: 14px 0 6px; color: var(--ta-muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
49
- .tac-chat-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 12vh auto 0; max-width: 360px; color: var(--ta-muted); font-size: 13px; text-align: center; }
50
- .tac-chat-empty strong { margin-top: 6px; color: var(--ta-text); font-size: 16px; }
51
- .tac-chat-hint { margin-top: 4px; font-size: 12px; }
52
- .tac-mine { margin: 6px 0 2px; }
53
- .tac-msg { display: flex; align-items: flex-start; gap: 10px; }
54
- .tac-msg.tac-first { margin-top: 10px; }
55
- .tac-msg-face { display: flex; justify-content: center; width: 28px; flex: none; }
56
- .tac-msg-col { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: min(84%, var(--ta-col)); }
57
- .tac-msg-name { display: flex; align-items: center; gap: 6px; margin: 0 2px 4px; color: var(--ta-muted); font-size: 12px; line-height: 16px; }
58
- .tac-msg-lead { padding: 0 5px; border-radius: 999px; background: color-mix(in srgb, var(--ta-green) 12%, transparent); color: var(--ta-green); font-size: 10.5px; font-weight: 600; line-height: 15px; }
59
- .tac-msg-bubble { min-width: 0; max-width: 100%; padding: 9px 14px; border: 1px solid var(--ta-border-muted); border-radius: 5px 16px 16px 16px; background: var(--ta-side); color: var(--ta-body); line-height: 1.6; overflow-wrap: anywhere; }
60
- .tac-msg-bubble.tac-failed { border-color: color-mix(in srgb, var(--ta-red) 35%, transparent); }
61
- .tac-msg-failed { margin-bottom: 4px; color: var(--ta-red); font-size: 12px; }
62
- .tac-msg-bubble pre { max-width: 100%; overflow-x: auto; }
63
- .tac-mention { color: var(--ta-link); }
64
- .tac-notice { align-self: center; margin: 10px 0; padding: 3px 10px; border-radius: 999px; background: var(--ta-hover); color: var(--ta-muted); font-size: 12px; }
65
- .tac-live { display: flex; align-items: center; gap: 8px; align-self: flex-start; margin: 10px 0 0 38px; padding: 5px 12px 5px 8px; border-radius: 999px; background: var(--ta-hover); color: var(--ta-secondary); font-size: 12.5px; }
66
- .tac-live-faces { display: inline-flex; }
67
- .tac-live-faces > * + * { margin-left: -4px; }
68
- .tac-chat-bottom { width: 100%; max-width: calc(var(--ta-col) + 48px); margin: 0 auto; padding: 8px 24px calc(16px + env(safe-area-inset-bottom)); box-sizing: border-box; flex: none; display: flex; flex-direction: column; gap: 8px; }
69
- @media (max-width: 720px) {
70
- .tac-head-topic, .tac-head-face:nth-child(n + 4), .tac-head-more { display: none; }
71
- .tac-chat-col, .tac-chat-bottom { padding-left: 14px; padding-right: 14px; }
72
- .tac-msg-col { max-width: calc(100% - 38px); }
73
- }
74
- .tac-new-head { position: relative; display: flex; align-items: center; justify-content: center; flex: 1; min-width: 0; height: 100%; }
75
- .tac-new-title { position: relative; display: flex; justify-content: center; min-width: 0; }
76
- .tac-new-head > .tac-button { position: absolute; right: 0; }
77
- .tac-new-trigger { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--ta-text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
78
- .tac-new-trigger span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
79
- .tac-new-trigger:hover, .tac-new-trigger[aria-expanded="true"] { background: var(--ta-hover); }
80
- .tac-new-trigger svg { flex: none; color: var(--ta-muted); }
81
- .tac-identity { position: absolute; top: calc(100% + 8px); left: 50%; z-index: 30; width: 300px; max-width: calc(100vw - 24px); padding: 12px; border: 1px solid var(--ta-border); border-radius: 14px; background: var(--ta-side); box-shadow: var(--ta-shadow-pop); transform: translateX(-50%); animation: tac-pop 140ms ease-out; box-sizing: border-box; }
82
- .tac-identity-label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; color: var(--ta-muted); font-size: 12px; }
83
- .tac-identity-label .tac-input { height: 36px; font-size: 13.5px; }
84
- .tac-faces { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
85
- .tac-face-pick { display: grid; place-items: center; aspect-ratio: 1; padding: 0; border: 2px solid transparent; border-radius: 12px; background: none; cursor: pointer; transition: background 120ms, border-color 120ms; }
86
- .tac-face-pick:hover { background: var(--ta-hover); }
87
- .tac-face-pick.tac-on { border-color: var(--ta-border-focus); background: var(--ta-hover); }
88
- @keyframes tac-pop { from { opacity: 0; transform: translate(-50%, -4px); } to { opacity: 1; transform: translate(-50%, 0); } }
89
- .tac-button.tac-quiet { border-color: transparent; background: none; color: var(--ta-secondary); }
90
- .tac-button.tac-quiet:hover { background: var(--ta-hover); color: var(--ta-text); }
91
- .tac-new-page { display: flex; flex: 1; min-height: 0; overflow-y: auto; background: var(--ta-main); color: var(--ta-text); }
92
- .tac-new-col { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: calc(var(--ta-col) + 48px); margin: auto; padding: 24px 24px calc(28px + env(safe-area-inset-bottom)); box-sizing: border-box; }
93
- .tac-new-name { display: flex; align-items: center; gap: 4px; margin: 16px 0 6px; font-size: 22px; font-weight: 700; }
94
- .tac-new-name .tac-action { color: var(--ta-muted); }
95
- .tac-new-hint { margin: 0 0 22px; max-width: 460px; color: var(--ta-muted); font-size: 13px; line-height: 1.6; text-align: center; }
96
- .tac-new-box { width: 100%; display: flex; flex-direction: column; gap: 8px; }
97
- .tac-dialog { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
98
- .tac-dialog-label { display: flex; flex-direction: column; gap: 8px; color: var(--ta-secondary); font-size: 13px; }
99
- div.tac-dialog-label { flex-direction: row; justify-content: space-between; margin-top: 6px; }
100
- .tac-dialog-count { color: var(--ta-muted); font-variant-numeric: tabular-nums; }
101
- .tac-dialog-input { height: 40px; font-size: 14px; }
102
- .tac-dialog-search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--ta-border-field); border-radius: 10px; background: var(--ta-input); color: var(--ta-muted); box-sizing: border-box; }
103
- .tac-dialog-search:focus-within { border-color: var(--ta-border-focus); }
104
- .tac-dialog-search input { flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: var(--ta-text); font: inherit; font-size: 13.5px; outline: none; }
105
- .tac-pick-list { display: flex; flex-direction: column; max-height: min(320px, 40vh); overflow-y: auto; padding: 4px; border: 1px solid var(--ta-border-muted); border-radius: 12px; }
106
- .tac-pick-list > .tac-empty { padding: 14px 10px; }
107
- .tac-pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px; background: none; color: var(--ta-text); font: inherit; text-align: left; cursor: pointer; }
108
- .tac-pick:hover:not(:disabled) { background: var(--ta-hover); }
109
- .tac-pick:disabled { opacity: 0.45; cursor: default; }
110
- .tac-check { display: grid; place-items: center; width: 18px; height: 18px; flex: none; border: 1.5px solid var(--ta-border-field); border-radius: 5px; color: var(--ta-main); box-sizing: border-box; }
111
- .tac-pick.tac-on .tac-check { border-color: var(--ta-text); background: var(--ta-text); }
112
- .tac-pick-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
113
- .tac-pick-name { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; }
114
- .tac-pick-role { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: 12px; }
115
- .tac-dialog-note { color: var(--ta-muted); font-size: 12px; }
116
- .tac-dialog-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
117
- .tac-dialog-actions .tac-button { height: 36px; padding: 0 18px; font-size: 13.5px; }
118
- @media (max-width: 720px) {
119
- .tac-new-head > .tac-button { position: static; margin-left: auto; }
120
- .tac-new-head { justify-content: flex-start; }
121
- .tac-identity { position: fixed; top: calc(60px + env(safe-area-inset-top) + var(--ta-titlebar, 0px)); left: 12px; right: 12px; width: auto; max-width: none; transform: none; animation: none; }
122
- }
123
- .tac-empty { padding: 8px 18px; }
124
- .tac-item { position: relative; display: flex; align-items: center; gap: 10px; width: calc(100% - 16px); margin: 4px 8px; padding: 8px 10px; border: 0; border-radius: 12px; background: none; color: var(--ta-text); font: inherit; text-align: left; cursor: pointer; transition: background 120ms; }
125
- .tac-item:hover { background: var(--ta-hover); }
126
- .tac-item.tac-selected { background: var(--ta-hover-strong); }
127
- .tac-item.tac-selected::before { content: ''; position: absolute; left: 2px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--ta-green); }
128
- .tac-item-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
129
- .tac-item-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
130
- .tac-item-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 500; line-height: 18px; }
131
- .tac-item-time { flex: none; margin-left: auto; padding-left: 4px; color: var(--ta-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
132
- .tac-item-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: 12px; line-height: 17px; }
133
- .tac-item-preview.tac-live { color: var(--ta-green); }
134
- .tac-lead { display: inline-flex; align-items: center; gap: 3px; flex: none; max-width: 96px; overflow: hidden; padding: 0 6px; border: 1px solid color-mix(in srgb, var(--ta-green) 35%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--ta-green) 10%, transparent); color: var(--ta-green); font-size: 10.5px; font-weight: 600; line-height: 16px; white-space: nowrap; }
135
- .tac-lead span { overflow: hidden; text-overflow: ellipsis; }
136
- .tac-lead svg { flex: none; }
137
- .tac-folder { display: flex; align-items: center; gap: 5px; margin: 12px 18px 4px; color: var(--ta-muted); font-size: 11.5px; line-height: 16px; }
138
- .tac-folder span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
139
- .tac-folder .tac-host { flex: none; max-width: 140px; height: 16px; padding: 0 5px; border-radius: 4px; background: var(--ta-hover-strong); color: var(--ta-secondary); font-size: 10.5px; line-height: 16px; }
140
- .tac-face { display: inline-flex; flex: none; }
141
- .tac-face svg { display: block; overflow: visible; }
142
- .tac-face-eyes { transform-box: fill-box; transform-origin: center; animation: tac-blink 5.2s infinite; }
143
- .tac-face[data-face="1"] .tac-face-eyes, .tac-face[data-face="5"] .tac-face-eyes, .tac-face[data-face="9"] .tac-face-eyes, .tac-face[data-face="13"] .tac-face-eyes { animation-delay: -1.7s; }
144
- .tac-face[data-face="2"] .tac-face-eyes, .tac-face[data-face="6"] .tac-face-eyes, .tac-face[data-face="10"] .tac-face-eyes, .tac-face[data-face="14"] .tac-face-eyes { animation-delay: -3.1s; }
145
- .tac-face[data-face="3"] .tac-face-eyes, .tac-face[data-face="7"] .tac-face-eyes, .tac-face[data-face="11"] .tac-face-eyes, .tac-face[data-face="15"] .tac-face-eyes { animation-delay: -4.4s; }
146
- .tac-face-working .tac-face-look { animation: tac-look 2.4s ease-in-out infinite; }
147
- .tac-face-working .tac-face-body { transform-box: fill-box; transform-origin: 50% 100%; animation: tac-bob 1.2s ease-in-out infinite; }
148
- @keyframes tac-blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(0.1); } }
149
- @keyframes tac-look { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-1.4px); } 70% { transform: translateX(1.4px); } }
150
- @keyframes tac-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.2px); } }
151
- @media (prefers-reduced-motion: reduce) { .tac-face * { animation: none !important; } }
152
- .tac-room { position: relative; display: inline-flex; flex: none; }
153
- .tac-room-back { position: absolute; right: 0; top: 0; }
154
- .tac-room-front { position: absolute; left: 0; bottom: 0; z-index: 1; }
155
- .tac-empty { padding: 8px; color: var(--ta-muted); font-size: 12px; line-height: 1.6; }
156
- .tac-error { color: var(--ta-red); }
157
- .tac-form { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; padding: 8px; border: 1px solid var(--ta-border-muted); border-radius: 8px; background: var(--ta-card); }
158
- .tac-form label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--ta-secondary); }
159
- .tac-input { width: 100%; box-sizing: border-box; padding: 5px 8px; border: 1px solid var(--ta-border-field); border-radius: 8px; background: var(--ta-input); color: var(--ta-text); font: inherit; font-size: 13px; }
160
- .tac-input:focus { outline: none; border-color: var(--ta-border-focus); }
161
- textarea.tac-input { resize: vertical; min-height: 56px; line-height: 1.5; }
162
- .tac-chips { display: flex; flex-wrap: wrap; gap: 4px; }
163
- .tac-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--ta-border-muted); border-radius: 12px; background: none; color: var(--ta-body); font: inherit; font-size: 12px; cursor: pointer; }
164
- .tac-chip.tac-on { border-color: var(--ta-accent); color: var(--ta-text); background: var(--ta-selected); }
165
- .tac-chip small { color: var(--ta-muted); }
166
- .tac-buttons { display: flex; justify-content: flex-end; gap: 6px; }
167
- .tac-button { padding: 4px 12px; border: 1px solid var(--ta-border); border-radius: 8px; background: var(--ta-raised); color: var(--ta-text); font: inherit; font-size: 12.5px; cursor: pointer; }
168
- .tac-button.tac-primary { border-color: transparent; background: var(--ta-text); color: var(--ta-main); }
169
- .tac-button:disabled { opacity: 0.5; cursor: default; }
170
- .tac-button.tac-danger { border-color: transparent; background: var(--ta-red); color: #fff; }
171
- .tac-link { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px; border: 0; border-radius: 6px; background: none; color: var(--ta-secondary); font: inherit; font-size: 12.5px; cursor: pointer; }
172
- .tac-link:hover { background: var(--ta-hover); }
173
- .tac-link.tac-danger { color: var(--ta-red); }
174
- .tac-members { background: var(--ta-main); }
175
- .tac-members-none { display: grid; place-items: center; flex: 1; padding: 24px; color: var(--ta-muted); text-align: center; }
176
- .tac-members-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 12px; }
177
- .tac-members-top { display: flex; align-items: center; gap: 12px; padding: 14px 10px 12px; }
178
- .tac-members-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
179
- .tac-members-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 600; }
180
- .tac-members-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: 12px; }
181
- .tac-members-label { padding: 10px 10px 6px; color: var(--ta-muted); font-size: 12px; }
182
- .tac-members-head { display: flex; align-items: center; gap: 6px; flex: none; padding: 10px 12px 4px 8px; font-size: 13.5px; }
183
- .tac-members-search { flex: none; margin: 6px 16px 2px; }
184
- .tac-members-sep { height: 1px; margin: 6px 10px; background: var(--ta-border-muted); }
185
- .tac-member { position: relative; display: flex; align-items: center; border-radius: 12px; transition: background 120ms; }
186
- .tac-member:hover, .tac-member:focus-within { background: var(--ta-hover); }
187
- .tac-member-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; width: 100%; padding: 8px 10px; border: 0; border-radius: 12px; background: none; color: var(--ta-text); font: inherit; text-align: left; cursor: pointer; }
188
- .tac-members-scroll > .tac-member-main:hover { background: var(--ta-hover); }
189
- .tac-member .tac-member-main:focus-visible, .tac-members-scroll > .tac-member-main:focus-visible { outline: 1px solid var(--ta-border-focus); outline-offset: -1px; }
190
- .tac-member-plus { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--ta-hover); color: var(--ta-secondary); }
191
- .tac-member-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
192
- .tac-member-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13.5px; font-weight: 500; line-height: 18px; }
193
- .tac-member-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
194
- .tac-member-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: 12px; line-height: 17px; }
195
- .tac-member-detail.tac-live { color: var(--ta-green); }
196
- .tac-member.tac-muted .tac-member-main > :first-child { opacity: 0.5; }
197
- .tac-member-actions { display: flex; align-items: center; gap: 2px; flex: none; padding-right: 8px; opacity: 0; transition: opacity 120ms; }
198
- .tac-member:hover .tac-member-actions, .tac-member:focus-within .tac-member-actions, .tac-member.tac-muted .tac-member-actions { opacity: 1; }
199
- .tac-member.tac-muted:not(:hover):not(:focus-within) .tac-member-actions > :not(.tac-on) { visibility: hidden; }
200
- .tac-member-actions .tac-action { width: 28px; height: 28px; border-radius: 8px; }
201
- .tac-member-actions .tac-action:disabled { opacity: 0.35; cursor: default; background: none; }
202
- .tac-member:hover .tac-action:not(:disabled):hover { background: var(--ta-hover-strong); }
203
- .tac-pick.tac-on { background: var(--ta-hover); }
204
- .tac-members-scroll > .tac-pick { margin: 1px 0; }
205
- .tac-check { display: grid; place-items: center; width: 18px; height: 18px; flex: none; box-sizing: border-box; border: 1.5px solid var(--ta-border-field); border-radius: 50%; color: var(--ta-main); }
206
- .tac-pick.tac-on .tac-check { border-color: var(--ta-green); background: var(--ta-green); }
207
- .tac-members-foot { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex: none; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--ta-border-muted); }
208
- .tac-members-ask { flex: 1; min-width: 0; color: var(--ta-body); font-size: 12.5px; }
209
- .tac-button.tac-wide { flex: 1; height: 36px; border-radius: 10px; font-size: 13.5px; }
210
- @media (hover: none) {
211
- .tac-member-actions { opacity: 1; }
212
- .tac-member.tac-muted .tac-member-actions > :not(.tac-on) { visibility: visible; }
213
- }
214
- .tac-action:focus-visible, .tac-item:focus-visible, .tac-add:focus-visible, .tac-menu button:focus-visible, .tac-chip:focus-visible, .tac-button:focus-visible { outline: 1px solid var(--ta-border-focus); outline-offset: -1px; }
215
- .tac-mention { color: var(--ta-link); }
216
- @media (pointer: coarse) {
217
- .tac-item { padding: 10px; }
218
- .tac-action { width: 32px; height: 32px; }
219
- .tac-input { font-size: 16px; }
220
- }
221
- /* The … of an agent: over the time while its row is hovered, focused or its menu open */
222
- .tac-item-row { position: relative; }
223
- .tac-item-row > .tac-item { width: calc(100% - 16px); }
224
- .tac-item-more { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); z-index: 2; }
225
- .tac-item-more > .tac-action { width: 26px; height: 26px; background: var(--ta-hover-strong); color: var(--ta-secondary); opacity: 0; transition: opacity 120ms; }
226
- .tac-item-row:hover .tac-item-more > .tac-action, .tac-item-more > .tac-action:focus-visible, .tac-item-more > .tac-action[aria-expanded="true"] { opacity: 1; }
227
- .tac-item-row:hover .tac-item-time, .tac-item-row:has(.tac-item-more [aria-expanded="true"]) .tac-item-time { visibility: hidden; }
228
- .tac-agent-menu { top: calc(100% + 4px); width: 210px; padding: 5px; border-color: var(--ta-border); background: var(--ta-side); }
229
- .tac-agent-menu.tac-up { top: auto; bottom: calc(100% + 4px); }
230
- .tac-agent-menu button { gap: 10px; height: 32px; padding: 0 9px; border-radius: 7px; }
231
- .tac-agent-menu button:disabled { opacity: 0.4; cursor: default; background: none; }
232
- .tac-menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
233
- .tac-menu-line { height: 1px; margin: 4px 2px; border: 0; background: var(--ta-border-muted); }
234
- .tac-menu button.tac-danger, .tac-menu button.tac-danger svg { color: var(--ta-red); }
235
- textarea.tac-role-input { min-height: 200px; max-height: 50vh; font-size: 13px; line-height: 1.6; }
236
- @media (max-width: 720px), (pointer: coarse) {
237
- .tac-item-more > .tac-action { opacity: 1; background: none; }
238
- .tac-item-row .tac-item-time { visibility: hidden; }
239
- }
240
- `;
241
-
242
- /** Adds the styles to the page; the function returned takes them away. */
243
- export function injectStyle(): () => void {
244
- const element = document.createElement('style');
245
- element.dataset.taPackage = 'ta-channels';
246
- element.textContent = STYLE;
247
- document.head.appendChild(element);
248
- return () => element.remove();
249
- }