@celljs/ta-web 4.33.0 → 4.35.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/README.en.md +1 -1
- package/README.md +1 -1
- package/esm/browser/apps/app-icon.d.ts +23 -0
- package/esm/browser/apps/app-icon.js +98 -0
- package/esm/browser/apps/app-settings.d.ts +6 -0
- package/esm/browser/apps/app-settings.js +67 -0
- package/esm/browser/apps/app-window-util.d.ts +23 -0
- package/esm/browser/apps/app-window-util.js +27 -0
- package/esm/browser/apps/app-window.d.ts +9 -0
- package/esm/browser/apps/app-window.js +90 -0
- package/esm/browser/apps/web-apps.d.ts +29 -0
- package/esm/browser/apps/web-apps.js +57 -0
- package/esm/browser/assistant/assistant-thread.js +3 -1
- package/esm/browser/assistant/assistant-view.js +8 -4
- package/esm/browser/assistant/call-keeper.d.ts +2 -5
- package/esm/browser/assistant/call-keeper.js +7 -11
- package/esm/browser/components/access-settings.d.ts +6 -0
- package/esm/browser/components/access-settings.js +52 -0
- package/esm/browser/components/app-root.d.ts +6 -0
- package/esm/browser/components/app-root.js +34 -0
- package/esm/browser/components/app-view.d.ts +8 -2
- package/esm/browser/components/app-view.js +1 -25
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/context-act.d.ts +4 -0
- package/esm/browser/components/context-act.js +8 -0
- package/esm/browser/components/context-line.d.ts +19 -0
- package/esm/browser/components/context-line.js +71 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/message-list.js +12 -6
- package/esm/browser/components/message-steps.js +1 -1
- package/esm/browser/components/session-settings.d.ts +8 -4
- package/esm/browser/components/session-settings.js +10 -5
- package/esm/browser/components/session-view.js +12 -8
- package/esm/browser/components/settings-more.js +6 -0
- package/esm/browser/device/screen-awake.d.ts +16 -0
- package/esm/browser/device/screen-awake.js +37 -0
- package/esm/browser/device/sheet-swipe.js +4 -0
- package/esm/browser/extension/icons.js +2 -1
- package/esm/browser/extension/web-access.d.ts +16 -0
- package/esm/browser/extension/web-access.js +75 -0
- package/esm/browser/extension/web-api-desktop.d.ts +23 -0
- package/esm/browser/extension/web-api-spec.d.ts +70 -0
- package/esm/browser/extension/web-api-spec.js +223 -0
- package/esm/browser/extension/web-extension-api.d.ts +6 -0
- package/esm/browser/extension/web-extension-context.js +11 -2
- package/esm/browser/extension/web-extension-run.d.ts +6 -1
- package/esm/browser/extension/web-extension-run.js +25 -0
- package/esm/browser/extension/web-extensions-running.d.ts +18 -1
- package/esm/browser/extension/web-extensions-running.js +102 -9
- package/esm/browser/extension/web-pages.d.ts +5 -0
- package/esm/browser/extension/web-pages.js +3 -0
- package/esm/browser/i18n/en/chat.d.ts +16 -2
- package/esm/browser/i18n/en/chat.js +16 -2
- package/esm/browser/i18n/en/common.d.ts +1 -0
- package/esm/browser/i18n/en/common.js +1 -0
- package/esm/browser/i18n/en/discover.d.ts +11 -0
- package/esm/browser/i18n/en/discover.js +11 -0
- package/esm/browser/i18n/en/settings.d.ts +54 -0
- package/esm/browser/i18n/en/settings.js +57 -3
- package/esm/browser/i18n/en/tools.d.ts +1 -0
- package/esm/browser/i18n/en/tools.js +1 -0
- package/esm/browser/i18n/ja/chat.js +16 -2
- package/esm/browser/i18n/ja/common.js +1 -0
- package/esm/browser/i18n/ja/discover.js +11 -0
- package/esm/browser/i18n/ja/settings.js +57 -3
- package/esm/browser/i18n/ja/tools.js +1 -0
- package/esm/browser/i18n/locales.d.ts +84 -5
- package/esm/browser/i18n/messages.d.ts +83 -4
- package/esm/browser/i18n/zh/chat.js +16 -2
- package/esm/browser/i18n/zh/common.js +1 -0
- package/esm/browser/i18n/zh/discover.js +11 -0
- package/esm/browser/i18n/zh/settings.js +57 -3
- package/esm/browser/i18n/zh/tools.js +1 -0
- package/esm/browser/i18n/zh-tw/chat.js +16 -2
- package/esm/browser/i18n/zh-tw/common.js +1 -0
- package/esm/browser/i18n/zh-tw/discover.js +11 -0
- package/esm/browser/i18n/zh-tw/settings.js +57 -3
- package/esm/browser/i18n/zh-tw/tools.js +1 -0
- package/esm/browser/index.d.ts +1 -0
- package/esm/browser/index.js +1 -0
- package/esm/browser/notices/notices.js +1 -0
- package/esm/browser/sandbox/channel/channel.d.ts +56 -0
- package/esm/browser/sandbox/channel/channel.js +124 -0
- package/esm/browser/sandbox/channel/codec.d.ts +80 -0
- package/esm/browser/sandbox/channel/codec.js +251 -0
- package/esm/browser/sandbox/hook-host.d.ts +23 -0
- package/esm/browser/sandbox/hook-host.js +61 -0
- package/esm/browser/sandbox/isolated-host.d.ts +105 -0
- package/esm/browser/sandbox/isolated-host.js +395 -0
- package/esm/browser/sandbox/remote/remote-copy.d.ts +56 -0
- package/esm/browser/sandbox/remote/remote-copy.js +302 -0
- package/esm/browser/sandbox/remote/remote-mirror.d.ts +61 -0
- package/esm/browser/sandbox/remote/remote-mirror.js +341 -0
- package/esm/browser/sandbox/remote/remote-protocol.d.ts +79 -0
- package/esm/browser/sandbox/remote/remote-protocol.js +54 -0
- package/esm/browser/sandbox/remote/remote-styles.d.ts +10 -0
- package/esm/browser/sandbox/remote/remote-styles.js +113 -0
- package/esm/browser/sandbox/remote-root.d.ts +11 -0
- package/esm/browser/sandbox/remote-root.js +81 -0
- package/esm/browser/sandbox/runtime/frame-api.d.ts +28 -0
- package/esm/browser/sandbox/runtime/frame-api.js +147 -0
- package/esm/browser/sandbox/runtime/frame-features.d.ts +6 -0
- package/esm/browser/sandbox/runtime/frame-features.js +50 -0
- package/esm/browser/sandbox/runtime/frame-parts.d.ts +36 -0
- package/esm/browser/sandbox/runtime/frame-parts.js +69 -0
- package/esm/browser/sandbox/runtime/frame-roots.d.ts +26 -0
- package/esm/browser/sandbox/runtime/frame-roots.js +76 -0
- package/esm/browser/sandbox/runtime/frame-store.d.ts +9 -0
- package/esm/browser/sandbox/runtime/frame-store.js +18 -0
- package/esm/browser/sandbox/runtime/sandbox-runtime.d.ts +11 -0
- package/esm/browser/sandbox/runtime/sandbox-runtime.js +45 -0
- package/esm/browser/sandbox/sandbox-features.d.ts +25 -0
- package/esm/browser/sandbox/sandbox-features.js +32 -0
- package/esm/browser/sandbox/sandbox-frame.d.ts +21 -0
- package/esm/browser/sandbox/sandbox-frame.js +75 -0
- package/esm/browser/sandbox/sandbox-guards.d.ts +19 -0
- package/esm/browser/sandbox/sandbox-guards.js +74 -0
- package/esm/browser/sandbox/sandbox-protocol.d.ts +57 -0
- package/esm/browser/sandbox/sandbox-protocol.js +49 -0
- package/esm/browser/sandbox/sandbox-runtime-code.d.ts +1 -0
- package/esm/browser/sandbox/sandbox-runtime-code.js +3 -0
- package/esm/browser/sandbox/web-sandbox.d.ts +28 -0
- package/esm/browser/sandbox/web-sandbox.js +44 -0
- package/esm/browser/settings/agent-settings.js +12 -2
- package/esm/browser/settings/settings-protocol.d.ts +2 -0
- package/esm/browser/settings/settings-protocol.js +2 -0
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +20 -1
- package/esm/browser/style/surfaces.d.ts +1 -1
- package/esm/browser/style/surfaces.js +5 -0
- package/esm/browser/style/tints.d.ts +2 -0
- package/esm/browser/style/tints.js +10 -0
- package/esm/browser/util/context-view.d.ts +16 -0
- package/esm/browser/util/context-view.js +42 -0
- package/esm/browser/util/desktop.d.ts +31 -1
- package/esm/browser/util/desktop.js +20 -0
- package/esm/browser/util/progress.d.ts +4 -0
- package/esm/browser/util/progress.js +9 -3
- package/esm/browser/view.js +1 -1
- package/lib/browser/apps/app-icon.d.ts +24 -0
- package/lib/browser/apps/app-icon.js +134 -0
- package/lib/browser/apps/app-settings.d.ts +7 -0
- package/lib/browser/apps/app-settings.js +103 -0
- package/lib/browser/apps/app-window-util.d.ts +24 -0
- package/lib/browser/apps/app-window-util.js +30 -0
- package/lib/browser/apps/app-window.d.ts +10 -0
- package/lib/browser/apps/app-window.js +126 -0
- package/lib/browser/apps/web-apps.d.ts +30 -0
- package/lib/browser/apps/web-apps.js +61 -0
- package/lib/browser/assistant/assistant-thread.js +3 -1
- package/lib/browser/assistant/assistant-view.js +8 -4
- package/lib/browser/assistant/call-keeper.d.ts +2 -5
- package/lib/browser/assistant/call-keeper.js +6 -10
- package/lib/browser/components/access-settings.d.ts +7 -0
- package/lib/browser/components/access-settings.js +88 -0
- package/lib/browser/components/app-root.d.ts +7 -0
- package/lib/browser/components/app-root.js +70 -0
- package/lib/browser/components/app-view.d.ts +8 -2
- package/lib/browser/components/app-view.js +1 -25
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/context-act.d.ts +5 -0
- package/lib/browser/components/context-act.js +44 -0
- package/lib/browser/components/context-line.d.ts +20 -0
- package/lib/browser/components/context-line.js +109 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/message-list.js +12 -6
- package/lib/browser/components/message-steps.js +1 -1
- package/lib/browser/components/session-settings.d.ts +8 -4
- package/lib/browser/components/session-settings.js +10 -5
- package/lib/browser/components/session-view.js +12 -8
- package/lib/browser/components/settings-more.js +6 -0
- package/lib/browser/device/screen-awake.d.ts +16 -0
- package/lib/browser/device/screen-awake.js +39 -1
- package/lib/browser/device/sheet-swipe.js +4 -0
- package/lib/browser/extension/icons.js +1 -0
- package/lib/browser/extension/web-access.d.ts +17 -0
- package/lib/browser/extension/web-access.js +78 -0
- package/lib/browser/extension/web-api-desktop.d.ts +23 -0
- package/lib/browser/extension/web-api-spec.d.ts +71 -0
- package/lib/browser/extension/web-api-spec.js +226 -0
- package/lib/browser/extension/web-extension-api.d.ts +6 -0
- package/lib/browser/extension/web-extension-context.js +11 -2
- package/lib/browser/extension/web-extension-run.d.ts +6 -1
- package/lib/browser/extension/web-extension-run.js +25 -0
- package/lib/browser/extension/web-extensions-running.d.ts +18 -1
- package/lib/browser/extension/web-extensions-running.js +102 -9
- package/lib/browser/extension/web-pages.d.ts +5 -0
- package/lib/browser/extension/web-pages.js +3 -0
- package/lib/browser/i18n/en/chat.d.ts +16 -2
- package/lib/browser/i18n/en/chat.js +16 -2
- package/lib/browser/i18n/en/common.d.ts +1 -0
- package/lib/browser/i18n/en/common.js +1 -0
- package/lib/browser/i18n/en/discover.d.ts +11 -0
- package/lib/browser/i18n/en/discover.js +11 -0
- package/lib/browser/i18n/en/settings.d.ts +54 -0
- package/lib/browser/i18n/en/settings.js +57 -3
- package/lib/browser/i18n/en/tools.d.ts +1 -0
- package/lib/browser/i18n/en/tools.js +1 -0
- package/lib/browser/i18n/ja/chat.js +16 -2
- package/lib/browser/i18n/ja/common.js +1 -0
- package/lib/browser/i18n/ja/discover.js +11 -0
- package/lib/browser/i18n/ja/settings.js +57 -3
- package/lib/browser/i18n/ja/tools.js +1 -0
- package/lib/browser/i18n/locales.d.ts +84 -5
- package/lib/browser/i18n/messages.d.ts +83 -4
- package/lib/browser/i18n/zh/chat.js +16 -2
- package/lib/browser/i18n/zh/common.js +1 -0
- package/lib/browser/i18n/zh/discover.js +11 -0
- package/lib/browser/i18n/zh/settings.js +57 -3
- package/lib/browser/i18n/zh/tools.js +1 -0
- package/lib/browser/i18n/zh-tw/chat.js +16 -2
- package/lib/browser/i18n/zh-tw/common.js +1 -0
- package/lib/browser/i18n/zh-tw/discover.js +11 -0
- package/lib/browser/i18n/zh-tw/settings.js +57 -3
- package/lib/browser/i18n/zh-tw/tools.js +1 -0
- package/lib/browser/index.d.ts +1 -0
- package/lib/browser/index.js +1 -0
- package/lib/browser/notices/notices.js +1 -0
- package/lib/browser/sandbox/channel/channel.d.ts +57 -0
- package/lib/browser/sandbox/channel/channel.js +128 -0
- package/lib/browser/sandbox/channel/codec.d.ts +81 -0
- package/lib/browser/sandbox/channel/codec.js +256 -0
- package/lib/browser/sandbox/hook-host.d.ts +24 -0
- package/lib/browser/sandbox/hook-host.js +98 -0
- package/lib/browser/sandbox/isolated-host.d.ts +106 -0
- package/lib/browser/sandbox/isolated-host.js +432 -0
- package/lib/browser/sandbox/remote/remote-copy.d.ts +57 -0
- package/lib/browser/sandbox/remote/remote-copy.js +306 -0
- package/lib/browser/sandbox/remote/remote-mirror.d.ts +62 -0
- package/lib/browser/sandbox/remote/remote-mirror.js +345 -0
- package/lib/browser/sandbox/remote/remote-protocol.d.ts +80 -0
- package/lib/browser/sandbox/remote/remote-protocol.js +57 -0
- package/lib/browser/sandbox/remote/remote-styles.d.ts +11 -0
- package/lib/browser/sandbox/remote/remote-styles.js +116 -0
- package/lib/browser/sandbox/remote-root.d.ts +12 -0
- package/lib/browser/sandbox/remote-root.js +117 -0
- package/lib/browser/sandbox/runtime/frame-api.d.ts +29 -0
- package/lib/browser/sandbox/runtime/frame-api.js +183 -0
- package/lib/browser/sandbox/runtime/frame-features.d.ts +7 -0
- package/lib/browser/sandbox/runtime/frame-features.js +53 -0
- package/lib/browser/sandbox/runtime/frame-parts.d.ts +37 -0
- package/lib/browser/sandbox/runtime/frame-parts.js +106 -0
- package/lib/browser/sandbox/runtime/frame-roots.d.ts +27 -0
- package/lib/browser/sandbox/runtime/frame-roots.js +113 -0
- package/lib/browser/sandbox/runtime/frame-store.d.ts +10 -0
- package/lib/browser/sandbox/runtime/frame-store.js +22 -0
- package/lib/browser/sandbox/runtime/sandbox-runtime.d.ts +12 -0
- package/lib/browser/sandbox/runtime/sandbox-runtime.js +47 -0
- package/lib/browser/sandbox/sandbox-features.d.ts +26 -0
- package/lib/browser/sandbox/sandbox-features.js +35 -0
- package/lib/browser/sandbox/sandbox-frame.d.ts +22 -0
- package/lib/browser/sandbox/sandbox-frame.js +79 -0
- package/lib/browser/sandbox/sandbox-guards.d.ts +20 -0
- package/lib/browser/sandbox/sandbox-guards.js +77 -0
- package/lib/browser/sandbox/sandbox-protocol.d.ts +58 -0
- package/lib/browser/sandbox/sandbox-protocol.js +52 -0
- package/lib/browser/sandbox/sandbox-runtime-code.d.ts +2 -0
- package/lib/browser/sandbox/sandbox-runtime-code.js +6 -0
- package/lib/browser/sandbox/web-sandbox.d.ts +29 -0
- package/lib/browser/sandbox/web-sandbox.js +47 -0
- package/lib/browser/settings/agent-settings.js +12 -2
- package/lib/browser/settings/settings-protocol.d.ts +2 -0
- package/lib/browser/settings/settings-protocol.js +2 -0
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +20 -1
- package/lib/browser/style/surfaces.d.ts +1 -1
- package/lib/browser/style/surfaces.js +5 -0
- package/lib/browser/style/tints.d.ts +2 -0
- package/lib/browser/style/tints.js +10 -0
- package/lib/browser/util/context-view.d.ts +17 -0
- package/lib/browser/util/context-view.js +45 -0
- package/lib/browser/util/desktop.d.ts +31 -1
- package/lib/browser/util/desktop.js +20 -0
- package/lib/browser/util/progress.d.ts +4 -0
- package/lib/browser/util/progress.js +9 -3
- package/lib/browser/view.js +2 -2
- package/package.json +8 -8
|
@@ -56,4 +56,41 @@ export class ScreenAwake {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Keeps the device awake for the page while any holds it (a call, a meeting written down): the screen stays on, and
|
|
61
|
+
* Ta Desktop keeps the display awake and the page unthrottled and does not restart under it (DesktopUtil.calling).
|
|
62
|
+
* One for the page, so that one letting go does not let the screen lock under another.
|
|
63
|
+
*/
|
|
64
|
+
export class KeepAwake {
|
|
65
|
+
static get shared() {
|
|
66
|
+
var _a;
|
|
67
|
+
(_a = KeepAwake.instance) !== null && _a !== void 0 ? _a : (KeepAwake.instance = new KeepAwake());
|
|
68
|
+
return KeepAwake.instance;
|
|
69
|
+
}
|
|
70
|
+
constructor(screen = new ScreenAwake(), desktop = () => DesktopUtil.calling()) {
|
|
71
|
+
this.screen = screen;
|
|
72
|
+
this.desktop = desktop;
|
|
73
|
+
this.holds = 0;
|
|
74
|
+
}
|
|
75
|
+
/** Holds it till the function it returns is called (again calls do nothing). */
|
|
76
|
+
hold() {
|
|
77
|
+
let held = true;
|
|
78
|
+
if (this.holds++ === 0) {
|
|
79
|
+
this.set(true);
|
|
80
|
+
}
|
|
81
|
+
return () => {
|
|
82
|
+
if (held) {
|
|
83
|
+
held = false;
|
|
84
|
+
if (--this.holds === 0) {
|
|
85
|
+
this.set(false);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
set(on) {
|
|
91
|
+
var _a;
|
|
92
|
+
(_a = this.desktop()) === null || _a === void 0 ? void 0 : _a(on);
|
|
93
|
+
this.screen.set(on);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
59
96
|
//# sourceMappingURL=screen-awake.js.map
|
|
@@ -57,6 +57,10 @@ class TouchSources {
|
|
|
57
57
|
this.listened.delete(key);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
+
// A frame apart (a game of a reply, an extension in a sandbox) has no document to reach: WebKit says so as an error.
|
|
61
|
+
if (frame.hasAttribute('sandbox') && !frame.sandbox.contains('allow-same-origin')) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
60
64
|
let doc = null;
|
|
61
65
|
try {
|
|
62
66
|
doc = frame.contentDocument;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { AlarmClock, Aperture, Archive, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, Bell, BellOff, BookOpen, Bot, Box, Bug, Building2, Calendar, Camera, CaseSensitive, ChartColumn, ChartSpline, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsDownUp, ChevronsUpDown, ChevronUp, Circle, CircleAlert, CircleArrowRight, CircleHelp, Clipboard, ClipboardPaste, Clock, Cloud, Code, Coins, Columns2, Contact, Copy, CopyMinus, CornerDownRight, CornerUpLeft, Cpu, Crown, Database, Download, Ellipsis, ExternalLink, Eye, File, FileArchive, FileDiff, FilePlus, Files, FileText, Film, FlaskConical, Folder, FolderInput, FolderLock, FolderOpen, FolderPlus, FolderSearch, FolderTree, Forward, Gamepad2, Gauge, GitBranch, GitCommitHorizontal, Globe, Grip, HardDrive, Hash, Headphones, Heart, House, Image, ImagePlus, Info, Keyboard, KeyRound, Laptop, LayoutDashboard, Lightbulb, Link, List, ListChecks, ListTodo, ListTree, ListX, LoaderCircle, LocateFixed, Lock, MapIcon, Maximize, Maximize2, Megaphone, MemoryStick, MessageCircle, MessageSquareDot, MessageSquareText, MessagesSquare, Mic, Minimize2, Minus, Monitor, MonitorSmartphone, MousePointer2, MousePointerClick, Navigation, Package, PackageOpen, Paperclip, Pencil, Phone, Pin, PinOff, Play, Plus, Pointer, Power, Puzzle, QrCode, Quote, Radar, RefreshCw, Regex, Replace, ReplaceAll, Rocket, RotateCcw, Rows2, Save, Scan, ScanLine, ScrollText, Search, Send, Server, Share2, Shield, ShieldAlert, ShieldCheck, Shuffle, SlidersHorizontal, Smartphone, Sparkles, Square, SquareMinus, SquarePlus, SquareTerminal, Star, StarOff, Store, Target, Text, ThumbsDown, ThumbsUp, Timer, Trash2, TrendingDown, TrendingUp, Trophy, Undo2, Unplug, Upload, User, UserPlus, Users, Volume2, WholeWord, Wrench, X, Zap, } from 'lucide-react';
|
|
1
|
+
import { AlarmClock, Aperture, AppWindow, Archive, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, Bell, BellOff, BookOpen, Bot, Box, Bug, Building2, Calendar, Camera, CaseSensitive, ChartColumn, ChartSpline, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsDownUp, ChevronsUpDown, ChevronUp, Circle, CircleAlert, CircleArrowRight, CircleHelp, Clipboard, ClipboardPaste, Clock, Cloud, Code, Coins, Columns2, Contact, Copy, CopyMinus, CornerDownRight, CornerUpLeft, Cpu, Crown, Database, Download, Ellipsis, ExternalLink, Eye, File, FileArchive, FileDiff, FilePlus, Files, FileText, Film, FlaskConical, Folder, FolderInput, FolderLock, FolderOpen, FolderPlus, FolderSearch, FolderTree, Forward, Gamepad2, Gauge, GitBranch, GitCommitHorizontal, Globe, Grip, HardDrive, Hash, Headphones, Heart, House, Image, ImagePlus, Info, Keyboard, KeyRound, Laptop, LayoutDashboard, Lightbulb, Link, List, ListChecks, ListTodo, ListTree, ListX, LoaderCircle, LocateFixed, Lock, MapIcon, Maximize, Maximize2, Megaphone, MemoryStick, MessageCircle, MessageSquareDot, MessageSquareText, MessagesSquare, Mic, Minimize2, Minus, Monitor, MonitorSmartphone, MousePointer2, MousePointerClick, Navigation, Package, PackageOpen, Paperclip, Pencil, Phone, Pin, PinOff, Play, Plus, Pointer, Power, Puzzle, QrCode, Quote, Radar, RefreshCw, Regex, Replace, ReplaceAll, Rocket, RotateCcw, Rows2, Save, Scan, ScanLine, ScrollText, Search, Send, Server, Share2, Shield, ShieldAlert, ShieldCheck, Shuffle, SlidersHorizontal, Smartphone, Sparkles, Square, SquareMinus, SquarePlus, SquareTerminal, Star, StarOff, Store, Target, Text, ThumbsDown, ThumbsUp, Timer, Trash2, TrendingDown, TrendingUp, Trophy, Undo2, Unplug, Upload, User, UserPlus, Users, Volume2, WholeWord, Wrench, X, Zap, } from 'lucide-react';
|
|
2
2
|
/** The icons a web extension gets as `pi.ui.icons`; names are lucide's. Only add: removing one breaks extensions. */
|
|
3
3
|
export const WEB_ICONS = Object.freeze({
|
|
4
4
|
AlarmClock,
|
|
5
5
|
Aperture,
|
|
6
|
+
AppWindow,
|
|
6
7
|
Archive,
|
|
7
8
|
ArrowDown,
|
|
8
9
|
ArrowLeft,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TaExtensionAccess, TaWebExtensionInfo } from '@celljs/ta-protocol';
|
|
2
|
+
import type { MessageId } from '../i18n/messages.js';
|
|
3
|
+
import type { WebExtensionAPI } from './web-extension-api.js';
|
|
4
|
+
export declare namespace WebAccessUtil {
|
|
5
|
+
/**
|
|
6
|
+
* What an extension may run with: a built-in, or from a ta serve older than access, all; one of a package, what the
|
|
7
|
+
* user allowed of this version of it; undefined while they have not (it waits to be allowed).
|
|
8
|
+
*/
|
|
9
|
+
function granted(info: TaWebExtensionInfo | undefined): TaExtensionAccess | undefined;
|
|
10
|
+
/** Where it came from, as the user knows it: never a link itself, whose key opens what it shares. */
|
|
11
|
+
function source(info: TaWebExtensionInfo, say: (id: MessageId) => string): string;
|
|
12
|
+
/** The API as far as `granted` reaches (WEB_API_SPEC): what is beyond it throws, saying what to ask for. */
|
|
13
|
+
function limit(api: WebExtensionAPI, granted: TaExtensionAccess, name: string): WebExtensionAPI;
|
|
14
|
+
/** Why a member is not there: what the extension has, what the member needs, and how to ask for it. */
|
|
15
|
+
function refusal(name: string, granted: TaExtensionAccess, path: string, need: TaExtensionAccess): string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Of its own module: the runtime of the sandbox bundles this file (sandbox/runtime), without the rest of the protocol.
|
|
2
|
+
import { TaExtensionAccessUtil } from '@celljs/ta-protocol/lib/common/package-protocol';
|
|
3
|
+
import { WEB_API_SPEC } from './web-api-spec.js';
|
|
4
|
+
export var WebAccessUtil;
|
|
5
|
+
(function (WebAccessUtil) {
|
|
6
|
+
/**
|
|
7
|
+
* What an extension may run with: a built-in, or from a ta serve older than access, all; one of a package, what the
|
|
8
|
+
* user allowed of this version of it; undefined while they have not (it waits to be allowed).
|
|
9
|
+
*/
|
|
10
|
+
function granted(info) {
|
|
11
|
+
if (!info || info.access === undefined) {
|
|
12
|
+
return 'full';
|
|
13
|
+
}
|
|
14
|
+
return info.granted;
|
|
15
|
+
}
|
|
16
|
+
WebAccessUtil.granted = granted;
|
|
17
|
+
/** Where it came from, as the user knows it: never a link itself, whose key opens what it shares. */
|
|
18
|
+
function source(info, say) {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
if (((_a = info.temporary) === null || _a === void 0 ? void 0 : _a.from) === 'link') {
|
|
21
|
+
return say('ta.access.fromLink');
|
|
22
|
+
}
|
|
23
|
+
if (((_b = info.temporary) === null || _b === void 0 ? void 0 : _b.from) === 'market') {
|
|
24
|
+
return say('ta.access.fromMarket');
|
|
25
|
+
}
|
|
26
|
+
return info.source;
|
|
27
|
+
}
|
|
28
|
+
WebAccessUtil.source = source;
|
|
29
|
+
/** The API as far as `granted` reaches (WEB_API_SPEC): what is beyond it throws, saying what to ask for. */
|
|
30
|
+
function limit(api, granted, name) {
|
|
31
|
+
return granted === 'full' ? api : only(api, WEB_API_SPEC, granted, name, '');
|
|
32
|
+
}
|
|
33
|
+
WebAccessUtil.limit = limit;
|
|
34
|
+
/** Why a member is not there: what the extension has, what the member needs, and how to ask for it. */
|
|
35
|
+
function refusal(name, granted, path, need) {
|
|
36
|
+
return `The web extension ${name} has ${granted} access; pi.${path} needs ${need}: declare "pi": { "access": "${need}" } in its package.json.`;
|
|
37
|
+
}
|
|
38
|
+
WebAccessUtil.refusal = refusal;
|
|
39
|
+
function only(whole, spec, granted, name, prefix) {
|
|
40
|
+
const part = {};
|
|
41
|
+
for (const [key, entry] of Object.entries(spec)) {
|
|
42
|
+
const descriptor = Object.getOwnPropertyDescriptor(whole, key);
|
|
43
|
+
if (!TaExtensionAccessUtil.reaches(granted, entry.access)) {
|
|
44
|
+
Object.defineProperty(part, key, {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get() {
|
|
47
|
+
throw new Error(refusal(name, granted, prefix + key, entry.access));
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else if (entry.form === 'group' && descriptor) {
|
|
52
|
+
// As far as it reaches too, the same object while the API gives the same one.
|
|
53
|
+
let cut;
|
|
54
|
+
Object.defineProperty(part, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get() {
|
|
57
|
+
const from = whole[key];
|
|
58
|
+
if (!from || typeof from !== 'object') {
|
|
59
|
+
return from;
|
|
60
|
+
}
|
|
61
|
+
if ((cut === null || cut === void 0 ? void 0 : cut.from) !== from) {
|
|
62
|
+
cut = { from, part: only(from, entry.members, granted, name, `${prefix}${key}.`) };
|
|
63
|
+
}
|
|
64
|
+
return cut.part;
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
else if (descriptor) {
|
|
69
|
+
Object.defineProperty(part, key, descriptor);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return part;
|
|
73
|
+
}
|
|
74
|
+
})(WebAccessUtil || (WebAccessUtil = {}));
|
|
75
|
+
//# sourceMappingURL=web-access.js.map
|
|
@@ -13,6 +13,11 @@ export interface WebDeviceUI {
|
|
|
13
13
|
* `download` saves it. Newer than some Ta apps.
|
|
14
14
|
*/
|
|
15
15
|
readonly saveFile?: (file: Blob, name: string) => Promise<WebFileSaved>;
|
|
16
|
+
/**
|
|
17
|
+
* Pages installed as apps of the computer, each with a window, a name and an icon of its own (Launchpad, the Dock, the
|
|
18
|
+
* Start menu): in Ta Desktop only, `pi.ui.apps?.…`. An extension installs, opens and removes only pages of its own.
|
|
19
|
+
*/
|
|
20
|
+
readonly apps?: WebApps;
|
|
16
21
|
}
|
|
17
22
|
export interface WebDesktop {
|
|
18
23
|
/** Node's `process.platform` of the machine (`darwin`, `win32`, `linux`): what its file manager is called. */
|
|
@@ -68,3 +73,21 @@ export interface WebFileDrag {
|
|
|
68
73
|
/** Their absolute paths inside their machine. */
|
|
69
74
|
paths(files: WebDraggedFiles): string[];
|
|
70
75
|
}
|
|
76
|
+
/** A page installed as an app of the computer (WebApps). */
|
|
77
|
+
export interface WebInstalledApp {
|
|
78
|
+
/** The id of the page, as `ui.showView` takes it. */
|
|
79
|
+
id: string;
|
|
80
|
+
name: string;
|
|
81
|
+
installedAt: number;
|
|
82
|
+
}
|
|
83
|
+
/** The pages installed as apps of the computer (WebExtensionUI.apps, docs/design/ta-install-as-app.md). */
|
|
84
|
+
export interface WebApps {
|
|
85
|
+
/** Whether a page may be installed now: the user lets pages be installed (Settings, Extensions). */
|
|
86
|
+
readonly installable: boolean;
|
|
87
|
+
list(): Promise<WebInstalledApp[]>;
|
|
88
|
+
/** Installs the page (its title and its icon, as the launcher shows it) and opens its window; again, to name it anew. */
|
|
89
|
+
install(id: string): Promise<void>;
|
|
90
|
+
remove(id: string): Promise<void>;
|
|
91
|
+
/** Its window in front, opened when it is not. */
|
|
92
|
+
open(id: string): Promise<void>;
|
|
93
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { TaExtensionAccess } from '@celljs/ta-protocol';
|
|
2
|
+
import type { WebExtensionAPI, WebExtensionUI } from './web-extension-api.js';
|
|
3
|
+
/**
|
|
4
|
+
* Where the components and the labels are in what crosses (docs/design/ta-extension-access.md 3.2): `C` a component,
|
|
5
|
+
* drawn where the page shows it; `L` a label, a string or a function read at once into one; `X` what the page would
|
|
6
|
+
* read without waiting and cannot from a sandbox, left out; or the fields of an object. Any other function is a
|
|
7
|
+
* callback, its result a promise; data is cloned as it is (a Blob too).
|
|
8
|
+
*/
|
|
9
|
+
export type WebApiShape = 'C' | 'L' | 'X' | WebApiFields;
|
|
10
|
+
export interface WebApiFields {
|
|
11
|
+
readonly fields?: Readonly<Record<string, WebApiShape>>;
|
|
12
|
+
/** Of every item of an array. */
|
|
13
|
+
readonly each?: WebApiShape;
|
|
14
|
+
/** Methods the page reads without waiting (`items()`): read where the extension runs, again whenever its `subscribe` says. */
|
|
15
|
+
readonly live?: readonly string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* How a member of the API crosses to an extension in a sandbox (3.2): `call` an async function; `fire` one that returns
|
|
19
|
+
* nothing; `hold` one that returns how to stop; `hook` a React hook whose value is data; `value` a property and `read`
|
|
20
|
+
* a method of no arguments, data both, read again as the page changes; `component` one of Ta, `components` a record of
|
|
21
|
+
* them; `group` an object of members of their own; `local` given by the sandbox itself; `page` only in the page, which is
|
|
22
|
+
* why it needs full access.
|
|
23
|
+
*/
|
|
24
|
+
export type WebApiForm = WebApiEntry['form'];
|
|
25
|
+
export type WebApiEntry = {
|
|
26
|
+
readonly form: 'page';
|
|
27
|
+
readonly access: 'full';
|
|
28
|
+
} | {
|
|
29
|
+
readonly form: 'local' | 'value' | 'read' | 'component' | 'components';
|
|
30
|
+
readonly access: TaExtensionAccess;
|
|
31
|
+
} | {
|
|
32
|
+
readonly form: 'fire' | 'hold';
|
|
33
|
+
readonly access: TaExtensionAccess;
|
|
34
|
+
readonly args?: readonly (WebApiShape | null)[];
|
|
35
|
+
}
|
|
36
|
+
/** `url`: it resolves with an address of the page, which a sandbox cannot load: what it holds crosses, a `blob:` there. */
|
|
37
|
+
| {
|
|
38
|
+
readonly form: 'call';
|
|
39
|
+
readonly access: TaExtensionAccess;
|
|
40
|
+
readonly args?: readonly (WebApiShape | null)[];
|
|
41
|
+
readonly returns?: 'url';
|
|
42
|
+
}
|
|
43
|
+
/** `peek`: a hook of no arguments, read before the extension starts, so that its first render has its value. */
|
|
44
|
+
| {
|
|
45
|
+
readonly form: 'hook';
|
|
46
|
+
readonly access: TaExtensionAccess;
|
|
47
|
+
readonly args?: readonly (WebApiShape | null)[];
|
|
48
|
+
readonly peek?: true;
|
|
49
|
+
} | {
|
|
50
|
+
readonly form: 'group';
|
|
51
|
+
readonly access: TaExtensionAccess;
|
|
52
|
+
readonly members: Readonly<Record<string, WebApiEntry>>;
|
|
53
|
+
};
|
|
54
|
+
/** An entry for every member: a member added to the API without one does not compile. */
|
|
55
|
+
export type WebApiSpec<T> = {
|
|
56
|
+
readonly [K in keyof Required<T>]: WebApiEntry;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* What each member of `pi.ui` needs and how it crosses. `browser`: what any page draws and asks. `app`: what Ta does
|
|
60
|
+
* for the extension as an app, in sight of the user. `full`: the computer, the conversations, the people, the other
|
|
61
|
+
* extensions, and what only the page can give (a page object, an element, an engine).
|
|
62
|
+
*/
|
|
63
|
+
export declare const WEB_UI_SPEC: WebApiSpec<WebExtensionUI>;
|
|
64
|
+
/** What each member of `pi` needs and how it crosses: one entry each, the only place it is said (3.2). */
|
|
65
|
+
export declare const WEB_API_SPEC: WebApiSpec<WebExtensionAPI>;
|
|
66
|
+
/** A member of the API by its path (`ui.voice.speak`), and every member with its path. */
|
|
67
|
+
export declare namespace WebApiSpecUtil {
|
|
68
|
+
function find(path: string): WebApiEntry | undefined;
|
|
69
|
+
function each(visit: (path: string, entry: WebApiEntry) => void, members?: Readonly<Record<string, WebApiEntry>>, prefix?: string): void;
|
|
70
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
const B = 'browser';
|
|
2
|
+
const A = 'app';
|
|
3
|
+
const page = { form: 'page', access: 'full' };
|
|
4
|
+
const local = (access) => ({ form: 'local', access });
|
|
5
|
+
const value = (access) => ({ form: 'value', access });
|
|
6
|
+
const read = (access) => ({ form: 'read', access });
|
|
7
|
+
const component = (access) => ({ form: 'component', access });
|
|
8
|
+
const call = (access, args) => ({ form: 'call', access, ...(args ? { args } : {}) });
|
|
9
|
+
const fire = (access, args) => ({ form: 'fire', access, ...(args ? { args } : {}) });
|
|
10
|
+
const hold = (access, args) => ({ form: 'hold', access, ...(args ? { args } : {}) });
|
|
11
|
+
const hook = (access, args) => ({ form: 'hook', access, ...(args ? { args } : {}) });
|
|
12
|
+
const peek = (access) => ({ form: 'hook', access, peek: true });
|
|
13
|
+
const group = (access, members) => ({ form: 'group', access, members });
|
|
14
|
+
/** A view, an editor tab: its components, its labels, and what the page reads of it without waiting. */
|
|
15
|
+
const VIEW = { fields: { title: 'L', render: 'C', head: 'C', mark: 'C', icon: 'C' }, live: ['menu', 'preview', 'busy'] };
|
|
16
|
+
const EDITOR = { fields: { title: 'L', tooltip: 'L', icon: 'C', render: 'C' } };
|
|
17
|
+
const SETTINGS = {
|
|
18
|
+
fields: {
|
|
19
|
+
title: 'L',
|
|
20
|
+
icon: 'C',
|
|
21
|
+
rows: { each: { fields: { label: 'L', search: 'L', description: 'L', render: 'C' } } },
|
|
22
|
+
signIn: { fields: { hint: 'L' } },
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const STORAGE = {
|
|
26
|
+
get: call(B),
|
|
27
|
+
set: call(B),
|
|
28
|
+
onChange: hold(B),
|
|
29
|
+
directory: page,
|
|
30
|
+
};
|
|
31
|
+
const APPS = {
|
|
32
|
+
installable: value(A),
|
|
33
|
+
list: call(A),
|
|
34
|
+
install: call(A),
|
|
35
|
+
remove: call(A),
|
|
36
|
+
open: call(A),
|
|
37
|
+
};
|
|
38
|
+
const VOICE = {
|
|
39
|
+
canListen: read(A),
|
|
40
|
+
canSpeak: read(A),
|
|
41
|
+
speak: fire(A),
|
|
42
|
+
hush: fire(A),
|
|
43
|
+
transcribe: call(A),
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* What each member of `pi.ui` needs and how it crosses. `browser`: what any page draws and asks. `app`: what Ta does
|
|
47
|
+
* for the extension as an app, in sight of the user. `full`: the computer, the conversations, the people, the other
|
|
48
|
+
* extensions, and what only the page can give (a page object, an element, an engine).
|
|
49
|
+
*/
|
|
50
|
+
export const WEB_UI_SPEC = {
|
|
51
|
+
confirm: call(B),
|
|
52
|
+
input: call(B),
|
|
53
|
+
editor: call(B),
|
|
54
|
+
theme: value(B),
|
|
55
|
+
language: value(B),
|
|
56
|
+
supportsWebview: value(B),
|
|
57
|
+
doubleInChats: value(B),
|
|
58
|
+
useDevice: peek(B),
|
|
59
|
+
showView: call(B),
|
|
60
|
+
showChats: fire(B),
|
|
61
|
+
custom: hold(B, ['C']),
|
|
62
|
+
openEditor: fire(B, [EDITOR]),
|
|
63
|
+
closeEditor: fire(B),
|
|
64
|
+
pinEditor: fire(B),
|
|
65
|
+
setEditorDirty: fire(B),
|
|
66
|
+
EditorActions: component(B),
|
|
67
|
+
Avatar: component(B),
|
|
68
|
+
Face: component(B),
|
|
69
|
+
GroupFace: component(B),
|
|
70
|
+
icons: { form: 'components', access: B },
|
|
71
|
+
CodeEditor: component(B),
|
|
72
|
+
DiffEditor: component(B),
|
|
73
|
+
FullScreen: component(B),
|
|
74
|
+
Stack: component(B),
|
|
75
|
+
Markdown: component(B),
|
|
76
|
+
Empty: component(B),
|
|
77
|
+
Loading: component(B),
|
|
78
|
+
Skeleton: component(B),
|
|
79
|
+
useBusy: local(B),
|
|
80
|
+
useBackLayer: hook(B),
|
|
81
|
+
Switch: component(B),
|
|
82
|
+
HostTag: component(B),
|
|
83
|
+
SwipeRow: component(B),
|
|
84
|
+
SelectCheck: component(B),
|
|
85
|
+
SelectBar: component(B),
|
|
86
|
+
TaskIcon: component(B),
|
|
87
|
+
Picture: component(B),
|
|
88
|
+
PictureCards: component(B),
|
|
89
|
+
ImageViewer: component(B),
|
|
90
|
+
ChatImages: component(B),
|
|
91
|
+
QrCode: component(B),
|
|
92
|
+
Dialog: component(B),
|
|
93
|
+
setWidget: fire(A, [null, 'C', { fields: { title: 'L' } }]),
|
|
94
|
+
notify: fire(A),
|
|
95
|
+
notifySession: fire(A),
|
|
96
|
+
usePages: peek(A),
|
|
97
|
+
scanCode: call(A),
|
|
98
|
+
scan: call(A),
|
|
99
|
+
saveFile: call(A),
|
|
100
|
+
shareExtension: fire(A),
|
|
101
|
+
stopExtension: fire(A),
|
|
102
|
+
forgetPage: fire(A),
|
|
103
|
+
useView: hook(A),
|
|
104
|
+
useScreenPart: hook(A),
|
|
105
|
+
useHomeShown: peek(A),
|
|
106
|
+
useActiveEditor: peek(A),
|
|
107
|
+
HoldToTalk: component(A),
|
|
108
|
+
voice: group(A, VOICE),
|
|
109
|
+
keepAwake: hold(A),
|
|
110
|
+
apps: group(A, APPS),
|
|
111
|
+
// An element, a node to draw, an answer at once, an engine: only in the page.
|
|
112
|
+
useContextMenu: page,
|
|
113
|
+
attachMenu: page,
|
|
114
|
+
useChatScroll: page,
|
|
115
|
+
fileDrag: page,
|
|
116
|
+
addToComposer: page,
|
|
117
|
+
Game: page,
|
|
118
|
+
Game3D: page,
|
|
119
|
+
// The computer, the conversations, the people, the other extensions.
|
|
120
|
+
useRoomAddons: page,
|
|
121
|
+
fileMenu: page,
|
|
122
|
+
pinChat: page,
|
|
123
|
+
desktop: page,
|
|
124
|
+
debugWebview: page,
|
|
125
|
+
useCwd: page,
|
|
126
|
+
useSessionId: page,
|
|
127
|
+
useSessions: page,
|
|
128
|
+
useSavedSessions: page,
|
|
129
|
+
useAsks: page,
|
|
130
|
+
answer: page,
|
|
131
|
+
screen: page,
|
|
132
|
+
openShared: page,
|
|
133
|
+
connect: page,
|
|
134
|
+
useTasks: page,
|
|
135
|
+
removeTasks: page,
|
|
136
|
+
createTerminal: page,
|
|
137
|
+
Composer: page,
|
|
138
|
+
Conversation: page,
|
|
139
|
+
ShareSheet: page,
|
|
140
|
+
FolderPicker: page,
|
|
141
|
+
ModelPicker: page,
|
|
142
|
+
useHomeItems: page,
|
|
143
|
+
openHome: page,
|
|
144
|
+
startGroup: page,
|
|
145
|
+
openPartner: page,
|
|
146
|
+
};
|
|
147
|
+
/** What each member of `pi` needs and how it crosses: one entry each, the only place it is said (3.2). */
|
|
148
|
+
export const WEB_API_SPEC = {
|
|
149
|
+
React: local(B),
|
|
150
|
+
ui: group(B, WEB_UI_SPEC),
|
|
151
|
+
storage: group(B, STORAGE),
|
|
152
|
+
fileUrl: { form: 'call', access: B, returns: 'url' },
|
|
153
|
+
openLink: call(B),
|
|
154
|
+
registerView: fire(B, [null, VIEW]),
|
|
155
|
+
registerMessageRenderer: fire(B, [null, 'C']),
|
|
156
|
+
registerCodeRenderer: fire(A, [null, 'C', { fields: { spoken: 'X' } }]),
|
|
157
|
+
registerAvatar: fire(A, ['C']),
|
|
158
|
+
registerHomeItems: fire(A, [{ live: ['items'] }]),
|
|
159
|
+
registerTasks: fire(A, [{ live: ['tasks'] }]),
|
|
160
|
+
registerSettings: fire(A, [SETTINGS]),
|
|
161
|
+
reloadExtensions: call(A),
|
|
162
|
+
// Drawn or answered at once, frame by frame: only in the page.
|
|
163
|
+
registerCallPartner: page,
|
|
164
|
+
registerCallMouth: page,
|
|
165
|
+
registerCallMoves: page,
|
|
166
|
+
registerChatIcon: page,
|
|
167
|
+
registerChatTag: page,
|
|
168
|
+
registerInitiative: page,
|
|
169
|
+
registerTool: page,
|
|
170
|
+
registerToolRenderer: page,
|
|
171
|
+
registerComposerAddon: page,
|
|
172
|
+
registerRoomAddon: page,
|
|
173
|
+
registerOpener: page,
|
|
174
|
+
registerSearch: page,
|
|
175
|
+
registerPartners: page,
|
|
176
|
+
registerSessionMenu: page,
|
|
177
|
+
registerFileMenu: page,
|
|
178
|
+
on: page,
|
|
179
|
+
sendUserMessage: page,
|
|
180
|
+
switchSession: page,
|
|
181
|
+
openChat: page,
|
|
182
|
+
callHost: page,
|
|
183
|
+
openTemporary: page,
|
|
184
|
+
onRoomEvent: page,
|
|
185
|
+
onTerminalData: page,
|
|
186
|
+
server: page,
|
|
187
|
+
workspace: page,
|
|
188
|
+
terminals: page,
|
|
189
|
+
packages: page,
|
|
190
|
+
files: page,
|
|
191
|
+
remote: page,
|
|
192
|
+
screenShare: page,
|
|
193
|
+
onScreenShareEvent: page,
|
|
194
|
+
settings: page,
|
|
195
|
+
rooms: page,
|
|
196
|
+
};
|
|
197
|
+
/** A member of the API by its path (`ui.voice.speak`), and every member with its path. */
|
|
198
|
+
export var WebApiSpecUtil;
|
|
199
|
+
(function (WebApiSpecUtil) {
|
|
200
|
+
function find(path) {
|
|
201
|
+
let members = WEB_API_SPEC;
|
|
202
|
+
let found;
|
|
203
|
+
for (const key of path.split('.')) {
|
|
204
|
+
found = Object.keys(members).includes(key) ? members[key] : undefined;
|
|
205
|
+
if (!found) {
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
208
|
+
members = found.form === 'group' ? found.members : {};
|
|
209
|
+
}
|
|
210
|
+
return found;
|
|
211
|
+
}
|
|
212
|
+
WebApiSpecUtil.find = find;
|
|
213
|
+
function each(visit, members = WEB_API_SPEC, prefix = '') {
|
|
214
|
+
for (const [key, entry] of Object.entries(members)) {
|
|
215
|
+
visit(prefix + key, entry);
|
|
216
|
+
if (entry.form === 'group') {
|
|
217
|
+
each(visit, entry.members, `${prefix}${key}.`);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
WebApiSpecUtil.each = each;
|
|
222
|
+
})(WebApiSpecUtil || (WebApiSpecUtil = {}));
|
|
223
|
+
//# sourceMappingURL=web-api-spec.js.map
|
|
@@ -480,6 +480,12 @@ export interface WebExtensionUI extends WebHomeUI, WebPartnersUI, WebEditorsUI,
|
|
|
480
480
|
readonly HoldToTalk: React.ComponentType<WebHoldToTalkProps>;
|
|
481
481
|
/** Listening and reading aloud as the conversations of the page do: its recognizer, the voice of the settings. */
|
|
482
482
|
readonly voice: WebVoice;
|
|
483
|
+
/**
|
|
484
|
+
* Keeps the device awake till the function it returns is called, as a call does: the screen does not lock (locked,
|
|
485
|
+
* a phone stops hearing), and Ta Desktop keeps the display on and does not restart. For what listens long (a
|
|
486
|
+
* meeting written down); let it go when it stops. Newer than some Ta apps: `pi.ui.keepAwake?.()`.
|
|
487
|
+
*/
|
|
488
|
+
readonly keepAwake?: () => () => void;
|
|
483
489
|
/** As the conversations show it; `inline`: in a line; `send`, `answer`: a group chat's, for taps in cards (newer). */
|
|
484
490
|
readonly Markdown: React.ComponentType<{
|
|
485
491
|
text: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TaMessageSource, } from '@celljs/ta-protocol';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { TaWebApps } from '../apps/web-apps.js';
|
|
3
4
|
import { TaskIcon } from '../assistant/task-views.js';
|
|
4
5
|
import { webVoice } from '../assistant/web-voice.js';
|
|
5
6
|
import { useBusy } from '../components/busy.js';
|
|
@@ -37,6 +38,7 @@ import { useBackLayer } from '../device/back-stack.js';
|
|
|
37
38
|
import { CodeScan } from '../device/code-scan.js';
|
|
38
39
|
import { useDevice } from '../device/device.js';
|
|
39
40
|
import { FileSave } from '../device/file-save.js';
|
|
41
|
+
import { KeepAwake } from '../device/screen-awake.js';
|
|
40
42
|
import { DraftPlaces } from '../drafts/drafts-protocol.js';
|
|
41
43
|
import { Game3DView, GameView } from '../game/game-view.js';
|
|
42
44
|
import { message as messageOf } from '../i18n/messages.js';
|
|
@@ -46,6 +48,7 @@ import { DefaultWebTerminal } from '../terminal/web-terminal.js';
|
|
|
46
48
|
import { DesktopUtil } from '../util/desktop.js';
|
|
47
49
|
import { FileDragUtil } from '../util/file-drag.js';
|
|
48
50
|
import { WEB_ICONS } from './icons.js';
|
|
51
|
+
import { WebAccessUtil } from './web-access.js';
|
|
49
52
|
import { WebCwdUtil, WebLabelUtil } from './web-extension-protocol.js';
|
|
50
53
|
import { WebExtensionRunUtil } from './web-extension-run.js';
|
|
51
54
|
import { WebHomeUtil } from './web-home.js';
|
|
@@ -131,6 +134,7 @@ export class WebExtensionContext {
|
|
|
131
134
|
return props => this.composer({ ...props, draft: props.draft === undefined ? undefined : DraftPlaces.extension(name, props.draft) });
|
|
132
135
|
}
|
|
133
136
|
create(run) {
|
|
137
|
+
var _a;
|
|
134
138
|
const { host } = this;
|
|
135
139
|
const { workbench, files } = host;
|
|
136
140
|
const register = (change) => {
|
|
@@ -148,7 +152,7 @@ export class WebExtensionContext {
|
|
|
148
152
|
let server;
|
|
149
153
|
/** Listens while the extension runs, what it hears guarded as all it runs. */
|
|
150
154
|
const hear = (on, listener) => WebExtensionRunUtil.track(run, () => on((...args) => host.guard(run, () => listener(...args))));
|
|
151
|
-
|
|
155
|
+
const api = {
|
|
152
156
|
React,
|
|
153
157
|
get server() {
|
|
154
158
|
if ((server === null || server === void 0 ? void 0 : server.of) !== workbench.server) {
|
|
@@ -256,6 +260,8 @@ export class WebExtensionContext {
|
|
|
256
260
|
callHost: (method, ...params) => live(() => workbench.packages.callPackageHost(run.loaded.name, method, params)),
|
|
257
261
|
reloadExtensions: () => live(() => host.extensions.reloadPackages()),
|
|
258
262
|
};
|
|
263
|
+
// As far as the user allowed this version of its package (docs/design/ta-extension-access.md); only an allowed one starts.
|
|
264
|
+
return WebAccessUtil.limit(api, (_a = WebAccessUtil.granted(run.loaded.info)) !== null && _a !== void 0 ? _a : 'browser', run.loaded.name);
|
|
259
265
|
}
|
|
260
266
|
ui(run, register) {
|
|
261
267
|
const { host } = this;
|
|
@@ -417,7 +423,10 @@ export class WebExtensionContext {
|
|
|
417
423
|
GroupFace,
|
|
418
424
|
Composer: this.composerOf(run),
|
|
419
425
|
HoldToTalk: this.holdToTalk,
|
|
420
|
-
voice: this.voice,
|
|
426
|
+
voice: WebExtensionRunUtil.voice(run, this.voice),
|
|
427
|
+
// Let go as the extension stops, whether or not it did; nothing held once stopped.
|
|
428
|
+
keepAwake: () => WebExtensionRunUtil.track(run, () => KeepAwake.shared.hold()),
|
|
429
|
+
apps: TaWebApps.of({ pages: () => host.extensions.pages(), settings, notices, fallbackIcon: WEB_ICONS.Puzzle }),
|
|
421
430
|
Markdown,
|
|
422
431
|
Conversation: ConversationView,
|
|
423
432
|
useChatScroll: (sent, key) => useConversationScroll(sent, { sentTo: 'bottom', key }),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TaEvent } from '@celljs/ta-protocol';
|
|
2
2
|
import type * as React from 'react';
|
|
3
|
-
import type { WebCallMouth, WebCallMoves, WebCallPartner, WebChatIconSource, WebChatTagSource, WebComposerAddon, WebFileMenu, WebHomeSource, WebInitiative, WebMenuItem, WebOpener, WebPartnerSource, WebRoomAddon, WebSearchSource, WebSessionMenu, WebSettingsSection, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WidgetOptions } from './web-extension-api.js';
|
|
3
|
+
import type { WebCallMouth, WebCallMoves, WebCallPartner, WebChatIconSource, WebChatTagSource, WebComposerAddon, WebFileMenu, WebHomeSource, WebInitiative, WebMenuItem, WebOpener, WebPartnerSource, WebRoomAddon, WebSearchSource, WebSessionMenu, WebSettingsSection, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WebVoice, WidgetOptions } from './web-extension-api.js';
|
|
4
4
|
import type { LoadedWebExtension, WebExtensionsState } from './web-extension-protocol.js';
|
|
5
5
|
/** What an extension registered through its API: all of it goes when it stops. */
|
|
6
6
|
export interface WebRegistrations {
|
|
@@ -60,6 +60,11 @@ export declare namespace WebExtensionRunUtil {
|
|
|
60
60
|
function clear(run: WebExtensionRun): void;
|
|
61
61
|
/** Subscribes for the extension: undone when it stops, or by the function returned. */
|
|
62
62
|
function track(run: WebExtensionRun, subscribe: () => () => void): () => void;
|
|
63
|
+
/**
|
|
64
|
+
* `ui.voice` of one extension: what it writes down ends as it stops, and once stopped it opens no microphone, as
|
|
65
|
+
* `ui.scanCode` opens no camera. Reading aloud stays: it does nothing for the user.
|
|
66
|
+
*/
|
|
67
|
+
function voice(run: WebExtensionRun, voice: WebVoice): WebVoice;
|
|
63
68
|
/** What the extensions that run registered, as the page shows it: the first of a message type or a tool name wins. */
|
|
64
69
|
function collect(runs: readonly WebExtensionRun[], onOpen: (id: string) => boolean): Pick<WebExtensionsState, 'openers' | 'specificOpeners' | 'sessionMenus' | 'fileMenus' | 'extensions' | 'views' | 'widgets' | 'composerAddons' | 'roomAddons' | 'settingsSections' | 'renderers' | 'codeRenderers' | 'codeSpeech' | 'callPartner' | 'callGroup' | 'callMouth' | 'callMoves' | 'avatars' | 'chatIcons' | 'chatTags' | 'initiatives' | 'tools' | 'toolRenderers' | 'searches'>;
|
|
65
70
|
}
|
|
@@ -72,6 +72,31 @@ export var WebExtensionRunUtil;
|
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
WebExtensionRunUtil.track = track;
|
|
75
|
+
/**
|
|
76
|
+
* `ui.voice` of one extension: what it writes down ends as it stops, and once stopped it opens no microphone, as
|
|
77
|
+
* `ui.scanCode` opens no camera. Reading aloud stays: it does nothing for the user.
|
|
78
|
+
*/
|
|
79
|
+
function voice(run, voice) {
|
|
80
|
+
return {
|
|
81
|
+
...voice,
|
|
82
|
+
transcribe: async (listener) => {
|
|
83
|
+
const transcribing = run.stopped ? undefined : await voice.transcribe(listener);
|
|
84
|
+
if (!transcribing || run.stopped) {
|
|
85
|
+
transcribing === null || transcribing === void 0 ? void 0 : transcribing.stop();
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
let stopped = false;
|
|
89
|
+
const stop = () => {
|
|
90
|
+
if (!stopped) {
|
|
91
|
+
stopped = true;
|
|
92
|
+
transcribing.stop();
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
return { service: transcribing.service, stop: track(run, () => stop) };
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
WebExtensionRunUtil.voice = voice;
|
|
75
100
|
/** What the extensions that run registered, as the page shows it: the first of a message type or a tool name wins. */
|
|
76
101
|
function collect(runs, onOpen) {
|
|
77
102
|
var _a;
|