@celljs/ta-web 4.38.0 → 4.40.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-thread.d.ts +1 -1
- package/esm/browser/assistant/chat-task-source.js +2 -1
- package/esm/browser/chat/chat-shown.js +2 -2
- package/esm/browser/components/app-contexts.js +11 -10
- package/esm/browser/components/busy.d.ts +5 -0
- package/esm/browser/components/busy.js +17 -0
- package/esm/browser/components/chat-asks.d.ts +4 -1
- package/esm/browser/components/chat-asks.js +10 -0
- package/esm/browser/components/chat-list-row.js +5 -3
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/composer-box-protocol.d.ts +5 -0
- package/esm/browser/components/composer-box.js +11 -14
- package/esm/browser/components/composer-media.d.ts +26 -0
- package/esm/browser/components/composer-media.js +37 -0
- package/esm/browser/components/composer-target.d.ts +2 -2
- package/esm/browser/components/composer-target.js +3 -3
- package/esm/browser/components/composer.js +1 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/link.d.ts +7 -1
- package/esm/browser/components/link.js +24 -5
- package/esm/browser/components/markdown.d.ts +1 -1
- package/esm/browser/components/markdown.js +70 -4
- package/esm/browser/components/remote-hosts.d.ts +3 -1
- package/esm/browser/components/remote-hosts.js +10 -5
- package/esm/browser/components/session-view.js +10 -6
- package/esm/browser/components/web-composer.d.ts +1 -1
- package/esm/browser/components/web-composer.js +12 -3
- package/esm/browser/device/photo-picker.d.ts +11 -3
- package/esm/browser/device/photo-picker.js +26 -9
- package/esm/browser/device/video-picks.d.ts +24 -0
- package/esm/browser/device/video-picks.js +104 -0
- package/esm/browser/extension/icons.js +17 -1
- package/esm/browser/extension/web-access.js +4 -1
- package/esm/browser/extension/web-api-code.d.ts +36 -0
- package/esm/browser/extension/web-api-code.js +3 -0
- package/esm/browser/extension/web-api-components.d.ts +22 -0
- package/esm/browser/extension/web-api-contributions.d.ts +0 -31
- package/esm/browser/extension/web-api-hosts.d.ts +22 -0
- package/esm/browser/extension/web-api-hosts.js +2 -0
- package/esm/browser/extension/web-api-menus.d.ts +17 -5
- package/esm/browser/extension/web-api-play.d.ts +29 -0
- package/esm/browser/extension/web-api-play.js +2 -0
- package/esm/browser/extension/web-api-spec.js +5 -0
- package/esm/browser/extension/web-api-terminal.d.ts +20 -0
- package/esm/browser/extension/web-extension-api.d.ts +19 -17
- package/esm/browser/extension/web-extension-context.d.ts +1 -1
- package/esm/browser/extension/web-extension-context.js +8 -6
- package/esm/browser/extension/web-extension-protocol.d.ts +2 -0
- package/esm/browser/extension/web-extension-protocol.js +1 -0
- package/esm/browser/extension/web-extension-run.d.ts +4 -3
- package/esm/browser/extension/web-extension-run.js +15 -8
- package/esm/browser/extension/web-extensions-running.js +38 -7
- package/esm/browser/extension/web-file-drag.d.ts +3 -0
- package/esm/browser/extension/web-file-drag.js +4 -0
- package/esm/browser/extension/web-hosts.d.ts +7 -0
- package/esm/browser/extension/web-hosts.js +29 -0
- package/esm/browser/extension/web-on-demand.d.ts +5 -0
- package/esm/browser/extension/web-on-demand.js +11 -0
- package/esm/browser/hosts.d.ts +2 -0
- package/esm/browser/hosts.js +9 -0
- package/esm/browser/i18n/en/assistant.d.ts +3 -0
- package/esm/browser/i18n/en/assistant.js +3 -0
- package/esm/browser/i18n/en/chat.d.ts +1 -0
- package/esm/browser/i18n/en/chat.js +1 -0
- 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 +2 -0
- package/esm/browser/i18n/en/discover.js +2 -0
- package/esm/browser/i18n/en/service.js +6 -6
- package/esm/browser/i18n/ja/assistant.js +3 -0
- package/esm/browser/i18n/ja/chat.js +1 -0
- package/esm/browser/i18n/ja/common.js +1 -0
- package/esm/browser/i18n/ja/discover.js +2 -0
- package/esm/browser/i18n/ja/service.js +6 -6
- package/esm/browser/i18n/locales.d.ts +8 -1
- package/esm/browser/i18n/messages.d.ts +7 -0
- package/esm/browser/i18n/zh/assistant.js +3 -0
- package/esm/browser/i18n/zh/chat.js +1 -0
- package/esm/browser/i18n/zh/common.js +1 -0
- package/esm/browser/i18n/zh/discover.js +2 -0
- package/esm/browser/i18n/zh/service.js +6 -6
- package/esm/browser/i18n/zh-tw/assistant.js +3 -0
- package/esm/browser/i18n/zh-tw/chat.js +1 -0
- package/esm/browser/i18n/zh-tw/common.js +1 -0
- package/esm/browser/i18n/zh-tw/discover.js +2 -0
- package/esm/browser/i18n/zh-tw/service.js +6 -6
- package/esm/browser/markdown/code-renderers.d.ts +3 -1
- package/esm/browser/markdown/code-renderers.js +2 -0
- package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/esm/browser/sandbox/work/work-api.d.ts +113 -0
- package/esm/browser/sandbox/work/work-api.js +95 -0
- package/esm/browser/sandbox/work/work-docs.d.ts +18 -0
- package/esm/browser/sandbox/work/work-docs.js +66 -0
- package/esm/browser/sandbox/work/work-frame.d.ts +27 -0
- package/esm/browser/sandbox/work/work-frame.js +124 -0
- package/esm/browser/share/shared-extensions.d.ts +2 -1
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +10 -0
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +1 -0
- package/esm/browser/terminal/terminal-osc.d.ts +15 -0
- package/esm/browser/terminal/terminal-osc.js +91 -0
- package/esm/browser/terminal/web-terminal.d.ts +4 -7
- package/esm/browser/terminal/web-terminal.js +22 -26
- package/esm/browser/util/link.d.ts +6 -1
- package/esm/browser/util/link.js +11 -0
- package/esm/browser/workbench-hosts.d.ts +1 -0
- package/esm/browser/workbench-hosts.js +9 -0
- package/esm/browser/workbench-protocol.d.ts +5 -0
- package/lib/browser/assistant/assistant-thread.d.ts +1 -1
- package/lib/browser/assistant/chat-task-source.js +2 -1
- package/lib/browser/chat/chat-shown.js +2 -2
- package/lib/browser/components/app-contexts.js +10 -9
- package/lib/browser/components/busy.d.ts +5 -0
- package/lib/browser/components/busy.js +17 -0
- package/lib/browser/components/chat-asks.d.ts +4 -1
- package/lib/browser/components/chat-asks.js +10 -0
- package/lib/browser/components/chat-list-row.js +5 -3
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/composer-box-protocol.d.ts +5 -0
- package/lib/browser/components/composer-box.js +9 -12
- package/lib/browser/components/composer-media.d.ts +27 -0
- package/lib/browser/components/composer-media.js +74 -0
- package/lib/browser/components/composer-target.d.ts +2 -2
- package/lib/browser/components/composer-target.js +3 -3
- package/lib/browser/components/composer.js +1 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/link.d.ts +7 -1
- package/lib/browser/components/link.js +25 -6
- package/lib/browser/components/markdown.d.ts +1 -1
- package/lib/browser/components/markdown.js +68 -2
- package/lib/browser/components/remote-hosts.d.ts +3 -1
- package/lib/browser/components/remote-hosts.js +10 -5
- package/lib/browser/components/session-view.js +8 -4
- package/lib/browser/components/web-composer.d.ts +1 -1
- package/lib/browser/components/web-composer.js +12 -3
- package/lib/browser/device/photo-picker.d.ts +11 -3
- package/lib/browser/device/photo-picker.js +26 -9
- package/lib/browser/device/video-picks.d.ts +25 -0
- package/lib/browser/device/video-picks.js +107 -0
- package/lib/browser/extension/icons.js +16 -0
- package/lib/browser/extension/web-access.js +4 -1
- package/lib/browser/extension/web-api-code.d.ts +37 -0
- package/lib/browser/extension/web-api-code.js +4 -0
- package/lib/browser/extension/web-api-components.d.ts +22 -0
- package/lib/browser/extension/web-api-contributions.d.ts +0 -31
- package/lib/browser/extension/web-api-hosts.d.ts +23 -0
- package/lib/browser/extension/web-api-hosts.js +3 -0
- package/lib/browser/extension/web-api-menus.d.ts +17 -5
- package/lib/browser/extension/web-api-play.d.ts +30 -0
- package/lib/browser/extension/web-api-play.js +3 -0
- package/lib/browser/extension/web-api-spec.js +5 -0
- package/lib/browser/extension/web-api-terminal.d.ts +20 -0
- package/lib/browser/extension/web-extension-api.d.ts +19 -17
- package/lib/browser/extension/web-extension-context.d.ts +1 -1
- package/lib/browser/extension/web-extension-context.js +8 -6
- package/lib/browser/extension/web-extension-protocol.d.ts +2 -0
- package/lib/browser/extension/web-extension-protocol.js +1 -0
- package/lib/browser/extension/web-extension-run.d.ts +4 -3
- package/lib/browser/extension/web-extension-run.js +15 -8
- package/lib/browser/extension/web-extensions-running.js +38 -7
- package/lib/browser/extension/web-file-drag.d.ts +4 -0
- package/lib/browser/extension/web-file-drag.js +7 -0
- package/lib/browser/extension/web-hosts.d.ts +8 -0
- package/lib/browser/extension/web-hosts.js +32 -0
- package/lib/browser/extension/web-on-demand.d.ts +5 -0
- package/lib/browser/extension/web-on-demand.js +11 -0
- package/lib/browser/hosts.d.ts +2 -0
- package/lib/browser/hosts.js +9 -0
- package/lib/browser/i18n/en/assistant.d.ts +3 -0
- package/lib/browser/i18n/en/assistant.js +3 -0
- package/lib/browser/i18n/en/chat.d.ts +1 -0
- package/lib/browser/i18n/en/chat.js +1 -0
- 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 +2 -0
- package/lib/browser/i18n/en/discover.js +2 -0
- package/lib/browser/i18n/en/service.js +6 -6
- package/lib/browser/i18n/ja/assistant.js +3 -0
- package/lib/browser/i18n/ja/chat.js +1 -0
- package/lib/browser/i18n/ja/common.js +1 -0
- package/lib/browser/i18n/ja/discover.js +2 -0
- package/lib/browser/i18n/ja/service.js +6 -6
- package/lib/browser/i18n/locales.d.ts +8 -1
- package/lib/browser/i18n/messages.d.ts +7 -0
- package/lib/browser/i18n/zh/assistant.js +3 -0
- package/lib/browser/i18n/zh/chat.js +1 -0
- package/lib/browser/i18n/zh/common.js +1 -0
- package/lib/browser/i18n/zh/discover.js +2 -0
- package/lib/browser/i18n/zh/service.js +6 -6
- package/lib/browser/i18n/zh-tw/assistant.js +3 -0
- package/lib/browser/i18n/zh-tw/chat.js +1 -0
- package/lib/browser/i18n/zh-tw/common.js +1 -0
- package/lib/browser/i18n/zh-tw/discover.js +2 -0
- package/lib/browser/i18n/zh-tw/service.js +6 -6
- package/lib/browser/markdown/code-renderers.d.ts +3 -1
- package/lib/browser/markdown/code-renderers.js +3 -1
- package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/lib/browser/sandbox/work/work-api.d.ts +114 -0
- package/lib/browser/sandbox/work/work-api.js +99 -0
- package/lib/browser/sandbox/work/work-docs.d.ts +19 -0
- package/lib/browser/sandbox/work/work-docs.js +69 -0
- package/lib/browser/sandbox/work/work-frame.d.ts +28 -0
- package/lib/browser/sandbox/work/work-frame.js +160 -0
- package/lib/browser/share/shared-extensions.d.ts +2 -1
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +10 -0
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +1 -0
- package/lib/browser/terminal/terminal-osc.d.ts +16 -0
- package/lib/browser/terminal/terminal-osc.js +94 -0
- package/lib/browser/terminal/web-terminal.d.ts +4 -7
- package/lib/browser/terminal/web-terminal.js +25 -29
- package/lib/browser/util/link.d.ts +6 -1
- package/lib/browser/util/link.js +11 -0
- package/lib/browser/workbench-hosts.d.ts +1 -0
- package/lib/browser/workbench-hosts.js +9 -0
- package/lib/browser/workbench-protocol.d.ts +5 -0
- package/package.json +7 -7
|
@@ -7,7 +7,7 @@ import { CallBar, callAction, callEndedNotice, dialogAnnouncements, talkCall, us
|
|
|
7
7
|
import { useKeyboardDismiss } from '../device/device.js';
|
|
8
8
|
import { DraftPlaces } from '../drafts/drafts-protocol.js';
|
|
9
9
|
import { TaFiles } from '../files/files-protocol.js';
|
|
10
|
-
import { useNotices, useOpenLink, usePersisted, useSessionState, useSettings, useSettingsServer } from '../hooks.js';
|
|
10
|
+
import { useNotices, useOpenLink, usePersisted, useSessionState, useSettings, useSettingsServer, useWebExtensions } from '../hooks.js';
|
|
11
11
|
import { useT } from '../i18n/use-t.js';
|
|
12
12
|
import { CodeConversation, CodeReply } from '../markdown/code-renderers.js';
|
|
13
13
|
import { ScreenUtil } from '../screen/screen-protocol.js';
|
|
@@ -33,7 +33,7 @@ import { DialogView } from './dialog-view.js';
|
|
|
33
33
|
import { useAsked, useEarlierMessages, useRowWindow } from './earlier-messages.js';
|
|
34
34
|
import { GrowBox } from './grow-box.js';
|
|
35
35
|
import { Icon } from './icon.js';
|
|
36
|
-
import { OpenLink } from './link.js';
|
|
36
|
+
import { FileMenu, OpenLink } from './link.js';
|
|
37
37
|
import { FileUrls } from './media.js';
|
|
38
38
|
import { useMessageActions } from './message-actions.js';
|
|
39
39
|
import { MessageActions } from './message-footer.js';
|
|
@@ -200,11 +200,14 @@ export function SessionView({ store, server, workspace, info, onClosed, onActivi
|
|
|
200
200
|
text: () => { var _a; var _b; return (_b = (_a = composer.current) === null || _a === void 0 ? void 0 : _a.text()) !== null && _b !== void 0 ? _b : ''; },
|
|
201
201
|
setText: text => { var _a; return (_a = composer.current) === null || _a === void 0 ? void 0 : _a.setText(text); },
|
|
202
202
|
addFiles: files => { var _a, _b; return (_b = (_a = composer.current) === null || _a === void 0 ? void 0 : _a.addFiles) === null || _b === void 0 ? void 0 : _b.call(_a, files); },
|
|
203
|
+
shown: () => { var _a; var _b; return (_b = (_a = composer.current) === null || _a === void 0 ? void 0 : _a.shown()) !== null && _b !== void 0 ? _b : false; },
|
|
203
204
|
}), [compact]);
|
|
204
205
|
const files = useInject(TaFiles);
|
|
205
206
|
const fileUrl = React.useCallback(async (path, box) => files.loadable(ThumbnailUtil.boxed(await workspace.fileUrl(path, cwd), box)), [workspace, cwd, files]);
|
|
206
207
|
const namedPaths = React.useCallback(() => MessageUtil.namedPaths(store.state.messages), [store]);
|
|
207
208
|
const openLink = useOpenLink(cwd, namedPaths);
|
|
209
|
+
const [{ fileMenus }] = useWebExtensions();
|
|
210
|
+
const fileMenu = React.useCallback((path) => (cwd ? fileMenus.flatMap(menu => menu(LinkUtil.fileRef(cwd, path))) : []), [cwd, fileMenus]);
|
|
208
211
|
// biome-ignore lint/correctness/useExhaustiveDependencies: runs when a run starts or settles
|
|
209
212
|
React.useEffect(() => onActivity(), [state.working, onActivity]);
|
|
210
213
|
React.useEffect(() => {
|
|
@@ -366,10 +369,11 @@ export function SessionView({ store, server, workspace, info, onClosed, onActivi
|
|
|
366
369
|
React.createElement(MessageActions.Provider, { value: messageActions },
|
|
367
370
|
React.createElement(FileUrls.Provider, { value: fileUrl },
|
|
368
371
|
React.createElement(OpenLink.Provider, { value: openLink },
|
|
369
|
-
React.createElement(
|
|
370
|
-
React.createElement(
|
|
371
|
-
React.createElement(
|
|
372
|
-
React.createElement(
|
|
372
|
+
React.createElement(FileMenu.Provider, { value: fileMenu },
|
|
373
|
+
React.createElement(MessageImages.Provider, { value: images },
|
|
374
|
+
React.createElement(CodeReply.Provider, { value: reply },
|
|
375
|
+
React.createElement(CodeConversation.Provider, { value: info === null || info === void 0 ? void 0 : info.sessionFile },
|
|
376
|
+
React.createElement(MessageList, { state: state, outbox: outbox, rows: rows })))))))))))),
|
|
373
377
|
React.createElement("div", { className: "ta-bottom" },
|
|
374
378
|
away &&
|
|
375
379
|
(asking ? (React.createElement("button", { type: "button", className: "ta-to-bottom ta-to-ask", title: t('ta.chat.toAsk', { question: asking.question }), onClick: toBottom },
|
|
@@ -19,4 +19,4 @@ export interface WebComposerHostProps extends WebComposerProps {
|
|
|
19
19
|
* The message box as web extensions get it (`pi.ui.Composer`): text, and pictures when it takes them (shrunk within
|
|
20
20
|
* the limits given), `@` for the names they give; a failure is a notice of the page.
|
|
21
21
|
*/
|
|
22
|
-
export declare function WebComposer({ notices, placeholder, onSend, images, emoji, autoFocus, mentions, mentionLabel, actions, cwd, onPickCwd, commands, working, onStop, voiceSends, onTalkSent, onListening, after, draft, server, listDirectory, serverCwd, remote, }: WebComposerHostProps): React.JSX.Element;
|
|
22
|
+
export declare function WebComposer({ notices, placeholder, onSend, images, videos, emoji, autoFocus, mentions, mentionLabel, actions, cwd, onPickCwd, commands, working, onStop, voiceSends, onTalkSent, onListening, after, draft, server, listDirectory, serverCwd, remote, }: WebComposerHostProps): React.JSX.Element;
|
|
@@ -4,22 +4,31 @@ import { ComposerUtil } from '../util/composer.js';
|
|
|
4
4
|
import { ImageShrink } from '../util/image-shrink.js';
|
|
5
5
|
import { ComposerAddonUtil } from './composer-addon-util.js';
|
|
6
6
|
import { ComposerBox } from './composer-box.js';
|
|
7
|
+
import { ComposerTarget } from './composer-target.js';
|
|
7
8
|
import { useDirectoryCommands } from './directory-commands.js';
|
|
8
9
|
import { DirectoryButton } from './folder-picker.js';
|
|
9
10
|
/**
|
|
10
11
|
* The message box as web extensions get it (`pi.ui.Composer`): text, and pictures when it takes them (shrunk within
|
|
11
12
|
* the limits given), `@` for the names they give; a failure is a notice of the page.
|
|
12
13
|
*/
|
|
13
|
-
export function WebComposer({ notices, placeholder, onSend, images, emoji, autoFocus, mentions, mentionLabel, actions, cwd, onPickCwd, commands, working, onStop, voiceSends, onTalkSent, onListening, after, draft, server, listDirectory, serverCwd, remote, }) {
|
|
14
|
+
export function WebComposer({ notices, placeholder, onSend, images, videos, emoji, autoFocus, mentions, mentionLabel, actions, cwd, onPickCwd, commands, working, onStop, voiceSends, onTalkSent, onListening, after, draft, server, listDirectory, serverCwd, remote, }) {
|
|
14
15
|
const t = useT();
|
|
15
16
|
const language = useLanguage();
|
|
16
17
|
const [query, setQuery] = React.useState();
|
|
18
|
+
// It takes what extensions put in the box in front (WebUiAPI.addToComposer), a message quoted in a group chat say.
|
|
19
|
+
const box = React.useRef(null);
|
|
20
|
+
React.useEffect(() => ComposerTarget.set({
|
|
21
|
+
text: () => { var _a; var _b; return (_b = (_a = box.current) === null || _a === void 0 ? void 0 : _a.text()) !== null && _b !== void 0 ? _b : ''; },
|
|
22
|
+
setText: text => { var _a; return (_a = box.current) === null || _a === void 0 ? void 0 : _a.setText(text); },
|
|
23
|
+
addFiles: files => { var _a, _b; return (_b = (_a = box.current) === null || _a === void 0 ? void 0 : _a.addFiles) === null || _b === void 0 ? void 0 : _b.call(_a, files); },
|
|
24
|
+
shown: () => { var _a; var _b; return (_b = (_a = box.current) === null || _a === void 0 ? void 0 : _a.shown()) !== null && _b !== void 0 ? _b : false; },
|
|
25
|
+
}), []);
|
|
17
26
|
const found = useDirectoryCommands(server, commands ? cwd || serverCwd : undefined);
|
|
18
27
|
const listed = React.useMemo(() => found.map(command => ({ name: command.name, description: ComposerUtil.commandDescription(command, language, t) })), [found, language, t]);
|
|
19
|
-
return (React.createElement(ComposerBox, { placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t('ta.composer.label'), onSend: async (text, attached) => {
|
|
28
|
+
return (React.createElement(ComposerBox, { ref: box, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t('ta.composer.label'), onSend: async (text, attached) => {
|
|
20
29
|
const limits = typeof images === 'object' ? images : undefined;
|
|
21
30
|
await onSend(text, limits ? await Promise.all(attached.map(image => ImageShrink.shrink(image, limits))) : attached);
|
|
22
|
-
}, images: !!images, emoji: emoji, autoFocus: autoFocus, commands: listed, onMentionQuery: mentions ? setQuery : undefined, mentions: mentions && query !== undefined
|
|
31
|
+
}, images: !!images, videos: videos, emoji: emoji, autoFocus: autoFocus, commands: listed, onMentionQuery: mentions ? setQuery : undefined, mentions: mentions && query !== undefined
|
|
23
32
|
? {
|
|
24
33
|
items: ComposerUtil.commands(mentions, query).map(mention => ({
|
|
25
34
|
key: mention.name,
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import type { WebPickedVideo } from '../extension/web-api-components.js';
|
|
2
|
+
/** What was picked: the photos, and the videos when asked for. */
|
|
3
|
+
export interface PhotoPick {
|
|
4
|
+
images: File[];
|
|
5
|
+
videos: WebPickedVideo[];
|
|
6
|
+
}
|
|
1
7
|
/**
|
|
2
8
|
* The photos of the device, picked in the library itself as WeChat's Album does: the Ta app on iOS opens it at once
|
|
3
9
|
* (PHPicker, which asks for no permission), where a file field shows a menu first (Photo Library, Take Photo,
|
|
@@ -7,8 +13,10 @@ export declare namespace PhotoPicker {
|
|
|
7
13
|
/** Whether the library opens at once here. */
|
|
8
14
|
function available(): boolean;
|
|
9
15
|
/**
|
|
10
|
-
* Up to `limit` photos, in the order picked; none when the user cancels. Not timed
|
|
11
|
-
* they need, and a pick started again ends the one before with none.
|
|
16
|
+
* Up to `limit` photos (and videos, with `videos`), in the order picked; none when the user cancels. Not timed
|
|
17
|
+
* out: the user takes the time they need, and a pick started again ends the one before with none.
|
|
12
18
|
*/
|
|
13
|
-
function pick(limit: number): Promise<
|
|
19
|
+
function pick(limit: number, videos?: boolean): Promise<PhotoPick>;
|
|
20
|
+
/** Picks, the photos to `images`, the videos to `videos` (asked for only with it). */
|
|
21
|
+
function pickInto(limit: number, images: (files: File[]) => void, videos?: (videos: WebPickedVideo[]) => void): void;
|
|
14
22
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RecentShots } from './recent-shots.js';
|
|
2
|
+
import { VideoPicks } from './video-picks.js';
|
|
2
3
|
/**
|
|
3
4
|
* The photos of the device, picked in the library itself as WeChat's Album does: the Ta app on iOS opens it at once
|
|
4
5
|
* (PHPicker, which asks for no permission), where a file field shows a menu first (Photo Library, Take Photo,
|
|
@@ -17,13 +18,13 @@ export var PhotoPicker;
|
|
|
17
18
|
}
|
|
18
19
|
PhotoPicker.available = available;
|
|
19
20
|
/**
|
|
20
|
-
* Up to `limit` photos, in the order picked; none when the user cancels. Not timed
|
|
21
|
-
* they need, and a pick started again ends the one before with none.
|
|
21
|
+
* Up to `limit` photos (and videos, with `videos`), in the order picked; none when the user cancels. Not timed
|
|
22
|
+
* out: the user takes the time they need, and a pick started again ends the one before with none.
|
|
22
23
|
*/
|
|
23
|
-
function pick(limit) {
|
|
24
|
+
function pick(limit, videos = false) {
|
|
24
25
|
const photos = native();
|
|
25
26
|
if (!photos) {
|
|
26
|
-
return Promise.resolve([]);
|
|
27
|
+
return Promise.resolve({ images: [], videos: [] });
|
|
27
28
|
}
|
|
28
29
|
const id = `p${++next}`;
|
|
29
30
|
return new Promise(resolve => {
|
|
@@ -34,15 +35,31 @@ export var PhotoPicker;
|
|
|
34
35
|
}
|
|
35
36
|
globalThis.removeEventListener(RecentShots.EVENT, onEvent);
|
|
36
37
|
const images = Array.isArray(detail.images) ? detail.images : [];
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
const kept = Array.isArray(detail.videos) ? detail.videos : [];
|
|
39
|
+
resolve({
|
|
40
|
+
images: images
|
|
41
|
+
.filter((image) => typeof image === 'string')
|
|
42
|
+
.map((image, index) => RecentShots.file(image, `photo-${index + 1}`))
|
|
43
|
+
.filter((file) => file !== undefined),
|
|
44
|
+
videos: kept.filter((video) => typeof (video === null || video === void 0 ? void 0 : video.url) === 'string').map(VideoPicks.ofNative),
|
|
45
|
+
});
|
|
41
46
|
};
|
|
42
47
|
globalThis.addEventListener(RecentShots.EVENT, onEvent);
|
|
43
|
-
photos.postMessage({ id, action: 'pick', limit: Math.max(1, limit) });
|
|
48
|
+
photos.postMessage({ id, action: 'pick', limit: Math.max(1, limit), ...(videos ? { videos: true } : {}) });
|
|
44
49
|
});
|
|
45
50
|
}
|
|
46
51
|
PhotoPicker.pick = pick;
|
|
52
|
+
/** Picks, the photos to `images`, the videos to `videos` (asked for only with it). */
|
|
53
|
+
function pickInto(limit, images, videos) {
|
|
54
|
+
void pick(limit, !!videos).then(picked => {
|
|
55
|
+
if (picked.images.length) {
|
|
56
|
+
images(picked.images);
|
|
57
|
+
}
|
|
58
|
+
if (picked.videos.length) {
|
|
59
|
+
videos === null || videos === void 0 ? void 0 : videos(picked.videos);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
PhotoPicker.pickInto = pickInto;
|
|
47
64
|
})(PhotoPicker || (PhotoPicker = {}));
|
|
48
65
|
//# sourceMappingURL=photo-picker.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { WebPickedVideo } from '../extension/web-api-components.js';
|
|
2
|
+
/** A video as the Ta app on iOS hands it from its picker (TaVideos.swift): an address of the app to read it at. */
|
|
3
|
+
export interface NativeVideo {
|
|
4
|
+
url: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
bytes?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The videos the message box takes with the pictures (WebComposerProps.videos), as WeChat's album: a file of a
|
|
11
|
+
* field, or one the picker of the Ta app on iOS kept, which it also makes smaller there, as WeChat sends a video.
|
|
12
|
+
*/
|
|
13
|
+
export declare namespace VideoPicks {
|
|
14
|
+
function isVideo(file: Pick<File, 'type'>): boolean;
|
|
15
|
+
/** What of the files pasted the box takes: the pictures, and the videos when it takes them. */
|
|
16
|
+
function pasted(files: FileList, videos: boolean): File[];
|
|
17
|
+
/** What a field of files takes: the pictures, and the videos when the box takes them. */
|
|
18
|
+
function accept(images: readonly string[], videos: boolean): string;
|
|
19
|
+
/** Hands the videos among `files` to `take` (none without it), and returns the rest. */
|
|
20
|
+
function take(files: FileList | readonly File[], take?: (videos: WebPickedVideo[]) => void): File[];
|
|
21
|
+
function ofFile(file: File): WebPickedVideo;
|
|
22
|
+
/** One kept by the app's picker: read at its address, made smaller by the app. */
|
|
23
|
+
function ofNative(video: NativeVideo): WebPickedVideo;
|
|
24
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { RecentShots } from './recent-shots.js';
|
|
2
|
+
/**
|
|
3
|
+
* The videos the message box takes with the pictures (WebComposerProps.videos), as WeChat's album: a file of a
|
|
4
|
+
* field, or one the picker of the Ta app on iOS kept, which it also makes smaller there, as WeChat sends a video.
|
|
5
|
+
*/
|
|
6
|
+
export var VideoPicks;
|
|
7
|
+
(function (VideoPicks) {
|
|
8
|
+
let next = 0;
|
|
9
|
+
function isVideo(file) {
|
|
10
|
+
return file.type.startsWith('video/');
|
|
11
|
+
}
|
|
12
|
+
VideoPicks.isVideo = isVideo;
|
|
13
|
+
/** What of the files pasted the box takes: the pictures, and the videos when it takes them. */
|
|
14
|
+
function pasted(files, videos) {
|
|
15
|
+
return Array.from(files).filter(file => file.type.startsWith('image/') || (videos && isVideo(file)));
|
|
16
|
+
}
|
|
17
|
+
VideoPicks.pasted = pasted;
|
|
18
|
+
/** What a field of files takes: the pictures, and the videos when the box takes them. */
|
|
19
|
+
function accept(images, videos) {
|
|
20
|
+
return videos ? [...images, 'video/*'].join(',') : images.join(',');
|
|
21
|
+
}
|
|
22
|
+
VideoPicks.accept = accept;
|
|
23
|
+
/** Hands the videos among `files` to `take` (none without it), and returns the rest. */
|
|
24
|
+
function take(files, take) {
|
|
25
|
+
const all = Array.from(files);
|
|
26
|
+
const videos = take ? all.filter(isVideo) : [];
|
|
27
|
+
if (videos.length) {
|
|
28
|
+
take === null || take === void 0 ? void 0 : take(videos.map(ofFile));
|
|
29
|
+
}
|
|
30
|
+
return all.filter(file => !videos.includes(file));
|
|
31
|
+
}
|
|
32
|
+
VideoPicks.take = take;
|
|
33
|
+
function ofFile(file) {
|
|
34
|
+
return { name: file.name, type: file.type, bytes: file.size, read: async () => file };
|
|
35
|
+
}
|
|
36
|
+
VideoPicks.ofFile = ofFile;
|
|
37
|
+
/** One kept by the app's picker: read at its address, made smaller by the app. */
|
|
38
|
+
function ofNative(video) {
|
|
39
|
+
const read = async (url) => {
|
|
40
|
+
const response = await fetch(url);
|
|
41
|
+
if (!response.ok) {
|
|
42
|
+
throw new Error(`The video could not be read (${response.status}).`);
|
|
43
|
+
}
|
|
44
|
+
return response.blob();
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
name: video.name || 'video.mov',
|
|
48
|
+
type: video.type || 'video/quicktime',
|
|
49
|
+
...(typeof video.bytes === 'number' ? { bytes: video.bytes } : {}),
|
|
50
|
+
read: () => read(video.url),
|
|
51
|
+
shrink: (limit, progress, signal) => shrinkNative(video.url, limit, progress, signal).then(read),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
VideoPicks.ofNative = ofNative;
|
|
55
|
+
function native() {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
return (_b = (_a = globalThis.webkit) === null || _a === void 0 ? void 0 : _a.messageHandlers) === null || _b === void 0 ? void 0 : _b.taShots;
|
|
58
|
+
}
|
|
59
|
+
/** The app makes the video at `url` smaller: the address of what it wrote. */
|
|
60
|
+
function shrinkNative(url, limit, progress, signal) {
|
|
61
|
+
const videos = native();
|
|
62
|
+
if (!videos) {
|
|
63
|
+
return Promise.reject(new Error('Not in the Ta app.'));
|
|
64
|
+
}
|
|
65
|
+
const id = `v${++next}`;
|
|
66
|
+
return new Promise((resolve, reject) => {
|
|
67
|
+
const end = () => {
|
|
68
|
+
globalThis.removeEventListener(RecentShots.EVENT, onEvent);
|
|
69
|
+
signal.removeEventListener('abort', onAbort);
|
|
70
|
+
};
|
|
71
|
+
const onEvent = (event) => {
|
|
72
|
+
const detail = event.detail;
|
|
73
|
+
if ((detail === null || detail === void 0 ? void 0 : detail.id) !== id) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (typeof detail.progress === 'number') {
|
|
77
|
+
progress(detail.progress);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
end();
|
|
81
|
+
if (detail.url) {
|
|
82
|
+
resolve(detail.url);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
reject(new Error(detail.error || 'The video could not be made smaller.'));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const onAbort = () => {
|
|
90
|
+
end();
|
|
91
|
+
videos.postMessage({ id, action: 'cancelShrink' });
|
|
92
|
+
reject(new DOMException('Aborted', 'AbortError'));
|
|
93
|
+
};
|
|
94
|
+
if (signal.aborted) {
|
|
95
|
+
onAbort();
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
globalThis.addEventListener(RecentShots.EVENT, onEvent);
|
|
99
|
+
signal.addEventListener('abort', onAbort);
|
|
100
|
+
videos.postMessage({ id, action: 'shrinkVideo', url, limit });
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
})(VideoPicks || (VideoPicks = {}));
|
|
104
|
+
//# sourceMappingURL=video-picks.js.map
|
|
@@ -1,6 +1,20 @@
|
|
|
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, CloudUpload, 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, AlignCenter, AlignLeft, AlignRight, Aperture, AppWindow, Archive, ArrowDown, ArrowDownToLine, ArrowDownWideNarrow, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, ArrowUpNarrowWide, Bell, BellOff, BetweenHorizontalStart, BetweenVerticalStart, Bold, 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, CloudUpload, Code, Coins, Columns2, Contact, Copy, CopyMinus, CornerDownRight, CornerUpLeft, Cpu, Crown, Database, Download, Ellipsis, Eraser, 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, PaintBucket, Paperclip, Pencil, Phone, Pin, PinOff, Play, Plus, Pointer, Power, Presentation, Puzzle, QrCode, Quote, Radar, RefreshCw, Regex, Replace, ReplaceAll, Rocket, RotateCcw, Rows2, Save, Scan, ScanLine, ScrollText, Search, Send, Server, Share2, Sheet, Shield, ShieldAlert, ShieldCheck, Shuffle, Sigma, SlidersHorizontal, Smartphone, Snowflake, Sparkles, Square, SquareMinus, SquarePlus, SquareTerminal, Star, StarOff, Store, TableCellsMerge, 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
|
+
AlignCenter,
|
|
5
|
+
AlignLeft,
|
|
6
|
+
AlignRight,
|
|
7
|
+
ArrowDownToLine,
|
|
8
|
+
ArrowDownWideNarrow,
|
|
9
|
+
ArrowUpNarrowWide,
|
|
10
|
+
BetweenHorizontalStart,
|
|
11
|
+
BetweenVerticalStart,
|
|
12
|
+
Bold,
|
|
13
|
+
Eraser,
|
|
14
|
+
PaintBucket,
|
|
15
|
+
Sigma,
|
|
16
|
+
Snowflake,
|
|
17
|
+
TableCellsMerge,
|
|
4
18
|
AlarmClock,
|
|
5
19
|
Aperture,
|
|
6
20
|
AppWindow,
|
|
@@ -125,6 +139,7 @@ export const WEB_ICONS = Object.freeze({
|
|
|
125
139
|
Plus,
|
|
126
140
|
Pointer,
|
|
127
141
|
Power,
|
|
142
|
+
Presentation,
|
|
128
143
|
Puzzle,
|
|
129
144
|
Quote,
|
|
130
145
|
QrCode,
|
|
@@ -144,6 +159,7 @@ export const WEB_ICONS = Object.freeze({
|
|
|
144
159
|
Send,
|
|
145
160
|
Server,
|
|
146
161
|
Share2,
|
|
162
|
+
Sheet,
|
|
147
163
|
Shield,
|
|
148
164
|
ShieldAlert,
|
|
149
165
|
ShieldCheck,
|
|
@@ -16,13 +16,16 @@ export var WebAccessUtil;
|
|
|
16
16
|
WebAccessUtil.granted = granted;
|
|
17
17
|
/** Where it came from, as the user knows it: never a link itself, whose key opens what it shares. */
|
|
18
18
|
function source(info, say) {
|
|
19
|
-
var _a, _b;
|
|
19
|
+
var _a, _b, _c;
|
|
20
20
|
if (((_a = info.temporary) === null || _a === void 0 ? void 0 : _a.from) === 'link') {
|
|
21
21
|
return say('ta.access.fromLink');
|
|
22
22
|
}
|
|
23
23
|
if (((_b = info.temporary) === null || _b === void 0 ? void 0 : _b.from) === 'market') {
|
|
24
24
|
return say('ta.access.fromMarket');
|
|
25
25
|
}
|
|
26
|
+
if (((_c = info.temporary) === null || _c === void 0 ? void 0 : _c.from) === 'agent') {
|
|
27
|
+
return say('ta.access.fromAgent');
|
|
28
|
+
}
|
|
26
29
|
return info.source;
|
|
27
30
|
}
|
|
28
31
|
WebAccessUtil.source = source;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Part of the web extension API (web-extension-api.ts, which exports it all): the fenced blocks extensions draw. */
|
|
2
|
+
import type { TaWorkPoint } from '@celljs/ta-protocol';
|
|
3
|
+
/** What else a code renderer says of its blocks (WebExtensionAPI.registerCodeRenderer). */
|
|
4
|
+
export interface WebCodeRendererOptions {
|
|
5
|
+
/**
|
|
6
|
+
* What of a block is said aloud, in a call or a reply read out (SpokenReply), the rest being on the screen: what
|
|
7
|
+
* the user must hear (a choice to make, a failure, a risk), in a sentence or two; nothing for none. Its code is whole.
|
|
8
|
+
*/
|
|
9
|
+
spoken?(code: string): string | undefined;
|
|
10
|
+
pointable?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** A fenced block of the language of a code renderer (WebExtensionAPI.registerCodeRenderer). */
|
|
13
|
+
export interface WebCodeRendererProps {
|
|
14
|
+
/** Its lines, as written. */
|
|
15
|
+
code: string;
|
|
16
|
+
/** As written after the fence. */
|
|
17
|
+
language: string;
|
|
18
|
+
/** False while the reply still streams it: the code may stop anywhere. */
|
|
19
|
+
closed: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Sends words as the user to the conversation the block is in (after its turn, if it works): a choice in it
|
|
22
|
+
* answered with a tap. None where no conversation holds the block (`ui.Markdown` of a page given none). Newer than some
|
|
23
|
+
* Ta apps, whose props have no `send`: there `pi.sendUserMessage` reaches the conversation shown.
|
|
24
|
+
*/
|
|
25
|
+
send?: (text: string) => Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* What the user said after the reply the block is in, once they did: a choice it offers was made (the words sent
|
|
28
|
+
* by `send`, or typed). None while they did not answer, and where no conversation holds the block. Newer than
|
|
29
|
+
* some Ta apps.
|
|
30
|
+
*/
|
|
31
|
+
answer?: string;
|
|
32
|
+
conversation?: string;
|
|
33
|
+
embedded?: boolean;
|
|
34
|
+
point?: (point: TaWorkPoint) => void;
|
|
35
|
+
}
|
|
36
|
+
/** pi's custom message, as the conversation holds it. */
|
|
@@ -329,6 +329,23 @@ export interface WebTranscribing {
|
|
|
329
329
|
/** Ends it: the words heard so far come as final, then `onEnd`. */
|
|
330
330
|
stop(): void;
|
|
331
331
|
}
|
|
332
|
+
/**
|
|
333
|
+
* A video picked in the message box (WebComposerProps.videos), with the pictures as WeChat's album does: read as it
|
|
334
|
+
* is, or made smaller on the device where it can be (the Ta app on iOS).
|
|
335
|
+
*/
|
|
336
|
+
export interface WebPickedVideo {
|
|
337
|
+
name: string;
|
|
338
|
+
type: string;
|
|
339
|
+
/** Its size in bytes, when known before it is read. */
|
|
340
|
+
bytes?: number;
|
|
341
|
+
/** Its bytes as they are. */
|
|
342
|
+
read(): Promise<Blob>;
|
|
343
|
+
/**
|
|
344
|
+
* Made smaller on the device to fit in `limit` bytes, `progress` from 0 to 1; rejects as `signal` aborts, or when
|
|
345
|
+
* it cannot. None where the device cannot: the computer makes it smaller, or it goes as it is.
|
|
346
|
+
*/
|
|
347
|
+
shrink?(limit: number, progress: (done: number) => void, signal: AbortSignal): Promise<Blob>;
|
|
348
|
+
}
|
|
332
349
|
export interface WebComposerProps {
|
|
333
350
|
placeholder?: string;
|
|
334
351
|
/**
|
|
@@ -342,6 +359,11 @@ export interface WebComposerProps {
|
|
|
342
359
|
* Newer than some Ta apps, which take none.
|
|
343
360
|
*/
|
|
344
361
|
images?: boolean | WebComposerImageLimits;
|
|
362
|
+
/**
|
|
363
|
+
* Videos are picked with the pictures (the album, the camera), pasted and dropped, and handed here as they come,
|
|
364
|
+
* never in the box. Newer than some Ta apps (`ui.composerVideos` says the box takes it).
|
|
365
|
+
*/
|
|
366
|
+
videos?(videos: WebPickedVideo[]): void;
|
|
345
367
|
/** An emoji button on the right of the field, as WeChat's: on a phone its panel takes the place of the keyboard. Newer than some Ta apps. */
|
|
346
368
|
emoji?: boolean;
|
|
347
369
|
/** The field takes the focus as the box shows (the keyboard comes up on a phone), as a box opened to comment. Newer than some Ta apps. */
|
|
@@ -482,37 +482,6 @@ export interface WebTaskEntry extends WebTask {
|
|
|
482
482
|
/** The name of the extension it is of. */
|
|
483
483
|
extension: string;
|
|
484
484
|
}
|
|
485
|
-
/** What else a code renderer says of its blocks (WebExtensionAPI.registerCodeRenderer). */
|
|
486
|
-
export interface WebCodeRendererOptions {
|
|
487
|
-
/**
|
|
488
|
-
* What of a block is said aloud, in a call or a reply read out (SpokenReply), the rest being on the screen: what
|
|
489
|
-
* the user must hear (a choice to make, a failure, a risk), in a sentence or two; nothing for none. Its code is whole.
|
|
490
|
-
*/
|
|
491
|
-
spoken?(code: string): string | undefined;
|
|
492
|
-
}
|
|
493
|
-
/** A fenced block of the language of a code renderer (WebExtensionAPI.registerCodeRenderer). */
|
|
494
|
-
export interface WebCodeRendererProps {
|
|
495
|
-
/** Its lines, as written. */
|
|
496
|
-
code: string;
|
|
497
|
-
/** As written after the fence. */
|
|
498
|
-
language: string;
|
|
499
|
-
/** False while the reply still streams it: the code may stop anywhere. */
|
|
500
|
-
closed: boolean;
|
|
501
|
-
/**
|
|
502
|
-
* Sends words as the user to the conversation the block is in (after its turn, if it works): a choice in it
|
|
503
|
-
* answered with a tap. None where no conversation holds the block (`ui.Markdown` of a page given none). Newer than some
|
|
504
|
-
* Ta apps, whose props have no `send`: there `pi.sendUserMessage` reaches the conversation shown.
|
|
505
|
-
*/
|
|
506
|
-
send?: (text: string) => Promise<void>;
|
|
507
|
-
/**
|
|
508
|
-
* What the user said after the reply the block is in, once they did: a choice it offers was made (the words sent
|
|
509
|
-
* by `send`, or typed). None while they did not answer, and where no conversation holds the block. Newer than
|
|
510
|
-
* some Ta apps.
|
|
511
|
-
*/
|
|
512
|
-
answer?: string;
|
|
513
|
-
conversation?: string;
|
|
514
|
-
embedded?: boolean;
|
|
515
|
-
}
|
|
516
485
|
/** pi's custom message, as the conversation holds it. */
|
|
517
486
|
export interface WebCustomMessage {
|
|
518
487
|
role: 'custom';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** A computer this device reaches, as the page keeps it (WebHosts). */
|
|
2
|
+
export interface WebHost {
|
|
3
|
+
/** Its id on this device. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** As the device shows it: the name given it, else its machine's. */
|
|
6
|
+
name: string;
|
|
7
|
+
/** The host name of its machine, as it said the last time. */
|
|
8
|
+
machine?: string;
|
|
9
|
+
/** Reached through a relay (a pairing), as a phone reaches a computer; not at an address of its own. */
|
|
10
|
+
relay: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** The computers this device reaches (WebExtensionAPI.hosts). Everything the page shows is of one: it loads again for another. */
|
|
13
|
+
export interface WebHosts {
|
|
14
|
+
/** The computer the page shows. */
|
|
15
|
+
current(): WebHost | undefined;
|
|
16
|
+
/** Those kept on this device. */
|
|
17
|
+
list(): WebHost[];
|
|
18
|
+
/** Keeps the computer of a pairing link (a link of Ta) on this device, named `name`, without asking or moving to it: its id. */
|
|
19
|
+
keep(link: string, name?: string): string;
|
|
20
|
+
/** The page loads again for another computer kept on this device, after a moment that says which. */
|
|
21
|
+
switchTo(id: string): void;
|
|
22
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Part of the web extension API (web-extension-api.ts, which exports it all): the entries extensions add to menus of the page. */
|
|
2
|
+
import type { TaWorkPoint } from '@celljs/ta-protocol';
|
|
2
3
|
import type { WebMenuItem } from './web-api-contributions.js';
|
|
3
4
|
/** A conversation as a list shows it: an open one has its session, one kept on the disk its file only. */
|
|
4
5
|
export interface WebSessionRef {
|
|
@@ -12,11 +13,11 @@ export interface WebSessionRef {
|
|
|
12
13
|
}
|
|
13
14
|
/** The entries an extension adds to the menu of a conversation of a list (registerSessionMenu); none for some. */
|
|
14
15
|
export type WebSessionMenu = (session: WebSessionRef) => WebMenuItem[];
|
|
15
|
-
/** A file or a folder of a workspace, as a list of files (the explorer) shows it. */
|
|
16
|
+
/** A file or a folder of a workspace, as a list of files (the explorer) or a turn that changed it shows it. */
|
|
16
17
|
export interface WebFileRef {
|
|
17
18
|
/** The directory of the workspace: a path, or `ssh://…` (TaLocation). */
|
|
18
19
|
cwd: string;
|
|
19
|
-
/** Relative to `cwd`, with
|
|
20
|
+
/** Relative to `cwd`, with `/`; absolute for a file a turn changed outside `cwd` (TaWorkspaceServer.fileUrl serves it alone). */
|
|
20
21
|
path: string;
|
|
21
22
|
name: string;
|
|
22
23
|
kind: 'file' | 'directory';
|
|
@@ -29,6 +30,15 @@ export interface WebCodeRef {
|
|
|
29
30
|
/** As the fence names it, in lower case; empty for none. */
|
|
30
31
|
language: string;
|
|
31
32
|
code: string;
|
|
33
|
+
/** Drawn by a renderer (registerCodeRenderer), once its fence ended: its actions are buttons with their words under it. */
|
|
34
|
+
drawn?: boolean;
|
|
35
|
+
/** The file of the conversation it is in, when it is drawn in one. */
|
|
36
|
+
conversation?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Of a block drawn by a renderer that tells its parts apart (WebCodeRendererOptions.pointable): lets the user
|
|
39
|
+
* point at one, the page saying so above it; the part tapped, or undefined when they gave up.
|
|
40
|
+
*/
|
|
41
|
+
point?: () => Promise<TaWorkPoint | undefined>;
|
|
32
42
|
}
|
|
33
43
|
/** The actions an extension adds to a block of code (registerCodeMenu); none for some. */
|
|
34
44
|
export type WebCodeMenu = (block: WebCodeRef) => WebMenuItem[];
|
|
@@ -41,13 +51,15 @@ export interface WebMenus {
|
|
|
41
51
|
registerSessionMenu(menu: WebSessionMenu): void;
|
|
42
52
|
/**
|
|
43
53
|
* Entries of the menu of a file or a folder where a list of files shows it (the explorer: a right click or a held
|
|
44
|
-
* finger on its row
|
|
54
|
+
* finger on its row; the files a turn changed; the tab of a file in the workbench), in a section of their own: read
|
|
55
|
+
* each time the menu opens. Newer than some Ta apps:
|
|
45
56
|
* `pi.registerFileMenu?.(…)`.
|
|
46
57
|
*/
|
|
47
58
|
registerFileMenu(menu: WebFileMenu): void;
|
|
48
59
|
/**
|
|
49
|
-
* Actions of a block of code (a fenced block of a reply, a command a tool ran)
|
|
50
|
-
*
|
|
60
|
+
* Actions of a block of code (a fenced block of a reply, a command a tool ran): of one drawn as code, each a button
|
|
61
|
+
* by its icon beside Copy (one without an icon is not drawn); of one a renderer drew (`drawn`), a button with its
|
|
62
|
+
* words under it. Read each time the block is drawn.
|
|
51
63
|
* Newer than some Ta apps: `pi.registerCodeMenu?.(…)`.
|
|
52
64
|
*/
|
|
53
65
|
registerCodeMenu(menu: WebCodeMenu): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Part of the web extension API (web-extension-api.ts, which exports it all): what plays in the page, drawn by its own
|
|
3
|
+
* engines (docs/design/ta-games.md) or run in a frame of its own (a document a model wrote, docs/design/ta-works.md).
|
|
4
|
+
*/
|
|
5
|
+
import type * as React from 'react';
|
|
6
|
+
import type { GameProps } from '../game/game-protocol.js';
|
|
7
|
+
import type { Game3DProps } from '../game/game3d-protocol.js';
|
|
8
|
+
import type { WorkFrameProps } from '../sandbox/work/work-frame.js';
|
|
9
|
+
export type { WorkEmit, WorkHost, WorkValues } from '../sandbox/work/work-api.js';
|
|
10
|
+
export type { WorkFrameProps } from '../sandbox/work/work-frame.js';
|
|
11
|
+
export interface WebPlayUI {
|
|
12
|
+
/**
|
|
13
|
+
* A game, drawn by Phaser, the game engine of the page (docs/design/ta-games.md): it fills its parent (a
|
|
14
|
+
* column of flex, or an element with a size), sleeps while out of sight and ends when it unmounts. Phaser
|
|
15
|
+
* loads the first time a game starts; an extension never brings an engine of its own.
|
|
16
|
+
*/
|
|
17
|
+
readonly Game: React.ComponentType<GameProps>;
|
|
18
|
+
/**
|
|
19
|
+
* A 3D game, drawn by Three.js, the 3D engine of the page, with its OrbitControls: `setup` puts things in
|
|
20
|
+
* the scene it is given and returns what to do each frame. As `Game`, it fills its parent, sleeps while out
|
|
21
|
+
* of sight and ends when it unmounts, all of its scene disposed; Three.js loads the first time one starts.
|
|
22
|
+
*/
|
|
23
|
+
readonly Game3D: React.ComponentType<Game3DProps>;
|
|
24
|
+
/**
|
|
25
|
+
* A document a model wrote (a game of a reply, a work) in a frame of its own, seen in the page: no origin, no network,
|
|
26
|
+
* nothing of Ta but its `window.ta` (WORK_API), each call checked and counted. Newer than some apps.
|
|
27
|
+
*/
|
|
28
|
+
readonly WorkFrame?: React.ComponentType<WorkFrameProps>;
|
|
29
|
+
}
|
|
@@ -54,6 +54,7 @@ export const WEB_UI_SPEC = {
|
|
|
54
54
|
theme: value(B),
|
|
55
55
|
language: value(B),
|
|
56
56
|
supportsWebview: value(B),
|
|
57
|
+
composerVideos: value(B),
|
|
57
58
|
doubleInChats: value(B),
|
|
58
59
|
useDevice: peek(B),
|
|
59
60
|
showView: call(B),
|
|
@@ -90,6 +91,8 @@ export const WEB_UI_SPEC = {
|
|
|
90
91
|
ImageViewer: component(B),
|
|
91
92
|
ChatImages: component(B),
|
|
92
93
|
QrCode: component(B),
|
|
94
|
+
// Its host is functions that take functions: only in the page, for now (docs/design/ta-works.md stage 2 opens it).
|
|
95
|
+
WorkFrame: page,
|
|
93
96
|
Dialog: component(B),
|
|
94
97
|
setWidget: fire(A, [null, 'C', { fields: { title: 'L' } }]),
|
|
95
98
|
notify: fire(A),
|
|
@@ -152,6 +155,8 @@ export const WEB_API_SPEC = {
|
|
|
152
155
|
storage: group(B, STORAGE),
|
|
153
156
|
fileUrl: { form: 'call', access: B, returns: 'url' },
|
|
154
157
|
openLink: call(B),
|
|
158
|
+
// The computers of the device, and moving to another: what the page itself is.
|
|
159
|
+
hosts: page,
|
|
155
160
|
registerView: fire(B, [null, VIEW]),
|
|
156
161
|
registerMessageRenderer: fire(B, [null, 'C']),
|
|
157
162
|
registerCodeRenderer: fire(A, [null, 'C', { fields: { spoken: 'X' } }]),
|