@celljs/ta-web 4.21.0 → 4.23.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.
- package/esm/browser/assistant/assistant-chat-list.js +5 -1
- package/esm/browser/assistant/assistant-conversation.js +1 -1
- package/esm/browser/assistant/assistant-initiative.d.ts +5 -1
- package/esm/browser/assistant/assistant-initiative.js +11 -3
- package/esm/browser/assistant/call-keeper.d.ts +2 -1
- package/esm/browser/assistant/call-keeper.js +4 -2
- package/esm/browser/assistant/call-screen.d.ts +1 -1
- package/esm/browser/assistant/call-turn-end.d.ts +11 -2
- package/esm/browser/assistant/call-turn-end.js +21 -5
- package/esm/browser/assistant/read-aloud.d.ts +1 -1
- package/esm/browser/assistant/realtime-voice.d.ts +1 -1
- package/esm/browser/assistant/voice-call-bar.d.ts +5 -2
- package/esm/browser/assistant/voice-call-bar.js +12 -0
- package/esm/browser/assistant/voice-call-protocol.d.ts +78 -0
- package/esm/browser/assistant/voice-call-protocol.js +2 -0
- package/esm/browser/assistant/voice-call.d.ts +17 -65
- package/esm/browser/assistant/voice-call.js +45 -1
- package/esm/browser/assistant/voice-reopen.d.ts +1 -1
- package/esm/browser/components/account-menu.js +28 -7
- package/esm/browser/components/chat-home-util.d.ts +13 -2
- package/esm/browser/components/chat-home-util.js +29 -0
- package/esm/browser/components/chat-home.d.ts +18 -4
- package/esm/browser/components/chat-home.js +11 -3
- package/esm/browser/components/chat-list.js +4 -2
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/earlier-messages.d.ts +4 -0
- package/esm/browser/components/earlier-messages.js +10 -2
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/message-footer.d.ts +0 -2
- package/esm/browser/components/message-footer.js +1 -8
- package/esm/browser/components/message-images.d.ts +22 -0
- package/esm/browser/components/message-images.js +90 -1
- package/esm/browser/components/message-steps.js +9 -0
- package/esm/browser/components/message-user.js +8 -1
- package/esm/browser/components/partner-row-util.d.ts +28 -0
- package/esm/browser/components/partner-row-util.js +45 -0
- package/esm/browser/components/partner-row.d.ts +18 -0
- package/esm/browser/components/partner-row.js +60 -0
- package/esm/browser/components/profile-view.d.ts +2 -2
- package/esm/browser/components/profile-view.js +6 -3
- package/esm/browser/components/web-composer.d.ts +5 -2
- package/esm/browser/components/web-composer.js +10 -5
- package/esm/browser/extension/extension-view.js +2 -2
- package/esm/browser/extension/icons.js +4 -1
- package/esm/browser/extension/web-api-call.d.ts +45 -0
- package/esm/browser/extension/web-api-call.js +2 -0
- package/esm/browser/extension/web-api-components.d.ts +37 -2
- package/esm/browser/extension/web-api-contributions.d.ts +2 -31
- package/esm/browser/extension/web-api-home.d.ts +1 -0
- package/esm/browser/extension/web-api-partners.d.ts +112 -0
- package/esm/browser/extension/web-api-partners.js +2 -0
- package/esm/browser/extension/web-extension-api.d.ts +12 -15
- package/esm/browser/extension/web-extension-context.d.ts +2 -3
- package/esm/browser/extension/web-extension-context.js +7 -7
- package/esm/browser/extension/web-extension-protocol.d.ts +8 -2
- package/esm/browser/extension/web-extension-run.d.ts +2 -1
- package/esm/browser/extension/web-extension-run.js +1 -0
- package/esm/browser/extension/web-extensions-running.d.ts +2 -0
- package/esm/browser/extension/web-extensions-running.js +3 -0
- package/esm/browser/extension/web-extensions.d.ts +1 -1
- package/esm/browser/extension/web-home.d.ts +11 -19
- package/esm/browser/extension/web-home.js +15 -68
- package/esm/browser/extension/web-partners.d.ts +8 -0
- package/esm/browser/extension/web-partners.js +13 -0
- package/esm/browser/extension/web-row-board.d.ts +38 -0
- package/esm/browser/extension/web-row-board.js +79 -0
- package/esm/browser/i18n/locales.d.ts +28 -1
- package/esm/browser/i18n/messages-ja.js +27 -0
- package/esm/browser/i18n/messages-zh-tw.js +27 -0
- package/esm/browser/i18n/messages.d.ts +27 -0
- package/esm/browser/i18n/messages.js +54 -0
- package/esm/browser/index.d.ts +4 -0
- package/esm/browser/index.js +4 -0
- package/esm/browser/partners/group-picker.d.ts +18 -0
- package/esm/browser/partners/group-picker.js +81 -0
- package/esm/browser/partners/partners-extension.d.ts +14 -0
- package/esm/browser/partners/partners-extension.js +78 -0
- package/esm/browser/partners/partners-util.d.ts +32 -0
- package/esm/browser/partners/partners-util.js +68 -0
- package/esm/browser/partners/partners-view.d.ts +32 -0
- package/esm/browser/partners/partners-view.js +103 -0
- package/esm/browser/style/chat-list.d.ts +1 -1
- package/esm/browser/style/chat-list.js +21 -0
- package/esm/browser/style/conversation-column.d.ts +1 -1
- package/esm/browser/style/conversation-column.js +21 -0
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +2 -2
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +1 -1
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +1 -1
- package/esm/browser/util/image-shrink.d.ts +26 -0
- package/esm/browser/util/image-shrink.js +60 -0
- package/esm/browser/util/process.d.ts +7 -3
- package/esm/browser/util/process.js +18 -18
- package/lib/browser/assistant/assistant-chat-list.js +5 -1
- package/lib/browser/assistant/assistant-conversation.js +1 -1
- package/lib/browser/assistant/assistant-initiative.d.ts +5 -1
- package/lib/browser/assistant/assistant-initiative.js +11 -3
- package/lib/browser/assistant/call-keeper.d.ts +2 -1
- package/lib/browser/assistant/call-keeper.js +4 -2
- package/lib/browser/assistant/call-screen.d.ts +1 -1
- package/lib/browser/assistant/call-turn-end.d.ts +11 -2
- package/lib/browser/assistant/call-turn-end.js +22 -6
- package/lib/browser/assistant/read-aloud.d.ts +1 -1
- package/lib/browser/assistant/realtime-voice.d.ts +1 -1
- package/lib/browser/assistant/voice-call-bar.d.ts +5 -2
- package/lib/browser/assistant/voice-call-bar.js +12 -0
- package/lib/browser/assistant/voice-call-protocol.d.ts +79 -0
- package/lib/browser/assistant/voice-call-protocol.js +3 -0
- package/lib/browser/assistant/voice-call.d.ts +17 -65
- package/lib/browser/assistant/voice-call.js +45 -1
- package/lib/browser/assistant/voice-reopen.d.ts +1 -1
- package/lib/browser/components/account-menu.js +27 -6
- package/lib/browser/components/chat-home-util.d.ts +13 -2
- package/lib/browser/components/chat-home-util.js +29 -0
- package/lib/browser/components/chat-home.d.ts +18 -4
- package/lib/browser/components/chat-home.js +12 -3
- package/lib/browser/components/chat-list.js +4 -2
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/earlier-messages.d.ts +4 -0
- package/lib/browser/components/earlier-messages.js +10 -2
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/message-footer.d.ts +0 -2
- package/lib/browser/components/message-footer.js +0 -8
- package/lib/browser/components/message-images.d.ts +22 -0
- package/lib/browser/components/message-images.js +92 -2
- package/lib/browser/components/message-steps.js +9 -0
- package/lib/browser/components/message-user.js +7 -0
- package/lib/browser/components/partner-row-util.d.ts +29 -0
- package/lib/browser/components/partner-row-util.js +48 -0
- package/lib/browser/components/partner-row.d.ts +19 -0
- package/lib/browser/components/partner-row.js +96 -0
- package/lib/browser/components/profile-view.d.ts +2 -2
- package/lib/browser/components/profile-view.js +6 -3
- package/lib/browser/components/web-composer.d.ts +5 -2
- package/lib/browser/components/web-composer.js +10 -5
- package/lib/browser/extension/extension-view.js +2 -2
- package/lib/browser/extension/icons.js +3 -0
- package/lib/browser/extension/web-api-call.d.ts +46 -0
- package/lib/browser/extension/web-api-call.js +3 -0
- package/lib/browser/extension/web-api-components.d.ts +37 -2
- package/lib/browser/extension/web-api-contributions.d.ts +2 -31
- package/lib/browser/extension/web-api-home.d.ts +1 -0
- package/lib/browser/extension/web-api-partners.d.ts +113 -0
- package/lib/browser/extension/web-api-partners.js +3 -0
- package/lib/browser/extension/web-extension-api.d.ts +12 -15
- package/lib/browser/extension/web-extension-context.d.ts +2 -3
- package/lib/browser/extension/web-extension-context.js +7 -7
- package/lib/browser/extension/web-extension-protocol.d.ts +8 -2
- package/lib/browser/extension/web-extension-run.d.ts +2 -1
- package/lib/browser/extension/web-extension-run.js +1 -0
- package/lib/browser/extension/web-extensions-running.d.ts +2 -0
- package/lib/browser/extension/web-extensions-running.js +3 -0
- package/lib/browser/extension/web-extensions.d.ts +1 -1
- package/lib/browser/extension/web-home.d.ts +11 -19
- package/lib/browser/extension/web-home.js +15 -68
- package/lib/browser/extension/web-partners.d.ts +9 -0
- package/lib/browser/extension/web-partners.js +17 -0
- package/lib/browser/extension/web-row-board.d.ts +39 -0
- package/lib/browser/extension/web-row-board.js +83 -0
- package/lib/browser/i18n/locales.d.ts +28 -1
- package/lib/browser/i18n/messages-ja.js +27 -0
- package/lib/browser/i18n/messages-zh-tw.js +27 -0
- package/lib/browser/i18n/messages.d.ts +27 -0
- package/lib/browser/i18n/messages.js +54 -0
- package/lib/browser/index.d.ts +4 -0
- package/lib/browser/index.js +4 -0
- package/lib/browser/partners/group-picker.d.ts +19 -0
- package/lib/browser/partners/group-picker.js +119 -0
- package/lib/browser/partners/partners-extension.d.ts +15 -0
- package/lib/browser/partners/partners-extension.js +114 -0
- package/lib/browser/partners/partners-util.d.ts +33 -0
- package/lib/browser/partners/partners-util.js +71 -0
- package/lib/browser/partners/partners-view.d.ts +33 -0
- package/lib/browser/partners/partners-view.js +144 -0
- package/lib/browser/style/chat-list.d.ts +1 -1
- package/lib/browser/style/chat-list.js +21 -0
- package/lib/browser/style/conversation-column.d.ts +1 -1
- package/lib/browser/style/conversation-column.js +21 -0
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +2 -2
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +1 -1
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +1 -1
- package/lib/browser/util/image-shrink.d.ts +27 -0
- package/lib/browser/util/image-shrink.js +63 -0
- package/lib/browser/util/process.d.ts +7 -3
- package/lib/browser/util/process.js +18 -18
- package/package.json +7 -7
|
@@ -3,6 +3,7 @@ import type { TaRoomInfo } from '@celljs/ta-protocol';
|
|
|
3
3
|
import type * as React from 'react';
|
|
4
4
|
import type { WebComposerAction } from './web-api-components';
|
|
5
5
|
import type { WebIcon } from './web-extension-api';
|
|
6
|
+
export type * from './web-api-call';
|
|
6
7
|
export type * from './web-api-chats';
|
|
7
8
|
/** A conversation as its message box knows it. */
|
|
8
9
|
export interface WebConversation {
|
|
@@ -467,37 +468,6 @@ export interface WebTaskEntry extends WebTask {
|
|
|
467
468
|
/** The name of the extension it is of. */
|
|
468
469
|
extension: string;
|
|
469
470
|
}
|
|
470
|
-
/** pi's custom message, as the conversation holds it. */
|
|
471
|
-
/** The conversation a call is with (WebCallPartner.open). */
|
|
472
|
-
export interface WebCallTarget {
|
|
473
|
-
sessionId: string;
|
|
474
|
-
sessionFile?: string;
|
|
475
|
-
cwd?: string;
|
|
476
|
-
/** The conversation of the double, which hands out tasks of its own. */
|
|
477
|
-
double: boolean;
|
|
478
|
-
/** The language the user speaks in the call. */
|
|
479
|
-
language: string;
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
* Who answers in a call in place of the conversation (WebExtensionAPI.registerCallPartner): a front that talks at
|
|
483
|
-
* once, whatever the conversation does, and hands it the work (docs/design/ta-call.md).
|
|
484
|
-
*/
|
|
485
|
-
export interface WebCallPartner {
|
|
486
|
-
/** Its side of a call with the conversation; undefined to leave the call to the conversation itself. */
|
|
487
|
-
open(target: WebCallTarget): Promise<WebCallSession | undefined>;
|
|
488
|
-
}
|
|
489
|
-
/** A call as its partner answers it, from when it starts until it ends. */
|
|
490
|
-
export interface WebCallSession {
|
|
491
|
-
/** What the user said; the reply to say. `sent`: it went to the conversation already, as it began the call. */
|
|
492
|
-
say(text: string, options?: {
|
|
493
|
-
sent?: boolean;
|
|
494
|
-
}): Promise<string | undefined>;
|
|
495
|
-
/** Whether the partner ended the call (asked to hang up): it ends once its last reply is said. */
|
|
496
|
-
ending?(): boolean;
|
|
497
|
-
/** What the partner says by itself (news of the work), asked again and again in a call; undefined after a while. */
|
|
498
|
-
next?(): Promise<string | undefined>;
|
|
499
|
-
close(): void;
|
|
500
|
-
}
|
|
501
471
|
/** What else a code renderer says of its blocks (WebExtensionAPI.registerCodeRenderer). */
|
|
502
472
|
export interface WebCodeRendererOptions {
|
|
503
473
|
/**
|
|
@@ -527,6 +497,7 @@ export interface WebCodeRendererProps {
|
|
|
527
497
|
*/
|
|
528
498
|
answer?: string;
|
|
529
499
|
}
|
|
500
|
+
/** pi's custom message, as the conversation holds it. */
|
|
530
501
|
export interface WebCustomMessage {
|
|
531
502
|
role: 'custom';
|
|
532
503
|
customType: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { WebHomeEntry } from './web-api-contributions';
|
|
2
|
+
export type * from './web-api-partners';
|
|
2
3
|
/** What the page offers of the rows of the double's home (registerHomeItems), for a list of an extension to show them as its own do. */
|
|
3
4
|
export interface WebHomeUI {
|
|
4
5
|
/** A React hook: the rows extensions add to the double's home (registerHomeItems), in the order they loaded. */
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { WebMenuItem } from './web-api-contributions';
|
|
3
|
+
import type { WebIcon } from './web-extension-api';
|
|
4
|
+
/**
|
|
5
|
+
* Those the user works with (docs/design/ta-partners.md): an agent, a friend, a group chat. Each is someone (or some
|
|
6
|
+
* ones) with a name and a face, a relation to the user, and one conversation with them; what is said there is a
|
|
7
|
+
* conversation of the double's list, as any other, and the page of the partners lists them, by kind, as contacts.
|
|
8
|
+
*/
|
|
9
|
+
export type WebPartnerKind = 'agent' | 'friend' | 'group';
|
|
10
|
+
/** One the user works with, as the extension that keeps them gives them (WebExtensionAPI.registerPartners). */
|
|
11
|
+
export interface WebPartner {
|
|
12
|
+
/** Unique in the extension: an agent's, a friend's identity, a group chat's. */
|
|
13
|
+
id: string;
|
|
14
|
+
kind: WebPartnerKind;
|
|
15
|
+
name: string;
|
|
16
|
+
/** Drawn `size` wide; else `icon` on a tile of its tint. */
|
|
17
|
+
face?: React.ComponentType<{
|
|
18
|
+
size: number;
|
|
19
|
+
}>;
|
|
20
|
+
icon: WebIcon;
|
|
21
|
+
/** Tints its tile, the same for the same text; default: the extension's name. */
|
|
22
|
+
tint?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Not a partner yet: `asking`, one asks the user (to be a friend, to join a group chat of theirs); `invited`, the
|
|
25
|
+
* user is asked into a group chat; `waiting`, the user asked, the other has not answered. Opening it answers.
|
|
26
|
+
*/
|
|
27
|
+
status?: 'asking' | 'invited' | 'waiting';
|
|
28
|
+
/** What it is, under its name when nothing was said with it: an agent's role, who asks and why. */
|
|
29
|
+
about?: string;
|
|
30
|
+
/** The conversation with it; none before there is one. */
|
|
31
|
+
chat?: WebPartnerChat;
|
|
32
|
+
/** A friend online now: the green dot of a contact. */
|
|
33
|
+
online?: boolean;
|
|
34
|
+
/** A group chat with friends in it, not of the user's agents alone: a small label after its name. */
|
|
35
|
+
friends?: boolean;
|
|
36
|
+
/** Where it works (an agent's directory): a remote one is marked by its host. */
|
|
37
|
+
location?: string;
|
|
38
|
+
/** Opens its conversation (or, while not a partner yet, what to answer). A promise keeps the row busy. */
|
|
39
|
+
open(): unknown;
|
|
40
|
+
/**
|
|
41
|
+
* Opens who it is and its settings, as a messenger's profile of a contact or info of a group: an agent's name, model,
|
|
42
|
+
* role and directory, what a friend may do, a group chat's members. In its menu after Open, and behind its row.
|
|
43
|
+
*/
|
|
44
|
+
info?(): unknown;
|
|
45
|
+
/** What else it does (stop, share, export…), in its menu between Open and {@link remove}. */
|
|
46
|
+
menu?(): WebMenuItem[][];
|
|
47
|
+
/**
|
|
48
|
+
* Takes it off the user's partners (delete an agent, remove a friend, leave a group chat): last in its menu, in red,
|
|
49
|
+
* and behind its row on the page of the partners. It asks the user first itself.
|
|
50
|
+
*/
|
|
51
|
+
remove?: WebMenuItem;
|
|
52
|
+
}
|
|
53
|
+
/** The conversation with a partner. */
|
|
54
|
+
export interface WebPartnerChat {
|
|
55
|
+
/** A conversation of pi (an agent's): the double's list has its row already, this only names whose it is. */
|
|
56
|
+
sessionFile?: string;
|
|
57
|
+
/** What was said last, with who said it where it is not the partner. */
|
|
58
|
+
last?: string;
|
|
59
|
+
/** `Date.now()` time of it: where the conversation is in the double's list. */
|
|
60
|
+
at?: number;
|
|
61
|
+
/** Said since the user last looked: the amber dot. */
|
|
62
|
+
unseen?: boolean;
|
|
63
|
+
/** Answers now: the green dot that breathes. */
|
|
64
|
+
busy?: boolean;
|
|
65
|
+
/** Waits for the user to answer: the blue ?. */
|
|
66
|
+
asks?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Takes the conversation off the double's list, the partner kept (delete a chat of two): behind its row there; without
|
|
69
|
+
* it, the row of a group chat there takes it off with {@link WebPartner.remove}.
|
|
70
|
+
*/
|
|
71
|
+
close?: WebMenuItem;
|
|
72
|
+
}
|
|
73
|
+
/** The partners of an extension (WebExtensionAPI.registerPartners). */
|
|
74
|
+
export interface WebPartnerSource {
|
|
75
|
+
partners(): readonly WebPartner[];
|
|
76
|
+
subscribe(listener: () => void): () => void;
|
|
77
|
+
/** What it adds to the + of the partners, to have a new one: an agent, a friend. */
|
|
78
|
+
add?(): WebMenuItem[];
|
|
79
|
+
/**
|
|
80
|
+
* Starts a group chat of these, two or more of the user's agents and friends (of every extension) the user picked:
|
|
81
|
+
* true once it did, false when it does not make such a group chat (one of the members is none it knows), for the
|
|
82
|
+
* next source to try.
|
|
83
|
+
*/
|
|
84
|
+
group?(members: readonly WebPartnerEntry[]): Promise<boolean>;
|
|
85
|
+
}
|
|
86
|
+
/** What an extension gives of the partners (WebExtensionAPI). */
|
|
87
|
+
export interface WebPartnersAPI {
|
|
88
|
+
/**
|
|
89
|
+
* Those the user works with that the extension keeps (agents, friends, group chats): the page lists them on the
|
|
90
|
+
* page of the partners, and what is said with each among the conversations of the double's list
|
|
91
|
+
* (docs/design/ta-partners.md). Newer than some Ta apps: `pi.registerPartners?.(…)`; without it, an extension shows
|
|
92
|
+
* them itself.
|
|
93
|
+
*/
|
|
94
|
+
registerPartners(source: WebPartnerSource): void;
|
|
95
|
+
}
|
|
96
|
+
/** What the page offers of the partners (WebExtensionUI). */
|
|
97
|
+
export interface WebPartnersUI {
|
|
98
|
+
/**
|
|
99
|
+
* Starts a chat as the + of the partners does: the user picks among their agents and friends, one is the conversation
|
|
100
|
+
* with them, two or more a group chat (WebPartnerSource.group). `partner`, the id of one of this extension's
|
|
101
|
+
* partners picked already (the friend of a chat of two). Newer than some Ta apps: `pi.ui.startGroup?.(…)`.
|
|
102
|
+
*/
|
|
103
|
+
startGroup(partner?: string): void;
|
|
104
|
+
}
|
|
105
|
+
/** A partner as the page lists it. */
|
|
106
|
+
export interface WebPartnerEntry extends WebPartner {
|
|
107
|
+
/** `<extension name>/<id>`. */
|
|
108
|
+
key: string;
|
|
109
|
+
extension: string;
|
|
110
|
+
/** The tint of its tile: `var(--ta-tint-<n>)`, `var(--ta-tint-ink-<n>)`. */
|
|
111
|
+
tone: number;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=web-api-partners.d.ts.map
|
|
@@ -6,10 +6,10 @@ import type { GameProps } from '../game/game-protocol';
|
|
|
6
6
|
import type { Game3DProps } from '../game/game3d-protocol';
|
|
7
7
|
import type { ScreenPartSpec, TaScreen } from '../screen/screen-protocol';
|
|
8
8
|
import type { Language, Theme } from '../settings/settings-protocol';
|
|
9
|
-
import type { CodeEditorProps, DiffEditorProps, WebComposerProps, WebConversationViewProps, WebDialogProps, WebEmptyProps, WebFaceProps, WebFolderPickerProps, WebFullScreenProps, WebGroupFaceProps, WebHoldToTalkProps, WebImageViewerProps, WebLoadingProps, WebModelPickerProps, WebPictureCardsProps, WebPictureProps, WebSelectBarProps, WebSelectCheckProps, WebShareSheetProps, WebStackProps, WebSwipeRowProps, WebSwitchProps, WebTaskIconProps, WebVoice } from './web-api-components';
|
|
9
|
+
import type { CodeEditorProps, DiffEditorProps, WebChatImagesProps, WebComposerProps, WebConversationViewProps, WebDialogProps, WebEmptyProps, WebFaceProps, WebFolderPickerProps, WebFullScreenProps, WebGroupFaceProps, WebHoldToTalkProps, WebImageViewerProps, WebLoadingProps, WebModelPickerProps, WebPictureCardsProps, WebPictureProps, WebSelectBarProps, WebSelectCheckProps, WebShareSheetProps, WebStackProps, WebSwipeRowProps, WebSwitchProps, WebTaskIconProps, WebVoice } from './web-api-components';
|
|
10
10
|
import type { WebAsk, WebCallPartner, WebChatIconSource, WebCodeRendererOptions, WebCodeRendererProps, WebComposerAddon, WebCustomMessage, WebEditor, WebHomeSource, WebInitiative, WebMenuItem, WebOpener, WebOpenerOptions, WebRoomAddon, WebRoomAddonEntry, WebSearchSource, WebSessionMenu, WebSessionNotice, WebSettingsSection, WebShareTarget, WebTaskEntry, WebTaskRemoval, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WebViewInfo, WidgetOptions } from './web-api-contributions';
|
|
11
11
|
import type { WebDesktop, WebFileDrag } from './web-api-desktop';
|
|
12
|
-
import type { WebHomeUI } from './web-api-home';
|
|
12
|
+
import type { WebHomeUI, WebPartnersAPI, WebPartnersUI } from './web-api-home';
|
|
13
13
|
import type { WebServices } from './web-api-services';
|
|
14
14
|
import type { WebTerminal, WebTerminalOptions } from './web-api-terminal';
|
|
15
15
|
import type { WebPageInfo } from './web-pages';
|
|
@@ -31,7 +31,7 @@ export type { WebPageInfo, WebPageState } from './web-pages';
|
|
|
31
31
|
* the two mean the same. A web extension is one ES module without imports, the `web` part of a pi
|
|
32
32
|
* package (see TaWebExtensionInfo); it exports a {@link WebExtensionFactory}.
|
|
33
33
|
*/
|
|
34
|
-
export interface WebExtensionAPI extends WebServices {
|
|
34
|
+
export interface WebExtensionAPI extends WebServices, WebPartnersAPI {
|
|
35
35
|
/** The React of the page: an extension brings no React of its own. */
|
|
36
36
|
readonly React: typeof React;
|
|
37
37
|
readonly ui: WebExtensionUI;
|
|
@@ -230,7 +230,7 @@ export interface WebNotifyOptions {
|
|
|
230
230
|
export type { ScreenAction, ScreenItem, ScreenPartSpec, ScreenPartView, ScreenPlace, ScreenScrollable, ScreenScrollTo } from '../screen/screen-protocol';
|
|
231
231
|
/** What web extensions see of TaScreen. */
|
|
232
232
|
export type WebScreen = Pick<TaScreen, 'agent' | 'parts' | 'act' | 'element' | 'where' | 'places' | 'go' | 'pageScroll' | 'scroll'>;
|
|
233
|
-
export interface WebExtensionUI extends WebHomeUI {
|
|
233
|
+
export interface WebExtensionUI extends WebHomeUI, WebPartnersUI {
|
|
234
234
|
/** A widget around the message box, as pi's, or a card in the workbench on the right; `undefined` removes it. */
|
|
235
235
|
setWidget(key: string, widget: React.ComponentType | undefined, options?: WidgetOptions): void;
|
|
236
236
|
/**
|
|
@@ -322,10 +322,7 @@ export interface WebExtensionUI extends WebHomeUI {
|
|
|
322
322
|
closeEditor(id: string): void;
|
|
323
323
|
/** Keeps a tab opened as a preview: the next preview opens beside it. */
|
|
324
324
|
pinEditor(id: string): void;
|
|
325
|
-
/**
|
|
326
|
-
* Marks a tab as changed and not saved: a dot in place of its close button, and the user is asked
|
|
327
|
-
* before closing it. Dirty tabs are pinned.
|
|
328
|
-
*/
|
|
325
|
+
/** Marks a tab as changed and not saved: a dot in place of its close button, and the user is asked before closing it. Dirty tabs are pinned. */
|
|
329
326
|
setEditorDirty(id: string, dirty: boolean): void;
|
|
330
327
|
/** A React hook: the id of the tab shown in the workbench, whoever opened it. */
|
|
331
328
|
useActiveEditor(): string | undefined;
|
|
@@ -593,9 +590,8 @@ export interface WebExtensionUI extends WebHomeUI {
|
|
|
593
590
|
readonly SelectCheck: React.ComponentType<WebSelectCheckProps>;
|
|
594
591
|
readonly SelectBar: React.ComponentType<WebSelectBarProps>;
|
|
595
592
|
/**
|
|
596
|
-
* The face of a task, as every list of tasks draws it: who does it (`WebTask.icon`), else its glyph on the tile
|
|
597
|
-
*
|
|
598
|
-
* `pi.ui.TaskIcon ?? fallback`.
|
|
593
|
+
* The face of a task, as every list of tasks draws it: who does it (`WebTask.icon`), else its glyph on the tile of tasks, a rounded
|
|
594
|
+
* square tinted green while it goes on and grey once it ended. Newer than some Ta apps: `pi.ui.TaskIcon ?? fallback`.
|
|
599
595
|
*/
|
|
600
596
|
readonly TaskIcon: React.ComponentType<WebTaskIconProps>;
|
|
601
597
|
/** A small picture as the pictures of Ta: an SVG whose shapes take the classes `ta-pic-*` (WebPictureProps). */
|
|
@@ -603,12 +599,13 @@ export interface WebExtensionUI extends WebHomeUI {
|
|
|
603
599
|
/** Choices as pictures in a row, as the suggestions of an empty conversation: a click picks one. */
|
|
604
600
|
readonly PictureCards: React.ComponentType<WebPictureCardsProps>;
|
|
605
601
|
/**
|
|
606
|
-
* A picture to look at closely, as the viewers of pictures: all of it at first (never larger than its own
|
|
607
|
-
*
|
|
608
|
-
*
|
|
609
|
-
* pictures beside it at its sides when given (`onPrevious` / `onNext`). It fills its parent (a column of flex).
|
|
602
|
+
* A picture to look at closely, as the viewers of pictures: all of it at first (never larger than its own pixels), pinched by two fingers
|
|
603
|
+
* or a trackpad, zoomed by a wheel with Ctrl or ⌘ and by a double tap or click, dragged or scrolled once zoomed; with − / the scale / + /
|
|
604
|
+
* fit / actual size below it, and the pictures beside it at its sides when given (`onPrevious` / `onNext`). It fills its parent (a column of flex).
|
|
610
605
|
*/
|
|
611
606
|
readonly ImageViewer: React.ComponentType<WebImageViewerProps>;
|
|
607
|
+
/** The pictures of a message of a chat the extension draws, as a conversation shows the user's (`thumb` blurred till `src`). Newer than some apps. */
|
|
608
|
+
readonly ChatImages?: React.ComponentType<WebChatImagesProps>;
|
|
612
609
|
/** A QR code of a text (a link to scan with a phone), black on white whatever the theme; `label` for a screen reader. */
|
|
613
610
|
readonly QrCode: React.ComponentType<{
|
|
614
611
|
text: string;
|
|
@@ -40,9 +40,8 @@ export interface WebExtensionContextHost {
|
|
|
40
40
|
switcher(): WebSessionSwitcher | undefined;
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
|
-
* The API each web extension gets: what it registers is its own and goes when it stops, and once it stopped
|
|
44
|
-
*
|
|
45
|
-
* no, and what would act for the user (send a message, switch the conversation, open or reload packages) fails.
|
|
43
|
+
* The API each web extension gets: what it registers is its own and goes when it stops, and once it stopped (turned off, removed,
|
|
44
|
+
* a timer of it left behind) it neither shows nor does anything more: its dialogs answer no, and what would act for the user fails.
|
|
46
45
|
*/
|
|
47
46
|
export declare class WebExtensionContext {
|
|
48
47
|
protected readonly host: WebExtensionContextHost;
|
|
@@ -56,6 +56,7 @@ const host_tag_1 = require("../components/host-tag");
|
|
|
56
56
|
const image_viewer_1 = require("../components/image-viewer");
|
|
57
57
|
const loading_1 = require("../components/loading");
|
|
58
58
|
const markdown_1 = require("../components/markdown");
|
|
59
|
+
const message_images_1 = require("../components/message-images");
|
|
59
60
|
const model_picker_1 = require("../components/model-picker");
|
|
60
61
|
const phone_shell_1 = require("../components/phone-shell");
|
|
61
62
|
const picture_1 = require("../components/picture");
|
|
@@ -87,9 +88,8 @@ const web_pages_1 = require("./web-pages");
|
|
|
87
88
|
const web_tasks_1 = require("./web-tasks");
|
|
88
89
|
const FILE_DRAG = Object.freeze({ set: file_drag_1.FileDragUtil.set, has: file_drag_1.FileDragUtil.has, get: file_drag_1.FileDragUtil.get, paths: file_drag_1.FileDragUtil.paths });
|
|
89
90
|
/**
|
|
90
|
-
* The API each web extension gets: what it registers is its own and goes when it stops, and once it stopped
|
|
91
|
-
*
|
|
92
|
-
* no, and what would act for the user (send a message, switch the conversation, open or reload packages) fails.
|
|
91
|
+
* The API each web extension gets: what it registers is its own and goes when it stops, and once it stopped (turned off, removed,
|
|
92
|
+
* a timer of it left behind) it neither shows nor does anything more: its dialogs answer no, and what would act for the user fails.
|
|
93
93
|
*/
|
|
94
94
|
class WebExtensionContext {
|
|
95
95
|
constructor(host) {
|
|
@@ -251,6 +251,7 @@ class WebExtensionContext {
|
|
|
251
251
|
registerToolRenderer: resolver => register(() => run.toolRenderers.push(resolver)),
|
|
252
252
|
registerTasks: source => register(() => run.taskSources.push(source)),
|
|
253
253
|
registerHomeItems: source => register(() => run.homeSources.push(source)),
|
|
254
|
+
registerPartners: source => register(() => run.partnerSources.push(source)),
|
|
254
255
|
registerInitiative: initiative => register(() => run.initiatives.push(initiative)),
|
|
255
256
|
registerSearch: source => register(() => run.searches.push(source)),
|
|
256
257
|
registerComposerAddon: addon => register(() => run.composerAddons.push(addon)),
|
|
@@ -428,8 +429,7 @@ class WebExtensionContext {
|
|
|
428
429
|
}
|
|
429
430
|
},
|
|
430
431
|
forgetPage: id => !run.stopped && host.extensions.forgetPage(id),
|
|
431
|
-
|
|
432
|
-
...web_home_1.WebHomeUtil.ui(host.extensions, () => run.stopped),
|
|
432
|
+
...web_home_1.WebHomeUtil.ui(host.extensions, () => run.stopped, run.loaded.name),
|
|
433
433
|
doubleInChats: true,
|
|
434
434
|
useRoomAddons: () => {
|
|
435
435
|
const read = () => host.extensions.state.roomAddons;
|
|
@@ -476,6 +476,7 @@ class WebExtensionContext {
|
|
|
476
476
|
Picture: picture_1.Picture,
|
|
477
477
|
PictureCards: picture_1.PictureCards,
|
|
478
478
|
ImageViewer: image_viewer_1.ImageViewer,
|
|
479
|
+
ChatImages: message_images_1.ChatImages,
|
|
479
480
|
QrCode: qr_view_1.QrView,
|
|
480
481
|
ShareSheet: this.shareSheet,
|
|
481
482
|
Dialog: web_dialog_1.WebDialog,
|
|
@@ -491,9 +492,8 @@ class WebExtensionContext {
|
|
|
491
492
|
const isShown = () => host.isShown(id);
|
|
492
493
|
const view = React.useSyncExternalStore(subscribe, find, find);
|
|
493
494
|
const shown = React.useSyncExternalStore(subscribe, isShown, isShown);
|
|
494
|
-
// The title
|
|
495
|
+
// The title (read again in another language) and the preview as strings, so that the same words stay the same value.
|
|
495
496
|
const title = view ? web_extension_protocol_1.WebLabelUtil.text(view.title) : undefined;
|
|
496
|
-
// The preview as one string, so that the same line stays the same value.
|
|
497
497
|
const watch = React.useCallback((listener) => { var _a; var _b; return (_b = (_a = view === null || view === void 0 ? void 0 : view.subscribePreview) === null || _a === void 0 ? void 0 : _a.call(view, listener)) !== null && _b !== void 0 ? _b : (() => undefined); }, [view]);
|
|
498
498
|
const read = () => {
|
|
499
499
|
var _a;
|
|
@@ -5,6 +5,7 @@ import type { BlockSpeech } from '../util/spoken';
|
|
|
5
5
|
import type { WebAvatarProps, WebCallPartner, WebChatIconSource, WebCodeRendererProps, WebComposerAddon, WebCustomMessage, WebEditor, WebExtensionFactory, WebHomeEntry, WebIcon, WebImage, WebInitiative, WebLabel, WebMenuItem, WebOpener, WebPageGroup, WebRoomAddonEntry, WebSearchSource, WebSessionMenu, WebSessionOpening, WebSettingsSection, WebShareTarget, WebTool, WebToolRendererResolver, WebViewLocation, WebViewPreview, WidgetOptions } from './web-extension-api';
|
|
6
6
|
import type { WebHomeBoard } from './web-home';
|
|
7
7
|
import type { PageUsage, WebPageInfo } from './web-pages';
|
|
8
|
+
import type { WebPartnerBoard } from './web-partners';
|
|
8
9
|
import type { WebTaskBoard } from './web-tasks';
|
|
9
10
|
export declare const TaWebExtensions: unique symbol;
|
|
10
11
|
export declare const BuiltinWebExtension: unique symbol;
|
|
@@ -234,6 +235,8 @@ export interface TaWebExtensions {
|
|
|
234
235
|
readonly tasks: WebTaskBoard;
|
|
235
236
|
/** The rows of the double's home of every extension (registerHomeItems). */
|
|
236
237
|
readonly home: WebHomeBoard;
|
|
238
|
+
/** Those the user works with, of every extension (registerPartners). */
|
|
239
|
+
readonly partners: WebPartnerBoard;
|
|
237
240
|
readonly builtins: readonly BuiltinWebExtension[];
|
|
238
241
|
subscribe(listener: (state: WebExtensionsState) => void): () => void;
|
|
239
242
|
/** Loads what is new, unloads what is gone or off, and loads again what changed. True when anything did. */
|
|
@@ -246,8 +249,11 @@ export interface TaWebExtensions {
|
|
|
246
249
|
openView(id: string): void;
|
|
247
250
|
/** Shows a page in the main area by the id of its view, or the conversation for `''`. */
|
|
248
251
|
showPage(id: string): void;
|
|
249
|
-
/**
|
|
250
|
-
|
|
252
|
+
/**
|
|
253
|
+
* Opens a row of the double's home or a partner: a page it shows meanwhile is shown as from the list
|
|
254
|
+
* (WebExtensionsState.pageFrom, its key).
|
|
255
|
+
*/
|
|
256
|
+
openHome(entry: Pick<WebHomeEntry, 'key' | 'open'>): Promise<void>;
|
|
251
257
|
/**
|
|
252
258
|
* Shows a view by its id as `ui.showView` does: an extension started on open is started first, and the
|
|
253
259
|
* name of one opens its first page. Resolves once it shows; false when there is no such view.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TaEvent } from '@celljs/ta-protocol';
|
|
2
2
|
import type * as React from 'react';
|
|
3
|
-
import type { WebCallPartner, WebChatIconSource, WebComposerAddon, WebHomeSource, WebInitiative, WebOpener, WebRoomAddon, WebSearchSource, WebSessionMenu, WebSettingsSection, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WidgetOptions } from './web-extension-api';
|
|
3
|
+
import type { WebCallPartner, WebChatIconSource, WebComposerAddon, WebHomeSource, WebInitiative, WebOpener, WebPartnerSource, WebRoomAddon, WebSearchSource, WebSessionMenu, WebSettingsSection, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WidgetOptions } from './web-extension-api';
|
|
4
4
|
import type { LoadedWebExtension, WebExtensionsState } from './web-extension-protocol';
|
|
5
5
|
/** What an extension registered through its API: all of it goes when it stops. */
|
|
6
6
|
export interface WebRegistrations {
|
|
@@ -16,6 +16,7 @@ export interface WebRegistrations {
|
|
|
16
16
|
avatar?: WebExtensionsState['avatars'][string];
|
|
17
17
|
chatIcons: WebChatIconSource[];
|
|
18
18
|
homeSources: WebHomeSource[];
|
|
19
|
+
partnerSources: WebPartnerSource[];
|
|
19
20
|
initiatives: WebInitiative[];
|
|
20
21
|
tools: WebTool[];
|
|
21
22
|
toolRenderers: WebToolRendererResolver[];
|
|
@@ -16,6 +16,7 @@ import { type WebExtensionRun } from './web-extension-run';
|
|
|
16
16
|
import { WebHomeBoard } from './web-home';
|
|
17
17
|
import { WebOnDemand } from './web-on-demand';
|
|
18
18
|
import { WebPageList } from './web-page-list';
|
|
19
|
+
import { WebPartnerBoard } from './web-partners';
|
|
19
20
|
import { WebTaskBoard } from './web-tasks';
|
|
20
21
|
/**
|
|
21
22
|
* The web extensions running: the built-ins and those of the computer's packages, loaded, started and
|
|
@@ -34,6 +35,7 @@ export declare abstract class WebExtensionsRunning {
|
|
|
34
35
|
readonly builtins: BuiltinWebExtension[];
|
|
35
36
|
readonly tasks: WebTaskBoard;
|
|
36
37
|
readonly home: WebHomeBoard;
|
|
38
|
+
readonly partners: WebPartnerBoard;
|
|
37
39
|
protected readonly tabs: WebEditorTabs;
|
|
38
40
|
/** The code read before, by its hash: a start reads only what changed. */
|
|
39
41
|
protected readonly code: WebExtensionCode;
|
|
@@ -27,6 +27,7 @@ const web_home_1 = require("./web-home");
|
|
|
27
27
|
const web_on_demand_1 = require("./web-on-demand");
|
|
28
28
|
const web_page_list_1 = require("./web-page-list");
|
|
29
29
|
const web_pages_1 = require("./web-pages");
|
|
30
|
+
const web_partners_1 = require("./web-partners");
|
|
30
31
|
const web_tasks_1 = require("./web-tasks");
|
|
31
32
|
const web_view_util_1 = require("./web-view-util");
|
|
32
33
|
/**
|
|
@@ -38,6 +39,7 @@ class WebExtensionsRunning {
|
|
|
38
39
|
this.builtins = [];
|
|
39
40
|
this.tasks = new web_tasks_1.WebTaskBoard();
|
|
40
41
|
this.home = new web_home_1.WebHomeBoard();
|
|
42
|
+
this.partners = new web_partners_1.WebPartnerBoard();
|
|
41
43
|
this.tabs = new web_editor_tabs_1.WebEditorTabs({
|
|
42
44
|
state: () => this.current,
|
|
43
45
|
update: change => this.update(change),
|
|
@@ -272,6 +274,7 @@ class WebExtensionsRunning {
|
|
|
272
274
|
const runs = [...this.running.values()];
|
|
273
275
|
this.tasks.setSources(runs.flatMap(run => run.taskSources.map(source => ({ extension: run.loaded.name, source }))));
|
|
274
276
|
this.home.setSources(runs.flatMap(run => run.homeSources.map(source => ({ extension: run.loaded.name, source }))));
|
|
277
|
+
this.partners.setSources(runs.flatMap(run => run.partnerSources.map(source => ({ extension: run.loaded.name, source }))));
|
|
275
278
|
const { views, ...registered } = web_extension_run_1.WebExtensionRunUtil.collect(runs, id => this.onDemand.has(id));
|
|
276
279
|
if (this.placeholders) {
|
|
277
280
|
views.push(...this.placeholders.filter(placeholder => !views.some(view => view.id === placeholder.id)));
|
|
@@ -19,7 +19,7 @@ export declare class TaWebExtensionsImpl extends WebExtensionsRunning implements
|
|
|
19
19
|
reloadPackages(): Promise<void>;
|
|
20
20
|
showEditor(id: string): void;
|
|
21
21
|
openView(id: string, preserveFocus?: boolean): void;
|
|
22
|
-
openHome(entry: WebHomeEntry): Promise<void>;
|
|
22
|
+
openHome(entry: Pick<WebHomeEntry, 'key' | 'open'>): Promise<void>;
|
|
23
23
|
showPage(id: string): void;
|
|
24
24
|
showChats(busy: boolean): void;
|
|
25
25
|
hidePage(): void;
|
|
@@ -1,28 +1,20 @@
|
|
|
1
|
-
import type { WebHomeUI } from './web-api-home';
|
|
2
|
-
import type { WebHomeEntry, WebHomeItem, WebHomeSource } from './web-extension-api';
|
|
1
|
+
import type { WebHomeUI, WebPartnersUI } from './web-api-home';
|
|
2
|
+
import type { WebExtensionUI, WebHomeEntry, WebHomeItem, WebHomeSource } from './web-extension-api';
|
|
3
3
|
import type { TaWebExtensions, WebExtensionsState } from './web-extension-protocol';
|
|
4
|
+
import { WebRowBoard } from './web-row-board';
|
|
4
5
|
export declare namespace WebHomeUtil {
|
|
5
6
|
/** The key of the row of the double's home whose page is in front (TaWebExtensions.openHome), as the lists select it. */
|
|
6
7
|
function shown(state: Pick<WebExtensionsState, 'page' | 'pageHidden' | 'pageFrom'>): string | undefined;
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
extension: string;
|
|
13
|
-
source: WebHomeSource;
|
|
8
|
+
/**
|
|
9
|
+
* What an extension's lists read of the double's home (WebHomeUI), its tasks, and the start of a chat with partners
|
|
10
|
+
* (`extension`, whose partner one picked already is); opening none once it stopped.
|
|
11
|
+
*/
|
|
12
|
+
function ui(extensions: TaWebExtensions, stopped: () => boolean, extension: string): WebHomeUI & WebPartnersUI & Pick<WebExtensionUI, 'useTasks'>;
|
|
14
13
|
}
|
|
15
14
|
/** The rows of the double's home of every extension: one list, drawn again only when a source says it changed. */
|
|
16
|
-
export declare class WebHomeBoard {
|
|
17
|
-
protected
|
|
18
|
-
protected readonly stops: Map<WebHomeSource, () => void>;
|
|
19
|
-
protected readonly listeners: Set<() => void>;
|
|
20
|
-
protected merged: readonly WebHomeEntry[];
|
|
21
|
-
protected readonly entries: WeakMap<WebHomeItem, WebHomeEntry>;
|
|
22
|
-
readonly subscribe: (listener: () => void) => (() => void);
|
|
15
|
+
export declare class WebHomeBoard extends WebRowBoard<WebHomeItem, WebHomeSource> {
|
|
16
|
+
protected readonly what = "home";
|
|
23
17
|
readonly items: () => readonly WebHomeEntry[];
|
|
24
|
-
|
|
25
|
-
setSources(sources: WebHomeSourceEntry[]): void;
|
|
26
|
-
protected merge(): void;
|
|
18
|
+
protected read(source: WebHomeSource): readonly WebHomeItem[];
|
|
27
19
|
}
|
|
28
20
|
//# sourceMappingURL=web-home.d.ts.map
|
|
@@ -35,7 +35,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.WebHomeBoard = exports.WebHomeUtil = void 0;
|
|
37
37
|
const React = __importStar(require("react"));
|
|
38
|
-
const
|
|
38
|
+
const group_picker_1 = require("../partners/group-picker");
|
|
39
|
+
const web_row_board_1 = require("./web-row-board");
|
|
39
40
|
var WebHomeUtil;
|
|
40
41
|
(function (WebHomeUtil) {
|
|
41
42
|
/** The key of the row of the double's home whose page is in front (TaWebExtensions.openHome), as the lists select it. */
|
|
@@ -43,86 +44,32 @@ var WebHomeUtil;
|
|
|
43
44
|
return state.page && !state.pageHidden ? state.pageFrom : undefined;
|
|
44
45
|
}
|
|
45
46
|
WebHomeUtil.shown = shown;
|
|
46
|
-
/**
|
|
47
|
-
|
|
47
|
+
/**
|
|
48
|
+
* What an extension's lists read of the double's home (WebHomeUI), its tasks, and the start of a chat with partners
|
|
49
|
+
* (`extension`, whose partner one picked already is); opening none once it stopped.
|
|
50
|
+
*/
|
|
51
|
+
function ui(extensions, stopped, extension) {
|
|
48
52
|
const subscribe = (listener) => extensions.subscribe(listener);
|
|
49
53
|
const read = () => shown(extensions.state);
|
|
50
54
|
return {
|
|
51
55
|
useHomeItems: () => React.useSyncExternalStore(extensions.home.subscribe, extensions.home.items, extensions.home.items),
|
|
52
56
|
openHome: entry => (stopped() ? Promise.resolve() : extensions.openHome(entry)),
|
|
53
57
|
useHomeShown: () => React.useSyncExternalStore(subscribe, read, read),
|
|
58
|
+
useTasks: () => React.useSyncExternalStore(extensions.tasks.subscribe, extensions.tasks.tasks, extensions.tasks.tasks),
|
|
59
|
+
startGroup: partner => (0, group_picker_1.openGroupPicker)(extensions, partner === undefined ? undefined : extensions.partners.partners().find(each => each.key === `${extension}/${partner}`)),
|
|
54
60
|
};
|
|
55
61
|
}
|
|
56
62
|
WebHomeUtil.ui = ui;
|
|
57
63
|
})(WebHomeUtil || (exports.WebHomeUtil = WebHomeUtil = {}));
|
|
58
64
|
/** The rows of the double's home of every extension: one list, drawn again only when a source says it changed. */
|
|
59
|
-
class WebHomeBoard {
|
|
65
|
+
class WebHomeBoard extends web_row_board_1.WebRowBoard {
|
|
60
66
|
constructor() {
|
|
61
|
-
|
|
62
|
-
this.
|
|
63
|
-
this.
|
|
64
|
-
this.merged = [];
|
|
65
|
-
this.entries = new WeakMap();
|
|
66
|
-
this.subscribe = (listener) => {
|
|
67
|
-
this.listeners.add(listener);
|
|
68
|
-
return () => this.listeners.delete(listener);
|
|
69
|
-
};
|
|
70
|
-
this.items = () => this.merged;
|
|
71
|
-
}
|
|
72
|
-
/** The sources of the extensions that run now: new ones are followed, those gone are left. */
|
|
73
|
-
setSources(sources) {
|
|
74
|
-
if (sources.length === this.sources.length && sources.every((entry, index) => entry.source === this.sources[index].source)) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
const kept = new Set(sources.map(entry => entry.source));
|
|
78
|
-
for (const [source, stop] of this.stops) {
|
|
79
|
-
if (!kept.has(source)) {
|
|
80
|
-
stop();
|
|
81
|
-
this.stops.delete(source);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
for (const { extension, source } of sources) {
|
|
85
|
-
if (!this.stops.has(source)) {
|
|
86
|
-
try {
|
|
87
|
-
this.stops.set(source, source.subscribe(() => this.merge()));
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
console.error(`The home of the web extension ${extension} failed:`, error);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
this.sources = sources;
|
|
95
|
-
this.merge();
|
|
67
|
+
super(...arguments);
|
|
68
|
+
this.what = 'home';
|
|
69
|
+
this.items = () => this.rows();
|
|
96
70
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const merged = [];
|
|
100
|
-
for (const { extension, source } of this.sources) {
|
|
101
|
-
let items;
|
|
102
|
-
try {
|
|
103
|
-
items = source.items();
|
|
104
|
-
}
|
|
105
|
-
catch (error) {
|
|
106
|
-
console.error(`The home of the web extension ${extension} failed:`, error);
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
for (const item of items) {
|
|
110
|
-
let entry = this.entries.get(item);
|
|
111
|
-
if (!entry) {
|
|
112
|
-
entry = { ...item, key: `${extension}/${item.id}`, extension, tone: launcher_search_util_1.LauncherSearchUtil.tint((_a = item.tint) !== null && _a !== void 0 ? _a : extension) };
|
|
113
|
-
this.entries.set(item, entry);
|
|
114
|
-
}
|
|
115
|
-
merged.push(entry);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
const before = this.merged;
|
|
119
|
-
if (merged.length === before.length && merged.every((entry, index) => entry === before[index])) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
this.merged = merged;
|
|
123
|
-
for (const listener of this.listeners) {
|
|
124
|
-
listener();
|
|
125
|
-
}
|
|
71
|
+
read(source) {
|
|
72
|
+
return source.items();
|
|
126
73
|
}
|
|
127
74
|
}
|
|
128
75
|
exports.WebHomeBoard = WebHomeBoard;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { WebPartner, WebPartnerEntry, WebPartnerSource } from './web-api-partners';
|
|
2
|
+
import { WebRowBoard } from './web-row-board';
|
|
3
|
+
/** The partners of every extension (registerPartners): one list, drawn again only when a source says it changed. */
|
|
4
|
+
export declare class WebPartnerBoard extends WebRowBoard<WebPartner, WebPartnerSource> {
|
|
5
|
+
protected readonly what = "partners";
|
|
6
|
+
readonly partners: () => readonly WebPartnerEntry[];
|
|
7
|
+
protected read(source: WebPartnerSource): readonly WebPartner[];
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=web-partners.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebPartnerBoard = void 0;
|
|
4
|
+
const web_row_board_1 = require("./web-row-board");
|
|
5
|
+
/** The partners of every extension (registerPartners): one list, drawn again only when a source says it changed. */
|
|
6
|
+
class WebPartnerBoard extends web_row_board_1.WebRowBoard {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.what = 'partners';
|
|
10
|
+
this.partners = () => this.rows();
|
|
11
|
+
}
|
|
12
|
+
read(source) {
|
|
13
|
+
return source.partners();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.WebPartnerBoard = WebPartnerBoard;
|
|
17
|
+
//# sourceMappingURL=web-partners.js.map
|