@celljs/ta-web 4.41.0 → 4.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/esm/browser/apps/web-apps.d.ts +4 -0
- package/esm/browser/apps/web-apps.js +14 -3
- package/esm/browser/assistant/ta-hearing.d.ts +85 -0
- package/esm/browser/assistant/ta-hearing.js +272 -0
- package/esm/browser/components/auth-view.js +1 -1
- package/esm/browser/components/board.js +9 -1
- package/esm/browser/components/clipboard-link-host.d.ts +2 -0
- package/esm/browser/components/clipboard-link-host.js +27 -0
- package/esm/browser/components/cloud-network.js +1 -1
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/custom-provider-advanced.js +8 -8
- package/esm/browser/components/custom-provider-view.js +12 -12
- package/esm/browser/components/empty-state.d.ts +2 -1
- package/esm/browser/components/empty-state.js +6 -2
- package/esm/browser/components/folder-picker.js +2 -2
- package/esm/browser/components/gallery.js +8 -9
- package/esm/browser/components/hearing-host.d.ts +5 -0
- package/esm/browser/components/hearing-host.js +58 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/link-dialog.js +4 -0
- package/esm/browser/components/loading.d.ts +3 -2
- package/esm/browser/components/loading.js +7 -3
- package/esm/browser/components/markdown.d.ts +3 -1
- package/esm/browser/components/markdown.js +55 -10
- package/esm/browser/components/media.d.ts +10 -4
- package/esm/browser/components/media.js +60 -14
- package/esm/browser/components/people-picker.d.ts +17 -0
- package/esm/browser/components/people-picker.js +129 -0
- package/esm/browser/components/relay-view.js +1 -1
- package/esm/browser/components/settings-parts.js +2 -0
- package/esm/browser/components/share-dialog.d.ts +2 -2
- package/esm/browser/components/share-dialog.js +7 -4
- package/esm/browser/components/share-friends.js +3 -10
- package/esm/browser/components/share-item-sheet.d.ts +12 -0
- package/esm/browser/components/share-item-sheet.js +39 -0
- package/esm/browser/components/share-sheet.d.ts +9 -2
- package/esm/browser/components/share-sheet.js +5 -4
- package/esm/browser/components/sign-in-setup.js +4 -4
- package/esm/browser/components/trusted-domains.js +1 -1
- package/esm/browser/components/view-room.d.ts +25 -0
- package/esm/browser/components/view-room.js +136 -0
- package/esm/browser/components/voice-services.js +6 -6
- package/esm/browser/device/device-protocol.d.ts +9 -6
- package/esm/browser/device/device-protocol.js +7 -4
- package/esm/browser/device/launch-screen.d.ts +11 -1
- package/esm/browser/device/launch-screen.js +22 -4
- package/esm/browser/extension/share-sheet-compat.d.ts +2 -0
- package/esm/browser/extension/share-sheet-compat.js +12 -2
- package/esm/browser/extension/web-api-code.d.ts +11 -0
- package/esm/browser/extension/web-api-components.d.ts +8 -1
- package/esm/browser/extension/web-api-contributions.d.ts +30 -1
- package/esm/browser/extension/web-api-desktop.d.ts +2 -1
- package/esm/browser/extension/web-api-file-views.d.ts +38 -0
- package/esm/browser/extension/web-api-file-views.js +2 -0
- package/esm/browser/extension/web-api-host.d.ts +47 -0
- package/esm/browser/extension/web-api-host.js +3 -0
- package/esm/browser/extension/web-api-menus.d.ts +46 -0
- package/esm/browser/extension/web-api-partners.d.ts +58 -1
- package/esm/browser/extension/web-api-spec.js +7 -0
- package/esm/browser/extension/web-extension-api.d.ts +10 -10
- package/esm/browser/extension/web-extension-context.d.ts +2 -8
- package/esm/browser/extension/web-extension-context.js +14 -39
- package/esm/browser/extension/web-extension-marks.d.ts +10 -0
- package/esm/browser/extension/web-extension-marks.js +29 -0
- package/esm/browser/extension/web-extension-protocol.d.ts +11 -1
- package/esm/browser/extension/web-extension-protocol.js +3 -0
- package/esm/browser/extension/web-extension-run.d.ts +15 -2
- package/esm/browser/extension/web-extension-run.js +77 -0
- package/esm/browser/extension/web-extensions-running.d.ts +5 -1
- package/esm/browser/extension/web-extensions-running.js +16 -0
- package/esm/browser/extension/web-extensions.d.ts +2 -1
- package/esm/browser/extension/web-extensions.js +3 -0
- package/esm/browser/extension/web-home.js +3 -1
- package/esm/browser/extension/web-host-values.d.ts +66 -0
- package/esm/browser/extension/web-host-values.js +191 -0
- package/esm/browser/extension/web-hosts.d.ts +7 -2
- package/esm/browser/extension/web-hosts.js +16 -4
- package/esm/browser/extension/web-share-ui.d.ts +7 -0
- package/esm/browser/extension/web-share-ui.js +15 -0
- package/esm/browser/extension/web-share.d.ts +18 -0
- package/esm/browser/extension/web-share.js +42 -0
- package/esm/browser/i18n/en/chat.d.ts +10 -0
- package/esm/browser/i18n/en/chat.js +10 -0
- package/esm/browser/i18n/en/common.d.ts +23 -0
- package/esm/browser/i18n/en/common.js +23 -0
- package/esm/browser/i18n/en/discover.d.ts +7 -0
- package/esm/browser/i18n/en/discover.js +7 -0
- package/esm/browser/i18n/en/settings.d.ts +2 -0
- package/esm/browser/i18n/en/settings.js +2 -0
- package/esm/browser/i18n/ja/chat.js +10 -0
- package/esm/browser/i18n/ja/common.js +23 -0
- package/esm/browser/i18n/ja/discover.js +7 -0
- package/esm/browser/i18n/ja/settings.js +2 -0
- package/esm/browser/i18n/locales.d.ts +43 -1
- package/esm/browser/i18n/messages.d.ts +42 -0
- package/esm/browser/i18n/zh/chat.js +10 -0
- package/esm/browser/i18n/zh/common.js +23 -0
- package/esm/browser/i18n/zh/discover.js +7 -0
- package/esm/browser/i18n/zh/settings.js +2 -0
- package/esm/browser/i18n/zh-tw/chat.js +10 -0
- package/esm/browser/i18n/zh-tw/common.js +23 -0
- package/esm/browser/i18n/zh-tw/discover.js +7 -0
- package/esm/browser/i18n/zh-tw/settings.js +2 -0
- package/esm/browser/launch-art/art-palette.d.ts +41 -0
- package/esm/browser/launch-art/art-palette.js +72 -0
- package/esm/browser/launch-art/cyclic-automaton.d.ts +45 -0
- package/esm/browser/launch-art/cyclic-automaton.js +176 -0
- package/esm/browser/launch-art/fractal-tree.d.ts +43 -0
- package/esm/browser/launch-art/fractal-tree.js +48 -0
- package/esm/browser/launch-art/launch-art.d.ts +98 -0
- package/esm/browser/launch-art/launch-art.js +420 -0
- package/esm/browser/launch-art/launch-sky.d.ts +66 -0
- package/esm/browser/launch-art/launch-sky.js +153 -0
- package/esm/browser/links/clipboard-links.d.ts +89 -0
- package/esm/browser/links/clipboard-links.js +303 -0
- package/esm/browser/links/link-text.d.ts +29 -0
- package/esm/browser/links/link-text.js +97 -0
- package/esm/browser/links/links-protocol.d.ts +12 -1
- package/esm/browser/links/links.d.ts +8 -2
- package/esm/browser/links/links.js +33 -3
- package/esm/browser/markdown/code-renderers.d.ts +4 -0
- package/esm/browser/markdown/code-renderers.js +4 -0
- package/esm/browser/partners/group-picker.js +23 -29
- package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/esm/browser/sandbox/work/work-senses.js +1 -1
- package/esm/browser/settings/settings-protocol.d.ts +2 -0
- package/esm/browser/settings/settings-protocol.js +2 -0
- package/esm/browser/style/base.d.ts +1 -1
- package/esm/browser/style/base.js +10 -6
- package/esm/browser/style/chat-list.d.ts +1 -1
- package/esm/browser/style/chat-list.js +28 -15
- package/esm/browser/style/conversation-column.d.ts +1 -1
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +29 -2
- package/esm/browser/style/dialogs.d.ts +1 -1
- package/esm/browser/style/dialogs.js +2 -5
- package/esm/browser/style/forms.d.ts +5 -0
- package/esm/browser/style/forms.js +65 -0
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +14 -24
- package/esm/browser/style/phone.d.ts +1 -1
- package/esm/browser/style/shared.d.ts +1 -1
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +1 -6
- package/esm/browser/style/surfaces.d.ts +1 -1
- package/esm/browser/style/surfaces.js +0 -6
- package/esm/browser/style/tasks.d.ts +1 -1
- package/esm/browser/style.js +2 -0
- package/esm/browser/util/markdown.d.ts +45 -3
- package/esm/browser/util/markdown.js +67 -11
- package/esm/browser/util/voice.d.ts +18 -0
- package/esm/browser/util/voice.js +111 -3
- package/esm/browser/workbench-protocol.d.ts +2 -0
- package/esm/browser/workbench-services.d.ts +2 -0
- package/esm/browser/workbench-services.js +5 -0
- package/esm/browser/workbench.js +5 -0
- package/lib/browser/apps/web-apps.d.ts +4 -0
- package/lib/browser/apps/web-apps.js +14 -3
- package/lib/browser/assistant/ta-hearing.d.ts +86 -0
- package/lib/browser/assistant/ta-hearing.js +277 -0
- package/lib/browser/components/auth-view.js +1 -1
- package/lib/browser/components/board.js +9 -1
- package/lib/browser/components/clipboard-link-host.d.ts +3 -0
- package/lib/browser/components/clipboard-link-host.js +63 -0
- package/lib/browser/components/cloud-network.js +1 -1
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/custom-provider-advanced.js +8 -8
- package/lib/browser/components/custom-provider-view.js +12 -12
- package/lib/browser/components/empty-state.d.ts +2 -1
- package/lib/browser/components/empty-state.js +6 -2
- package/lib/browser/components/folder-picker.js +2 -2
- package/lib/browser/components/gallery.js +7 -8
- package/lib/browser/components/hearing-host.d.ts +6 -0
- package/lib/browser/components/hearing-host.js +94 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/link-dialog.js +4 -0
- package/lib/browser/components/loading.d.ts +3 -2
- package/lib/browser/components/loading.js +7 -3
- package/lib/browser/components/markdown.d.ts +3 -1
- package/lib/browser/components/markdown.js +53 -8
- package/lib/browser/components/media.d.ts +10 -4
- package/lib/browser/components/media.js +61 -14
- package/lib/browser/components/people-picker.d.ts +18 -0
- package/lib/browser/components/people-picker.js +166 -0
- package/lib/browser/components/relay-view.js +1 -1
- package/lib/browser/components/settings-parts.js +2 -0
- package/lib/browser/components/share-dialog.d.ts +2 -2
- package/lib/browser/components/share-dialog.js +7 -4
- package/lib/browser/components/share-friends.js +3 -10
- package/lib/browser/components/share-item-sheet.d.ts +13 -0
- package/lib/browser/components/share-item-sheet.js +75 -0
- package/lib/browser/components/share-sheet.d.ts +9 -2
- package/lib/browser/components/share-sheet.js +5 -3
- package/lib/browser/components/sign-in-setup.js +4 -4
- package/lib/browser/components/trusted-domains.js +1 -1
- package/lib/browser/components/view-room.d.ts +26 -0
- package/lib/browser/components/view-room.js +173 -0
- package/lib/browser/components/voice-services.js +6 -6
- package/lib/browser/device/device-protocol.d.ts +9 -6
- package/lib/browser/device/device-protocol.js +7 -4
- package/lib/browser/device/launch-screen.d.ts +11 -1
- package/lib/browser/device/launch-screen.js +22 -4
- package/lib/browser/extension/share-sheet-compat.d.ts +2 -0
- package/lib/browser/extension/share-sheet-compat.js +13 -2
- package/lib/browser/extension/web-api-code.d.ts +11 -0
- package/lib/browser/extension/web-api-components.d.ts +8 -1
- package/lib/browser/extension/web-api-contributions.d.ts +30 -1
- package/lib/browser/extension/web-api-desktop.d.ts +2 -1
- package/lib/browser/extension/web-api-file-views.d.ts +39 -0
- package/lib/browser/extension/web-api-file-views.js +3 -0
- package/lib/browser/extension/web-api-host.d.ts +48 -0
- package/lib/browser/extension/web-api-host.js +4 -0
- package/lib/browser/extension/web-api-menus.d.ts +46 -0
- package/lib/browser/extension/web-api-partners.d.ts +58 -1
- package/lib/browser/extension/web-api-spec.js +7 -0
- package/lib/browser/extension/web-extension-api.d.ts +10 -10
- package/lib/browser/extension/web-extension-context.d.ts +2 -8
- package/lib/browser/extension/web-extension-context.js +14 -39
- package/lib/browser/extension/web-extension-marks.d.ts +11 -0
- package/lib/browser/extension/web-extension-marks.js +65 -0
- package/lib/browser/extension/web-extension-protocol.d.ts +11 -1
- package/lib/browser/extension/web-extension-protocol.js +3 -0
- package/lib/browser/extension/web-extension-run.d.ts +15 -2
- package/lib/browser/extension/web-extension-run.js +77 -0
- package/lib/browser/extension/web-extensions-running.d.ts +5 -1
- package/lib/browser/extension/web-extensions-running.js +16 -0
- package/lib/browser/extension/web-extensions.d.ts +2 -1
- package/lib/browser/extension/web-extensions.js +3 -0
- package/lib/browser/extension/web-home.js +3 -1
- package/lib/browser/extension/web-host-values.d.ts +67 -0
- package/lib/browser/extension/web-host-values.js +229 -0
- package/lib/browser/extension/web-hosts.d.ts +7 -2
- package/lib/browser/extension/web-hosts.js +16 -4
- package/lib/browser/extension/web-share-ui.d.ts +8 -0
- package/lib/browser/extension/web-share-ui.js +51 -0
- package/lib/browser/extension/web-share.d.ts +19 -0
- package/lib/browser/extension/web-share.js +45 -0
- package/lib/browser/i18n/en/chat.d.ts +10 -0
- package/lib/browser/i18n/en/chat.js +10 -0
- package/lib/browser/i18n/en/common.d.ts +23 -0
- package/lib/browser/i18n/en/common.js +23 -0
- package/lib/browser/i18n/en/discover.d.ts +7 -0
- package/lib/browser/i18n/en/discover.js +7 -0
- package/lib/browser/i18n/en/settings.d.ts +2 -0
- package/lib/browser/i18n/en/settings.js +2 -0
- package/lib/browser/i18n/ja/chat.js +10 -0
- package/lib/browser/i18n/ja/common.js +23 -0
- package/lib/browser/i18n/ja/discover.js +7 -0
- package/lib/browser/i18n/ja/settings.js +2 -0
- package/lib/browser/i18n/locales.d.ts +43 -1
- package/lib/browser/i18n/messages.d.ts +42 -0
- package/lib/browser/i18n/zh/chat.js +10 -0
- package/lib/browser/i18n/zh/common.js +23 -0
- package/lib/browser/i18n/zh/discover.js +7 -0
- package/lib/browser/i18n/zh/settings.js +2 -0
- package/lib/browser/i18n/zh-tw/chat.js +10 -0
- package/lib/browser/i18n/zh-tw/common.js +23 -0
- package/lib/browser/i18n/zh-tw/discover.js +7 -0
- package/lib/browser/i18n/zh-tw/settings.js +2 -0
- package/lib/browser/launch-art/art-palette.d.ts +42 -0
- package/lib/browser/launch-art/art-palette.js +76 -0
- package/lib/browser/launch-art/cyclic-automaton.d.ts +46 -0
- package/lib/browser/launch-art/cyclic-automaton.js +180 -0
- package/lib/browser/launch-art/fractal-tree.d.ts +44 -0
- package/lib/browser/launch-art/fractal-tree.js +52 -0
- package/lib/browser/launch-art/launch-art.d.ts +99 -0
- package/lib/browser/launch-art/launch-art.js +424 -0
- package/lib/browser/launch-art/launch-sky.d.ts +67 -0
- package/lib/browser/launch-art/launch-sky.js +157 -0
- package/lib/browser/links/clipboard-links.d.ts +90 -0
- package/lib/browser/links/clipboard-links.js +308 -0
- package/lib/browser/links/link-text.d.ts +30 -0
- package/lib/browser/links/link-text.js +100 -0
- package/lib/browser/links/links-protocol.d.ts +12 -1
- package/lib/browser/links/links.d.ts +8 -2
- package/lib/browser/links/links.js +33 -3
- package/lib/browser/markdown/code-renderers.d.ts +4 -0
- package/lib/browser/markdown/code-renderers.js +5 -1
- package/lib/browser/partners/group-picker.js +23 -29
- package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/lib/browser/sandbox/work/work-senses.js +1 -1
- package/lib/browser/settings/settings-protocol.d.ts +2 -0
- package/lib/browser/settings/settings-protocol.js +2 -0
- package/lib/browser/style/base.d.ts +1 -1
- package/lib/browser/style/base.js +10 -6
- package/lib/browser/style/chat-list.d.ts +1 -1
- package/lib/browser/style/chat-list.js +28 -15
- package/lib/browser/style/conversation-column.d.ts +1 -1
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +29 -2
- package/lib/browser/style/dialogs.d.ts +1 -1
- package/lib/browser/style/dialogs.js +2 -5
- package/lib/browser/style/forms.d.ts +6 -0
- package/lib/browser/style/forms.js +68 -0
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +14 -24
- package/lib/browser/style/phone.d.ts +1 -1
- package/lib/browser/style/shared.d.ts +1 -1
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +1 -6
- package/lib/browser/style/surfaces.d.ts +1 -1
- package/lib/browser/style/surfaces.js +0 -6
- package/lib/browser/style/tasks.d.ts +1 -1
- package/lib/browser/style.js +2 -0
- package/lib/browser/util/markdown.d.ts +45 -3
- package/lib/browser/util/markdown.js +68 -12
- package/lib/browser/util/voice.d.ts +18 -0
- package/lib/browser/util/voice.js +111 -3
- package/lib/browser/workbench-protocol.d.ts +2 -0
- package/lib/browser/workbench-services.d.ts +2 -0
- package/lib/browser/workbench-services.js +5 -0
- package/lib/browser/workbench.js +5 -0
- package/package.json +8 -8
- package/public/launch.svg +3 -3
|
@@ -25,9 +25,49 @@ const MEDIA_MAX_HEIGHT = 420;
|
|
|
25
25
|
const MEDIA_MAX_WIDTH = 720;
|
|
26
26
|
/** The box an image of a reply asks for. */
|
|
27
27
|
const IMAGE_BOX = { width: ThumbnailUtil.side(MEDIA_MAX_WIDTH), height: ThumbnailUtil.side(MEDIA_MAX_HEIGHT) };
|
|
28
|
+
/** What could not load, told to load again: when the page may reach the computer again, or a tap on one asks. */
|
|
29
|
+
const again = new Set();
|
|
30
|
+
function askAgainShown() {
|
|
31
|
+
if (document.visibilityState === 'visible') {
|
|
32
|
+
askAgain();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Asks every picture that could not load to load again: one may not have come for a while (a phone whose network
|
|
37
|
+
* changed, the app in the background, the relay of the computer reconnecting), not be missing.
|
|
38
|
+
*/
|
|
39
|
+
export function askAgain() {
|
|
40
|
+
for (const one of [...again]) {
|
|
41
|
+
one();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** Counts the times what could not load is asked again, while `waiting`: a dependency of what asks for it. */
|
|
45
|
+
function useAgain(waiting) {
|
|
46
|
+
const [count, setCount] = React.useState(0);
|
|
47
|
+
React.useEffect(() => {
|
|
48
|
+
if (!waiting) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const bump = () => setCount(n => n + 1);
|
|
52
|
+
if (!again.size) {
|
|
53
|
+
window.addEventListener('online', askAgain);
|
|
54
|
+
document.addEventListener('visibilitychange', askAgainShown);
|
|
55
|
+
}
|
|
56
|
+
again.add(bump);
|
|
57
|
+
return () => {
|
|
58
|
+
again.delete(bump);
|
|
59
|
+
if (!again.size) {
|
|
60
|
+
window.removeEventListener('online', askAgain);
|
|
61
|
+
document.removeEventListener('visibilitychange', askAgainShown);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}, [waiting]);
|
|
65
|
+
return count;
|
|
66
|
+
}
|
|
28
67
|
/**
|
|
29
68
|
* The URL of a target: as it is, or for a path, the URL of the file, smaller in `box`; null when it cannot show,
|
|
30
|
-
* undefined while it is asked (and for no target).
|
|
69
|
+
* undefined while it is asked (and for no target). With it, what to call when what it gave did not load (an image
|
|
70
|
+
* that failed): it is null then, and asked again with the others that could not load (askAgain).
|
|
31
71
|
*/
|
|
32
72
|
export function useMediaUrl(src, box) {
|
|
33
73
|
const fileUrl = React.useContext(FileUrls);
|
|
@@ -36,6 +76,8 @@ export function useMediaUrl(src, box) {
|
|
|
36
76
|
// What it asked for with the URL: another target (a gallery enlarged goes through its pictures) is not shown the one before.
|
|
37
77
|
const asked = `${path} ${width}x${height}${cover ? ' cover' : ''}`;
|
|
38
78
|
const [found, setFound] = React.useState();
|
|
79
|
+
const count = useAgain(path !== undefined && (found === null || found === void 0 ? void 0 : found.asked) === asked && found.url === null);
|
|
80
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: count asks again what could not load
|
|
39
81
|
React.useEffect(() => {
|
|
40
82
|
if (path === undefined) {
|
|
41
83
|
return;
|
|
@@ -49,11 +91,12 @@ export function useMediaUrl(src, box) {
|
|
|
49
91
|
return () => {
|
|
50
92
|
current = false;
|
|
51
93
|
};
|
|
52
|
-
}, [fileUrl, path, asked, width, height, cover]);
|
|
94
|
+
}, [fileUrl, path, asked, width, height, cover, count]);
|
|
95
|
+
const broke = React.useCallback(() => setFound(known => ((known === null || known === void 0 ? void 0 : known.asked) === asked ? { asked, url: null } : known)), [asked]);
|
|
53
96
|
if (path === undefined) {
|
|
54
|
-
return src;
|
|
97
|
+
return [src, broke];
|
|
55
98
|
}
|
|
56
|
-
return (found === null || found === void 0 ? void 0 : found.asked) === asked ? found.url : undefined;
|
|
99
|
+
return [(found === null || found === void 0 ? void 0 : found.asked) === asked ? found.url : undefined, broke];
|
|
57
100
|
}
|
|
58
101
|
/** The URL of the file itself of a target, not of a picture of it made smaller: what copying it takes. */
|
|
59
102
|
export function useFullUrl() {
|
|
@@ -66,12 +109,14 @@ export function useFullUrl() {
|
|
|
66
109
|
return fileUrl ? fileUrl(path) : Promise.reject(new Error(`Cannot load ${path}`));
|
|
67
110
|
}, [fileUrl]);
|
|
68
111
|
}
|
|
69
|
-
/** The URLs of targets, as `useMediaUrl` gives each, all in one `box`: the tiles of a gallery. */
|
|
112
|
+
/** The URLs of targets, as `useMediaUrl` gives each, all in one `box`: the tiles of a gallery; and what to call for one that did not load. */
|
|
70
113
|
export function useMediaUrls(sources, box) {
|
|
71
114
|
const fileUrl = React.useContext(FileUrls);
|
|
72
115
|
const key = sources.join('\n');
|
|
73
116
|
const { width, height, cover } = box !== null && box !== void 0 ? box : {};
|
|
74
117
|
const [urls, setUrls] = React.useState({});
|
|
118
|
+
const count = useAgain(sources.some(src => urls[src] === null));
|
|
119
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: count asks again what could not load
|
|
75
120
|
React.useEffect(() => {
|
|
76
121
|
let current = true;
|
|
77
122
|
for (const src of key.split('\n')) {
|
|
@@ -83,13 +128,14 @@ export function useMediaUrls(sources, box) {
|
|
|
83
128
|
setUrls(known => ({ ...known, [src]: null }));
|
|
84
129
|
continue;
|
|
85
130
|
}
|
|
86
|
-
fileUrl(path, width && height ? { width, height, cover } : undefined).then(url => current && setUrls(known => ({ ...known, [src]: url })), () => current && setUrls(known => ({ ...known, [src]: null })));
|
|
131
|
+
fileUrl(path, width && height ? { width, height, cover } : undefined).then(url => current && setUrls(known => (known[src] === url ? known : { ...known, [src]: url })), () => current && setUrls(known => (known[src] === null ? known : { ...known, [src]: null })));
|
|
87
132
|
}
|
|
88
133
|
return () => {
|
|
89
134
|
current = false;
|
|
90
135
|
};
|
|
91
|
-
}, [fileUrl, key, width, height, cover]);
|
|
92
|
-
|
|
136
|
+
}, [fileUrl, key, width, height, cover, count]);
|
|
137
|
+
const broke = React.useCallback((src) => setUrls(known => (known[src] === null ? known : { ...known, [src]: null })), []);
|
|
138
|
+
return [sources.map(src => (MarkdownUtil.localPath(src) === undefined ? src : urls[src])), broke];
|
|
93
139
|
}
|
|
94
140
|
/** An image, a video or a sound a reply shows: from the web, a data URL, or a file of the workspace. */
|
|
95
141
|
export function MediaView({ src, alt }) {
|
|
@@ -97,21 +143,21 @@ export function MediaView({ src, alt }) {
|
|
|
97
143
|
const t = useT();
|
|
98
144
|
const kind = (_a = MarkdownUtil.media(src)) !== null && _a !== void 0 ? _a : 'image';
|
|
99
145
|
// A picture of the workspace loads as large as it shows (ThumbnailUtil); enlarged, as it is.
|
|
100
|
-
const url = useMediaUrl(src, kind === 'image' ? IMAGE_BOX : undefined);
|
|
101
|
-
const [failedUrl, setFailedUrl] = React.useState();
|
|
146
|
+
const [url, broke] = useMediaUrl(src, kind === 'image' ? IMAGE_BOX : undefined);
|
|
102
147
|
const [open, setOpen] = React.useState(false);
|
|
103
|
-
const full = useMediaUrl(open && kind === 'image' ? src : undefined);
|
|
148
|
+
const [full] = useMediaUrl(open && kind === 'image' ? src : undefined);
|
|
104
149
|
const [loaded, setLoaded] = React.useState(false);
|
|
105
150
|
const fullUrl = useFullUrl();
|
|
106
151
|
const [menu, openMenu] = useImageMenu();
|
|
107
152
|
const known = shown.get(src);
|
|
108
|
-
|
|
153
|
+
// One that could not show before says so at once while it is asked again: it may only not have come then.
|
|
154
|
+
const failed = url === null || (url === undefined && known === false);
|
|
109
155
|
const setFailed = () => {
|
|
110
156
|
// A file of the workspace that is not there; one from the web may only be out of reach for now (offline).
|
|
111
157
|
if (MarkdownUtil.localPath(src) !== undefined) {
|
|
112
158
|
shown.set(src, false);
|
|
113
159
|
}
|
|
114
|
-
|
|
160
|
+
broke();
|
|
115
161
|
};
|
|
116
162
|
const size = kind === 'image' && known ? known : undefined;
|
|
117
163
|
// Of the size it had when known: its place does not change as it loads.
|
|
@@ -127,7 +173,7 @@ export function MediaView({ src, alt }) {
|
|
|
127
173
|
}
|
|
128
174
|
if (!url || failed) {
|
|
129
175
|
const name = alt || src.split(/[?#]/)[0].split('/').pop() || src;
|
|
130
|
-
return (React.createElement("
|
|
176
|
+
return (React.createElement("button", { type: "button", className: "ta-media-missing", title: `${src}\n${t('ta.markdown.retry')}`, onClick: askAgain },
|
|
131
177
|
React.createElement(Icon, { icon: ImageOff, size: 14 }),
|
|
132
178
|
t('ta.markdown.missing', { name })));
|
|
133
179
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { WebPeoplePickerProps, WebPerson } from '../extension/web-api-partners.js';
|
|
3
|
+
export declare namespace PeoplePickerUtil {
|
|
4
|
+
/** Those with every word of `query`, in any case, in their name, tag, line, heading or keywords. */
|
|
5
|
+
function filter(people: readonly WebPerson[], query: string): WebPerson[];
|
|
6
|
+
/** Under their headings, each heading once, in the order the first of it comes. */
|
|
7
|
+
function sections(people: readonly WebPerson[]): {
|
|
8
|
+
title?: string;
|
|
9
|
+
people: WebPerson[];
|
|
10
|
+
}[];
|
|
11
|
+
/** What is picked once `key` is tapped: in or out of several, in place of the one before alone. */
|
|
12
|
+
function toggle(value: readonly string[], key: string, single?: boolean): string[];
|
|
13
|
+
/** Whether a tap does nothing on it: it is fixed, or there are as many as may be and it is not one of them. */
|
|
14
|
+
function locked(person: WebPerson, value: readonly string[], max?: number): boolean;
|
|
15
|
+
}
|
|
16
|
+
/** The one way to pick people of Ta (WebPeoplePickerProps; web extensions `ui.PeoplePicker`). */
|
|
17
|
+
export declare function PeoplePicker({ people, value, onChange, single, max, disabled, placeholder, empty, emptyHint }: WebPeoplePickerProps): React.JSX.Element;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { Check, Search } from 'lucide-react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useT } from '../i18n/use-t.js';
|
|
4
|
+
import { EmptyState } from './empty-state.js';
|
|
5
|
+
import { Face, GroupFace } from './face.js';
|
|
6
|
+
import { Icon } from './icon.js';
|
|
7
|
+
import { Loading } from './loading.js';
|
|
8
|
+
import { SelectCheck } from './select-bar.js';
|
|
9
|
+
export var PeoplePickerUtil;
|
|
10
|
+
(function (PeoplePickerUtil) {
|
|
11
|
+
/** Those with every word of `query`, in any case, in their name, tag, line, heading or keywords. */
|
|
12
|
+
function filter(people, query) {
|
|
13
|
+
const words = query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
14
|
+
if (!words.length) {
|
|
15
|
+
return [...people];
|
|
16
|
+
}
|
|
17
|
+
return people.filter(person => {
|
|
18
|
+
const text = [person.name, person.tag, person.detail, person.section, person.keywords].filter(Boolean).join(' ').toLowerCase();
|
|
19
|
+
return words.every(word => text.includes(word));
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
PeoplePickerUtil.filter = filter;
|
|
23
|
+
/** Under their headings, each heading once, in the order the first of it comes. */
|
|
24
|
+
function sections(people) {
|
|
25
|
+
const sections = [];
|
|
26
|
+
for (const person of people) {
|
|
27
|
+
const section = sections.find(each => each.title === person.section);
|
|
28
|
+
if (section) {
|
|
29
|
+
section.people.push(person);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
sections.push({ title: person.section, people: [person] });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return sections;
|
|
36
|
+
}
|
|
37
|
+
PeoplePickerUtil.sections = sections;
|
|
38
|
+
/** What is picked once `key` is tapped: in or out of several, in place of the one before alone. */
|
|
39
|
+
function toggle(value, key, single) {
|
|
40
|
+
if (single) {
|
|
41
|
+
return [key];
|
|
42
|
+
}
|
|
43
|
+
return value.includes(key) ? value.filter(each => each !== key) : [...value, key];
|
|
44
|
+
}
|
|
45
|
+
PeoplePickerUtil.toggle = toggle;
|
|
46
|
+
/** Whether a tap does nothing on it: it is fixed, or there are as many as may be and it is not one of them. */
|
|
47
|
+
function locked(person, value, max) {
|
|
48
|
+
return !!person.disabled || (max !== undefined && value.length >= max && !value.includes(person.key));
|
|
49
|
+
}
|
|
50
|
+
PeoplePickerUtil.locked = locked;
|
|
51
|
+
})(PeoplePickerUtil || (PeoplePickerUtil = {}));
|
|
52
|
+
/** How large a face is in a row, and among those picked in the box. */
|
|
53
|
+
const FACE = 36;
|
|
54
|
+
const CHIP = 28;
|
|
55
|
+
/**
|
|
56
|
+
* Its face as the lists draw it: its own picture (drawn at 36 px, scaled into a chip), the faces of a group chat, else
|
|
57
|
+
* that of its seed; whether it is online only in its row.
|
|
58
|
+
*/
|
|
59
|
+
function PersonFace({ person, size = FACE }) {
|
|
60
|
+
var _a;
|
|
61
|
+
var _b;
|
|
62
|
+
if (person.avatar) {
|
|
63
|
+
return (React.createElement("span", { className: "ta-picker-face", style: { width: size, height: size }, "aria-hidden": "true" },
|
|
64
|
+
React.createElement("span", { style: size === FACE ? undefined : { transform: `scale(${size / FACE})` } }, person.avatar)));
|
|
65
|
+
}
|
|
66
|
+
if ((_a = person.members) === null || _a === void 0 ? void 0 : _a.length) {
|
|
67
|
+
return React.createElement(GroupFace, { members: person.members, size: size });
|
|
68
|
+
}
|
|
69
|
+
const online = size === FACE ? person.online : undefined;
|
|
70
|
+
return React.createElement(Face, { seed: (_b = person.seed) !== null && _b !== void 0 ? _b : person.key, face: person.face, look: person.look, double: person.double, online: online, size: size });
|
|
71
|
+
}
|
|
72
|
+
/** The one way to pick people of Ta (WebPeoplePickerProps; web extensions `ui.PeoplePicker`). */
|
|
73
|
+
export function PeoplePicker({ people, value, onChange, single, max, disabled, placeholder, empty, emptyHint }) {
|
|
74
|
+
const t = useT();
|
|
75
|
+
const [query, setQuery] = React.useState('');
|
|
76
|
+
if (!people) {
|
|
77
|
+
return React.createElement(Loading, { compact: true });
|
|
78
|
+
}
|
|
79
|
+
if (people.length === 0) {
|
|
80
|
+
return React.createElement(EmptyState, { compact: true, title: empty !== null && empty !== void 0 ? empty : t('ta.people.none'), hint: emptyHint });
|
|
81
|
+
}
|
|
82
|
+
const shown = PeoplePickerUtil.filter(people, query);
|
|
83
|
+
const picked = single ? [] : value.map(key => people.find(person => person.key === key)).filter(person => !!person);
|
|
84
|
+
const tap = (person) => {
|
|
85
|
+
if (!disabled && !PeoplePickerUtil.locked(person, value, max)) {
|
|
86
|
+
onChange(PeoplePickerUtil.toggle(value, person.key, single));
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const label = placeholder !== null && placeholder !== void 0 ? placeholder : t('ta.people.search');
|
|
90
|
+
return (React.createElement("div", { className: "ta-picker" },
|
|
91
|
+
React.createElement("label", { className: "ta-picker-search" },
|
|
92
|
+
picked.length === 0 && React.createElement(Icon, { icon: Search, size: 14 }),
|
|
93
|
+
picked.map(person => (React.createElement("button", { key: person.key, type: "button", className: "ta-picker-chip", title: person.disabled ? person.name : t('ta.people.leaveOut', { name: person.name }), "aria-label": t('ta.people.leaveOut', { name: person.name }), disabled: disabled || person.disabled, onClick: event => {
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
tap(person);
|
|
96
|
+
} },
|
|
97
|
+
React.createElement(PersonFace, { person: person, size: CHIP })))),
|
|
98
|
+
React.createElement("input", { value: query, placeholder: label, "aria-label": label, onChange: event => setQuery(event.target.value), onKeyDown: event => {
|
|
99
|
+
// The one found is taken by Enter, as a search of a messenger's picker.
|
|
100
|
+
if (event.key === 'Enter' && shown.length === 1) {
|
|
101
|
+
event.preventDefault();
|
|
102
|
+
tap(shown[0]);
|
|
103
|
+
setQuery('');
|
|
104
|
+
}
|
|
105
|
+
else if (event.key === 'Backspace' && !query && picked.length) {
|
|
106
|
+
const last = picked[picked.length - 1];
|
|
107
|
+
if (!last.disabled) {
|
|
108
|
+
tap(last);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
} })),
|
|
112
|
+
React.createElement("div", { className: "ta-picker-list" },
|
|
113
|
+
shown.length === 0 && React.createElement(EmptyState, { compact: true, title: t('ta.people.noMatch') }),
|
|
114
|
+
PeoplePickerUtil.sections(shown).map(section => { var _a; return (React.createElement("div", { key: (_a = section.title) !== null && _a !== void 0 ? _a : '', className: "ta-picker-section" },
|
|
115
|
+
section.title && React.createElement("div", { className: "ta-picker-heading" }, section.title),
|
|
116
|
+
section.people.map(person => {
|
|
117
|
+
const on = value.includes(person.key);
|
|
118
|
+
return (React.createElement("button", { key: person.key, type: "button", "aria-pressed": on, className: "ta-picker-row", disabled: disabled || PeoplePickerUtil.locked(person, value, max), onClick: () => tap(person) },
|
|
119
|
+
!single && React.createElement(SelectCheck, { checked: on, disabled: PeoplePickerUtil.locked(person, value, max) && !on }),
|
|
120
|
+
React.createElement(PersonFace, { person: person }),
|
|
121
|
+
React.createElement("span", { className: "ta-picker-text" },
|
|
122
|
+
React.createElement("span", { className: "ta-picker-line" },
|
|
123
|
+
React.createElement("span", { className: "ta-picker-name" }, person.name),
|
|
124
|
+
person.tag && React.createElement("span", { className: "ta-picker-tag" }, person.tag)),
|
|
125
|
+
person.detail && React.createElement("span", { className: "ta-picker-detail" }, person.detail)),
|
|
126
|
+
single && on && React.createElement(Icon, { icon: Check, size: 16, className: "ta-picker-check" })));
|
|
127
|
+
}))); }))));
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=people-picker.js.map
|
|
@@ -108,7 +108,7 @@ export function RelayDialog({ onClose }) {
|
|
|
108
108
|
React.createElement(RelayPicture, null),
|
|
109
109
|
React.createElement("p", null, t('ta.relay.hint')),
|
|
110
110
|
React.createElement("div", { className: "ta-relay-form" },
|
|
111
|
-
React.createElement("label", { className: "ta-field
|
|
111
|
+
React.createElement("label", { className: "ta-field" },
|
|
112
112
|
React.createElement(Smartphone, { size: 15, strokeWidth: 1.75, "aria-hidden": "true" }),
|
|
113
113
|
React.createElement("input", { placeholder: t('ta.relay.phone'), value: name, onChange: event => setName(event.target.value) })),
|
|
114
114
|
React.createElement("button", { type: "button", className: busy ? 'ta-button ta-primary ta-busy' : 'ta-button ta-primary', "aria-busy": busy || undefined, disabled: !info, onClick: () => void pair() },
|
|
@@ -96,6 +96,8 @@ export function useParts(scope, onScope, onDialog) {
|
|
|
96
96
|
// After the notices and who answers others, before what is kept.
|
|
97
97
|
order: 30,
|
|
98
98
|
rows: [
|
|
99
|
+
row('clipboard-links', [t('ta.settings.clipboardLinks'), t('ta.settings.clipboardLinksHint')], React.createElement(Row, { label: t('ta.settings.clipboardLinks'), description: t('ta.settings.clipboardLinksHint') },
|
|
100
|
+
React.createElement(Switch, { label: t('ta.settings.clipboardLinks'), checked: settings.clipboardLinks, onChange: clipboardLinks => store.update({ clipboardLinks }) }))),
|
|
99
101
|
row('trusted-domains', [t('ta.settings.trustedDomains'), t('ta.settings.trustedDomainsHint'), ...settings.trustedDomains], React.createElement(TrustedDomains, null)),
|
|
100
102
|
],
|
|
101
103
|
},
|
|
@@ -8,5 +8,5 @@ export declare function ShareDialog({ target, onClose }: {
|
|
|
8
8
|
target: WebShareTarget;
|
|
9
9
|
onClose(): void;
|
|
10
10
|
}): React.JSX.Element;
|
|
11
|
-
/** The share asked for by a web extension, over the page. */
|
|
12
|
-
export declare function ShareHost(): React.JSX.Element
|
|
11
|
+
/** The share asked for by a web extension, over the page: an extension handed on, or the share sheet of something. */
|
|
12
|
+
export declare function ShareHost(): React.JSX.Element;
|
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { useNotices, useWebExtensions, useWorkbench } from '../hooks.js';
|
|
4
4
|
import { useT } from '../i18n/use-t.js';
|
|
5
5
|
import { ShareLinkUtil } from '../util/share-link.js';
|
|
6
|
+
import { ShareItemSheet } from './share-item-sheet.js';
|
|
6
7
|
import { ShareSheet } from './share-sheet.js';
|
|
7
8
|
/** The link of an extension: of its source when it is published, else of the relay, made by this computer. */
|
|
8
9
|
function useShared(target) {
|
|
@@ -37,12 +38,14 @@ export function ShareDialog({ target, onClose }) {
|
|
|
37
38
|
const [shared, error] = useShared(target);
|
|
38
39
|
const packageId = target.packageId;
|
|
39
40
|
const days = (shared === null || shared === void 0 ? void 0 : shared.relayed) ? Math.max(1, Math.round((shared.expiresAt - Date.now()) / 86400000)) : 0;
|
|
40
|
-
return (React.createElement(ShareSheet, { title: t('ta.share.title', { name: target.title }), link: shared === null || shared === void 0 ? void 0 : shared.link, error: error === undefined ? undefined : error || t('ta.share.cannot'), face: React.createElement(Package, { size: 22 }), name: target.title, gets: t('ta.share.extensionGets'), notes: [(shared === null || shared === void 0 ? void 0 : shared.relayed) ? t('ta.share.relayed', { days, size: Math.round(shared.maxBytes / 1024 / 1024) }) : t('ta.share.published')], onStop: (shared === null || shared === void 0 ? void 0 : shared.relayed) && packageId ? () => bench.relay.unsharePackage(packageId) : undefined, stop: { title: t('ta.share.stopTitle', { name: target.title }), message: t('ta.share.stopHint') }, onClose: onClose, notices: notices, rooms: bench.rooms }));
|
|
41
|
+
return (React.createElement(ShareSheet, { title: t('ta.share.title', { name: target.title }), link: shared === null || shared === void 0 ? void 0 : shared.link, error: error === undefined ? undefined : error || t('ta.share.cannot'), face: React.createElement(Package, { size: 22 }), name: target.title, gets: t('ta.share.extensionGets'), invite: t('ta.share.extensionInvite', { name: target.title }), notes: [(shared === null || shared === void 0 ? void 0 : shared.relayed) ? t('ta.share.relayed', { days, size: Math.round(shared.maxBytes / 1024 / 1024) }) : t('ta.share.published')], onStop: (shared === null || shared === void 0 ? void 0 : shared.relayed) && packageId ? () => bench.relay.unsharePackage(packageId) : undefined, stop: { title: t('ta.share.stopTitle', { name: target.title }), message: t('ta.share.stopHint') }, onClose: onClose, notices: notices, rooms: bench.rooms }));
|
|
41
42
|
}
|
|
42
|
-
/** The share asked for by a web extension, over the page. */
|
|
43
|
+
/** The share asked for by a web extension, over the page: an extension handed on, or the share sheet of something. */
|
|
43
44
|
export function ShareHost() {
|
|
44
45
|
var _a, _b;
|
|
45
|
-
const [{ sharing }, host] = useWebExtensions();
|
|
46
|
-
return
|
|
46
|
+
const [{ sharing, sharingItem, shareWays }, host] = useWebExtensions();
|
|
47
|
+
return (React.createElement(React.Fragment, null,
|
|
48
|
+
sharing && React.createElement(ShareDialog, { key: (_b = (_a = sharing.packageId) !== null && _a !== void 0 ? _a : sharing.source) !== null && _b !== void 0 ? _b : sharing.title, target: sharing, onClose: () => host.share(undefined) }),
|
|
49
|
+
sharingItem && React.createElement(ShareItemSheet, { item: sharingItem, ways: shareWays, onClose: () => host.shareItem(undefined) })));
|
|
47
50
|
}
|
|
48
51
|
//# sourceMappingURL=share-dialog.js.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Check } from 'lucide-react';
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { useT } from '../i18n/use-t.js';
|
|
4
|
-
import {
|
|
3
|
+
import { PeoplePicker } from './people-picker.js';
|
|
5
4
|
/** The friends of this Ta, once read; undefined while read, or where they cannot be. */
|
|
6
5
|
export function useShareFriends(rooms) {
|
|
7
6
|
const [friends, setFriends] = React.useState();
|
|
@@ -38,15 +37,9 @@ export function ShareToFriends({ rooms, notices, friends, link, title, onDone, }
|
|
|
38
37
|
setBusy(false);
|
|
39
38
|
}
|
|
40
39
|
};
|
|
40
|
+
const people = friends.map(friend => ({ key: friend.id, name: friend.name, seed: friend.id, look: friend.look, online: friend.online }));
|
|
41
41
|
return (React.createElement("div", { className: "ta-share-friends" },
|
|
42
|
-
React.createElement(
|
|
43
|
-
const on = chosen.includes(friend.id);
|
|
44
|
-
return (React.createElement("li", { key: friend.id },
|
|
45
|
-
React.createElement("button", { type: "button", className: `ta-share-friend${on ? ' ta-on' : ''}`, "aria-pressed": on, onClick: () => setChosen(on ? chosen.filter(id => id !== friend.id) : [...chosen, friend.id]) },
|
|
46
|
-
React.createElement(Face, { seed: friend.id, look: friend.look, size: 36, online: friend.online }),
|
|
47
|
-
React.createElement("span", { className: "ta-share-friend-name" }, friend.name),
|
|
48
|
-
React.createElement("span", { className: "ta-share-friend-check" }, on && React.createElement(Check, { size: 14 })))));
|
|
49
|
-
})),
|
|
42
|
+
React.createElement(PeoplePicker, { people: people, value: chosen, onChange: setChosen, disabled: busy }),
|
|
50
43
|
React.createElement("div", { className: "ta-share-friends-actions" },
|
|
51
44
|
React.createElement("button", { type: "button", className: "ta-button", onClick: onDone }, t('ta.cancel')),
|
|
52
45
|
React.createElement("button", { type: "button", className: `ta-button ta-primary${busy ? ' ta-busy' : ''}`, disabled: busy || chosen.length === 0, onClick: () => void send() },
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { WebShareItem, WebShareWay } from '../extension/web-api-menus.js';
|
|
3
|
+
/**
|
|
4
|
+
* The share sheet of something (WebExtensionUI.share, docs/design/ta-links.md 4.2): what goes, as the other will see
|
|
5
|
+
* it, over a row of the ways that take it (registerShareWay: send to friends and group chats, post to Moments, a link).
|
|
6
|
+
* A way picked, the sheet closes and the way shows what it needs; the one place sharing starts, whatever is shared.
|
|
7
|
+
*/
|
|
8
|
+
export declare function ShareItemSheet({ item, ways, onClose }: {
|
|
9
|
+
item: WebShareItem;
|
|
10
|
+
ways: readonly WebShareWay[];
|
|
11
|
+
onClose(): void;
|
|
12
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Sparkles } from 'lucide-react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { WEB_ICONS } from '../extension/icons.js';
|
|
4
|
+
import { WebShareUtil } from '../extension/web-share.js';
|
|
5
|
+
import { useNotices } from '../hooks.js';
|
|
6
|
+
import { useT } from '../i18n/use-t.js';
|
|
7
|
+
import { EmptyState } from './empty-state.js';
|
|
8
|
+
import { Tile } from './share-sheet.js';
|
|
9
|
+
import { WebDialog } from './web-dialog.js';
|
|
10
|
+
/**
|
|
11
|
+
* The share sheet of something (WebExtensionUI.share, docs/design/ta-links.md 4.2): what goes, as the other will see
|
|
12
|
+
* it, over a row of the ways that take it (registerShareWay: send to friends and group chats, post to Moments, a link).
|
|
13
|
+
* A way picked, the sheet closes and the way shows what it needs; the one place sharing starts, whatever is shared.
|
|
14
|
+
*/
|
|
15
|
+
export function ShareItemSheet({ item, ways, onClose }) {
|
|
16
|
+
var _a;
|
|
17
|
+
const t = useT();
|
|
18
|
+
const [, notices] = useNotices();
|
|
19
|
+
const taking = WebShareUtil.ways(ways, item);
|
|
20
|
+
const Icon = (_a = WEB_ICONS[WebShareUtil.icon(item)]) !== null && _a !== void 0 ? _a : Sparkles;
|
|
21
|
+
const name = WebShareUtil.name(item) || t('ta.share.thing');
|
|
22
|
+
const pick = (way) => {
|
|
23
|
+
onClose();
|
|
24
|
+
Promise.resolve()
|
|
25
|
+
.then(() => way.share(item))
|
|
26
|
+
.catch(reason => notices.error(reason));
|
|
27
|
+
};
|
|
28
|
+
return (React.createElement(WebDialog, { title: t('ta.share.titled', { name }), onClose: onClose },
|
|
29
|
+
React.createElement("div", { className: "ta-share" },
|
|
30
|
+
React.createElement("div", { className: "ta-share-card" },
|
|
31
|
+
React.createElement("div", { className: "ta-share-who" },
|
|
32
|
+
React.createElement("span", { className: "ta-share-face" },
|
|
33
|
+
React.createElement(Icon, { size: 22 })),
|
|
34
|
+
React.createElement("span", { className: "ta-share-who-text" },
|
|
35
|
+
React.createElement("strong", { className: "ta-share-name" }, name),
|
|
36
|
+
React.createElement("span", { className: "ta-share-gets" }, item.kind === 'file' ? t('ta.share.itemFile') : t('ta.share.itemWork'))))),
|
|
37
|
+
taking.length ? (React.createElement("div", { className: "ta-share-tiles" }, taking.map(way => (React.createElement(Tile, { key: way.key, icon: way.icon, label: WebShareUtil.label(way), onClick: () => pick(way) }))))) : (React.createElement(EmptyState, { title: t('ta.share.noWay'), compact: true })))));
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=share-item-sheet.js.map
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import type { TaRoomServer } from '@celljs/ta-protocol';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import type { WebShareSheetProps } from '../extension/web-extension-api.js';
|
|
3
|
+
import type { WebIcon, WebShareSheetProps } from '../extension/web-extension-api.js';
|
|
4
4
|
import type { TaNotices } from '../notices/notices-protocol.js';
|
|
5
|
+
/** One of the actions under the code, as the share sheets of phones: a round icon over a word. */
|
|
6
|
+
export declare function Tile({ icon: Icon, label, onClick, disabled }: {
|
|
7
|
+
icon: WebIcon;
|
|
8
|
+
label: string;
|
|
9
|
+
onClick(): void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}): React.JSX.Element;
|
|
5
12
|
/**
|
|
6
13
|
* The sheet everything shared goes out from (`ui.ShareSheet`, docs/design/ta-links.md 4): who or what goes and what
|
|
7
14
|
* the other gets over its code, the link, and the actions in one row: Send to Ta friends, Copy, the system's other apps
|
|
@@ -12,4 +19,4 @@ export interface ShareSheetServices {
|
|
|
12
19
|
notices: TaNotices;
|
|
13
20
|
rooms: TaRoomServer;
|
|
14
21
|
}
|
|
15
|
-
export declare function ShareSheet({ title, link, error, face, name, gets, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, }: WebShareSheetProps & ShareSheetServices): React.JSX.Element;
|
|
22
|
+
export declare function ShareSheet({ title, link, error, face, name, gets, invite, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, }: WebShareSheetProps & ShareSheetServices): React.JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Check, Copy, KeyRound, RefreshCw, Send, Share2 } from 'lucide-react';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { shareMessage } from '../extension/share-sheet-compat.js';
|
|
3
4
|
import { useT } from '../i18n/use-t.js';
|
|
4
5
|
import { EmptyState } from './empty-state.js';
|
|
5
6
|
import { QrView } from './qr-view.js';
|
|
@@ -19,13 +20,13 @@ function useCopied() {
|
|
|
19
20
|
return [copied, copy];
|
|
20
21
|
}
|
|
21
22
|
/** One of the actions under the code, as the share sheets of phones: a round icon over a word. */
|
|
22
|
-
function Tile({ icon: Icon, label, onClick, disabled }) {
|
|
23
|
+
export function Tile({ icon: Icon, label, onClick, disabled }) {
|
|
23
24
|
return (React.createElement("button", { type: "button", className: "ta-share-tile", disabled: disabled, onClick: onClick },
|
|
24
25
|
React.createElement("span", { className: "ta-share-tile-icon" },
|
|
25
26
|
React.createElement(Icon, { size: 20 })),
|
|
26
27
|
React.createElement("span", { className: "ta-share-tile-label" }, label)));
|
|
27
28
|
}
|
|
28
|
-
export function ShareSheet({ title, link, error, face, name, gets, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, }) {
|
|
29
|
+
export function ShareSheet({ title, link, error, face, name, gets, invite, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, }) {
|
|
29
30
|
const t = useT();
|
|
30
31
|
const [copied, copy] = useCopied();
|
|
31
32
|
const [stopping, setStopping] = React.useState(false);
|
|
@@ -67,8 +68,8 @@ export function ShareSheet({ title, link, error, face, name, gets, notes, passwo
|
|
|
67
68
|
React.createElement("button", { type: "button", className: "ta-button", onClick: () => copy(password, 'password') }, copied === 'password' ? t('ta.share.copied') : t('ta.share.copyPassword')))),
|
|
68
69
|
picking && link && friends ? (React.createElement(ShareToFriends, { rooms: rooms, notices: notices, friends: friends, link: link, title: name || title, onDone: () => setPicking(false) })) : (React.createElement("div", { className: "ta-share-tiles" },
|
|
69
70
|
canFriends && React.createElement(Tile, { icon: Send, label: t('ta.share.friends'), disabled: !link, onClick: () => setPicking(true) }),
|
|
70
|
-
React.createElement(Tile, { icon: copied === 'link' ? Check : Copy, label: copied === 'link' ? t('ta.share.copied') : t('ta.share.copy'), disabled: !link, onClick: () => link && copy(link, 'link') }),
|
|
71
|
-
canSend && (React.createElement(Tile, { icon: Share2, label: t('ta.share.apps'), disabled: !link, onClick: () => link && void navigator.share({ title: name || title, url: link }).catch(() => undefined) })),
|
|
71
|
+
React.createElement(Tile, { icon: copied === 'link' ? Check : Copy, label: copied === 'link' ? t('ta.share.copied') : t('ta.share.copy'), disabled: !link, onClick: () => link && copy(shareMessage(invite, link), 'link') }),
|
|
72
|
+
canSend && (React.createElement(Tile, { icon: Share2, label: t('ta.share.apps'), disabled: !link, onClick: () => link && void navigator.share({ title: name || title, text: invite, url: link }).catch(() => undefined) })),
|
|
72
73
|
onRenew && React.createElement(Tile, { icon: RefreshCw, label: t('ta.share.renew'), disabled: !link, onClick: onRenew }))),
|
|
73
74
|
children,
|
|
74
75
|
lines.length > 0 && (React.createElement("div", { className: "ta-share-notes" }, lines.map(line => (React.createElement("p", { key: line }, line))))),
|
|
@@ -37,19 +37,19 @@ function SetupForm({ setup, onSave, onCancel }) {
|
|
|
37
37
|
const [busy, setBusy] = React.useState(false);
|
|
38
38
|
const set = (id, value) => setValues(current => ({ ...current, [id]: value }));
|
|
39
39
|
const missing = shape.fields.some(field => { var _a; return !field.optional && !((_a = values[field.id]) === null || _a === void 0 ? void 0 : _a.trim()); }) || (!setup.secret && !((_a = values[shape.secret]) === null || _a === void 0 ? void 0 : _a.trim()));
|
|
40
|
-
return (React.createElement("form", { className: "ta-
|
|
40
|
+
return (React.createElement("form", { className: "ta-form", onSubmit: event => {
|
|
41
41
|
event.preventDefault();
|
|
42
42
|
setBusy(true);
|
|
43
43
|
void onSave(values).finally(() => setBusy(false));
|
|
44
44
|
} },
|
|
45
|
-
[...shape.fields, { id: shape.secret, secret: true }].map(field => { var _a; return (React.createElement("label", { key: field.id, className: "ta-
|
|
46
|
-
React.createElement("span",
|
|
45
|
+
[...shape.fields, { id: shape.secret, secret: true }].map(field => { var _a; return (React.createElement("label", { key: field.id, className: "ta-form-item" },
|
|
46
|
+
React.createElement("span", { className: "ta-form-label" }, t(`ta.signInSetup.field.${field.id}`)),
|
|
47
47
|
React.createElement("input", { className: "ta-input", type: 'secret' in field ? 'password' : 'text', value: (_a = values[field.id]) !== null && _a !== void 0 ? _a : '', placeholder: 'secret' in field && setup.secret
|
|
48
48
|
? t('ta.signInSetup.secretKept')
|
|
49
49
|
: 'optional' in field && field.optional
|
|
50
50
|
? t('ta.signInSetup.optional')
|
|
51
51
|
: '', autoComplete: "off", spellCheck: false, autoCapitalize: "off", onChange: event => set(field.id, event.target.value) }))); }),
|
|
52
|
-
React.createElement("div", { className: "ta-
|
|
52
|
+
React.createElement("div", { className: "ta-form-actions" },
|
|
53
53
|
React.createElement("button", { type: "button", className: "ta-button", disabled: busy, onClick: onCancel }, t('ta.cancel')),
|
|
54
54
|
React.createElement("button", { type: "submit", className: `ta-button ta-primary${busy ? ' ta-busy' : ''}`, disabled: busy || missing }, t('ta.signInSetup.save')))));
|
|
55
55
|
}
|
|
@@ -23,7 +23,7 @@ export function TrustedDomains() {
|
|
|
23
23
|
};
|
|
24
24
|
return (React.createElement(React.Fragment, null,
|
|
25
25
|
React.createElement(Row, { label: t('ta.settings.trustedDomains'), description: t('ta.settings.trustedDomainsHint'), stacked: true },
|
|
26
|
-
React.createElement("form", { className: "ta-trusted-add", onSubmit: event => {
|
|
26
|
+
React.createElement("form", { className: "ta-trusted-add ta-form-inline", onSubmit: event => {
|
|
27
27
|
event.preventDefault();
|
|
28
28
|
add();
|
|
29
29
|
} },
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The room of a Loading or an EmptyState that is not `compact`: the rest of the view it is in, from its top to the
|
|
4
|
+
* bottom of what shows it, less what comes under it, so that it sits in the middle of what is left however the page
|
|
5
|
+
* around it is laid out. A column of flex that gives it room already (`flex: 1` in base.ts) is left to do so; where its
|
|
6
|
+
* parent is not one (a block an extension wraps it in, a body that is no column of flex) it takes the room itself,
|
|
7
|
+
* rather than each page having to make every box above it a column of flex. It keeps its own height in a reply, in a
|
|
8
|
+
* box drawn as one (a card: rounded, with a background, a border or a shadow) and beside something (a cell of a grid).
|
|
9
|
+
*/
|
|
10
|
+
export declare namespace ViewRoom {
|
|
11
|
+
interface Measure {
|
|
12
|
+
/** Its height as laid out, before any room of its own. */
|
|
13
|
+
height: number;
|
|
14
|
+
/** The height of what it holds (or its min-height): more than that, its parent gives it room. */
|
|
15
|
+
natural: number;
|
|
16
|
+
/** From its top to the bottom of the view, less what comes under it. */
|
|
17
|
+
room: number;
|
|
18
|
+
}
|
|
19
|
+
/** The min-height it takes, or undefined where it keeps the height it has. */
|
|
20
|
+
function height({ height, natural, room }: Measure): number | undefined;
|
|
21
|
+
/** Keeps the room of the element while the view and what is around it change; the function stops it. */
|
|
22
|
+
function keep(element: HTMLElement): () => void;
|
|
23
|
+
}
|
|
24
|
+
/** Gives the element its room in the view (ViewRoom) while `on`. */
|
|
25
|
+
export declare function useViewRoom(ref: React.RefObject<HTMLElement | null>, on: boolean): void;
|