@celljs/ta-web 4.26.0 → 4.28.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-role.d.ts +9 -4
- package/esm/browser/assistant/assistant-role.js +17 -5
- package/esm/browser/assistant/assistant-task-util.d.ts +6 -0
- package/esm/browser/assistant/assistant-task-util.js +12 -1
- package/esm/browser/assistant/assistant-view.js +4 -1
- package/esm/browser/assistant/assistant.d.ts +2 -1
- package/esm/browser/assistant/assistant.js +9 -7
- package/esm/browser/assistant/call-conversing.d.ts +45 -0
- package/esm/browser/assistant/call-conversing.js +91 -0
- package/esm/browser/assistant/call-face.d.ts +13 -0
- package/esm/browser/assistant/call-face.js +81 -0
- package/esm/browser/assistant/call-keeper.d.ts +8 -4
- package/esm/browser/assistant/call-keeper.js +32 -11
- package/esm/browser/assistant/call-partnering.d.ts +37 -0
- package/esm/browser/assistant/call-partnering.js +79 -0
- package/esm/browser/assistant/call-scenes.d.ts +25 -0
- package/esm/browser/assistant/call-scenes.js +82 -0
- package/esm/browser/assistant/call-screen.d.ts +3 -0
- package/esm/browser/assistant/call-screen.js +15 -0
- package/esm/browser/assistant/mic-sense.d.ts +31 -0
- package/esm/browser/assistant/mic-sense.js +119 -0
- package/esm/browser/assistant/noise-gate.d.ts +32 -0
- package/esm/browser/assistant/noise-gate.js +66 -0
- package/esm/browser/assistant/pcm-util.d.ts +10 -0
- package/esm/browser/assistant/pcm-util.js +55 -0
- package/esm/browser/assistant/read-aloud.d.ts +2 -1
- package/esm/browser/assistant/realtime-voice-protocol.d.ts +84 -0
- package/esm/browser/assistant/realtime-voice-protocol.js +40 -0
- package/esm/browser/assistant/realtime-voice.d.ts +50 -62
- package/esm/browser/assistant/realtime-voice.js +213 -134
- package/esm/browser/assistant/spoken-timeline.d.ts +27 -0
- package/esm/browser/assistant/spoken-timeline.js +49 -0
- package/esm/browser/assistant/voice-call-bar.d.ts +9 -2
- package/esm/browser/assistant/voice-call-bar.js +81 -31
- package/esm/browser/assistant/voice-call-protocol.d.ts +61 -4
- package/esm/browser/assistant/voice-call.d.ts +16 -23
- package/esm/browser/assistant/voice-call.js +134 -117
- package/esm/browser/assistant/voice-reading.d.ts +83 -0
- package/esm/browser/assistant/voice-reading.js +150 -0
- package/esm/browser/avatar/dino-talk.d.ts +15 -0
- package/esm/browser/avatar/dino-talk.js +34 -0
- package/esm/browser/components/chat-home.d.ts +6 -4
- package/esm/browser/components/chat-home.js +7 -7
- package/esm/browser/components/chat-icon.js +9 -5
- package/esm/browser/components/chat-list-hooks.d.ts +14 -4
- package/esm/browser/components/chat-list-hooks.js +11 -5
- package/esm/browser/components/chat-list-row.d.ts +7 -4
- package/esm/browser/components/chat-list-row.js +22 -10
- package/esm/browser/components/chat-list.js +6 -11
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/conversation-scroll-util.d.ts +8 -1
- package/esm/browser/components/conversation-scroll-util.js +21 -0
- package/esm/browser/components/conversation-scroll.js +10 -11
- package/esm/browser/components/gallery.js +28 -7
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/image-pull.d.ts +64 -0
- package/esm/browser/components/image-pull.js +202 -0
- package/esm/browser/components/kept-call-bar.js +2 -1
- package/esm/browser/components/lightbox.d.ts +1 -1
- package/esm/browser/components/lightbox.js +57 -2
- package/esm/browser/components/markdown.d.ts +3 -1
- package/esm/browser/components/markdown.js +8 -4
- package/esm/browser/components/partner-row.js +2 -1
- package/esm/browser/components/relay-services.d.ts +9 -3
- package/esm/browser/components/relay-services.js +73 -35
- package/esm/browser/components/session-view.js +4 -2
- package/esm/browser/components/settings-parts.js +2 -0
- package/esm/browser/components/ta-avatar.d.ts +15 -1
- package/esm/browser/components/ta-avatar.js +72 -11
- package/esm/browser/components/voice-services.js +6 -1
- package/esm/browser/extension/web-api-call.d.ts +64 -2
- package/esm/browser/extension/web-api-contributions.d.ts +1 -0
- package/esm/browser/extension/web-api-partners.d.ts +2 -0
- package/esm/browser/extension/web-extension-api.d.ts +6 -6
- package/esm/browser/extension/web-extension-context.js +1 -0
- package/esm/browser/extension/web-extension-protocol.d.ts +3 -1
- package/esm/browser/extension/web-extension-run.d.ts +3 -2
- package/esm/browser/extension/web-extension-run.js +2 -0
- package/esm/browser/hosts.d.ts +2 -0
- package/esm/browser/hosts.js +22 -3
- package/esm/browser/i18n/locales.d.ts +24 -5
- package/esm/browser/i18n/messages-ja.js +25 -6
- package/esm/browser/i18n/messages-zh-tw.js +25 -6
- package/esm/browser/i18n/messages.d.ts +23 -4
- package/esm/browser/i18n/messages.js +50 -12
- package/esm/browser/markdown/code-renderers.d.ts +2 -0
- package/esm/browser/markdown/code-renderers.js +2 -0
- package/esm/browser/screen/page-answers.d.ts +2 -1
- package/esm/browser/screen/page-answers.js +7 -4
- package/esm/browser/settings/settings-protocol.d.ts +2 -0
- package/esm/browser/settings/settings-protocol.js +2 -0
- package/esm/browser/style/chat-list.d.ts +1 -1
- package/esm/browser/style/chat-list.js +1 -1
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +6 -1
- package/esm/browser/style/device.js +1 -0
- package/esm/browser/style/dialogs.d.ts +1 -1
- package/esm/browser/style/dialogs.js +1 -1
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +135 -57
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +8 -0
- package/esm/browser/style/video-call.d.ts +2 -0
- package/esm/browser/style/video-call.js +52 -0
- package/esm/browser/style.js +2 -0
- package/esm/browser/util/desktop.d.ts +10 -1
- package/esm/browser/util/desktop.js +10 -0
- package/esm/browser/util/image-pull.d.ts +61 -0
- package/esm/browser/util/image-pull.js +88 -0
- package/esm/browser/util/spoken.d.ts +3 -3
- package/esm/browser/util/spoken.js +4 -4
- package/esm/browser/video-call/call-camera.d.ts +59 -0
- package/esm/browser/video-call/call-camera.js +188 -0
- package/esm/browser/video-call/call-window.d.ts +19 -0
- package/esm/browser/video-call/call-window.js +80 -0
- package/esm/browser/video-call/clip-plan.d.ts +47 -0
- package/esm/browser/video-call/clip-plan.js +60 -0
- package/esm/browser/video-call/face-clips.d.ts +33 -0
- package/esm/browser/video-call/face-clips.js +93 -0
- package/esm/browser/video-call/face-files.d.ts +31 -0
- package/esm/browser/video-call/face-files.js +77 -0
- package/esm/browser/video-call/video-call-view.d.ts +19 -0
- package/esm/browser/video-call/video-call-view.js +214 -0
- package/esm/browser/video-call/video-face.d.ts +13 -0
- package/esm/browser/video-call/video-face.js +497 -0
- package/esm/browser/workbench-hosts.d.ts +1 -0
- package/esm/browser/workbench-hosts.js +8 -4
- package/esm/browser/workbench-lists.d.ts +16 -1
- package/esm/browser/workbench-lists.js +38 -3
- package/esm/browser/workbench-protocol.d.ts +2 -0
- package/esm/browser/workbench-util.d.ts +5 -0
- package/esm/browser/workbench-util.js +18 -0
- package/esm/browser/workbench.d.ts +6 -0
- package/esm/browser/workbench.js +36 -5
- package/lib/browser/assistant/assistant-role.d.ts +9 -4
- package/lib/browser/assistant/assistant-role.js +17 -5
- package/lib/browser/assistant/assistant-task-util.d.ts +6 -0
- package/lib/browser/assistant/assistant-task-util.js +11 -0
- package/lib/browser/assistant/assistant-view.js +3 -0
- package/lib/browser/assistant/assistant.d.ts +2 -1
- package/lib/browser/assistant/assistant.js +9 -7
- package/lib/browser/assistant/call-conversing.d.ts +46 -0
- package/lib/browser/assistant/call-conversing.js +96 -0
- package/lib/browser/assistant/call-face.d.ts +14 -0
- package/lib/browser/assistant/call-face.js +117 -0
- package/lib/browser/assistant/call-keeper.d.ts +8 -4
- package/lib/browser/assistant/call-keeper.js +32 -11
- package/lib/browser/assistant/call-partnering.d.ts +38 -0
- package/lib/browser/assistant/call-partnering.js +83 -0
- package/lib/browser/assistant/call-scenes.d.ts +26 -0
- package/lib/browser/assistant/call-scenes.js +85 -0
- package/lib/browser/assistant/call-screen.d.ts +3 -0
- package/lib/browser/assistant/call-screen.js +15 -0
- package/lib/browser/assistant/mic-sense.d.ts +32 -0
- package/lib/browser/assistant/mic-sense.js +123 -0
- package/lib/browser/assistant/noise-gate.d.ts +33 -0
- package/lib/browser/assistant/noise-gate.js +71 -0
- package/lib/browser/assistant/pcm-util.d.ts +11 -0
- package/lib/browser/assistant/pcm-util.js +58 -0
- package/lib/browser/assistant/read-aloud.d.ts +2 -1
- package/lib/browser/assistant/realtime-voice-protocol.d.ts +85 -0
- package/lib/browser/assistant/realtime-voice-protocol.js +43 -0
- package/lib/browser/assistant/realtime-voice.d.ts +50 -62
- package/lib/browser/assistant/realtime-voice.js +217 -138
- package/lib/browser/assistant/spoken-timeline.d.ts +28 -0
- package/lib/browser/assistant/spoken-timeline.js +53 -0
- package/lib/browser/assistant/voice-call-bar.d.ts +9 -2
- package/lib/browser/assistant/voice-call-bar.js +81 -30
- package/lib/browser/assistant/voice-call-protocol.d.ts +61 -4
- package/lib/browser/assistant/voice-call.d.ts +16 -23
- package/lib/browser/assistant/voice-call.js +134 -117
- package/lib/browser/assistant/voice-reading.d.ts +84 -0
- package/lib/browser/assistant/voice-reading.js +156 -0
- package/lib/browser/avatar/dino-talk.d.ts +16 -0
- package/lib/browser/avatar/dino-talk.js +37 -0
- package/lib/browser/components/chat-home.d.ts +6 -4
- package/lib/browser/components/chat-home.js +8 -9
- package/lib/browser/components/chat-icon.js +9 -5
- package/lib/browser/components/chat-list-hooks.d.ts +14 -4
- package/lib/browser/components/chat-list-hooks.js +12 -6
- package/lib/browser/components/chat-list-row.d.ts +7 -4
- package/lib/browser/components/chat-list-row.js +23 -12
- package/lib/browser/components/chat-list.js +5 -10
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/conversation-scroll-util.d.ts +8 -1
- package/lib/browser/components/conversation-scroll-util.js +21 -0
- package/lib/browser/components/conversation-scroll.js +10 -11
- package/lib/browser/components/gallery.js +28 -7
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/image-pull.d.ts +65 -0
- package/lib/browser/components/image-pull.js +206 -0
- package/lib/browser/components/kept-call-bar.js +2 -1
- package/lib/browser/components/lightbox.d.ts +1 -1
- package/lib/browser/components/lightbox.js +57 -2
- package/lib/browser/components/markdown.d.ts +3 -1
- package/lib/browser/components/markdown.js +7 -3
- package/lib/browser/components/partner-row.js +2 -1
- package/lib/browser/components/relay-services.d.ts +9 -3
- package/lib/browser/components/relay-services.js +71 -33
- package/lib/browser/components/session-view.js +3 -1
- package/lib/browser/components/settings-parts.js +2 -0
- package/lib/browser/components/ta-avatar.d.ts +15 -1
- package/lib/browser/components/ta-avatar.js +72 -11
- package/lib/browser/components/voice-services.js +5 -0
- package/lib/browser/extension/web-api-call.d.ts +64 -2
- package/lib/browser/extension/web-api-contributions.d.ts +1 -0
- package/lib/browser/extension/web-api-partners.d.ts +2 -0
- package/lib/browser/extension/web-extension-api.d.ts +6 -6
- package/lib/browser/extension/web-extension-context.js +1 -0
- package/lib/browser/extension/web-extension-protocol.d.ts +3 -1
- package/lib/browser/extension/web-extension-run.d.ts +3 -2
- package/lib/browser/extension/web-extension-run.js +2 -0
- package/lib/browser/hosts.d.ts +2 -0
- package/lib/browser/hosts.js +22 -3
- package/lib/browser/i18n/locales.d.ts +24 -5
- package/lib/browser/i18n/messages-ja.js +25 -6
- package/lib/browser/i18n/messages-zh-tw.js +25 -6
- package/lib/browser/i18n/messages.d.ts +23 -4
- package/lib/browser/i18n/messages.js +50 -12
- package/lib/browser/markdown/code-renderers.d.ts +2 -0
- package/lib/browser/markdown/code-renderers.js +3 -1
- package/lib/browser/screen/page-answers.d.ts +2 -1
- package/lib/browser/screen/page-answers.js +7 -4
- package/lib/browser/settings/settings-protocol.d.ts +2 -0
- package/lib/browser/settings/settings-protocol.js +2 -0
- package/lib/browser/style/chat-list.d.ts +1 -1
- package/lib/browser/style/chat-list.js +1 -1
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +6 -1
- package/lib/browser/style/device.js +1 -0
- package/lib/browser/style/dialogs.d.ts +1 -1
- package/lib/browser/style/dialogs.js +1 -1
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +135 -57
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +8 -0
- package/lib/browser/style/video-call.d.ts +3 -0
- package/lib/browser/style/video-call.js +55 -0
- package/lib/browser/style.js +2 -0
- package/lib/browser/util/desktop.d.ts +10 -1
- package/lib/browser/util/desktop.js +10 -0
- package/lib/browser/util/image-pull.d.ts +62 -0
- package/lib/browser/util/image-pull.js +91 -0
- package/lib/browser/util/spoken.d.ts +3 -3
- package/lib/browser/util/spoken.js +4 -4
- package/lib/browser/video-call/call-camera.d.ts +60 -0
- package/lib/browser/video-call/call-camera.js +192 -0
- package/lib/browser/video-call/call-window.d.ts +20 -0
- package/lib/browser/video-call/call-window.js +83 -0
- package/lib/browser/video-call/clip-plan.d.ts +48 -0
- package/lib/browser/video-call/clip-plan.js +64 -0
- package/lib/browser/video-call/face-clips.d.ts +34 -0
- package/lib/browser/video-call/face-clips.js +96 -0
- package/lib/browser/video-call/face-files.d.ts +32 -0
- package/lib/browser/video-call/face-files.js +82 -0
- package/lib/browser/video-call/video-call-view.d.ts +20 -0
- package/lib/browser/video-call/video-call-view.js +250 -0
- package/lib/browser/video-call/video-face.d.ts +14 -0
- package/lib/browser/video-call/video-face.js +533 -0
- package/lib/browser/workbench-hosts.d.ts +1 -0
- package/lib/browser/workbench-hosts.js +8 -4
- package/lib/browser/workbench-lists.d.ts +16 -1
- package/lib/browser/workbench-lists.js +38 -3
- package/lib/browser/workbench-protocol.d.ts +2 -0
- package/lib/browser/workbench-util.d.ts +5 -0
- package/lib/browser/workbench-util.js +18 -0
- package/lib/browser/workbench.d.ts +6 -0
- package/lib/browser/workbench.js +35 -4
- package/package.json +7 -7
- package/public/faces/README.md +27 -0
- package/public/faces/clap.mp4 +0 -0
- package/public/faces/dance.mp4 +0 -0
- package/public/faces/happy.mp4 +0 -0
- package/public/faces/heart.mp4 +0 -0
- package/public/faces/idle-1.mp4 +0 -0
- package/public/faces/idle-2.mp4 +0 -0
- package/public/faces/idle-3.mp4 +0 -0
- package/public/faces/laugh.mp4 +0 -0
- package/public/faces/lips.json +1 -0
- package/public/faces/listening.mp4 +0 -0
- package/public/faces/poster.jpg +0 -0
- package/public/faces/shy.mp4 +0 -0
- package/public/faces/sorry.mp4 +0 -0
- package/public/faces/stretch.mp4 +0 -0
- package/public/faces/surprised.mp4 +0 -0
- package/public/faces/talk-1.mp4 +0 -0
- package/public/faces/talk-2.mp4 +0 -0
- package/public/faces/think-2.mp4 +0 -0
- package/public/faces/thinking.mp4 +0 -0
- package/public/faces/wave.mp4 +0 -0
|
@@ -39,24 +39,60 @@ const React = __importStar(require("react"));
|
|
|
39
39
|
const back_stack_1 = require("../device/back-stack");
|
|
40
40
|
const use_t_1 = require("../i18n/use-t");
|
|
41
41
|
const icon_1 = require("./icon");
|
|
42
|
+
const image_pull_1 = require("./image-pull");
|
|
42
43
|
const image_viewer_1 = require("./image-viewer");
|
|
43
44
|
/**
|
|
44
45
|
* An image over the page, to look at closely (ImageViewer): pinched, zoomed, dragged, and with `onPrevious` /
|
|
45
46
|
* `onNext` the images beside it, by its side buttons, ← → and a finger that swipes it (`previousSrc` / `nextSrc`
|
|
46
47
|
* in sight as it does, as the viewers of pictures of a phone). A click or tap beside it,
|
|
47
|
-
* its close button or
|
|
48
|
+
* its close button, Escape, back or a finger that pulls it down closes it, shrinking back onto its thumbnail (ImagePull). In the top layer, so no container clips it; the touches in it are its
|
|
48
49
|
* own, never a swipe of a sheet under it.
|
|
49
50
|
*/
|
|
50
51
|
function Lightbox({ src, alt, caption, count, onClose, onPrevious, onNext, previousSrc, nextSrc, }) {
|
|
51
52
|
const t = (0, use_t_1.useT)();
|
|
52
53
|
const dialog = React.useRef(null);
|
|
54
|
+
/** What opened it (the thumbnail tapped): the picture goes back there first, of those that show the same. */
|
|
55
|
+
const opener = React.useRef(null);
|
|
53
56
|
React.useEffect(() => {
|
|
54
57
|
var _a, _b;
|
|
58
|
+
opener.current = document.activeElement;
|
|
55
59
|
(_b = (_a = dialog.current) === null || _a === void 0 ? void 0 : _a.showModal) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
56
60
|
}, []);
|
|
57
|
-
const
|
|
61
|
+
const pull = React.useRef(undefined);
|
|
62
|
+
// It shrinks back onto its thumbnail, then closes.
|
|
63
|
+
const close = () => { var _a; return (pull.current ? pull.current.leave() : (_a = dialog.current) === null || _a === void 0 ? void 0 : _a.close()); };
|
|
58
64
|
(0, back_stack_1.useBackLayer)(true, close);
|
|
65
|
+
const shade = React.useRef(null);
|
|
66
|
+
const shown = React.useRef(src);
|
|
67
|
+
shown.current = src;
|
|
68
|
+
React.useEffect(() => {
|
|
69
|
+
const box = dialog.current;
|
|
70
|
+
const viewport = box === null || box === void 0 ? void 0 : box.querySelector('.ta-zoom-viewport');
|
|
71
|
+
const image = viewport === null || viewport === void 0 ? void 0 : viewport.querySelector('img');
|
|
72
|
+
if (!box || !viewport || !image || !shade.current) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const controller = new image_pull_1.ImagePull(viewport, image, shade.current, {
|
|
76
|
+
origin: () => LightboxUtil.thumbnail(shown.current, box, opener.current),
|
|
77
|
+
pulling: pulling => box.toggleAttribute('data-pulling', pulling),
|
|
78
|
+
close: () => box.close(),
|
|
79
|
+
});
|
|
80
|
+
pull.current = controller;
|
|
81
|
+
// Escape shrinks it back too.
|
|
82
|
+
const onCancel = (event) => {
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
controller.leave();
|
|
85
|
+
};
|
|
86
|
+
box.addEventListener('cancel', onCancel);
|
|
87
|
+
const detach = controller.attach();
|
|
88
|
+
return () => {
|
|
89
|
+
box.removeEventListener('cancel', onCancel);
|
|
90
|
+
detach();
|
|
91
|
+
pull.current = undefined;
|
|
92
|
+
};
|
|
93
|
+
}, []);
|
|
59
94
|
return (React.createElement("dialog", { ref: dialog, className: "ta-lightbox", onClose: onClose, onTouchStart: event => event.stopPropagation() },
|
|
95
|
+
React.createElement("div", { ref: shade, className: "ta-lightbox-shade" }),
|
|
60
96
|
React.createElement(image_viewer_1.ImageViewer, { src: src, alt: alt, onBackground: close, onPrevious: onPrevious, onNext: onNext, previousSrc: previousSrc, nextSrc: nextSrc, autoFocus: true }),
|
|
61
97
|
(caption || count) && (React.createElement("div", { className: "ta-lightbox-caption" },
|
|
62
98
|
caption && React.createElement("span", { className: "ta-lightbox-words" }, caption),
|
|
@@ -64,4 +100,23 @@ function Lightbox({ src, alt, caption, count, onClose, onPrevious, onNext, previ
|
|
|
64
100
|
React.createElement("button", { type: "button", className: "ta-lightbox-close", title: t('ta.close'), "aria-label": t('ta.close'), onClick: close },
|
|
65
101
|
React.createElement(icon_1.Icon, { icon: lucide_react_1.X, size: 18 }))));
|
|
66
102
|
}
|
|
103
|
+
var LightboxUtil;
|
|
104
|
+
(function (LightboxUtil) {
|
|
105
|
+
/** The picture `src` small on the page, in sight (the thumbnail it was opened from, in `opener` first), out of `lightbox`. */
|
|
106
|
+
function thumbnail(src, lightbox, opener) {
|
|
107
|
+
var _a;
|
|
108
|
+
const url = new URL(src, location.href).href;
|
|
109
|
+
for (const image of [...((_a = opener === null || opener === void 0 ? void 0 : opener.querySelectorAll('img')) !== null && _a !== void 0 ? _a : []), ...document.images]) {
|
|
110
|
+
if (lightbox.contains(image) || (image.currentSrc || image.src) !== url) {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
const rect = image.getBoundingClientRect();
|
|
114
|
+
if (rect.width > 0 && rect.height > 0 && rect.bottom > 0 && rect.top < window.innerHeight && rect.right > 0 && rect.left < window.innerWidth) {
|
|
115
|
+
return image;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
LightboxUtil.thumbnail = thumbnail;
|
|
121
|
+
})(LightboxUtil || (LightboxUtil = {}));
|
|
67
122
|
//# sourceMappingURL=lightbox.js.map
|
|
@@ -6,9 +6,11 @@ export declare function CodeBlock({ code }: {
|
|
|
6
6
|
/**
|
|
7
7
|
* Markdown as React elements; drawn again only when its text changes, and then only the blocks that did.
|
|
8
8
|
* `streaming`: the text is a reply still coming, which shows nothing that is about to turn into something else.
|
|
9
|
+
* `inline`: a short text in a line (an option, an answer, a label), its marks and formulas drawn without blocks.
|
|
9
10
|
*/
|
|
10
|
-
export declare function Markdown({ text, streaming }: {
|
|
11
|
+
export declare function Markdown({ text, streaming, inline }: {
|
|
11
12
|
text: string;
|
|
12
13
|
streaming?: boolean;
|
|
14
|
+
inline?: boolean;
|
|
13
15
|
}): React.JSX.Element;
|
|
14
16
|
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -118,6 +118,7 @@ function CodeView({ language, code, closed }) {
|
|
|
118
118
|
const Renderer = React.useContext(code_renderers_1.CodeRenderers)[language.trim().toLowerCase()];
|
|
119
119
|
const send = React.useContext(code_renderers_1.CodeReply);
|
|
120
120
|
const answer = React.useContext(code_renderers_1.CodeAnswer);
|
|
121
|
+
const embedded = React.useContext(code_renderers_1.CodeEmbedded);
|
|
121
122
|
// What a reply holds for the ear alone (SpokenReply) is heard, not shown.
|
|
122
123
|
if (language.trim().toLowerCase() === spoken_1.SpokenReply.LANGUAGE) {
|
|
123
124
|
return null;
|
|
@@ -125,7 +126,8 @@ function CodeView({ language, code, closed }) {
|
|
|
125
126
|
const plain = React.createElement(CodeBlock, { code: code, language: language });
|
|
126
127
|
if (Renderer) {
|
|
127
128
|
return (React.createElement(CodeBoundary, { retry: closed, fallback: plain },
|
|
128
|
-
React.createElement(
|
|
129
|
+
React.createElement(code_renderers_1.CodeEmbedded.Provider, { value: true }, embedded ? (React.createElement("div", { className: "ta-code-embedded" },
|
|
130
|
+
React.createElement(Renderer, { code: code, language: language, closed: closed, send: send, answer: answer, embedded: true }))) : (React.createElement(Renderer, { code: code, language: language, closed: closed, send: send, answer: answer })))));
|
|
129
131
|
}
|
|
130
132
|
if (mermaid_1.MermaidUtil.isDiagram(language, code)) {
|
|
131
133
|
return React.createElement(mermaid_view_1.MermaidView, { code: code, fallback: plain });
|
|
@@ -187,8 +189,10 @@ const MarkdownBody = React.memo(function MarkdownBody({ text, streaming }) {
|
|
|
187
189
|
/**
|
|
188
190
|
* Markdown as React elements; drawn again only when its text changes, and then only the blocks that did.
|
|
189
191
|
* `streaming`: the text is a reply still coming, which shows nothing that is about to turn into something else.
|
|
192
|
+
* `inline`: a short text in a line (an option, an answer, a label), its marks and formulas drawn without blocks.
|
|
190
193
|
*/
|
|
191
|
-
function Markdown({ text, streaming = false }) {
|
|
192
|
-
return React.createElement(
|
|
194
|
+
function Markdown({ text, streaming = false, inline = false }) {
|
|
195
|
+
return inline ? (React.createElement("span", { className: "ta-markdown ta-markdown-inline" },
|
|
196
|
+
React.createElement(Text, { text: text }))) : (React.createElement(MarkdownBody, { text: text, streaming: streaming }));
|
|
193
197
|
}
|
|
194
198
|
//# sourceMappingURL=markdown.js.map
|
|
@@ -53,6 +53,7 @@ const swipe_row_1 = require("./swipe-row");
|
|
|
53
53
|
*/
|
|
54
54
|
function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
|
|
55
55
|
var _a, _b;
|
|
56
|
+
var _c;
|
|
56
57
|
const t = (0, use_t_1.useT)();
|
|
57
58
|
const [menu, openMenu] = (0, context_menu_1.useContextMenu)();
|
|
58
59
|
const [opening, setOpening] = React.useState(false);
|
|
@@ -91,6 +92,6 @@ function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
|
|
|
91
92
|
React.createElement(Own, { size: 38 }))) : (React.createElement("span", { className: "ta-chat-avatar ta-chat-icon", style: { background: `var(--ta-tint-${partner.tone})`, color: `var(--ta-tint-ink-${partner.tone})`, width: 38, height: 38 }, "aria-hidden": "true" }, opening ? React.createElement("span", { className: "ta-spinner" }) : React.createElement(Glyph, { size: 18, strokeWidth: 1.8 }))),
|
|
92
93
|
partner.online && React.createElement("span", { className: "ta-partner-online", "aria-hidden": "true" }),
|
|
93
94
|
React.createElement(chat_list_row_1.ChatDot, { unseen: unseen, asks: asks })),
|
|
94
|
-
React.createElement(chat_home_1.RowText, { title: partner.name, time: time, line: partners_util_1.PartnersUtil.line(partner, t('ta.partners.waiting')), unseen: unseen, busy: !partner.status && !!((_b = partner.chat) === null || _b === void 0 ? void 0 : _b.busy), tag: partner.location ? React.createElement(host_tag_1.HostTag, { location: partner.location }) : undefined, badge: partner.friends ? t('ta.partners.withFriends') : undefined }))));
|
|
95
|
+
React.createElement(chat_home_1.RowText, { title: partner.name, time: time, line: partners_util_1.PartnersUtil.line(partner, t('ta.partners.waiting')), unseen: unseen, busy: !partner.status && !!((_b = partner.chat) === null || _b === void 0 ? void 0 : _b.busy), tag: partner.location ? React.createElement(host_tag_1.HostTag, { location: partner.location }) : undefined, badge: (_c = partner.label) !== null && _c !== void 0 ? _c : (partner.friends ? t('ta.partners.withFriends') : undefined) }))));
|
|
95
96
|
}
|
|
96
97
|
//# sourceMappingURL=partner-row.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TaJoinedDeployment, TaRelayFeature, TaRelayProbe, TaRelayService, TaRelayTypeInfo } from '@celljs/ta-protocol';
|
|
1
|
+
import type { TaJoinedDeployment, TaRelayFeature, TaRelayProbe, TaRelayService, TaRelays, TaRelayTypeInfo } from '@celljs/ta-protocol';
|
|
2
2
|
import { type LucideIcon } from 'lucide-react';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useT } from '../i18n/use-t';
|
|
@@ -11,14 +11,20 @@ export declare namespace RelayServicesUtil {
|
|
|
11
11
|
function serves(service: TaRelayService, feature: TaRelayFeature): boolean;
|
|
12
12
|
/** The icon of a service: the official relay, a relay, a folder, a store by the icon its package gave its type. */
|
|
13
13
|
function icon(service: TaRelayService, types?: readonly TaRelayTypeInfo[]): LucideIcon;
|
|
14
|
+
/** The ways of the phones, in order: as the computer lists them, else the relay of `devices` alone. */
|
|
15
|
+
function routes(relays: TaRelays): string[];
|
|
16
|
+
/** The ways of the phones as relays.json keeps them: `direct` first while it is on. */
|
|
17
|
+
function withDirect(relays: TaRelays, ids: readonly string[], on?: boolean): string[];
|
|
18
|
+
/** The ways with the one at `index` tried one earlier. */
|
|
19
|
+
function earlier(routes: readonly string[], index: number): string[];
|
|
14
20
|
/** What a deployment is called: its name, else the host of the address it was joined by. */
|
|
15
21
|
function deploymentName(deployment: TaJoinedDeployment): string;
|
|
16
22
|
function host(url: string): string;
|
|
17
23
|
/** A name for the cloud workspace of a deployment's gateway (ta://<name>): its first label, as TaLocation takes it. */
|
|
18
24
|
function cloudName(gateway: string): string;
|
|
19
25
|
function iconNamed(name: string | undefined): LucideIcon;
|
|
20
|
-
/**
|
|
21
|
-
function
|
|
26
|
+
/** Where a relay is and whether it answers, short enough for a phone beside its controls. */
|
|
27
|
+
function brief(service: TaRelayService, probe: TaRelayProbe | undefined, t: ReturnType<typeof useT>): string;
|
|
22
28
|
}
|
|
23
29
|
/**
|
|
24
30
|
* The relays of relays.json (docs/design/ta-relays.md) and which one each feature uses: phones that reach this
|
|
@@ -42,8 +42,13 @@ const use_t_1 = require("../i18n/use-t");
|
|
|
42
42
|
const icon_1 = require("./icon");
|
|
43
43
|
const remote_hosts_1 = require("./remote-hosts");
|
|
44
44
|
const settings_controls_1 = require("./settings-controls");
|
|
45
|
-
/**
|
|
46
|
-
const
|
|
45
|
+
/** In `use.devices`, the direct connection of a phone to this computer (DIRECT_ROUTE of ta-relay). */
|
|
46
|
+
const DIRECT = 'direct';
|
|
47
|
+
/**
|
|
48
|
+
* The features that go through one relay, in the order the settings list them, after the ways of the phones
|
|
49
|
+
* (DeviceRoutes); where sync goes is chosen in its own settings (ta-sync).
|
|
50
|
+
*/
|
|
51
|
+
const FEATURES = ['share', 'rooms'];
|
|
47
52
|
var RelayServicesUtil;
|
|
48
53
|
(function (RelayServicesUtil) {
|
|
49
54
|
/** What a service is called: the official relay, its name, else its host or its folder. */
|
|
@@ -83,6 +88,30 @@ var RelayServicesUtil;
|
|
|
83
88
|
return iconNamed((_a = types.find(each => each.type === service.type)) === null || _a === void 0 ? void 0 : _a.icon);
|
|
84
89
|
}
|
|
85
90
|
RelayServicesUtil.icon = icon;
|
|
91
|
+
/** The ways of the phones, in order: as the computer lists them, else the relay of `devices` alone. */
|
|
92
|
+
function routes(relays) {
|
|
93
|
+
var _a;
|
|
94
|
+
const listed = ((_a = relays.routes) === null || _a === void 0 ? void 0 : _a.length) ? relays.routes : [relays.use.devices];
|
|
95
|
+
return listed.filter(id => relays.relays.some(relay => relay.id === id && relay.type === 'ta-relay'));
|
|
96
|
+
}
|
|
97
|
+
RelayServicesUtil.routes = routes;
|
|
98
|
+
/** The ways of the phones as relays.json keeps them: `direct` first while it is on. */
|
|
99
|
+
function withDirect(relays, ids, on) {
|
|
100
|
+
var _a;
|
|
101
|
+
var _b;
|
|
102
|
+
if (on === void 0) { on = (_b = (_a = relays.direct) === null || _a === void 0 ? void 0 : _a.on) !== null && _b !== void 0 ? _b : false; }
|
|
103
|
+
return [...(on ? [DIRECT] : []), ...ids.filter(id => id !== DIRECT)];
|
|
104
|
+
}
|
|
105
|
+
RelayServicesUtil.withDirect = withDirect;
|
|
106
|
+
/** The ways with the one at `index` tried one earlier. */
|
|
107
|
+
function earlier(routes, index) {
|
|
108
|
+
const next = [...routes];
|
|
109
|
+
if (index > 0 && index < next.length) {
|
|
110
|
+
[next[index - 1], next[index]] = [next[index], next[index - 1]];
|
|
111
|
+
}
|
|
112
|
+
return next;
|
|
113
|
+
}
|
|
114
|
+
RelayServicesUtil.earlier = earlier;
|
|
86
115
|
/** What a deployment is called: its name, else the host of the address it was joined by. */
|
|
87
116
|
function deploymentName(deployment) {
|
|
88
117
|
var _a;
|
|
@@ -112,38 +141,20 @@ var RelayServicesUtil;
|
|
|
112
141
|
return name === 'Database' ? lucide_react_1.Database : name === 'GitBranch' ? lucide_react_1.GitBranch : name === 'HardDrive' ? lucide_react_1.HardDrive : name === 'Server' ? lucide_react_1.Server : lucide_react_1.Cloud;
|
|
113
142
|
}
|
|
114
143
|
RelayServicesUtil.iconNamed = iconNamed;
|
|
115
|
-
/**
|
|
116
|
-
function
|
|
117
|
-
var _a, _b;
|
|
144
|
+
/** Where a relay is and whether it answers, short enough for a phone beside its controls. */
|
|
145
|
+
function brief(service, probe, t) {
|
|
118
146
|
const host = where(service);
|
|
119
|
-
if (service.type === 'folder') {
|
|
120
|
-
return probe && !probe.online ? `${host} · ${(_a = probe.error) !== null && _a !== void 0 ? _a : t('ta.relays.offline')}` : `${host} · ${t('ta.relays.folderOnly')}`;
|
|
121
|
-
}
|
|
122
|
-
if (service.type !== 'ta-relay') {
|
|
123
|
-
if (service.unavailable) {
|
|
124
|
-
return `${service.type} · ${t('ta.relays.unavailable')}`;
|
|
125
|
-
}
|
|
126
|
-
if (probe && !probe.online) {
|
|
127
|
-
return `${host} · ${(_b = probe.error) !== null && _b !== void 0 ? _b : t('ta.relays.offline')}`;
|
|
128
|
-
}
|
|
129
|
-
return [host, (probe === null || probe === void 0 ? void 0 : probe.ms) !== undefined ? t('ta.relays.online', { ms: probe.ms }) : undefined, t('ta.relays.storeOnly')].filter(Boolean).join(' · ');
|
|
130
|
-
}
|
|
131
147
|
if (!probe) {
|
|
132
148
|
return host;
|
|
133
149
|
}
|
|
134
150
|
if (!probe.online) {
|
|
135
151
|
return `${host} · ${t('ta.relays.offline')}`;
|
|
136
152
|
}
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
if (probe.limits && !probe.legacy) {
|
|
142
|
-
parts.push(t('ta.relays.limits', { members: probe.limits.hubMembers, state: Math.round(probe.limits.hubStateBytes / 1024 / 1024) }));
|
|
143
|
-
}
|
|
144
|
-
return parts.join(' · ');
|
|
153
|
+
const answers = probe.ms !== undefined ? t('ta.relays.online', { ms: probe.ms }) : t('ta.relays.onlineNoTime');
|
|
154
|
+
// A relay that keeps group chats in memory loses them when it restarts: worth saying.
|
|
155
|
+
return [host, answers, probe.persistent === false ? t('ta.relays.memory') : undefined].filter(Boolean).join(' · ');
|
|
145
156
|
}
|
|
146
|
-
RelayServicesUtil.
|
|
157
|
+
RelayServicesUtil.brief = brief;
|
|
147
158
|
})(RelayServicesUtil || (exports.RelayServicesUtil = RelayServicesUtil = {}));
|
|
148
159
|
/**
|
|
149
160
|
* The relays of relays.json (docs/design/ta-relays.md) and which one each feature uses: phones that reach this
|
|
@@ -203,10 +214,7 @@ function RelayServices() {
|
|
|
203
214
|
if (!relays) {
|
|
204
215
|
return null;
|
|
205
216
|
}
|
|
206
|
-
const used = new Set(Object.values(relays.use));
|
|
207
|
-
const types = (_a = relays.types) !== null && _a !== void 0 ? _a : [];
|
|
208
|
-
// Folders and stores are places of sync, chosen and removed there.
|
|
209
|
-
const shown = relays.relays.filter(relay => relay.type === 'ta-relay');
|
|
217
|
+
const used = new Set([...Object.values(relays.use), ...((_a = relays.routes) !== null && _a !== void 0 ? _a : [])]);
|
|
210
218
|
return (React.createElement(React.Fragment, null,
|
|
211
219
|
React.createElement(Deployment, { relays: relays, changed: listed => {
|
|
212
220
|
var _a;
|
|
@@ -221,9 +229,9 @@ function RelayServices() {
|
|
|
221
229
|
React.createElement("select", { className: "ta-input ta-select", "aria-label": t(`ta.relays.feature.${feature}`), disabled: busy !== undefined, value: (_a = relays.use[feature]) !== null && _a !== void 0 ? _a : '', onChange: event => void run(feature, async () => setRelays(await bench.relay.chooseRelay(feature, event.target.value || null))) }, relays.relays
|
|
222
230
|
.filter(relay => RelayServicesUtil.serves(relay, feature) || relays.use[feature] === relay.id)
|
|
223
231
|
.map(relay => (React.createElement("option", { key: relay.id, value: relay.id }, RelayServicesUtil.label(relay, t))))))); }),
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
232
|
+
React.createElement(DeviceRoutes, { relays: relays, probes: probes, busy: busy !== undefined, chooseWays: ids => void run('devices', async () => setRelays(await bench.relay.chooseRelay('devices', ids))), choose: ids => void run('devices', async () => setRelays(await bench.relay.chooseRelay('devices', RelayServicesUtil.withDirect(relays, ids)))), remove: relay => !relay.builtin && relay.id !== 'relay-json' && !used.has(relay.id)
|
|
233
|
+
? () => void run(relay.id, () => bench.relay.removeRelay(relay.id))
|
|
234
|
+
: undefined }),
|
|
227
235
|
React.createElement(settings_controls_1.Row, { label: t('ta.relays.add'), description: t('ta.relays.addHint'), stacked: true },
|
|
228
236
|
React.createElement("form", { className: "ta-trusted-add", onSubmit: event => {
|
|
229
237
|
event.preventDefault();
|
|
@@ -237,6 +245,36 @@ function RelayServices() {
|
|
|
237
245
|
React.createElement(settings_controls_1.Row, { icon: lucide_react_1.RefreshCw, label: t('ta.relays.syncElsewhere'), description: t('ta.relays.syncElsewhereHint') }),
|
|
238
246
|
React.createElement(settings_controls_1.Row, { icon: lucide_react_1.FileJson, label: t('ta.relays.file'), description: React.createElement("span", { className: "ta-path" }, relays.file) })));
|
|
239
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* The relays, as the ways of the phones to this computer (docs/design/ta-relays.md 12): each relay a row with whether it
|
|
250
|
+
* answers, on or off for phones and moved earlier by its arrow, the phones trying them in that order and keeping the first
|
|
251
|
+
* that connects; one stays on. A relay nothing uses can be removed. Folders and stores are places of sync, listed there.
|
|
252
|
+
*/
|
|
253
|
+
function DeviceRoutes({ relays, probes, busy, choose, chooseWays, remove, }) {
|
|
254
|
+
const t = (0, use_t_1.useT)();
|
|
255
|
+
const routes = RelayServicesUtil.routes(relays);
|
|
256
|
+
const all = relays.relays.filter(relay => relay.type === 'ta-relay');
|
|
257
|
+
const ordered = [...routes.flatMap(id => all.filter(relay => relay.id === id)), ...all.filter(relay => !routes.includes(relay.id))];
|
|
258
|
+
return (React.createElement(React.Fragment, null,
|
|
259
|
+
React.createElement(settings_controls_1.Row, { label: t('ta.relays.feature.devices'), description: t('ta.relays.feature.devicesHint') }),
|
|
260
|
+
relays.direct && (React.createElement(settings_controls_1.Row, { icon: lucide_react_1.Zap, label: t('ta.relays.direct'), description: relays.direct.available ? t('ta.relays.directHint') : t('ta.relays.directUnavailable') },
|
|
261
|
+
React.createElement(settings_controls_1.Switch, { checked: relays.direct.on && relays.direct.available, label: t('ta.relays.direct'), disabled: busy || !relays.direct.available, onChange: on => chooseWays(RelayServicesUtil.withDirect(relays, routes, on)) }))),
|
|
262
|
+
ordered.map(relay => {
|
|
263
|
+
var _a;
|
|
264
|
+
const at = routes.indexOf(relay.id);
|
|
265
|
+
const name = RelayServicesUtil.label(relay, t);
|
|
266
|
+
const removing = remove(relay);
|
|
267
|
+
return (React.createElement(settings_controls_1.Row, { key: relay.id, icon: RelayServicesUtil.icon(relay, relays.types), label: name, description: React.createElement("span", { className: "ta-remote-state" },
|
|
268
|
+
React.createElement("span", { className: `ta-remote-light${((_a = probes[relay.id]) === null || _a === void 0 ? void 0 : _a.online) ? ' ta-on' : ''}` }),
|
|
269
|
+
[
|
|
270
|
+
at >= 0 ? t('ta.relays.routeAt', { n: at + 1 }) : t('ta.relays.routeOff'),
|
|
271
|
+
RelayServicesUtil.brief(relay, probes[relay.id], t),
|
|
272
|
+
].join(' · ')) },
|
|
273
|
+
removing && React.createElement(icon_1.IconButton, { icon: lucide_react_1.Trash2, label: t('ta.relays.remove', { name }), disabled: busy, onClick: removing }),
|
|
274
|
+
at > 0 && (React.createElement(icon_1.IconButton, { icon: lucide_react_1.ArrowUp, label: t('ta.relays.routeUp', { name }), disabled: busy, onClick: () => choose(RelayServicesUtil.earlier(routes, at)) })),
|
|
275
|
+
React.createElement(settings_controls_1.Switch, { checked: at >= 0, label: t('ta.relays.routeUse', { name }), disabled: busy || (at >= 0 && routes.length === 1), onChange: on => choose(on ? [...routes, relay.id] : routes.filter(id => id !== relay.id)) })));
|
|
276
|
+
})));
|
|
277
|
+
}
|
|
240
278
|
/**
|
|
241
279
|
* A deployment of Ta, inside a company or outside it (docs/design/ta-deploy.md 8): joined by the address of any of its
|
|
242
280
|
* services, its relay is the default of what is new, and its gateway gives a Ta in the cloud to open, or its sandbox as a
|
|
@@ -38,6 +38,7 @@ const react_1 = require("@celljs/react");
|
|
|
38
38
|
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
39
39
|
const lucide_react_1 = require("lucide-react");
|
|
40
40
|
const React = __importStar(require("react"));
|
|
41
|
+
const call_face_1 = require("../assistant/call-face");
|
|
41
42
|
const voice_call_bar_1 = require("../assistant/voice-call-bar");
|
|
42
43
|
const device_1 = require("../device/device");
|
|
43
44
|
const drafts_protocol_1 = require("../drafts/drafts-protocol");
|
|
@@ -358,7 +359,7 @@ function SessionView({ store, server, workspace, info, onClosed, onActivity, lea
|
|
|
358
359
|
disabled: nothingSaid,
|
|
359
360
|
run: () => setFinding(count => count + 1),
|
|
360
361
|
},
|
|
361
|
-
...(callable ? [(0, voice_call_bar_1.callAction)(callState, call, t)] : []),
|
|
362
|
+
...(callable ? [(0, voice_call_bar_1.callAction)(callState, call, t), (0, voice_call_bar_1.videoCallAction)(callState, call, t)] : []),
|
|
362
363
|
],
|
|
363
364
|
...addons.actions,
|
|
364
365
|
], [actions, addons.actions, t, nothingSaid, callable, callState, call]);
|
|
@@ -380,6 +381,7 @@ function SessionView({ store, server, workspace, info, onClosed, onActivity, lea
|
|
|
380
381
|
info && (React.createElement("span", { className: "ta-muted ta-path", title: info.cwd }, message_1.MessageUtil.shortPath(info.cwd)))),
|
|
381
382
|
React.createElement(people_1.PeopleFaces, { people: viewing, size: 24, label: t('ta.presence.viewing') }),
|
|
382
383
|
trailing)),
|
|
384
|
+
React.createElement(call_face_1.CallFace, { state: callState, call: call }),
|
|
383
385
|
finding > 0 && React.createElement(conversation_find_1.ConversationFind, { store: store, state: state, rows: rows, scroller: scroller, focusKey: finding, onClose: closeFind }),
|
|
384
386
|
React.createElement("div", { className: "ta-scroll ta-conversation", ref: scroller },
|
|
385
387
|
React.createElement("div", { className: "ta-thread" },
|
|
@@ -163,6 +163,8 @@ function useParts(scope, onScope, onClose, onDialog) {
|
|
|
163
163
|
React.createElement(settings_controls_1.Switch, { label: t('ta.settings.speakTalk'), checked: settings.speakTalk, onChange: speakTalk => store.update({ speakTalk }) }))),
|
|
164
164
|
(0, settings_controls_1.row)('callCaptions', [t('ta.settings.callCaptions'), t('ta.settings.callCaptionsHint')], React.createElement(settings_controls_1.Row, { label: t('ta.settings.callCaptions'), description: t('ta.settings.callCaptionsHint') },
|
|
165
165
|
React.createElement(settings_controls_1.Switch, { label: t('ta.settings.callCaptions'), checked: settings.callCaptions, onChange: callCaptions => store.update({ callCaptions }) }))),
|
|
166
|
+
(0, settings_controls_1.row)('callFace', [t('ta.settings.callFace'), t('ta.settings.callFaceHint')], React.createElement(settings_controls_1.Row, { label: t('ta.settings.callFace'), description: t('ta.settings.callFaceHint') },
|
|
167
|
+
React.createElement(settings_controls_1.Switch, { label: t('ta.settings.callFace'), checked: settings.callFace, onChange: callFace => store.update({ callFace }) }))),
|
|
166
168
|
...(voice_1.Voice.canSpeak()
|
|
167
169
|
? [
|
|
168
170
|
(0, settings_controls_1.row)('voiceName', [t('ta.settings.voiceName'), t('ta.settings.voiceNameHint')], React.createElement(settings_controls_1.Row, { label: t('ta.settings.voiceName'), description: t('ta.settings.voiceNameHint'), stacked: true },
|
|
@@ -2,6 +2,16 @@ import * as React from 'react';
|
|
|
2
2
|
import { type Mood } from '../avatar/dino-avatar';
|
|
3
3
|
import { type Gait } from '../avatar/dino-motion';
|
|
4
4
|
import { type SpeciesId } from '../avatar/dino-species';
|
|
5
|
+
/**
|
|
6
|
+
* What moves a close-up in a call (the face of a call): the mouth by the sound that plays while it speaks, a nod as the
|
|
7
|
+
* user's words come.
|
|
8
|
+
*/
|
|
9
|
+
export interface DinoTalk {
|
|
10
|
+
/** How loud what plays now is (RMS, 0 to 1); undefined when nothing tells, and the mouth moves by itself. */
|
|
11
|
+
level?(): number | undefined;
|
|
12
|
+
/** Changes as the user's words come: it nods (once in a while). */
|
|
13
|
+
nods?: number;
|
|
14
|
+
}
|
|
5
15
|
/** The kind of dinosaur ta is and how it walks, as the user picked them for the double; the logo walking until then. */
|
|
6
16
|
export interface DinoLook {
|
|
7
17
|
species: SpeciesId;
|
|
@@ -26,10 +36,14 @@ export declare function TaAvatar({ mood, size, mark, className, roam, species, g
|
|
|
26
36
|
* A close-up of ta's head in a round frame tinted with its color, sweet rather than fierce: the figure of the
|
|
27
37
|
* account. It tilts its head, blinks, follows the pointer with its eyes, and laughs when poked.
|
|
28
38
|
*/
|
|
29
|
-
export declare function DinoFace({ mood, size, species, className }: {
|
|
39
|
+
export declare function DinoFace({ mood, size, species, className, talk, fill, }: {
|
|
30
40
|
mood?: Mood;
|
|
31
41
|
size?: number;
|
|
32
42
|
species?: SpeciesId;
|
|
33
43
|
className?: string;
|
|
44
|
+
/** In a call: its mouth moves by the sound it plays, it nods to the words it hears. */
|
|
45
|
+
talk?: DinoTalk;
|
|
46
|
+
/** As large as its box, which the styles size; `size` says how large it is drawn at most. */
|
|
47
|
+
fill?: boolean;
|
|
34
48
|
}): React.JSX.Element;
|
|
35
49
|
//# sourceMappingURL=ta-avatar.d.ts.map
|
|
@@ -40,6 +40,7 @@ const React = __importStar(require("react"));
|
|
|
40
40
|
const dino_avatar_1 = require("../avatar/dino-avatar");
|
|
41
41
|
const dino_motion_1 = require("../avatar/dino-motion");
|
|
42
42
|
const dino_species_1 = require("../avatar/dino-species");
|
|
43
|
+
const dino_talk_1 = require("../avatar/dino-talk");
|
|
43
44
|
const scroll_rest_1 = require("../util/scroll-rest");
|
|
44
45
|
let next = 0;
|
|
45
46
|
/** How long a change of mood takes to blend into the new motion, in seconds. */
|
|
@@ -48,12 +49,18 @@ const BLEND = 0.45;
|
|
|
48
49
|
const FOLLOW = 0.18;
|
|
49
50
|
/** From how many pixels on a ta is drawn in full detail. */
|
|
50
51
|
const FINE = 48;
|
|
52
|
+
/** How often where a ta is on the page is read again for it to look at the pointer, in milliseconds: reading it lays the page out. */
|
|
53
|
+
const BOX_MS = 200;
|
|
51
54
|
/** The whole dinosaur's viewBox: its left and top edge, and its width. */
|
|
52
55
|
const WHOLE = [-8, -8, 272];
|
|
56
|
+
/** How long after a nod a close-up nods again, however often the words it hears come, in seconds. */
|
|
57
|
+
const NOD_GAP = 1.4;
|
|
53
58
|
exports.DinoLook = React.createContext({ species: dino_species_1.DinoSpecies.DEFAULT, gait: 'walk' });
|
|
54
59
|
/** One loop of animation frames for every ta on the page; only those on screen move, and none when motion is reduced. */
|
|
55
60
|
const players = new Set();
|
|
56
61
|
let loop = 0;
|
|
62
|
+
/** Counts the frames: a small ta (of a row, a few dozen pixels) moves every other one, which nobody can tell at its size. */
|
|
63
|
+
let frames = 0;
|
|
57
64
|
let watcher;
|
|
58
65
|
/** Where the mouse is on the page; undefined when it is off the page or the device has none. */
|
|
59
66
|
let pointer;
|
|
@@ -112,16 +119,29 @@ function draw(player, now) {
|
|
|
112
119
|
player.last = now;
|
|
113
120
|
const since = (now - player.poked) / 1000;
|
|
114
121
|
// A close-up only tilts its head toward the pointer, and laughs when poked; the whole dinosaur roars.
|
|
122
|
+
if (player.face && player.talk) {
|
|
123
|
+
pose = talking(player, pose, now, dt);
|
|
124
|
+
}
|
|
115
125
|
pose = player.face
|
|
116
126
|
? dino_motion_1.DinoMotion.tickle(dino_motion_1.DinoMotion.look(pose, { ...look, weight: look.weight * 0.5 }), since)
|
|
117
127
|
: dino_motion_1.DinoMotion.poke(dino_motion_1.DinoMotion.look(pose, look), since);
|
|
118
128
|
player.pose = pose;
|
|
119
129
|
const f = (0, dino_avatar_1.frame)(pose, player.fine, player.species);
|
|
120
130
|
const svg = player.svg;
|
|
131
|
+
// Drawn sixty times a second for each ta on screen: its parts are looked up once, until its markup changes.
|
|
132
|
+
if (player.partsOf !== svg.firstChild) {
|
|
133
|
+
player.parts.clear();
|
|
134
|
+
player.partsOf = svg.firstChild;
|
|
135
|
+
}
|
|
121
136
|
const set = (part, name, value) => {
|
|
122
|
-
|
|
123
|
-
if (
|
|
124
|
-
element.
|
|
137
|
+
let found = player.parts.get(part);
|
|
138
|
+
if (!found) {
|
|
139
|
+
found = { element: svg.querySelector(`.ta-dino-${part}`), values: new Map() };
|
|
140
|
+
player.parts.set(part, found);
|
|
141
|
+
}
|
|
142
|
+
if (found.element && found.values.get(name) !== value) {
|
|
143
|
+
found.values.set(name, value);
|
|
144
|
+
found.element.setAttribute(name, value);
|
|
125
145
|
}
|
|
126
146
|
};
|
|
127
147
|
set('skin', 'd', f.skin);
|
|
@@ -152,6 +172,27 @@ function draw(player, now) {
|
|
|
152
172
|
svg.classList.toggle('ta-dino-poked', since >= 0 && since < dino_motion_1.POKE);
|
|
153
173
|
}
|
|
154
174
|
}
|
|
175
|
+
/** A close-up in a call: its mouth by the sound it plays as it speaks, a nod to the words it hears. */
|
|
176
|
+
function talking(player, pose, now, dt) {
|
|
177
|
+
var _a;
|
|
178
|
+
const talk = player.talk;
|
|
179
|
+
const level = player.mood === 'speaking' ? (_a = talk === null || talk === void 0 ? void 0 : talk.level) === null || _a === void 0 ? void 0 : _a.call(talk) : undefined;
|
|
180
|
+
let posed = pose;
|
|
181
|
+
if (level !== undefined) {
|
|
182
|
+
player.open = dino_talk_1.DinoTalkMotion.mouth(player.open, level, dt);
|
|
183
|
+
posed = dino_talk_1.DinoTalkMotion.speak(posed, player.open);
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
player.open = 0;
|
|
187
|
+
}
|
|
188
|
+
if ((talk === null || talk === void 0 ? void 0 : talk.nods) !== player.nods) {
|
|
189
|
+
player.nods = talk === null || talk === void 0 ? void 0 : talk.nods;
|
|
190
|
+
if (player.mood === 'listening' && (now - player.nodded) / 1000 >= NOD_GAP) {
|
|
191
|
+
player.nodded = now;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return dino_talk_1.DinoTalkMotion.nod(posed, (now - player.nodded) / 1000);
|
|
195
|
+
}
|
|
155
196
|
function tick(now) {
|
|
156
197
|
loop = 0;
|
|
157
198
|
if (document.documentElement.hasAttribute('data-reduce-motion')) {
|
|
@@ -163,15 +204,27 @@ function tick(now) {
|
|
|
163
204
|
}
|
|
164
205
|
// Still while the page scrolls: a frame of a fling is the scroll's.
|
|
165
206
|
if (scroll_rest_1.ScrollRest.moving(now)) {
|
|
207
|
+
// Where they are is read again once it rests.
|
|
208
|
+
for (const player of players) {
|
|
209
|
+
player.box = undefined;
|
|
210
|
+
}
|
|
166
211
|
loop = requestAnimationFrame(tick);
|
|
167
212
|
return;
|
|
168
213
|
}
|
|
169
|
-
// Read where they all are first, then draw them all, so the page is laid out once a frame
|
|
214
|
+
// Read where they all are first, then draw them all, so the page is laid out once a frame at most; and
|
|
215
|
+
// only now and then, as reading it lays out what the page changed since (a list drawn again, a reply).
|
|
170
216
|
for (const player of players) {
|
|
171
|
-
|
|
217
|
+
if (!player.visible || !pointer) {
|
|
218
|
+
player.box = undefined;
|
|
219
|
+
}
|
|
220
|
+
else if (!player.box || now - player.boxedAt >= BOX_MS) {
|
|
221
|
+
player.box = player.svg.getBoundingClientRect();
|
|
222
|
+
player.boxedAt = now;
|
|
223
|
+
}
|
|
172
224
|
}
|
|
225
|
+
frames++;
|
|
173
226
|
for (const player of players) {
|
|
174
|
-
if (player.visible) {
|
|
227
|
+
if (player.visible && (player.fine || frames % 2 === 0)) {
|
|
175
228
|
draw(player, now);
|
|
176
229
|
}
|
|
177
230
|
}
|
|
@@ -207,7 +260,7 @@ function start(player) {
|
|
|
207
260
|
};
|
|
208
261
|
}
|
|
209
262
|
/** Plays the drawing in `svg`: its markup (which changes with the mood and the kind only) and the frames that move what is in it. */
|
|
210
|
-
function usePlayer(svg, { mood, size, roam, species, gait, face }) {
|
|
263
|
+
function usePlayer(svg, { mood, size, roam, species, gait, face, talk }) {
|
|
211
264
|
const id = React.useMemo(() => `ta-${++next}`, []);
|
|
212
265
|
const player = React.useRef(undefined);
|
|
213
266
|
const detail = size >= FINE;
|
|
@@ -229,6 +282,7 @@ function usePlayer(svg, { mood, size, roam, species, gait, face }) {
|
|
|
229
282
|
const view = face ? species.face : WHOLE;
|
|
230
283
|
if (current) {
|
|
231
284
|
current.svg = element;
|
|
285
|
+
current.talk = talk;
|
|
232
286
|
current.fine = size >= FINE;
|
|
233
287
|
current.view = view;
|
|
234
288
|
if (current.species !== species) {
|
|
@@ -261,8 +315,14 @@ function usePlayer(svg, { mood, size, roam, species, gait, face }) {
|
|
|
261
315
|
look: { x: 0, y: 0, weight: 0 },
|
|
262
316
|
last: now,
|
|
263
317
|
poked: -Infinity,
|
|
318
|
+
talk,
|
|
319
|
+
open: 0,
|
|
320
|
+
nods: talk === null || talk === void 0 ? void 0 : talk.nods,
|
|
321
|
+
nodded: -Infinity,
|
|
322
|
+
boxedAt: -Infinity,
|
|
323
|
+
parts: new Map(),
|
|
264
324
|
};
|
|
265
|
-
}, [mood, roam, size, species, gait, face]);
|
|
325
|
+
}, [mood, roam, size, species, gait, face, talk]);
|
|
266
326
|
React.useEffect(() => {
|
|
267
327
|
const current = player.current;
|
|
268
328
|
return current ? start(current) : undefined;
|
|
@@ -294,12 +354,13 @@ function TaAvatar({ mood = 'idle', size = 40, mark, className = '', roam = false
|
|
|
294
354
|
* A close-up of ta's head in a round frame tinted with its color, sweet rather than fierce: the figure of the
|
|
295
355
|
* account. It tilts its head, blinks, follows the pointer with its eyes, and laughs when poked.
|
|
296
356
|
*/
|
|
297
|
-
function DinoFace({ mood = 'idle', size = 32, species, className = '' }) {
|
|
357
|
+
function DinoFace({ mood = 'idle', size = 32, species, className = '', talk, fill = false, }) {
|
|
298
358
|
const look = React.useContext(exports.DinoLook);
|
|
299
359
|
const kind = dino_species_1.DinoSpecies.of(species !== null && species !== void 0 ? species : look.species);
|
|
300
360
|
const svgRef = React.useRef(null);
|
|
301
|
-
const markup = usePlayer(svgRef, { mood, size, roam: false, species: kind, gait: look.gait, face: true });
|
|
302
|
-
|
|
361
|
+
const markup = usePlayer(svgRef, { mood, size, roam: false, species: kind, gait: look.gait, face: true, talk });
|
|
362
|
+
const box = fill ? {} : { width: size, height: size };
|
|
363
|
+
return (React.createElement("span", { className: `ta-dino-face ${className}`, style: { ...box, ['--ta-dino']: kind.colors.skin } },
|
|
303
364
|
React.createElement("svg", { ref: svgRef, className: `ta-avatar ta-avatar-${mood}`, width: size, height: size, viewBox: dino_avatar_1.DinoAvatar.faceBox(kind), "aria-hidden": "true",
|
|
304
365
|
// biome-ignore lint/security/noDangerouslySetInnerHtml: markup made here from constants, nothing from outside
|
|
305
366
|
dangerouslySetInnerHTML: { __html: markup } })));
|
|
@@ -47,6 +47,7 @@ const settings_controls_1 = require("./settings-controls");
|
|
|
47
47
|
* to use it; the types packages registered, each with a form to add one. Keys are typed here and never shown again.
|
|
48
48
|
*/
|
|
49
49
|
function VoiceServices() {
|
|
50
|
+
var _a;
|
|
50
51
|
const t = (0, use_t_1.useT)();
|
|
51
52
|
const language = (0, use_t_1.useLanguage)();
|
|
52
53
|
const [workbench, bench] = (0, hooks_1.useWorkbench)();
|
|
@@ -78,6 +79,8 @@ function VoiceServices() {
|
|
|
78
79
|
}
|
|
79
80
|
const title = (type, fallback) => (type && ta_protocol_1.TaPackageTextUtil.pick(type.title, language)) || fallback;
|
|
80
81
|
const typeOf = (name) => voices.types.find(type => type.type === name);
|
|
82
|
+
const inUse = voices.services.find(service => service.id === voices.use);
|
|
83
|
+
const thinks = !!inUse && !!((_a = typeOf(inUse.type)) === null || _a === void 0 ? void 0 : _a.thinks);
|
|
81
84
|
const chosen = (id) => voices.use === id ? (React.createElement(icon_1.Icon, { icon: lucide_react_1.Check, size: 18, className: "ta-setting-check" })) : (React.createElement("button", { type: "button", className: "ta-button", disabled: busy !== undefined, onClick: () => void run('use', () => bench.voice.chooseVoice(id !== null && id !== void 0 ? id : null)) }, t('ta.voices.use')));
|
|
82
85
|
return (React.createElement(React.Fragment, null,
|
|
83
86
|
React.createElement(settings_controls_1.Row, { icon: lucide_react_1.Smartphone, label: t('ta.voices.device'), description: t('ta.voices.deviceHint') }, chosen(undefined)),
|
|
@@ -97,6 +100,8 @@ function VoiceServices() {
|
|
|
97
100
|
await read();
|
|
98
101
|
} })))));
|
|
99
102
|
}),
|
|
103
|
+
thinks && (React.createElement(settings_controls_1.Row, { icon: lucide_react_1.BrainCircuit, label: t('ta.voices.brain'), description: t('ta.voices.brainHint') },
|
|
104
|
+
React.createElement(settings_controls_1.Switch, { checked: voices.brain === 'service', label: t('ta.voices.brain'), onChange: on => run('brain', () => bench.voice.setBrain(on ? 'service' : 'ta')) }))),
|
|
100
105
|
voices.use && (React.createElement(settings_controls_1.Row, { icon: lucide_react_1.Hand, label: t('ta.voices.cutIn'), description: t('ta.voices.cutInHint') },
|
|
101
106
|
React.createElement(settings_controls_1.Switch, { checked: !voices.bargeIn.tap, label: t('ta.voices.cutIn'), onChange: on => run('bargeIn', () => bench.voice.setBargeIn({ tap: !on })) }))),
|
|
102
107
|
voices.use && !voices.bargeIn.tap && (React.createElement(BargeInRow, { bargeIn: voices.bargeIn, onChange: bargeIn => void run('bargeIn', () => bench.voice.setBargeIn(bargeIn)) })),
|