@celljs/ta-web 4.30.0 → 4.31.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/account/account-side.js +1 -1
- package/esm/browser/account/device-account.d.ts +8 -0
- package/esm/browser/account/device-account.js +26 -0
- package/esm/browser/components/account-menu.d.ts +1 -1
- package/esm/browser/components/account-menu.js +8 -4
- package/esm/browser/components/account-view.d.ts +7 -0
- package/esm/browser/components/account-view.js +90 -10
- package/esm/browser/components/chat-tag.d.ts +13 -5
- package/esm/browser/components/chat-tag.js +23 -6
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/composer-box.js +6 -2
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/host-view.js +3 -3
- package/esm/browser/components/me-rows.d.ts +2 -0
- package/esm/browser/components/me-rows.js +1 -1
- package/esm/browser/components/scan-screen.js +10 -0
- package/esm/browser/components/session-view.js +1 -1
- package/esm/browser/components/tool-view.js +10 -4
- package/esm/browser/components/voice-button.d.ts +7 -0
- package/esm/browser/components/voice-button.js +25 -2
- package/esm/browser/components/voice-talk.js +1 -1
- package/esm/browser/components/workbench-view.js +2 -2
- package/esm/browser/device/back-stack.d.ts +7 -0
- package/esm/browser/device/back-stack.js +13 -1
- package/esm/browser/device/code-scan.d.ts +5 -2
- package/esm/browser/device/code-scan.js +22 -2
- package/esm/browser/device/mini-program.d.ts +69 -0
- package/esm/browser/device/mini-program.js +251 -0
- package/esm/browser/device/sheet-swipe.js +4 -1
- package/esm/browser/device/swipe-util.d.ts +2 -0
- package/esm/browser/device/swipe-util.js +5 -0
- package/esm/browser/extension/extension-view.d.ts +1 -1
- package/esm/browser/extension/icons.js +2 -1
- package/esm/browser/extension/web-api-chats.d.ts +2 -0
- package/esm/browser/extension/web-api-components.d.ts +10 -1
- package/esm/browser/extension/web-api-storage.d.ts +20 -0
- package/esm/browser/extension/web-api-storage.js +3 -0
- package/esm/browser/extension/web-extension-api.d.ts +3 -27
- package/esm/browser/extension/web-extension-context.js +1 -1
- package/esm/browser/extension/web-home.d.ts +1 -1
- package/esm/browser/extension/web-home.js +7 -2
- package/esm/browser/extension/web-pages.js +2 -2
- package/esm/browser/i18n/en/account.d.ts +3 -1
- package/esm/browser/i18n/en/account.js +3 -1
- package/esm/browser/i18n/en/chat.d.ts +2 -0
- package/esm/browser/i18n/en/chat.js +3 -1
- package/esm/browser/i18n/en/common.d.ts +1 -0
- package/esm/browser/i18n/en/common.js +1 -0
- package/esm/browser/i18n/ja/account.js +3 -1
- package/esm/browser/i18n/ja/chat.js +3 -1
- package/esm/browser/i18n/ja/common.js +1 -0
- package/esm/browser/i18n/locales.d.ts +7 -2
- package/esm/browser/i18n/messages.d.ts +6 -1
- package/esm/browser/i18n/zh/account.js +3 -1
- package/esm/browser/i18n/zh/chat.js +3 -1
- package/esm/browser/i18n/zh/common.js +1 -0
- package/esm/browser/i18n/zh-tw/account.js +3 -1
- package/esm/browser/i18n/zh-tw/chat.js +3 -1
- package/esm/browser/i18n/zh-tw/common.js +1 -0
- package/esm/browser/links/links.d.ts +4 -1
- package/esm/browser/links/links.js +10 -1
- package/esm/browser/settings/settings.js +3 -0
- package/esm/browser/style/chat-list.d.ts +1 -1
- package/esm/browser/style/chat-list.js +2 -0
- package/esm/browser/style/dialogs.d.ts +1 -1
- package/esm/browser/style/dialogs.js +0 -1
- package/esm/browser/util/tool.d.ts +6 -2
- package/esm/browser/util/tool.js +28 -5
- package/esm/browser/util/voice.d.ts +9 -0
- package/esm/browser/util/voice.js +20 -0
- package/esm/browser/workbench-util.d.ts +5 -0
- package/esm/browser/workbench-util.js +9 -0
- package/esm/browser/workbench.js +6 -1
- package/lib/browser/account/account-side.js +1 -1
- package/lib/browser/account/device-account.d.ts +8 -0
- package/lib/browser/account/device-account.js +26 -0
- package/lib/browser/components/account-menu.d.ts +1 -1
- package/lib/browser/components/account-menu.js +6 -2
- package/lib/browser/components/account-view.d.ts +7 -0
- package/lib/browser/components/account-view.js +91 -10
- package/lib/browser/components/chat-tag.d.ts +13 -5
- package/lib/browser/components/chat-tag.js +22 -5
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/composer-box.js +5 -1
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/host-view.js +3 -3
- package/lib/browser/components/me-rows.d.ts +2 -0
- package/lib/browser/components/me-rows.js +1 -1
- package/lib/browser/components/scan-screen.js +10 -0
- package/lib/browser/components/session-view.js +1 -1
- package/lib/browser/components/tool-view.js +10 -4
- package/lib/browser/components/voice-button.d.ts +7 -0
- package/lib/browser/components/voice-button.js +26 -2
- package/lib/browser/components/voice-talk.js +1 -1
- package/lib/browser/components/workbench-view.js +2 -2
- package/lib/browser/device/back-stack.d.ts +7 -0
- package/lib/browser/device/back-stack.js +13 -1
- package/lib/browser/device/code-scan.d.ts +5 -2
- package/lib/browser/device/code-scan.js +22 -2
- package/lib/browser/device/mini-program.d.ts +70 -0
- package/lib/browser/device/mini-program.js +254 -0
- package/lib/browser/device/sheet-swipe.js +4 -1
- package/lib/browser/device/swipe-util.d.ts +2 -0
- package/lib/browser/device/swipe-util.js +5 -0
- package/lib/browser/extension/extension-view.d.ts +1 -1
- package/lib/browser/extension/icons.js +1 -0
- package/lib/browser/extension/web-api-chats.d.ts +2 -0
- package/lib/browser/extension/web-api-components.d.ts +10 -1
- package/lib/browser/extension/web-api-storage.d.ts +21 -0
- package/lib/browser/extension/web-api-storage.js +4 -0
- package/lib/browser/extension/web-extension-api.d.ts +3 -27
- package/lib/browser/extension/web-extension-context.js +1 -1
- package/lib/browser/extension/web-home.d.ts +1 -1
- package/lib/browser/extension/web-home.js +7 -2
- package/lib/browser/extension/web-pages.js +1 -1
- package/lib/browser/i18n/en/account.d.ts +3 -1
- package/lib/browser/i18n/en/account.js +3 -1
- package/lib/browser/i18n/en/chat.d.ts +2 -0
- package/lib/browser/i18n/en/chat.js +3 -1
- package/lib/browser/i18n/en/common.d.ts +1 -0
- package/lib/browser/i18n/en/common.js +1 -0
- package/lib/browser/i18n/ja/account.js +3 -1
- package/lib/browser/i18n/ja/chat.js +3 -1
- package/lib/browser/i18n/ja/common.js +1 -0
- package/lib/browser/i18n/locales.d.ts +7 -2
- package/lib/browser/i18n/messages.d.ts +6 -1
- package/lib/browser/i18n/zh/account.js +3 -1
- package/lib/browser/i18n/zh/chat.js +3 -1
- package/lib/browser/i18n/zh/common.js +1 -0
- package/lib/browser/i18n/zh-tw/account.js +3 -1
- package/lib/browser/i18n/zh-tw/chat.js +3 -1
- package/lib/browser/i18n/zh-tw/common.js +1 -0
- package/lib/browser/links/links.d.ts +4 -1
- package/lib/browser/links/links.js +10 -1
- package/lib/browser/settings/settings.js +3 -0
- package/lib/browser/style/chat-list.d.ts +1 -1
- package/lib/browser/style/chat-list.js +2 -0
- package/lib/browser/style/dialogs.d.ts +1 -1
- package/lib/browser/style/dialogs.js +0 -1
- package/lib/browser/util/tool.d.ts +6 -2
- package/lib/browser/util/tool.js +28 -5
- package/lib/browser/util/voice.d.ts +9 -0
- package/lib/browser/util/voice.js +20 -0
- package/lib/browser/workbench-util.d.ts +5 -0
- package/lib/browser/workbench-util.js +9 -0
- package/lib/browser/workbench.js +6 -1
- package/package.json +10 -10
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Dialogs and sheets, the picker of machines, rows far up a conversation, the sign-in to model accounts, Ta on a phone. */
|
|
2
|
-
export declare const DIALOGS_STYLE = "\n/* A dialog in the middle of the page; a sheet from the bottom on a phone */\n.ta-modal-scrim { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 12vh 12px 12px; background: rgba(0, 0, 0, 0.32); animation: ta-fade 140ms ease-out; }\n.ta-modal { position: relative; z-index: 1; width: min(520px, 100%); max-height: 76vh; display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 14px; border-radius: 14px; border: 1px solid var(--ta-border); background: var(--ta-card); box-shadow: var(--ta-shadow-pop); }\n.ta-modal-head { display: flex; align-items: center; justify-content: space-between; padding-left: 2px; }\n.ta-modal-title { font-size: calc(14px * var(--ta-font-scale)); font-weight: 600; }\n.ta-web-dialog { width: min(480px, 100%); gap: 14px; padding: 16px 18px 18px; }\n.ta-web-dialog > :not(.ta-modal-head) { min-height: 0; overflow-y: auto; }\n.ta-web-dialog .ta-modal-title { font-size: calc(16px * var(--ta-font-scale)); }\n.ta-folder-bar { display: flex; align-items: center; gap: 6px; }\n.ta-folder-bar .ta-field input { font-family: var(--ta-mono); font-size: calc(12.5px * var(--ta-font-scale)); }\n/* The path on a touch screen: its folders as buttons, scrolled to the last; it fills the bar as the field does. */\n.ta-folder-crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; height: 34px; padding: 0 6px; overflow-x: auto; scrollbar-width: none; border-radius: 8px; background: var(--ta-input); border: 1px solid var(--ta-border-field); white-space: nowrap; }\n.ta-folder-crumbs::-webkit-scrollbar { display: none; }\n.ta-folder-crumbs[data-clipped] { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 28px); mask-image: linear-gradient(to right, transparent 0, #000 28px); }\n.ta-folder-crumb { flex: none; height: 26px; padding: 0 6px; border: 0; border-radius: 6px; background: transparent; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); }\n.ta-folder-crumb:active { background: var(--ta-hover); }\n.ta-folder-crumb.ta-current { color: var(--ta-text); font-weight: 600; }\n.ta-folder-crumb-sep { flex: none; color: var(--ta-muted); }\n.ta-folder-machines .ta-chip-filter { flex: none; max-width: 70%; }\n.ta-folder-list { list-style: none; flex: none; height: min(340px, 44vh); overflow-y: auto; margin: 0; padding: 4px; border: 1px solid var(--ta-border-muted); border-radius: 10px; }\n.ta-folder-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ta-body); font-size: calc(13px * var(--ta-font-scale)); text-align: left; }\n.ta-folder-item:hover { background: var(--ta-hover); color: var(--ta-text); }\n.ta-folder-item > .ta-icon:first-child, .ta-folder-chevron { color: var(--ta-muted); }\n.ta-folder-chevron { opacity: 0; }\n.ta-folder-item:hover .ta-folder-chevron { opacity: 1; }\n.ta-folder-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.ta-folder-note { display: flex; justify-content: center; padding: 28px 8px; color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); }\n.ta-folder-failed { color: var(--ta-red); font-size: calc(12.5px * var(--ta-font-scale)); overflow-wrap: anywhere; }\n.ta-folder-note { gap: 8px; align-items: center; }\n.ta-folder-step { color: var(--ta-secondary); }\n.ta-folder-unreachable { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 16px; text-align: center; font-size: calc(13px * var(--ta-font-scale)); color: var(--ta-text); }\n.ta-folder-unreachable span { max-width: 100%; color: var(--ta-muted); font-family: var(--ta-mono); font-size: calc(12px * var(--ta-font-scale)); overflow-wrap: anywhere; }\n/* The machines of the picker: this one, the hosts of ssh, + another */\n.ta-modal.ta-folder { width: min(640px, 100%); }\n.ta-folder-machines { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; margin: 0; padding: 0 0 2px; gap: 6px; scrollbar-width: none; }\n.ta-folder-machines::-webkit-scrollbar { display: none; }\n.ta-folder-machines .ta-icon-button { flex: none; width: 28px; height: 28px; border-radius: 14px; }\n/* A host to add: a row of its own under the machines, as wide as the path, what it may be said under it. */\n.ta-folder-add { display: flex; flex-direction: column; gap: 6px; }\n.ta-folder-add-row { display: flex; align-items: center; gap: 8px; }\n.ta-folder-add-row .ta-field input { font-family: var(--ta-mono); font-size: calc(12.5px * var(--ta-font-scale)); }\n.ta-folder-add-row .ta-field:has(input[aria-invalid='true']) { border-color: var(--ta-red); }\n.ta-folder-add-row .ta-button { flex: none; height: 34px; }\n.ta-folder-add-hint { padding: 0 2px; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); overflow-wrap: anywhere; }\n.ta-remote-state { display: inline-flex; align-items: center; gap: 6px; }\n.ta-remote-light { width: 7px; height: 7px; border-radius: 50%; background: var(--ta-border-field); flex: none; }\n.ta-remote-light.ta-on { background: var(--ta-green); }\n.ta-remote-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ta-green); flex: none; }\n/* The host of a directory of another machine, before its name */\n.ta-host-tag { display: inline-flex; align-items: center; gap: 3px; flex: none; box-sizing: border-box; max-width: 120px; height: 17px; padding: 0 5px 0 4px; margin-right: 5px; border-radius: 5px; background: color-mix(in srgb, var(--ta-blue) 11%, transparent); color: color-mix(in srgb, var(--ta-blue) 82%, var(--ta-text)); font-size: calc(11px * var(--ta-font-scale)); font-weight: 500; line-height: calc(17px * var(--ta-font-scale)); white-space: nowrap; vertical-align: middle; }\n.ta-host-tag > svg { flex: none; }\n.ta-host-tag > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }\n/* In a narrow chip the host gives way before the name of the folder, and both stay inside it. */\n.ta-cwd-chip .ta-host-tag { flex: 0 10 auto; min-width: 0; margin: 0 0 0 2px; }\n.ta-cwd-chip .ta-ellipsis { flex: none; max-width: 60%; }\n/* What ssh asks, and the line while a host connects */\n.ta-remote-prompt { width: min(440px, 100%); gap: 12px; }\n.ta-remote-prompt .ta-confirm-title { display: flex; align-items: center; gap: 8px; }\n.ta-remote-message { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--ta-hover); color: var(--ta-body); font-family: var(--ta-mono); font-size: calc(12px * var(--ta-font-scale)); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 160px; overflow-y: auto; }\n.ta-remote-status { position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top) + var(--ta-titlebar, 0px)); z-index: 65; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px); height: 32px; padding: 0 14px; border-radius: 16px; border: 1px solid var(--ta-border); background: var(--ta-side); box-shadow: var(--ta-shadow-pop); color: var(--ta-secondary); font-size: calc(12.5px * var(--ta-font-scale)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: ta-fade 160ms ease-out; }\n/* The picker says it itself */\nbody:has(.ta-folder) .ta-remote-status { display: none; }\n@media (max-width: 860px), (max-height: 500px) and (pointer: coarse) {\n .ta-modal-scrim { align-items: flex-end; padding: 0; }\n .ta-modal { max-height: 88dvh; border-radius: 16px 16px 0 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); animation: ta-up 260ms var(--ta-ease); }\n .ta-chat-row:hover .ta-compact .ta-chat-time, .ta-chat-row:hover .ta-chat-state { visibility: visible; }\n .ta-chat-row:not(.ta-selected) .ta-chat-delete { display: none; }\n .ta-chat-row.ta-selected .ta-chat-delete { opacity: 1; }\n .ta-chat-row.ta-selected .ta-compact .ta-chat-time, .ta-chat-row.ta-selected .ta-chat-state { visibility: hidden; }\n .ta-chat-row.ta-selected .ta-chat-item:not(.ta-compact) .ta-chat-sub { padding-right: 28px; }\n .ta-folder-chevron { opacity: 1; }\n}\n/* A tap leaves no hover behind on a folder; a press shows. */\n@media (pointer: coarse) {\n .ta-folder-item:hover { background: transparent; color: var(--ta-body); }\n .ta-folder-item:active { background: var(--ta-hover); color: var(--ta-text); }\n}\n\n/* Performance (t6): rows far up the conversation skip layout and paint until they come into view */\n.ta-thread-item { display: flex; flex-direction: column; min-width: 0; contain-intrinsic-size: auto 160px; }\n/* A message nothing is drawn of (pi's note of a changed prompt) takes no gap: the first message does not move down when it comes. */\n.ta-thread-item:empty { display: none; }\n.ta-thread-item.ta-settled { content-visibility: auto; }\n/* Above the messages while the earlier ones of a long conversation load, as it is scrolled up. */\n.ta-earlier { display: flex; justify-content: center; padding: 12px 0; }\n.ta-earlier-idle .ta-spinner { visibility: hidden; animation: none; }\n\n/* Model accounts: the sign-in page, the dialog and a sign-in under way */\n.ta-login-card { width: min(460px, 100%); display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }\n.ta-login-card h1 { margin: 6px 0 0; font-size: calc(20px * var(--ta-font-scale)); font-weight: 600; color: var(--ta-text); }\n.ta-login-card > p { margin: 0 0 6px; color: var(--ta-secondary); font-size: calc(13.5px * var(--ta-font-scale)); line-height: 1.6; }\n.ta-login-card .ta-auth-panel { width: 100%; text-align: left; }\n.ta-login-card .ta-auth-list { max-height: min(46vh, 420px); }\n.ta-login-later { margin-top: 2px; border: 0; background: none; color: var(--ta-muted); font: inherit; font-size: calc(13px * var(--ta-font-scale)); cursor: pointer; }\n.ta-login-later:hover { color: var(--ta-text); }\n.ta-login-card .ta-pic-cards { margin-top: 4px; }\n.ta-auth-dialog { width: min(520px, 100%); gap: 12px; padding: 16px 18px 18px; }\n.ta-auth-dialog .ta-modal-title { font-size: calc(16px * var(--ta-font-scale)); }\n.ta-auth-panel { display: flex; flex-direction: column; gap: 10px; min-height: 0; }\n.ta-auth-list { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; max-height: 56vh; }\n.ta-auth-group h3 { margin: 0 0 4px; padding: 0 10px; font-size: calc(12px * var(--ta-font-scale)); font-weight: 500; color: var(--ta-muted); }\n.ta-auth-row { display: flex; align-items: center; gap: 4px; }\n.ta-auth-item { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; height: 38px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ta-body); font: inherit; font-size: calc(13.5px * var(--ta-font-scale)); text-align: left; cursor: pointer; }\n.ta-auth-item:hover { background: var(--ta-hover); color: var(--ta-text); }\n.ta-auth-item > .ta-icon:last-child { color: var(--ta-muted); }\n.ta-auth-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-text); }\n.ta-auth-kind { flex: none; padding: 1px 7px; border-radius: 999px; background: var(--ta-raised); color: var(--ta-muted); font-size: calc(11.5px * var(--ta-font-scale)); }\n.ta-auth-note { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }\n.ta-auth-on { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; color: var(--ta-green); font-size: calc(12px * var(--ta-font-scale)); max-width: 45%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }\n.ta-auth-item .ta-auth-on + .ta-icon { margin-left: 0; }\n.ta-auth-item > .ta-auth-kind + .ta-icon { margin-left: auto; }\n.ta-auth-flow { display: flex; flex-direction: column; gap: 14px; text-align: left; }\n.ta-auth-flow-head { display: flex; align-items: center; gap: 8px; }\n.ta-auth-flow-title { font-size: calc(15px * var(--ta-font-scale)); font-weight: 600; color: var(--ta-text); }\n.ta-auth-step { display: flex; flex-direction: column; gap: 10px; }\n.ta-auth-step p { margin: 0; color: var(--ta-body); font-size: calc(13.5px * var(--ta-font-scale)); line-height: 1.6; }\n.ta-auth-actions { display: flex; flex-wrap: wrap; gap: 8px; }\n.ta-auth-code { align-self: flex-start; padding: 8px 14px; border-radius: 10px; background: var(--ta-raised); color: var(--ta-text); font-family: var(--ta-mono); font-size: calc(20px * var(--ta-font-scale)); letter-spacing: 0.12em; user-select: all; }\n.ta-auth-options { display: flex; flex-direction: column; gap: 2px; }\n.ta-auth-link { display: block; margin-top: 4px; color: var(--ta-link, var(--ta-brand)); word-break: break-all; }\n/* The sign-in comes in step by step; its pictures answer the pointer */\n@keyframes ta-rise { from { transform: translateY(10px); opacity: 0; } }\n@keyframes ta-key-dot { 0%, 100% { opacity: .35; } 50% { opacity: 1; transform: translateY(-1.5px); } }\n@keyframes ta-tick { from { stroke-dashoffset: 12; } }\n@keyframes ta-code-in { from { letter-spacing: 0.4em; opacity: 0; } }\n.ta-login-card > * { animation: ta-rise 420ms var(--ta-ease) both; }\n.ta-login-card > :nth-child(2) { animation-delay: 60ms; }\n.ta-login-card > :nth-child(3) { animation-delay: 100ms; }\n.ta-login-card > :nth-child(4) { animation-delay: 150ms; }\n.ta-login-card > :nth-child(5) { animation-delay: 220ms; }\n.ta-login-card .ta-pic-card:hover .ta-pic-tick { stroke-dasharray: 12; animation: ta-tick 420ms var(--ta-ease) both; }\n.ta-login-card .ta-pic-card:hover .ta-pic-dot { animation: ta-key-dot 900ms ease-in-out infinite; }\n.ta-login-card .ta-pic-card:hover .ta-pic-dot:nth-child(n+8) { animation-delay: 90ms; }\n.ta-login-card .ta-pic-card:hover .ta-pic-dot:nth-child(n+10) { animation-delay: 180ms; }\n.ta-login-card .ta-pic-card:hover .ta-pic-dot:nth-child(n+12) { animation-delay: 270ms; }\n.ta-auth-flow > *, .ta-auth-panel > *, .ta-auth-group { animation: ta-in 260ms var(--ta-ease) both; }\n.ta-auth-code { animation: ta-code-in 420ms var(--ta-ease) both; }\n.ta-auth-item { transition: background 120ms, color 120ms, transform 120ms var(--ta-ease); }\n.ta-auth-item:hover > .ta-icon:last-child { transform: translateX(2px); transition: transform 160ms var(--ta-ease); }\n/* Ta on a phone: a picture of the way through the relay, the code to scan, the devices */\n@keyframes ta-qr-in { from { transform: scale(.94); opacity: 0; } }\n.ta-relay-dialog { width: min(440px, 100%); gap: 14px; padding: 16px 18px 18px; }\n.ta-relay-dialog .ta-modal-title { font-size: calc(16px * var(--ta-font-scale)); }\n.ta-relay-start, .ta-relay-pairing { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; animation: ta-in 260ms var(--ta-ease) both; }\n.ta-relay-start p, .ta-relay-pairing p { margin: 0; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); line-height: 1.6; }\n.ta-relay-pic { width: 100%; max-width: 320px; border-radius: 0; }\n.ta-relay-form { display: flex; gap: 8px; width: 100%; }\n.ta-relay-form .ta-field { flex: 1; }\n.ta-qr { width: 220px; height: 220px; border-radius: 12px; animation: ta-qr-in 320ms var(--ta-ease) both; }\n.ta-relay-state { margin-left: 8px; font-weight: 400; color: var(--ta-muted); }\n.ta-relay-state::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--ta-muted); vertical-align: middle; }\n.ta-relay-state.ta-on::before { background: var(--ta-green); }\n.ta-relay-device { gap: 10px; height: 38px; padding: 0 4px 0 10px; color: var(--ta-muted); }\n.ta-relay-device .ta-auth-note { flex: none; margin-left: auto; }\n.ta-relay-awake { display: flex; align-items: center; gap: 12px; padding: 0 4px 0 10px; }\n.ta-relay-awake-text { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 2px; }\n.ta-relay-awake-text .ta-auth-note { white-space: normal; line-height: 1.5; }\n/* The account and its devices (account-view.tsx) */\n.ta-account-dialog { width: min(440px, 100%); gap: 14px; padding: 16px 18px 18px; overflow-y: auto; }\n.ta-account-dialog .ta-modal-title { font-size: calc(16px * var(--ta-font-scale)); }\n.ta-account-hint { margin: 0; color: var(--ta-muted); font-size: calc(13px * var(--ta-font-scale)); line-height: 1.55; }\n.ta-account-ways, .ta-account-signing { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }\n.ta-account-signing p { margin: 0; text-align: center; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); }\n.ta-account-waiting { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 6px 0 2px; text-align: center; }\n.ta-account-waiting strong { font-size: calc(15px * var(--ta-font-scale)); font-weight: 600; }\n.ta-account-waiting p { margin: 0; color: var(--ta-muted); font-size: calc(13px * var(--ta-font-scale)); line-height: 1.55; }\n.ta-account-code { padding: 12px 22px; border-radius: 14px; background: var(--ta-hover); font-family: var(--ta-mono); font-size: calc(30px * var(--ta-font-scale)); font-weight: 600; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; color: var(--ta-text); white-space: nowrap; }\n.ta-account-devices { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }\n.ta-account-device { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 6px 6px 6px 8px; border-radius: 12px; }\n.ta-account-device.ta-waiting { background: var(--ta-hover); }\n.ta-account-device-icon { position: relative; flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--ta-hover); color: var(--ta-secondary); }\n.ta-account-device.ta-waiting .ta-account-device-icon { background: var(--ta-card); }\n.ta-account-dot { position: absolute; right: 0; bottom: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--ta-muted); box-shadow: 0 0 0 2px var(--ta-card); }\n.ta-account-dot.ta-on { background: var(--ta-green); }\n.ta-account-device-text { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 2px; font-size: calc(14px * var(--ta-font-scale)); }\n.ta-account-device-detail { color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); }\n.ta-account-device-actions { flex: none; display: flex; align-items: center; gap: 6px; }\n.ta-account-device-actions .ta-button { height: 30px; padding: 0 12px; }\n.ta-account-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--ta-border-muted); }\n.ta-account-who { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); }\n.ta-account-foot .ta-button { height: 30px; padding: 0 12px; }\n.ta-account-sign-in { display: flex; width: 100%; flex-direction: column; gap: 12px; text-align: left; }\n.ta-account-signed { display: flex; width: 100%; flex-direction: column; align-items: center; gap: 8px; padding: 4px 0; text-align: center; }\n.ta-account-signed .ta-account-who { font-size: calc(14px * var(--ta-font-scale)); color: var(--ta-text); }\n.ta-account-offer { display: flex; flex-direction: column; gap: 10px; }\n.ta-account-others { display: flex; flex-direction: column; gap: 6px; }\n.ta-account-others h2 { margin: 0 4px; font-size: calc(12.5px * var(--ta-font-scale)); font-weight: 500; color: var(--ta-muted); }\n.ta-account-recent-mark { display: grid; place-items: center; background: var(--ta-hover); color: var(--ta-text); }\n.ta-account-ask { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 58; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 12px; width: min(420px, calc(100vw - 24px)); padding: 14px 16px; border-radius: 16px; border: 1px solid var(--ta-border); background: var(--ta-card); box-shadow: var(--ta-shadow-pop); transform: translateX(-50%); animation: ta-fade 160ms ease-out; }\n.ta-account-ask-text { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; gap: 6px; }\n.ta-account-ask-text strong { max-width: 100%; font-size: calc(14px * var(--ta-font-scale)); font-weight: 600; }\n.ta-account-ask .ta-account-code { padding: 4px 10px; border-radius: 8px; font-size: calc(20px * var(--ta-font-scale)); }\n.ta-account-ask-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }\n.ta-account-ask-actions .ta-link-button { margin-right: auto; }\n";
|
|
2
|
+
export declare const DIALOGS_STYLE = "\n/* A dialog in the middle of the page; a sheet from the bottom on a phone */\n.ta-modal-scrim { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 12vh 12px 12px; background: rgba(0, 0, 0, 0.32); animation: ta-fade 140ms ease-out; }\n.ta-modal { position: relative; z-index: 1; width: min(520px, 100%); max-height: 76vh; display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 14px; border-radius: 14px; border: 1px solid var(--ta-border); background: var(--ta-card); box-shadow: var(--ta-shadow-pop); }\n.ta-modal-head { display: flex; align-items: center; justify-content: space-between; padding-left: 2px; }\n.ta-modal-title { font-size: calc(14px * var(--ta-font-scale)); font-weight: 600; }\n.ta-web-dialog { width: min(480px, 100%); gap: 14px; padding: 16px 18px 18px; }\n.ta-web-dialog > :not(.ta-modal-head) { min-height: 0; overflow-y: auto; }\n.ta-web-dialog .ta-modal-title { font-size: calc(16px * var(--ta-font-scale)); }\n.ta-folder-bar { display: flex; align-items: center; gap: 6px; }\n.ta-folder-bar .ta-field input { font-family: var(--ta-mono); font-size: calc(12.5px * var(--ta-font-scale)); }\n/* The path on a touch screen: its folders as buttons, scrolled to the last; it fills the bar as the field does. */\n.ta-folder-crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; height: 34px; padding: 0 6px; overflow-x: auto; scrollbar-width: none; border-radius: 8px; background: var(--ta-input); border: 1px solid var(--ta-border-field); white-space: nowrap; }\n.ta-folder-crumbs::-webkit-scrollbar { display: none; }\n.ta-folder-crumbs[data-clipped] { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 28px); mask-image: linear-gradient(to right, transparent 0, #000 28px); }\n.ta-folder-crumb { flex: none; height: 26px; padding: 0 6px; border: 0; border-radius: 6px; background: transparent; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); }\n.ta-folder-crumb:active { background: var(--ta-hover); }\n.ta-folder-crumb.ta-current { color: var(--ta-text); font-weight: 600; }\n.ta-folder-crumb-sep { flex: none; color: var(--ta-muted); }\n.ta-folder-machines .ta-chip-filter { flex: none; max-width: 70%; }\n.ta-folder-list { list-style: none; flex: none; height: min(340px, 44vh); overflow-y: auto; margin: 0; padding: 4px; border: 1px solid var(--ta-border-muted); border-radius: 10px; }\n.ta-folder-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ta-body); font-size: calc(13px * var(--ta-font-scale)); text-align: left; }\n.ta-folder-item:hover { background: var(--ta-hover); color: var(--ta-text); }\n.ta-folder-item > .ta-icon:first-child, .ta-folder-chevron { color: var(--ta-muted); }\n.ta-folder-chevron { opacity: 0; }\n.ta-folder-item:hover .ta-folder-chevron { opacity: 1; }\n.ta-folder-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.ta-folder-note { display: flex; justify-content: center; padding: 28px 8px; color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); }\n.ta-folder-failed { color: var(--ta-red); font-size: calc(12.5px * var(--ta-font-scale)); overflow-wrap: anywhere; }\n.ta-folder-note { gap: 8px; align-items: center; }\n.ta-folder-step { color: var(--ta-secondary); }\n.ta-folder-unreachable { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 16px; text-align: center; font-size: calc(13px * var(--ta-font-scale)); color: var(--ta-text); }\n.ta-folder-unreachable span { max-width: 100%; color: var(--ta-muted); font-family: var(--ta-mono); font-size: calc(12px * var(--ta-font-scale)); overflow-wrap: anywhere; }\n/* The machines of the picker: this one, the hosts of ssh, + another */\n.ta-modal.ta-folder { width: min(640px, 100%); }\n.ta-folder-machines { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; margin: 0; padding: 0 0 2px; gap: 6px; scrollbar-width: none; }\n.ta-folder-machines::-webkit-scrollbar { display: none; }\n.ta-folder-machines .ta-icon-button { flex: none; width: 28px; height: 28px; border-radius: 14px; }\n/* A host to add: a row of its own under the machines, as wide as the path, what it may be said under it. */\n.ta-folder-add { display: flex; flex-direction: column; gap: 6px; }\n.ta-folder-add-row { display: flex; align-items: center; gap: 8px; }\n.ta-folder-add-row .ta-field input { font-family: var(--ta-mono); font-size: calc(12.5px * var(--ta-font-scale)); }\n.ta-folder-add-row .ta-field:has(input[aria-invalid='true']) { border-color: var(--ta-red); }\n.ta-folder-add-row .ta-button { flex: none; height: 34px; }\n.ta-folder-add-hint { padding: 0 2px; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); overflow-wrap: anywhere; }\n.ta-remote-state { display: inline-flex; align-items: center; gap: 6px; }\n.ta-remote-light { width: 7px; height: 7px; border-radius: 50%; background: var(--ta-border-field); flex: none; }\n.ta-remote-light.ta-on { background: var(--ta-green); }\n.ta-remote-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ta-green); flex: none; }\n/* The host of a directory of another machine, before its name */\n.ta-host-tag { display: inline-flex; align-items: center; gap: 3px; flex: none; box-sizing: border-box; max-width: 120px; height: 17px; padding: 0 5px 0 4px; margin-right: 5px; border-radius: 5px; background: color-mix(in srgb, var(--ta-blue) 11%, transparent); color: color-mix(in srgb, var(--ta-blue) 82%, var(--ta-text)); font-size: calc(11px * var(--ta-font-scale)); font-weight: 500; line-height: calc(17px * var(--ta-font-scale)); white-space: nowrap; vertical-align: middle; }\n.ta-host-tag > svg { flex: none; }\n.ta-host-tag > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }\n/* In a narrow chip the host gives way before the name of the folder, and both stay inside it. */\n.ta-cwd-chip .ta-host-tag { flex: 0 10 auto; min-width: 0; margin: 0 0 0 2px; }\n.ta-cwd-chip .ta-ellipsis { flex: none; max-width: 60%; }\n/* What ssh asks, and the line while a host connects */\n.ta-remote-prompt { width: min(440px, 100%); gap: 12px; }\n.ta-remote-prompt .ta-confirm-title { display: flex; align-items: center; gap: 8px; }\n.ta-remote-message { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--ta-hover); color: var(--ta-body); font-family: var(--ta-mono); font-size: calc(12px * var(--ta-font-scale)); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 160px; overflow-y: auto; }\n.ta-remote-status { position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top) + var(--ta-titlebar, 0px)); z-index: 65; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px); height: 32px; padding: 0 14px; border-radius: 16px; border: 1px solid var(--ta-border); background: var(--ta-side); box-shadow: var(--ta-shadow-pop); color: var(--ta-secondary); font-size: calc(12.5px * var(--ta-font-scale)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: ta-fade 160ms ease-out; }\n/* The picker says it itself */\nbody:has(.ta-folder) .ta-remote-status { display: none; }\n@media (max-width: 860px), (max-height: 500px) and (pointer: coarse) {\n .ta-modal-scrim { align-items: flex-end; padding: 0; }\n .ta-modal { max-height: 88dvh; border-radius: 16px 16px 0 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); animation: ta-up 260ms var(--ta-ease); }\n .ta-chat-row:hover .ta-compact .ta-chat-time, .ta-chat-row:hover .ta-chat-state { visibility: visible; }\n .ta-chat-row:not(.ta-selected) .ta-chat-delete { display: none; }\n .ta-chat-row.ta-selected .ta-chat-delete { opacity: 1; }\n .ta-chat-row.ta-selected .ta-compact .ta-chat-time, .ta-chat-row.ta-selected .ta-chat-state { visibility: hidden; }\n .ta-chat-row.ta-selected .ta-chat-item:not(.ta-compact) .ta-chat-sub { padding-right: 28px; }\n .ta-folder-chevron { opacity: 1; }\n}\n/* A tap leaves no hover behind on a folder; a press shows. */\n@media (pointer: coarse) {\n .ta-folder-item:hover { background: transparent; color: var(--ta-body); }\n .ta-folder-item:active { background: var(--ta-hover); color: var(--ta-text); }\n}\n\n/* Performance (t6): rows far up the conversation skip layout and paint until they come into view */\n.ta-thread-item { display: flex; flex-direction: column; min-width: 0; contain-intrinsic-size: auto 160px; }\n/* A message nothing is drawn of (pi's note of a changed prompt) takes no gap: the first message does not move down when it comes. */\n.ta-thread-item:empty { display: none; }\n.ta-thread-item.ta-settled { content-visibility: auto; }\n/* Above the messages while the earlier ones of a long conversation load, as it is scrolled up. */\n.ta-earlier { display: flex; justify-content: center; padding: 12px 0; }\n.ta-earlier-idle .ta-spinner { visibility: hidden; animation: none; }\n\n/* Model accounts: the sign-in page, the dialog and a sign-in under way */\n.ta-login-card { width: min(460px, 100%); display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }\n.ta-login-card h1 { margin: 6px 0 0; font-size: calc(20px * var(--ta-font-scale)); font-weight: 600; color: var(--ta-text); }\n.ta-login-card > p { margin: 0 0 6px; color: var(--ta-secondary); font-size: calc(13.5px * var(--ta-font-scale)); line-height: 1.6; }\n.ta-login-card .ta-auth-panel { width: 100%; text-align: left; }\n.ta-login-card .ta-auth-list { max-height: min(46vh, 420px); }\n.ta-login-later { margin-top: 2px; border: 0; background: none; color: var(--ta-muted); font: inherit; font-size: calc(13px * var(--ta-font-scale)); cursor: pointer; }\n.ta-login-later:hover { color: var(--ta-text); }\n.ta-login-card .ta-pic-cards { margin-top: 4px; }\n.ta-auth-dialog { width: min(520px, 100%); gap: 12px; padding: 16px 18px 18px; }\n.ta-auth-dialog .ta-modal-title { font-size: calc(16px * var(--ta-font-scale)); }\n.ta-auth-panel { display: flex; flex-direction: column; gap: 10px; min-height: 0; }\n.ta-auth-list { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; max-height: 56vh; }\n.ta-auth-group h3 { margin: 0 0 4px; padding: 0 10px; font-size: calc(12px * var(--ta-font-scale)); font-weight: 500; color: var(--ta-muted); }\n.ta-auth-row { display: flex; align-items: center; gap: 4px; }\n.ta-auth-item { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; height: 38px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ta-body); font: inherit; font-size: calc(13.5px * var(--ta-font-scale)); text-align: left; cursor: pointer; }\n.ta-auth-item:hover { background: var(--ta-hover); color: var(--ta-text); }\n.ta-auth-item > .ta-icon:last-child { color: var(--ta-muted); }\n.ta-auth-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-text); }\n.ta-auth-kind { flex: none; padding: 1px 7px; border-radius: 999px; background: var(--ta-raised); color: var(--ta-muted); font-size: calc(11.5px * var(--ta-font-scale)); }\n.ta-auth-note { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }\n.ta-auth-on { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; color: var(--ta-green); font-size: calc(12px * var(--ta-font-scale)); max-width: 45%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }\n.ta-auth-item .ta-auth-on + .ta-icon { margin-left: 0; }\n.ta-auth-item > .ta-auth-kind + .ta-icon { margin-left: auto; }\n.ta-auth-flow { display: flex; flex-direction: column; gap: 14px; text-align: left; }\n.ta-auth-flow-head { display: flex; align-items: center; gap: 8px; }\n.ta-auth-flow-title { font-size: calc(15px * var(--ta-font-scale)); font-weight: 600; color: var(--ta-text); }\n.ta-auth-step { display: flex; flex-direction: column; gap: 10px; }\n.ta-auth-step p { margin: 0; color: var(--ta-body); font-size: calc(13.5px * var(--ta-font-scale)); line-height: 1.6; }\n.ta-auth-actions { display: flex; flex-wrap: wrap; gap: 8px; }\n.ta-auth-code { align-self: flex-start; padding: 8px 14px; border-radius: 10px; background: var(--ta-raised); color: var(--ta-text); font-family: var(--ta-mono); font-size: calc(20px * var(--ta-font-scale)); letter-spacing: 0.12em; user-select: all; }\n.ta-auth-options { display: flex; flex-direction: column; gap: 2px; }\n.ta-auth-link { display: block; margin-top: 4px; color: var(--ta-link, var(--ta-brand)); word-break: break-all; }\n/* The sign-in comes in step by step; its pictures answer the pointer */\n@keyframes ta-rise { from { transform: translateY(10px); opacity: 0; } }\n@keyframes ta-key-dot { 0%, 100% { opacity: .35; } 50% { opacity: 1; transform: translateY(-1.5px); } }\n@keyframes ta-tick { from { stroke-dashoffset: 12; } }\n@keyframes ta-code-in { from { letter-spacing: 0.4em; opacity: 0; } }\n.ta-login-card > * { animation: ta-rise 420ms var(--ta-ease) both; }\n.ta-login-card > :nth-child(2) { animation-delay: 60ms; }\n.ta-login-card > :nth-child(3) { animation-delay: 100ms; }\n.ta-login-card > :nth-child(4) { animation-delay: 150ms; }\n.ta-login-card > :nth-child(5) { animation-delay: 220ms; }\n.ta-login-card .ta-pic-card:hover .ta-pic-tick { stroke-dasharray: 12; animation: ta-tick 420ms var(--ta-ease) both; }\n.ta-login-card .ta-pic-card:hover .ta-pic-dot { animation: ta-key-dot 900ms ease-in-out infinite; }\n.ta-login-card .ta-pic-card:hover .ta-pic-dot:nth-child(n+8) { animation-delay: 90ms; }\n.ta-login-card .ta-pic-card:hover .ta-pic-dot:nth-child(n+10) { animation-delay: 180ms; }\n.ta-login-card .ta-pic-card:hover .ta-pic-dot:nth-child(n+12) { animation-delay: 270ms; }\n.ta-auth-flow > *, .ta-auth-panel > *, .ta-auth-group { animation: ta-in 260ms var(--ta-ease) both; }\n.ta-auth-code { animation: ta-code-in 420ms var(--ta-ease) both; }\n.ta-auth-item { transition: background 120ms, color 120ms, transform 120ms var(--ta-ease); }\n.ta-auth-item:hover > .ta-icon:last-child { transform: translateX(2px); transition: transform 160ms var(--ta-ease); }\n/* Ta on a phone: a picture of the way through the relay, the code to scan, the devices */\n@keyframes ta-qr-in { from { transform: scale(.94); opacity: 0; } }\n.ta-relay-dialog { width: min(440px, 100%); gap: 14px; padding: 16px 18px 18px; }\n.ta-relay-dialog .ta-modal-title { font-size: calc(16px * var(--ta-font-scale)); }\n.ta-relay-start, .ta-relay-pairing { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; animation: ta-in 260ms var(--ta-ease) both; }\n.ta-relay-start p, .ta-relay-pairing p { margin: 0; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); line-height: 1.6; }\n.ta-relay-pic { width: 100%; max-width: 320px; border-radius: 0; }\n.ta-relay-form { display: flex; gap: 8px; width: 100%; }\n.ta-relay-form .ta-field { flex: 1; }\n.ta-qr { width: 220px; height: 220px; border-radius: 12px; animation: ta-qr-in 320ms var(--ta-ease) both; }\n.ta-relay-state { margin-left: 8px; font-weight: 400; color: var(--ta-muted); }\n.ta-relay-state::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--ta-muted); vertical-align: middle; }\n.ta-relay-state.ta-on::before { background: var(--ta-green); }\n.ta-relay-device { gap: 10px; height: 38px; padding: 0 4px 0 10px; color: var(--ta-muted); }\n.ta-relay-device .ta-auth-note { flex: none; margin-left: auto; }\n.ta-relay-awake { display: flex; align-items: center; gap: 12px; padding: 0 4px 0 10px; }\n.ta-relay-awake-text { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 2px; }\n.ta-relay-awake-text .ta-auth-note { white-space: normal; line-height: 1.5; }\n/* The account and its devices (account-view.tsx) */\n.ta-account-dialog { width: min(440px, 100%); gap: 14px; padding: 16px 18px 18px; overflow-y: auto; }\n.ta-account-dialog .ta-modal-title { font-size: calc(16px * var(--ta-font-scale)); }\n.ta-account-hint { margin: 0; color: var(--ta-muted); font-size: calc(13px * var(--ta-font-scale)); line-height: 1.55; }\n.ta-account-ways, .ta-account-signing { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }\n.ta-account-signing p { margin: 0; text-align: center; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); }\n.ta-account-waiting { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 6px 0 2px; text-align: center; }\n.ta-account-waiting strong { font-size: calc(15px * var(--ta-font-scale)); font-weight: 600; }\n.ta-account-waiting p { margin: 0; color: var(--ta-muted); font-size: calc(13px * var(--ta-font-scale)); line-height: 1.55; }\n.ta-account-code { padding: 12px 22px; border-radius: 14px; background: var(--ta-hover); font-family: var(--ta-mono); font-size: calc(30px * var(--ta-font-scale)); font-weight: 600; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; color: var(--ta-text); white-space: nowrap; }\n.ta-account-devices { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }\n.ta-account-device { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 6px 6px 6px 8px; border-radius: 12px; }\n.ta-account-device.ta-waiting { background: var(--ta-hover); }\n.ta-account-device-icon { position: relative; flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--ta-hover); color: var(--ta-secondary); }\n.ta-account-device.ta-waiting .ta-account-device-icon { background: var(--ta-card); }\n.ta-account-dot { position: absolute; right: 0; bottom: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--ta-muted); box-shadow: 0 0 0 2px var(--ta-card); }\n.ta-account-dot.ta-on { background: var(--ta-green); }\n.ta-account-device-text { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 2px; font-size: calc(14px * var(--ta-font-scale)); }\n.ta-account-device-detail { color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); }\n.ta-account-device-actions { flex: none; display: flex; align-items: center; gap: 6px; }\n.ta-account-device-actions .ta-button { height: 30px; padding: 0 12px; }\n.ta-account-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--ta-border-muted); }\n.ta-account-who { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); }\n.ta-account-foot .ta-button { height: 30px; padding: 0 12px; }\n.ta-account-sign-in { display: flex; width: 100%; flex-direction: column; gap: 12px; text-align: left; }\n.ta-account-signed { display: flex; width: 100%; flex-direction: column; align-items: center; gap: 8px; padding: 4px 0; text-align: center; }\n.ta-account-signed .ta-account-who { font-size: calc(14px * var(--ta-font-scale)); color: var(--ta-text); }\n.ta-account-others { display: flex; flex-direction: column; gap: 6px; }\n.ta-account-others h2 { margin: 0 4px; font-size: calc(12.5px * var(--ta-font-scale)); font-weight: 500; color: var(--ta-muted); }\n.ta-account-recent-mark { display: grid; place-items: center; background: var(--ta-hover); color: var(--ta-text); }\n.ta-account-ask { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 58; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 12px; width: min(420px, calc(100vw - 24px)); padding: 14px 16px; border-radius: 16px; border: 1px solid var(--ta-border); background: var(--ta-card); box-shadow: var(--ta-shadow-pop); transform: translateX(-50%); animation: ta-fade 160ms ease-out; }\n.ta-account-ask-text { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; gap: 6px; }\n.ta-account-ask-text strong { max-width: 100%; font-size: calc(14px * var(--ta-font-scale)); font-weight: 600; }\n.ta-account-ask .ta-account-code { padding: 4px 10px; border-radius: 8px; font-size: calc(20px * var(--ta-font-scale)); }\n.ta-account-ask-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }\n.ta-account-ask-actions .ta-link-button { margin-right: auto; }\n";
|
|
@@ -185,7 +185,6 @@ body:has(.ta-folder) .ta-remote-status { display: none; }
|
|
|
185
185
|
.ta-account-sign-in { display: flex; width: 100%; flex-direction: column; gap: 12px; text-align: left; }
|
|
186
186
|
.ta-account-signed { display: flex; width: 100%; flex-direction: column; align-items: center; gap: 8px; padding: 4px 0; text-align: center; }
|
|
187
187
|
.ta-account-signed .ta-account-who { font-size: calc(14px * var(--ta-font-scale)); color: var(--ta-text); }
|
|
188
|
-
.ta-account-offer { display: flex; flex-direction: column; gap: 10px; }
|
|
189
188
|
.ta-account-others { display: flex; flex-direction: column; gap: 6px; }
|
|
190
189
|
.ta-account-others h2 { margin: 0 4px; font-size: calc(12.5px * var(--ta-font-scale)); font-weight: 500; color: var(--ta-muted); }
|
|
191
190
|
.ta-account-recent-mark { display: grid; place-items: center; background: var(--ta-hover); color: var(--ta-text); }
|
|
@@ -37,10 +37,14 @@ export declare namespace ToolUtil {
|
|
|
37
37
|
/** What the resolvers of web extensions use for a tool, from `index` on: the first asks the next. */
|
|
38
38
|
function renderer(resolvers: readonly WebToolRendererResolver[], name: string, index?: number): WebToolRenderer | undefined;
|
|
39
39
|
/** A call in one line; a tool a web extension draws reads as it says (`resolvers`, WebToolRendererResolver). */
|
|
40
|
-
|
|
40
|
+
/**
|
|
41
|
+
* `input`: what another agent gave its call (`details.input` of an `agent_tool` result), for a call of one
|
|
42
|
+
* of Ta's own tools it made through MCP to read as Ta's call does.
|
|
43
|
+
*/
|
|
44
|
+
function summary(name: string, args: Record<string, unknown>, resolvers?: readonly WebToolRendererResolver[], input?: Record<string, unknown>): ToolSummary;
|
|
41
45
|
/**
|
|
42
46
|
* What a call does, in words: the verb ta or the extension gave; else the name, as words, for a name in
|
|
43
|
-
* snake case (`list_channels`: List channels), as it is for others (
|
|
47
|
+
* snake case (`list_channels`: List channels), as it is for others (`ViewImage`).
|
|
44
48
|
*/
|
|
45
49
|
function verb(summary: Pick<ToolSummary, 'verb' | 'label' | 'name'>, t: Translate): string;
|
|
46
50
|
/** What a script says it does in its first comment, when it has one. */
|
package/esm/browser/util/tool.js
CHANGED
|
@@ -83,6 +83,11 @@ function command(name, text) {
|
|
|
83
83
|
? { verb: said.verb, name, target: line(said.target), code: said.code }
|
|
84
84
|
: { verb: 'ta.tool.verb.bash', name, target: line(ShellWords.work(text)), code: true };
|
|
85
85
|
}
|
|
86
|
+
/** An MCP tool's name, `mcp__server__tool`, as its server and tool. */
|
|
87
|
+
function mcp(name) {
|
|
88
|
+
const found = /^mcp__(.+?)__(.+)$/.exec(name);
|
|
89
|
+
return found ? { server: found[1], tool: found[2] } : undefined;
|
|
90
|
+
}
|
|
86
91
|
/** A path in a line: the file and the folder it is in, not where that folder is (`…/util/tool.ts`). */
|
|
87
92
|
function short(path) {
|
|
88
93
|
const parts = path.split('/').filter(Boolean);
|
|
@@ -97,7 +102,11 @@ export var ToolUtil;
|
|
|
97
102
|
}
|
|
98
103
|
ToolUtil.renderer = renderer;
|
|
99
104
|
/** A call in one line; a tool a web extension draws reads as it says (`resolvers`, WebToolRendererResolver). */
|
|
100
|
-
|
|
105
|
+
/**
|
|
106
|
+
* `input`: what another agent gave its call (`details.input` of an `agent_tool` result), for a call of one
|
|
107
|
+
* of Ta's own tools it made through MCP to read as Ta's call does.
|
|
108
|
+
*/
|
|
109
|
+
function summary(name, args, resolvers, input) {
|
|
101
110
|
var _a, _b;
|
|
102
111
|
var _c, _d;
|
|
103
112
|
if (resolvers === null || resolvers === void 0 ? void 0 : resolvers.length) {
|
|
@@ -141,6 +150,16 @@ export var ToolUtil;
|
|
|
141
150
|
const kind = str(args.kind);
|
|
142
151
|
const tool = str(args.tool) || str(args.title) || name;
|
|
143
152
|
const target = line(str(args.target) || str(args.title));
|
|
153
|
+
const via = mcp(tool);
|
|
154
|
+
if ((via === null || via === void 0 ? void 0 : via.server) === 'ta') {
|
|
155
|
+
// One of Ta's own tools, called through MCP: read as Ta's call of it, by what it was given;
|
|
156
|
+
// before the agent says (while it runs), by what it was on.
|
|
157
|
+
const own = summary(via.tool, input !== null && input !== void 0 ? input : {}, resolvers);
|
|
158
|
+
return own.label || own.verb ? { ...own, name: tool, target: own.target || target } : { name: via.tool, target, code: false };
|
|
159
|
+
}
|
|
160
|
+
if (via) {
|
|
161
|
+
return { name: via.tool, target: target === tool ? '' : target, code: false };
|
|
162
|
+
}
|
|
144
163
|
if (kind === 'execute') {
|
|
145
164
|
return { ...command(tool, str(args.target) || str(args.title)), name: tool };
|
|
146
165
|
}
|
|
@@ -168,18 +187,22 @@ export var ToolUtil;
|
|
|
168
187
|
ToolUtil.summary = summary;
|
|
169
188
|
/**
|
|
170
189
|
* What a call does, in words: the verb ta or the extension gave; else the name, as words, for a name in
|
|
171
|
-
* snake case (`list_channels`: List channels), as it is for others (
|
|
190
|
+
* snake case (`list_channels`: List channels), as it is for others (`ViewImage`).
|
|
172
191
|
*/
|
|
173
192
|
function verb(summary, t) {
|
|
193
|
+
var _a;
|
|
174
194
|
if (summary.label) {
|
|
175
195
|
return summary.label;
|
|
176
196
|
}
|
|
177
197
|
if (summary.verb) {
|
|
178
198
|
return t(summary.verb);
|
|
179
199
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
200
|
+
// An MCP tool reads by its own name, not its server's (`mcp__github__search_issues`: Search issues).
|
|
201
|
+
const via = (_a = mcp(summary.name)) === null || _a === void 0 ? void 0 : _a.tool;
|
|
202
|
+
const name = via !== null && via !== void 0 ? via : summary.name;
|
|
203
|
+
return (via ? /^[a-z][a-z0-9]*(_[a-z0-9]+)*$/ : /^[a-z][a-z0-9]*(_[a-z0-9]+)+$/).test(name)
|
|
204
|
+
? name.charAt(0).toUpperCase() + name.slice(1).replace(/_/g, ' ')
|
|
205
|
+
: name;
|
|
183
206
|
}
|
|
184
207
|
ToolUtil.verb = verb;
|
|
185
208
|
/** What a script says it does in its first comment, when it has one. */
|
|
@@ -26,9 +26,18 @@ export declare namespace Voice {
|
|
|
26
26
|
* At most 100 are taken, with the directory and the names a box adds.
|
|
27
27
|
*/
|
|
28
28
|
const VOCABULARY: readonly string[];
|
|
29
|
+
/**
|
|
30
|
+
* Whether the page can listen. Not in WeChat's mini program, on a phone or a computer: its web-view has the
|
|
31
|
+
* recognition of WebKit or Chromium, and always refuses it (`not-allowed`), with nowhere for the user to allow it.
|
|
32
|
+
*/
|
|
29
33
|
function canListen(): boolean;
|
|
30
34
|
/** The user, the system or the browser does not let the page listen: the microphone or speech recognition is not allowed. */
|
|
31
35
|
function denied(error: string): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* What to tell the user of a listening that failed. `service-not-allowed` is the browser's recognizer that is not
|
|
38
|
+
* there (Siri and dictation off on iOS, a browser without the service): no setting of the page's allows it.
|
|
39
|
+
*/
|
|
40
|
+
function failure(error: string): 'ta.composer.voiceDenied' | 'ta.composer.voiceUnavailable' | 'ta.composer.voiceFailed';
|
|
32
41
|
interface Listening {
|
|
33
42
|
stop(): void;
|
|
34
43
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MiniProgram } from '../device/mini-program.js';
|
|
1
2
|
import { DesktopUtil } from './desktop.js';
|
|
2
3
|
/** Talking to ta and hearing it, with what the browser or the app has: no service, no dependency. */
|
|
3
4
|
export var Voice;
|
|
@@ -83,7 +84,14 @@ export var Voice;
|
|
|
83
84
|
}
|
|
84
85
|
return DesktopUtil.speech();
|
|
85
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Whether the page can listen. Not in WeChat's mini program, on a phone or a computer: its web-view has the
|
|
89
|
+
* recognition of WebKit or Chromium, and always refuses it (`not-allowed`), with nowhere for the user to allow it.
|
|
90
|
+
*/
|
|
86
91
|
function canListen() {
|
|
92
|
+
if (MiniProgram.inside()) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
87
95
|
return nativeSpeech() !== undefined || recognitionClass() !== undefined;
|
|
88
96
|
}
|
|
89
97
|
Voice.canListen = canListen;
|
|
@@ -92,6 +100,18 @@ export var Voice;
|
|
|
92
100
|
return error === 'not-allowed' || error === 'service-not-allowed';
|
|
93
101
|
}
|
|
94
102
|
Voice.denied = denied;
|
|
103
|
+
/**
|
|
104
|
+
* What to tell the user of a listening that failed. `service-not-allowed` is the browser's recognizer that is not
|
|
105
|
+
* there (Siri and dictation off on iOS, a browser without the service): no setting of the page's allows it.
|
|
106
|
+
*/
|
|
107
|
+
function failure(error) {
|
|
108
|
+
return error === 'service-not-allowed'
|
|
109
|
+
? 'ta.composer.voiceUnavailable'
|
|
110
|
+
: error === 'not-allowed'
|
|
111
|
+
? 'ta.composer.voiceDenied'
|
|
112
|
+
: 'ta.composer.voiceFailed';
|
|
113
|
+
}
|
|
114
|
+
Voice.failure = failure;
|
|
95
115
|
/**
|
|
96
116
|
* The words of a recognition's results. Safari's repeat what came before: a result may be all the words so far
|
|
97
117
|
* rather than the next ones, and a phrase may come twice over. A result that starts with what was said before it
|
|
@@ -51,6 +51,11 @@ export declare namespace WorkbenchUtil {
|
|
|
51
51
|
function loopback(hostname?: string): boolean;
|
|
52
52
|
/** In the Ta app on a phone, where no ta serve serves the page: it reaches one through a relay. */
|
|
53
53
|
function isApp(): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* A device of the user's own, with an account of its own (docs/design/ta-account.md): the Ta app, or Ta's mini
|
|
56
|
+
* program of WeChat (docs/design/ta-weapp.md); no ta serve serves its page, it pairs with computers through a relay.
|
|
57
|
+
*/
|
|
58
|
+
function ownDevice(): boolean;
|
|
54
59
|
function readPairing(text: string | null): RelayPairing | undefined;
|
|
55
60
|
/**
|
|
56
61
|
* Whether the server of the page answers at all. A WebSocket that does not open cannot say why: a
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TA_WEBSOCKET_PATH } from '@celljs/ta-protocol';
|
|
2
2
|
import { RelayPairingUtil } from '@celljs/ta-relay';
|
|
3
|
+
import { MiniProgram } from './device/mini-program.js';
|
|
3
4
|
import { HostUtil } from './hosts.js';
|
|
4
5
|
/** Before the list of hosts (HostUtil.KEY): the one token or pairing, taken into the list once. */
|
|
5
6
|
const TOKEN_KEY = 'ta.token';
|
|
@@ -92,6 +93,14 @@ export var WorkbenchUtil;
|
|
|
92
93
|
return Boolean((_b = (_a = globalThis.Capacitor) === null || _a === void 0 ? void 0 : _a.isNativePlatform) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
93
94
|
}
|
|
94
95
|
WorkbenchUtil.isApp = isApp;
|
|
96
|
+
/**
|
|
97
|
+
* A device of the user's own, with an account of its own (docs/design/ta-account.md): the Ta app, or Ta's mini
|
|
98
|
+
* program of WeChat (docs/design/ta-weapp.md); no ta serve serves its page, it pairs with computers through a relay.
|
|
99
|
+
*/
|
|
100
|
+
function ownDevice() {
|
|
101
|
+
return isApp() || MiniProgram.inside();
|
|
102
|
+
}
|
|
103
|
+
WorkbenchUtil.ownDevice = ownDevice;
|
|
95
104
|
function readPairing(text) {
|
|
96
105
|
try {
|
|
97
106
|
return text ? RelayPairingUtil.parse(RelayPairingUtil.link(JSON.parse(text))) : undefined;
|
package/esm/browser/workbench.js
CHANGED
|
@@ -12,6 +12,7 @@ import { TaConnection } from '@celljs/ta-client';
|
|
|
12
12
|
import { TaErrorCode, TaRoomWatchUtil } from '@celljs/ta-protocol';
|
|
13
13
|
import { RelayRouteSocket } from '@celljs/ta-relay';
|
|
14
14
|
import { TaCallKeeper } from './assistant/call-keeper.js';
|
|
15
|
+
import { MiniProgram } from './device/mini-program.js';
|
|
15
16
|
import { HostUtil } from './hosts.js';
|
|
16
17
|
import { PresenceReporter } from './presence/presence-reporter.js';
|
|
17
18
|
import { PageBuild } from './pwa/page-build.js';
|
|
@@ -163,9 +164,13 @@ let TaWorkbenchImpl = class TaWorkbenchImpl extends WorkbenchHosts {
|
|
|
163
164
|
const fragment = new URLSearchParams(location.hash.slice(1));
|
|
164
165
|
// A token of `ta serve --web`, or a pairing link: the page of a relay opened for one let in from a browser (docs/design/ta-team.md 8.3).
|
|
165
166
|
const fromUrl = WorkbenchUtil.fromFragment(fragment);
|
|
166
|
-
|
|
167
|
+
// A code the scan page of Ta's mini program of WeChat read, opened once connected (ScanHost).
|
|
168
|
+
const scanned = MiniProgram.arrive(fragment);
|
|
169
|
+
if (fromUrl || scanned) {
|
|
167
170
|
// Out of the address bar, the history and bookmarks.
|
|
168
171
|
history.replaceState(null, '', location.pathname + location.search);
|
|
172
|
+
}
|
|
173
|
+
if (fromUrl) {
|
|
169
174
|
this.keepHosts(HostUtil.use(this.list, WorkbenchUtil.serverOf(fromUrl, pageHost()), fromUrl, Date.now()));
|
|
170
175
|
}
|
|
171
176
|
const host = this.list.hosts.find(one => one.id === this.list.current);
|
|
@@ -68,7 +68,7 @@ async function appService(hosts, current) {
|
|
|
68
68
|
*/
|
|
69
69
|
function useAccountSide() {
|
|
70
70
|
const [{ status, hosts, host }, bench] = (0, hooks_1.useWorkbench)();
|
|
71
|
-
const app = workbench_util_1.WorkbenchUtil.
|
|
71
|
+
const app = workbench_util_1.WorkbenchUtil.ownDevice();
|
|
72
72
|
const where = React.useRef({ hosts, host });
|
|
73
73
|
where.current = { hosts, host };
|
|
74
74
|
const online = status === 'online';
|
|
@@ -9,6 +9,8 @@ export interface AccountSide {
|
|
|
9
9
|
approve(id: string): Promise<TaAccountInfo>;
|
|
10
10
|
remove(id: string): Promise<TaAccountInfo>;
|
|
11
11
|
signOut(): Promise<TaAccountInfo>;
|
|
12
|
+
/** The device's own (DeviceAccount.joinThrough): signs in as the computer in use is, which lets it in. */
|
|
13
|
+
joinThrough?(): Promise<TaAccountInfo>;
|
|
12
14
|
}
|
|
13
15
|
/** The computers a device's account brings, kept with the device's computers (TaWorkbench). */
|
|
14
16
|
export interface AccountHosts {
|
|
@@ -84,6 +86,12 @@ export declare class DeviceAccount implements AccountSide {
|
|
|
84
86
|
protected bringPending(): Promise<void>;
|
|
85
87
|
/** The computers this device brought in, let in as soon as they ask. */
|
|
86
88
|
protected letInBrought(view: AccountView): Promise<AccountView>;
|
|
89
|
+
/**
|
|
90
|
+
* Signs in as the computer in use is (docs/design/ta-account.md 4.4): this device, connected to it by its code, joins
|
|
91
|
+
* its account with a token it gives, and the computer lets it in at once. No page of a provider to open, which the
|
|
92
|
+
* mini program of WeChat cannot.
|
|
93
|
+
*/
|
|
94
|
+
joinThrough(): Promise<TaAccountInfo>;
|
|
87
95
|
/** The one of the page, once made. */
|
|
88
96
|
static current(): DeviceAccount | undefined;
|
|
89
97
|
/** The one of the page. */
|
|
@@ -125,6 +125,32 @@ class DeviceAccount {
|
|
|
125
125
|
}
|
|
126
126
|
return next;
|
|
127
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Signs in as the computer in use is (docs/design/ta-account.md 4.4): this device, connected to it by its code, joins
|
|
130
|
+
* its account with a token it gives, and the computer lets it in at once. No page of a provider to open, which the
|
|
131
|
+
* mini program of WeChat cannot.
|
|
132
|
+
*/
|
|
133
|
+
async joinThrough() {
|
|
134
|
+
var _a, _b;
|
|
135
|
+
const { host } = this.hosts.state;
|
|
136
|
+
const { service, token } = await this.hosts.account.inviteDevice();
|
|
137
|
+
const there = await this.hosts.account.getAccount();
|
|
138
|
+
const kept = await ta_relay_1.AccountAgent.create(service, token, { id: '', name: '' }, 'phone', DeviceAccount.deviceName());
|
|
139
|
+
(_a = (0, workbench_util_1.storage)()) === null || _a === void 0 ? void 0 : _a.setItem(KEY, JSON.stringify(kept));
|
|
140
|
+
(_b = (0, workbench_util_1.storage)()) === null || _b === void 0 ? void 0 : _b.removeItem(OFF_KEY);
|
|
141
|
+
this.signingIn = undefined;
|
|
142
|
+
this.agent = this.agentOf(kept);
|
|
143
|
+
this.view = await this.agent.sync();
|
|
144
|
+
await this.hosts.account.approve(kept.self.id);
|
|
145
|
+
const computer = there.devices.find(one => one.self);
|
|
146
|
+
if (host && computer) {
|
|
147
|
+
this.hosts.markAccountHost(host, computer.id);
|
|
148
|
+
}
|
|
149
|
+
this.view = await this.agent.sync();
|
|
150
|
+
this.error = undefined;
|
|
151
|
+
this.schedule(0);
|
|
152
|
+
return this.read();
|
|
153
|
+
}
|
|
128
154
|
/** The one of the page, once made. */
|
|
129
155
|
static current() {
|
|
130
156
|
return DeviceAccount.instance;
|
|
@@ -2,7 +2,7 @@ import { type LucideIcon } from 'lucide-react';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import type { SettingsSection } from './settings-view';
|
|
4
4
|
/** What an entry of the account opens over the page. */
|
|
5
|
-
export type AccountDialog = 'accounts' | 'relay' | 'devices' | 'profile';
|
|
5
|
+
export type AccountDialog = 'accounts' | 'relay' | 'devices' | 'profile' | 'signIn';
|
|
6
6
|
/** An entry of the account: an item of the menu of the rail, a row of Me on a phone. */
|
|
7
7
|
export interface AccountEntry {
|
|
8
8
|
key: string;
|
|
@@ -76,7 +76,7 @@ function useAccountEntries(onSettings, onDialog) {
|
|
|
76
76
|
const side = (0, account_side_1.useAccountSide)();
|
|
77
77
|
const { info } = (0, account_side_1.useAccountInfo)(side, 15000);
|
|
78
78
|
const signedIn = Boolean(info === null || info === void 0 ? void 0 : info.account);
|
|
79
|
-
const app = workbench_util_1.WorkbenchUtil.
|
|
79
|
+
const app = workbench_util_1.WorkbenchUtil.ownDevice();
|
|
80
80
|
const [{ views }, extensions] = (0, hooks_1.useWebExtensions)();
|
|
81
81
|
const own = views.filter(view => view.group === 'me' && view.location === 'page');
|
|
82
82
|
// Signed in, out of the account (its computers go, those connected by a code stay); else out of the computer in use.
|
|
@@ -122,6 +122,7 @@ function useAccountEntries(onSettings, onDialog) {
|
|
|
122
122
|
}
|
|
123
123
|
entry('install', t('ta.pwa.install'), lucide_react_1.Download, () => void pwa.install(), { action: true });
|
|
124
124
|
// As WeChat's: the account in use kept, with its computers, to come back to in one tap (docs/design/ta-me.md 4).
|
|
125
|
+
entry('signIn', t('ta.me.signIn'), lucide_react_1.LogIn, () => onDialog('signIn'));
|
|
125
126
|
entry('switchAccount', t('ta.account.switchSignIn'), lucide_react_1.ArrowLeftRight, () => { var _a; return (_a = device_account_1.DeviceAccount.current()) === null || _a === void 0 ? void 0 : _a.switchAccount(); });
|
|
126
127
|
entry('signOut', t('ta.settings.signOut'), lucide_react_1.LogOut, () => void signOut(), { danger: true });
|
|
127
128
|
return me_rows_1.MeUtil.keys({
|
|
@@ -130,6 +131,8 @@ function useAccountEntries(onSettings, onDialog) {
|
|
|
130
131
|
update: Boolean(update),
|
|
131
132
|
installable: installable && !standalone,
|
|
132
133
|
switchAccount: app && signedIn,
|
|
134
|
+
// The account is who the user is, not one of their devices (docs/design/ta-me.md 4).
|
|
135
|
+
signIn: Boolean(info) && !signedIn,
|
|
133
136
|
pairPhone: !app && !handheld,
|
|
134
137
|
}).map(group => group.map(key => entries[key]));
|
|
135
138
|
}
|
|
@@ -139,7 +142,8 @@ function AccountDialogs({ dialog, onClose, onDialog }) {
|
|
|
139
142
|
dialog === 'profile' && React.createElement(profile_view_1.ProfileDialog, { onClose: onClose, onDevices: () => onDialog('devices') }),
|
|
140
143
|
dialog === 'accounts' && React.createElement(auth_view_1.AuthDialog, { onClose: onClose }),
|
|
141
144
|
dialog === 'relay' && React.createElement(relay_view_1.RelayDialog, { onClose: onClose }),
|
|
142
|
-
dialog === 'devices' && React.createElement(account_view_1.DevicesDialog, { onClose: onClose })
|
|
145
|
+
dialog === 'devices' && React.createElement(account_view_1.DevicesDialog, { onClose: onClose }),
|
|
146
|
+
dialog === 'signIn' && React.createElement(account_view_1.AccountSignInDialog, { onClose: onClose })));
|
|
143
147
|
}
|
|
144
148
|
/**
|
|
145
149
|
* The round figure of the user: the picture they gave themselves (docs/design/ta-me.md 3), else the close-up of the
|
|
@@ -35,6 +35,13 @@ export declare function RecentAccounts(): React.JSX.Element;
|
|
|
35
35
|
export declare function DevicesDialog({ onClose }: {
|
|
36
36
|
onClose(): void;
|
|
37
37
|
}): React.ReactPortal;
|
|
38
|
+
/**
|
|
39
|
+
* Signing in to an account, from Me (docs/design/ta-me.md 4): who the user is, not one of their devices. The ways, the
|
|
40
|
+
* code to enter at the provider, waiting to be let in; closed once signed in, the computers of the account coming in.
|
|
41
|
+
*/
|
|
42
|
+
export declare function AccountSignInDialog({ onClose }: {
|
|
43
|
+
onClose(): void;
|
|
44
|
+
}): React.ReactPortal;
|
|
38
45
|
/**
|
|
39
46
|
* A device asks to join the account: whichever device of it the user has at hand says so, with the code to compare,
|
|
40
47
|
* until it is let in, refused, or put off for now.
|
|
@@ -40,6 +40,7 @@ exports.WaitingPart = WaitingPart;
|
|
|
40
40
|
exports.AccountWays = AccountWays;
|
|
41
41
|
exports.RecentAccounts = RecentAccounts;
|
|
42
42
|
exports.DevicesDialog = DevicesDialog;
|
|
43
|
+
exports.AccountSignInDialog = AccountSignInDialog;
|
|
43
44
|
exports.AccountAsk = AccountAsk;
|
|
44
45
|
const lucide_react_1 = require("lucide-react");
|
|
45
46
|
const React = __importStar(require("react"));
|
|
@@ -47,6 +48,7 @@ const react_dom_1 = require("react-dom");
|
|
|
47
48
|
const account_side_1 = require("../account/account-side");
|
|
48
49
|
const device_account_1 = require("../account/device-account");
|
|
49
50
|
const back_stack_1 = require("../device/back-stack");
|
|
51
|
+
const mini_program_1 = require("../device/mini-program");
|
|
50
52
|
const console_util_1 = require("../gateway/console-util");
|
|
51
53
|
const hooks_1 = require("../hooks");
|
|
52
54
|
const hosts_1 = require("../hosts");
|
|
@@ -97,26 +99,35 @@ function SignInPart({ info, act }) {
|
|
|
97
99
|
const [busy, run] = (0, busy_1.useBusy)();
|
|
98
100
|
const [, notices] = (0, hooks_1.useNotices)();
|
|
99
101
|
const go = (action) => void run(() => act(action).catch((error) => notices.error(error)));
|
|
102
|
+
// The web-view of the mini program opens no page of another domain: the page of the provider is copied, for a browser.
|
|
103
|
+
const openProvider = (url) => {
|
|
104
|
+
var _a;
|
|
105
|
+
if (!mini_program_1.MiniProgram.inside()) {
|
|
106
|
+
window.open(url, '_blank', 'noopener,noreferrer');
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
void ((_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText(url).then(() => notices.notify(t('ta.link.copiedToOpen'), { level: 'success' }), () => notices.notify(url, { level: 'info' })));
|
|
110
|
+
};
|
|
100
111
|
const signing = info.signingIn;
|
|
101
112
|
if (signing) {
|
|
102
113
|
const name = providerName(info, signing.provider);
|
|
103
114
|
return (React.createElement("div", { className: "ta-account-signing" },
|
|
104
115
|
React.createElement("p", null, t('ta.myDevices.enterCode', { name })),
|
|
105
116
|
React.createElement(cloud_sign_in_view_1.CodeBox, { code: signing.code }),
|
|
106
|
-
React.createElement("button", { type: "button", className: "ta-button ta-primary ta-wide", onClick: () =>
|
|
117
|
+
React.createElement("button", { type: "button", className: "ta-button ta-primary ta-wide", onClick: () => openProvider(signing.url) },
|
|
107
118
|
React.createElement(sign_in_marks_1.SignInMark, { provider: signing.provider, size: 16 }),
|
|
108
119
|
" ",
|
|
109
120
|
t('ta.myDevices.openProvider', { name })),
|
|
110
121
|
React.createElement("button", { type: "button", className: "ta-link-button", onClick: () => go(side => side.cancelSignIn()) }, t('ta.cancel'))));
|
|
111
122
|
}
|
|
112
|
-
const ways = workbench_util_1.WorkbenchUtil.
|
|
123
|
+
const ways = workbench_util_1.WorkbenchUtil.ownDevice() ? info.providers.filter(one => !one.gateway) : info.providers;
|
|
113
124
|
if (ways.length === 0) {
|
|
114
125
|
return null;
|
|
115
126
|
}
|
|
116
127
|
return (React.createElement("div", { className: "ta-account-ways" }, ways.map(provider => (React.createElement("button", { key: `${provider.service} ${provider.id}`, type: "button", className: busy ? 'ta-button ta-primary ta-wide ta-busy' : 'ta-button ta-primary ta-wide', "aria-busy": busy || undefined, onClick: () => go(async (side) => {
|
|
117
128
|
const next = await side.signIn(provider.id, provider.service);
|
|
118
129
|
if (next.signingIn) {
|
|
119
|
-
|
|
130
|
+
openProvider(next.signingIn.url);
|
|
120
131
|
}
|
|
121
132
|
return next;
|
|
122
133
|
}) },
|
|
@@ -189,7 +200,7 @@ function AccountWays({ info, act }) {
|
|
|
189
200
|
/** The accounts this device switched away from, on its sign-in: a tap goes back to one, its computers with it. */
|
|
190
201
|
function RecentAccounts() {
|
|
191
202
|
const way = useAccountWay();
|
|
192
|
-
const [recent] = React.useState(() => (workbench_util_1.WorkbenchUtil.
|
|
203
|
+
const [recent] = React.useState(() => (workbench_util_1.WorkbenchUtil.ownDevice() ? device_account_1.DeviceAccount.recent() : []));
|
|
193
204
|
return (React.createElement(React.Fragment, null, recent.map(one => (React.createElement("li", { key: one.kept.account.id, className: "ta-host-row" },
|
|
194
205
|
React.createElement("button", { type: "button", className: "ta-host-item", onClick: () => { var _a; return (_a = device_account_1.DeviceAccount.current()) === null || _a === void 0 ? void 0 : _a.resume(one.kept.account.id); } },
|
|
195
206
|
React.createElement("span", { className: "ta-chat-avatar ta-account-recent-mark", "aria-hidden": "true" },
|
|
@@ -251,7 +262,6 @@ function DevicesDialog({ onClose }) {
|
|
|
251
262
|
bench.rename(host.id, name);
|
|
252
263
|
}
|
|
253
264
|
};
|
|
254
|
-
const signedOut = info && !info.account && !info.signingIn;
|
|
255
265
|
return (0, react_dom_1.createPortal)(React.createElement("div", { className: "ta-modal-scrim" },
|
|
256
266
|
React.createElement("button", { type: "button", className: "ta-overlay-close", "aria-label": t('ta.close'), tabIndex: -1, onClick: onClose }),
|
|
257
267
|
React.createElement("div", { className: "ta-modal ta-hosts-dialog ta-account-dialog", role: "dialog", "aria-modal": "true", "aria-label": t('ta.myDevices.title') },
|
|
@@ -271,11 +281,7 @@ function DevicesDialog({ onClose }) {
|
|
|
271
281
|
React.createElement("h2", null, t('ta.myDevices.others')),
|
|
272
282
|
React.createElement("ul", { className: "ta-account-devices" }, others.map(device => (React.createElement(DeviceRow, { key: device.id, device: device, onApprove: () => go(one => one.approve(device.id)), onRemove: () => void removeDevice(device) })))))),
|
|
273
283
|
add.error && React.createElement(callout_1.Callout, { level: "error" }, t(add.error)),
|
|
274
|
-
adding === 'cloud' ? (React.createElement(cloud_sign_in_view_1.CloudSignInFlow, { onBack: () => setAdding(undefined) })) : adding === 'paste' ? (React.createElement(host_view_1.LinkForm, { busy: add.busy, autoFocus: true, placeholder: t('ta.signin.pairing'), onSubmit: text => void add.add(text) })) :
|
|
275
|
-
signedOut && (React.createElement("div", { className: "ta-account-offer" },
|
|
276
|
-
React.createElement("p", { className: "ta-account-hint" }, t('ta.myDevices.hint')),
|
|
277
|
-
React.createElement("button", { type: "button", className: "ta-button ta-wide", onClick: () => setAdding('account') }, t('ta.myDevices.signInAccount')))),
|
|
278
|
-
(info === null || info === void 0 ? void 0 : info.signingIn) && React.createElement(SignInPart, { info: info, act: act }),
|
|
284
|
+
adding === 'cloud' ? (React.createElement(cloud_sign_in_view_1.CloudSignInFlow, { onBack: () => setAdding(undefined) })) : adding === 'paste' ? (React.createElement(host_view_1.LinkForm, { busy: add.busy, autoFocus: true, placeholder: t('ta.signin.pairing'), onSubmit: text => void add.add(text) })) : (React.createElement(React.Fragment, null,
|
|
279
285
|
!info && side && React.createElement(loading_1.Loading, { compact: true }),
|
|
280
286
|
React.createElement("div", { className: "ta-host-actions" },
|
|
281
287
|
add.canScan && (React.createElement("button", { type: "button", className: "ta-button ta-primary", disabled: add.busy, onClick: () => void add.scan() },
|
|
@@ -289,6 +295,81 @@ function DevicesDialog({ onClose }) {
|
|
|
289
295
|
React.createElement(cloud_sign_in_view_1.CloudSignInEntry, { onPick: () => setAdding('cloud') }))),
|
|
290
296
|
menu)), document.body);
|
|
291
297
|
}
|
|
298
|
+
/** The account of the computer in use, which this device may sign in as (DeviceAccount.joinThrough): none on a computer's own page. */
|
|
299
|
+
function useAccountThrough(side) {
|
|
300
|
+
const t = (0, use_t_1.useT)();
|
|
301
|
+
const [{ status, hosts, host }, bench] = (0, hooks_1.useWorkbench)();
|
|
302
|
+
const [there, setThere] = React.useState();
|
|
303
|
+
const can = Boolean(side === null || side === void 0 ? void 0 : side.joinThrough) && status === 'online';
|
|
304
|
+
React.useEffect(() => {
|
|
305
|
+
// Read again for each computer switched to.
|
|
306
|
+
if (!can || !host) {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
let live = true;
|
|
310
|
+
bench.account.getAccount().then(info => live && setThere(info), () => undefined);
|
|
311
|
+
return () => {
|
|
312
|
+
live = false;
|
|
313
|
+
};
|
|
314
|
+
}, [can, bench, host]);
|
|
315
|
+
const inUse = hosts.find(one => one.id === host);
|
|
316
|
+
return can && (there === null || there === void 0 ? void 0 : there.account) && !there.waiting
|
|
317
|
+
? { account: there.account, computer: (inUse && hosts_1.HostUtil.label(inUse)) || t('ta.hosts.thisServer') }
|
|
318
|
+
: undefined;
|
|
319
|
+
}
|
|
320
|
+
/** Signs in as the computer in use is: one tap, no page of a provider (the mini program of WeChat opens none). */
|
|
321
|
+
function JoinThrough({ through, act }) {
|
|
322
|
+
const t = (0, use_t_1.useT)();
|
|
323
|
+
const [busy, run] = (0, busy_1.useBusy)();
|
|
324
|
+
const [, notices] = (0, hooks_1.useNotices)();
|
|
325
|
+
const join = () => void run(() => act(side => {
|
|
326
|
+
if (!side.joinThrough) {
|
|
327
|
+
throw new Error('No computer to sign in through.');
|
|
328
|
+
}
|
|
329
|
+
return side.joinThrough();
|
|
330
|
+
}).catch((error) => notices.error(error)));
|
|
331
|
+
return (React.createElement("div", { className: "ta-account-ways" },
|
|
332
|
+
React.createElement("button", { type: "button", className: busy ? 'ta-button ta-primary ta-wide ta-busy' : 'ta-button ta-primary ta-wide', "aria-busy": busy || undefined, onClick: join },
|
|
333
|
+
React.createElement(sign_in_marks_1.SignInMark, { provider: through.account.id.split(':')[0], size: 16 }),
|
|
334
|
+
" ",
|
|
335
|
+
t('ta.me.signInAs', { name: accountName(through.account) }),
|
|
336
|
+
React.createElement(busy_1.BusyMark, { busy: busy })),
|
|
337
|
+
React.createElement("p", { className: "ta-account-hint" }, t('ta.me.signInAsHint', { computer: through.computer }))));
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Signing in to an account, from Me (docs/design/ta-me.md 4): who the user is, not one of their devices. The ways, the
|
|
341
|
+
* code to enter at the provider, waiting to be let in; closed once signed in, the computers of the account coming in.
|
|
342
|
+
*/
|
|
343
|
+
function AccountSignInDialog({ onClose }) {
|
|
344
|
+
var _a;
|
|
345
|
+
const t = (0, use_t_1.useT)();
|
|
346
|
+
const side = (0, account_side_1.useAccountSide)();
|
|
347
|
+
const { info, failed, act } = (0, account_side_1.useAccountInfo)(side);
|
|
348
|
+
(0, back_stack_1.useBackLayer)(true, onClose);
|
|
349
|
+
React.useEffect(() => {
|
|
350
|
+
const onKey = (event) => event.key === 'Escape' && onClose();
|
|
351
|
+
document.addEventListener('keydown', onKey);
|
|
352
|
+
return () => document.removeEventListener('keydown', onKey);
|
|
353
|
+
}, [onClose]);
|
|
354
|
+
const done = Boolean((info === null || info === void 0 ? void 0 : info.account) && !info.waiting);
|
|
355
|
+
React.useEffect(() => {
|
|
356
|
+
if (done) {
|
|
357
|
+
onClose();
|
|
358
|
+
}
|
|
359
|
+
}, [done, onClose]);
|
|
360
|
+
const through = useAccountThrough(side);
|
|
361
|
+
return (0, react_dom_1.createPortal)(React.createElement("div", { className: "ta-modal-scrim" },
|
|
362
|
+
React.createElement("button", { type: "button", className: "ta-overlay-close", "aria-label": t('ta.close'), tabIndex: -1, onClick: onClose }),
|
|
363
|
+
React.createElement("div", { className: "ta-modal ta-hosts-dialog ta-account-dialog", role: "dialog", "aria-modal": "true", "aria-label": t('ta.me.signIn') },
|
|
364
|
+
React.createElement("div", { className: "ta-modal-head" },
|
|
365
|
+
React.createElement("span", { className: "ta-modal-title" }, t('ta.me.signIn')),
|
|
366
|
+
React.createElement(icon_1.IconButton, { icon: lucide_react_1.X, label: t('ta.close'), onClick: onClose })),
|
|
367
|
+
failed ? React.createElement(callout_1.Callout, { level: "error" }, String((_a = failed.message) !== null && _a !== void 0 ? _a : failed)) : null,
|
|
368
|
+
info ? (React.createElement(React.Fragment, null,
|
|
369
|
+
!info.signingIn && !info.waiting && React.createElement("p", { className: "ta-account-hint" }, t('ta.myDevices.hint')),
|
|
370
|
+
through && !info.signingIn && !info.waiting && React.createElement(JoinThrough, { through: through, act: act }),
|
|
371
|
+
React.createElement(AccountWays, { info: info, act: act }))) : (React.createElement(loading_1.Loading, { compact: true })))), document.body);
|
|
372
|
+
}
|
|
292
373
|
/**
|
|
293
374
|
* A device asks to join the account: whichever device of it the user has at hand says so, with the code to compare,
|
|
294
375
|
* until it is let in, refused, or put off for now.
|