@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
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.FileUrls = void 0;
|
|
37
|
+
exports.askAgain = askAgain;
|
|
37
38
|
exports.useMediaUrl = useMediaUrl;
|
|
38
39
|
exports.useFullUrl = useFullUrl;
|
|
39
40
|
exports.useMediaUrls = useMediaUrls;
|
|
@@ -65,9 +66,49 @@ const MEDIA_MAX_HEIGHT = 420;
|
|
|
65
66
|
const MEDIA_MAX_WIDTH = 720;
|
|
66
67
|
/** The box an image of a reply asks for. */
|
|
67
68
|
const IMAGE_BOX = { width: thumbnail_1.ThumbnailUtil.side(MEDIA_MAX_WIDTH), height: thumbnail_1.ThumbnailUtil.side(MEDIA_MAX_HEIGHT) };
|
|
69
|
+
/** What could not load, told to load again: when the page may reach the computer again, or a tap on one asks. */
|
|
70
|
+
const again = new Set();
|
|
71
|
+
function askAgainShown() {
|
|
72
|
+
if (document.visibilityState === 'visible') {
|
|
73
|
+
askAgain();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Asks every picture that could not load to load again: one may not have come for a while (a phone whose network
|
|
78
|
+
* changed, the app in the background, the relay of the computer reconnecting), not be missing.
|
|
79
|
+
*/
|
|
80
|
+
function askAgain() {
|
|
81
|
+
for (const one of [...again]) {
|
|
82
|
+
one();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/** Counts the times what could not load is asked again, while `waiting`: a dependency of what asks for it. */
|
|
86
|
+
function useAgain(waiting) {
|
|
87
|
+
const [count, setCount] = React.useState(0);
|
|
88
|
+
React.useEffect(() => {
|
|
89
|
+
if (!waiting) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const bump = () => setCount(n => n + 1);
|
|
93
|
+
if (!again.size) {
|
|
94
|
+
window.addEventListener('online', askAgain);
|
|
95
|
+
document.addEventListener('visibilitychange', askAgainShown);
|
|
96
|
+
}
|
|
97
|
+
again.add(bump);
|
|
98
|
+
return () => {
|
|
99
|
+
again.delete(bump);
|
|
100
|
+
if (!again.size) {
|
|
101
|
+
window.removeEventListener('online', askAgain);
|
|
102
|
+
document.removeEventListener('visibilitychange', askAgainShown);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}, [waiting]);
|
|
106
|
+
return count;
|
|
107
|
+
}
|
|
68
108
|
/**
|
|
69
109
|
* 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,
|
|
70
|
-
* undefined while it is asked (and for no target).
|
|
110
|
+
* undefined while it is asked (and for no target). With it, what to call when what it gave did not load (an image
|
|
111
|
+
* that failed): it is null then, and asked again with the others that could not load (askAgain).
|
|
71
112
|
*/
|
|
72
113
|
function useMediaUrl(src, box) {
|
|
73
114
|
const fileUrl = React.useContext(exports.FileUrls);
|
|
@@ -76,6 +117,8 @@ function useMediaUrl(src, box) {
|
|
|
76
117
|
// What it asked for with the URL: another target (a gallery enlarged goes through its pictures) is not shown the one before.
|
|
77
118
|
const asked = `${path} ${width}x${height}${cover ? ' cover' : ''}`;
|
|
78
119
|
const [found, setFound] = React.useState();
|
|
120
|
+
const count = useAgain(path !== undefined && (found === null || found === void 0 ? void 0 : found.asked) === asked && found.url === null);
|
|
121
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: count asks again what could not load
|
|
79
122
|
React.useEffect(() => {
|
|
80
123
|
if (path === undefined) {
|
|
81
124
|
return;
|
|
@@ -89,11 +132,12 @@ function useMediaUrl(src, box) {
|
|
|
89
132
|
return () => {
|
|
90
133
|
current = false;
|
|
91
134
|
};
|
|
92
|
-
}, [fileUrl, path, asked, width, height, cover]);
|
|
135
|
+
}, [fileUrl, path, asked, width, height, cover, count]);
|
|
136
|
+
const broke = React.useCallback(() => setFound(known => ((known === null || known === void 0 ? void 0 : known.asked) === asked ? { asked, url: null } : known)), [asked]);
|
|
93
137
|
if (path === undefined) {
|
|
94
|
-
return src;
|
|
138
|
+
return [src, broke];
|
|
95
139
|
}
|
|
96
|
-
return (found === null || found === void 0 ? void 0 : found.asked) === asked ? found.url : undefined;
|
|
140
|
+
return [(found === null || found === void 0 ? void 0 : found.asked) === asked ? found.url : undefined, broke];
|
|
97
141
|
}
|
|
98
142
|
/** The URL of the file itself of a target, not of a picture of it made smaller: what copying it takes. */
|
|
99
143
|
function useFullUrl() {
|
|
@@ -106,12 +150,14 @@ function useFullUrl() {
|
|
|
106
150
|
return fileUrl ? fileUrl(path) : Promise.reject(new Error(`Cannot load ${path}`));
|
|
107
151
|
}, [fileUrl]);
|
|
108
152
|
}
|
|
109
|
-
/** The URLs of targets, as `useMediaUrl` gives each, all in one `box`: the tiles of a gallery. */
|
|
153
|
+
/** 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. */
|
|
110
154
|
function useMediaUrls(sources, box) {
|
|
111
155
|
const fileUrl = React.useContext(exports.FileUrls);
|
|
112
156
|
const key = sources.join('\n');
|
|
113
157
|
const { width, height, cover } = box !== null && box !== void 0 ? box : {};
|
|
114
158
|
const [urls, setUrls] = React.useState({});
|
|
159
|
+
const count = useAgain(sources.some(src => urls[src] === null));
|
|
160
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: count asks again what could not load
|
|
115
161
|
React.useEffect(() => {
|
|
116
162
|
let current = true;
|
|
117
163
|
for (const src of key.split('\n')) {
|
|
@@ -123,13 +169,14 @@ function useMediaUrls(sources, box) {
|
|
|
123
169
|
setUrls(known => ({ ...known, [src]: null }));
|
|
124
170
|
continue;
|
|
125
171
|
}
|
|
126
|
-
fileUrl(path, width && height ? { width, height, cover } : undefined).then(url => current && setUrls(known => ({ ...known, [src]: url })), () => current && setUrls(known => ({ ...known, [src]: null })));
|
|
172
|
+
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 })));
|
|
127
173
|
}
|
|
128
174
|
return () => {
|
|
129
175
|
current = false;
|
|
130
176
|
};
|
|
131
|
-
}, [fileUrl, key, width, height, cover]);
|
|
132
|
-
|
|
177
|
+
}, [fileUrl, key, width, height, cover, count]);
|
|
178
|
+
const broke = React.useCallback((src) => setUrls(known => (known[src] === null ? known : { ...known, [src]: null })), []);
|
|
179
|
+
return [sources.map(src => (markdown_1.MarkdownUtil.localPath(src) === undefined ? src : urls[src])), broke];
|
|
133
180
|
}
|
|
134
181
|
/** An image, a video or a sound a reply shows: from the web, a data URL, or a file of the workspace. */
|
|
135
182
|
function MediaView({ src, alt }) {
|
|
@@ -137,21 +184,21 @@ function MediaView({ src, alt }) {
|
|
|
137
184
|
const t = (0, use_t_1.useT)();
|
|
138
185
|
const kind = (_a = markdown_1.MarkdownUtil.media(src)) !== null && _a !== void 0 ? _a : 'image';
|
|
139
186
|
// A picture of the workspace loads as large as it shows (ThumbnailUtil); enlarged, as it is.
|
|
140
|
-
const url = useMediaUrl(src, kind === 'image' ? IMAGE_BOX : undefined);
|
|
141
|
-
const [failedUrl, setFailedUrl] = React.useState();
|
|
187
|
+
const [url, broke] = useMediaUrl(src, kind === 'image' ? IMAGE_BOX : undefined);
|
|
142
188
|
const [open, setOpen] = React.useState(false);
|
|
143
|
-
const full = useMediaUrl(open && kind === 'image' ? src : undefined);
|
|
189
|
+
const [full] = useMediaUrl(open && kind === 'image' ? src : undefined);
|
|
144
190
|
const [loaded, setLoaded] = React.useState(false);
|
|
145
191
|
const fullUrl = useFullUrl();
|
|
146
192
|
const [menu, openMenu] = (0, image_menu_1.useImageMenu)();
|
|
147
193
|
const known = shown.get(src);
|
|
148
|
-
|
|
194
|
+
// One that could not show before says so at once while it is asked again: it may only not have come then.
|
|
195
|
+
const failed = url === null || (url === undefined && known === false);
|
|
149
196
|
const setFailed = () => {
|
|
150
197
|
// A file of the workspace that is not there; one from the web may only be out of reach for now (offline).
|
|
151
198
|
if (markdown_1.MarkdownUtil.localPath(src) !== undefined) {
|
|
152
199
|
shown.set(src, false);
|
|
153
200
|
}
|
|
154
|
-
|
|
201
|
+
broke();
|
|
155
202
|
};
|
|
156
203
|
const size = kind === 'image' && known ? known : undefined;
|
|
157
204
|
// Of the size it had when known: its place does not change as it loads.
|
|
@@ -167,7 +214,7 @@ function MediaView({ src, alt }) {
|
|
|
167
214
|
}
|
|
168
215
|
if (!url || failed) {
|
|
169
216
|
const name = alt || src.split(/[?#]/)[0].split('/').pop() || src;
|
|
170
|
-
return (React.createElement("
|
|
217
|
+
return (React.createElement("button", { type: "button", className: "ta-media-missing", title: `${src}\n${t('ta.markdown.retry')}`, onClick: askAgain },
|
|
171
218
|
React.createElement(icon_1.Icon, { icon: lucide_react_1.ImageOff, size: 14 }),
|
|
172
219
|
t('ta.markdown.missing', { name })));
|
|
173
220
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { WebPeoplePickerProps, WebPerson } from '../extension/web-api-partners';
|
|
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;
|
|
18
|
+
//# sourceMappingURL=people-picker.d.ts.map
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.PeoplePickerUtil = void 0;
|
|
37
|
+
exports.PeoplePicker = PeoplePicker;
|
|
38
|
+
const lucide_react_1 = require("lucide-react");
|
|
39
|
+
const React = __importStar(require("react"));
|
|
40
|
+
const use_t_1 = require("../i18n/use-t");
|
|
41
|
+
const empty_state_1 = require("./empty-state");
|
|
42
|
+
const face_1 = require("./face");
|
|
43
|
+
const icon_1 = require("./icon");
|
|
44
|
+
const loading_1 = require("./loading");
|
|
45
|
+
const select_bar_1 = require("./select-bar");
|
|
46
|
+
var PeoplePickerUtil;
|
|
47
|
+
(function (PeoplePickerUtil) {
|
|
48
|
+
/** Those with every word of `query`, in any case, in their name, tag, line, heading or keywords. */
|
|
49
|
+
function filter(people, query) {
|
|
50
|
+
const words = query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
51
|
+
if (!words.length) {
|
|
52
|
+
return [...people];
|
|
53
|
+
}
|
|
54
|
+
return people.filter(person => {
|
|
55
|
+
const text = [person.name, person.tag, person.detail, person.section, person.keywords].filter(Boolean).join(' ').toLowerCase();
|
|
56
|
+
return words.every(word => text.includes(word));
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
PeoplePickerUtil.filter = filter;
|
|
60
|
+
/** Under their headings, each heading once, in the order the first of it comes. */
|
|
61
|
+
function sections(people) {
|
|
62
|
+
const sections = [];
|
|
63
|
+
for (const person of people) {
|
|
64
|
+
const section = sections.find(each => each.title === person.section);
|
|
65
|
+
if (section) {
|
|
66
|
+
section.people.push(person);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
sections.push({ title: person.section, people: [person] });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return sections;
|
|
73
|
+
}
|
|
74
|
+
PeoplePickerUtil.sections = sections;
|
|
75
|
+
/** What is picked once `key` is tapped: in or out of several, in place of the one before alone. */
|
|
76
|
+
function toggle(value, key, single) {
|
|
77
|
+
if (single) {
|
|
78
|
+
return [key];
|
|
79
|
+
}
|
|
80
|
+
return value.includes(key) ? value.filter(each => each !== key) : [...value, key];
|
|
81
|
+
}
|
|
82
|
+
PeoplePickerUtil.toggle = toggle;
|
|
83
|
+
/** 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. */
|
|
84
|
+
function locked(person, value, max) {
|
|
85
|
+
return !!person.disabled || (max !== undefined && value.length >= max && !value.includes(person.key));
|
|
86
|
+
}
|
|
87
|
+
PeoplePickerUtil.locked = locked;
|
|
88
|
+
})(PeoplePickerUtil || (exports.PeoplePickerUtil = PeoplePickerUtil = {}));
|
|
89
|
+
/** How large a face is in a row, and among those picked in the box. */
|
|
90
|
+
const FACE = 36;
|
|
91
|
+
const CHIP = 28;
|
|
92
|
+
/**
|
|
93
|
+
* 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
|
|
94
|
+
* that of its seed; whether it is online only in its row.
|
|
95
|
+
*/
|
|
96
|
+
function PersonFace({ person, size = FACE }) {
|
|
97
|
+
var _a;
|
|
98
|
+
var _b;
|
|
99
|
+
if (person.avatar) {
|
|
100
|
+
return (React.createElement("span", { className: "ta-picker-face", style: { width: size, height: size }, "aria-hidden": "true" },
|
|
101
|
+
React.createElement("span", { style: size === FACE ? undefined : { transform: `scale(${size / FACE})` } }, person.avatar)));
|
|
102
|
+
}
|
|
103
|
+
if ((_a = person.members) === null || _a === void 0 ? void 0 : _a.length) {
|
|
104
|
+
return React.createElement(face_1.GroupFace, { members: person.members, size: size });
|
|
105
|
+
}
|
|
106
|
+
const online = size === FACE ? person.online : undefined;
|
|
107
|
+
return React.createElement(face_1.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 });
|
|
108
|
+
}
|
|
109
|
+
/** The one way to pick people of Ta (WebPeoplePickerProps; web extensions `ui.PeoplePicker`). */
|
|
110
|
+
function PeoplePicker({ people, value, onChange, single, max, disabled, placeholder, empty, emptyHint }) {
|
|
111
|
+
const t = (0, use_t_1.useT)();
|
|
112
|
+
const [query, setQuery] = React.useState('');
|
|
113
|
+
if (!people) {
|
|
114
|
+
return React.createElement(loading_1.Loading, { compact: true });
|
|
115
|
+
}
|
|
116
|
+
if (people.length === 0) {
|
|
117
|
+
return React.createElement(empty_state_1.EmptyState, { compact: true, title: empty !== null && empty !== void 0 ? empty : t('ta.people.none'), hint: emptyHint });
|
|
118
|
+
}
|
|
119
|
+
const shown = PeoplePickerUtil.filter(people, query);
|
|
120
|
+
const picked = single ? [] : value.map(key => people.find(person => person.key === key)).filter(person => !!person);
|
|
121
|
+
const tap = (person) => {
|
|
122
|
+
if (!disabled && !PeoplePickerUtil.locked(person, value, max)) {
|
|
123
|
+
onChange(PeoplePickerUtil.toggle(value, person.key, single));
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const label = placeholder !== null && placeholder !== void 0 ? placeholder : t('ta.people.search');
|
|
127
|
+
return (React.createElement("div", { className: "ta-picker" },
|
|
128
|
+
React.createElement("label", { className: "ta-picker-search" },
|
|
129
|
+
picked.length === 0 && React.createElement(icon_1.Icon, { icon: lucide_react_1.Search, size: 14 }),
|
|
130
|
+
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 => {
|
|
131
|
+
event.preventDefault();
|
|
132
|
+
tap(person);
|
|
133
|
+
} },
|
|
134
|
+
React.createElement(PersonFace, { person: person, size: CHIP })))),
|
|
135
|
+
React.createElement("input", { value: query, placeholder: label, "aria-label": label, onChange: event => setQuery(event.target.value), onKeyDown: event => {
|
|
136
|
+
// The one found is taken by Enter, as a search of a messenger's picker.
|
|
137
|
+
if (event.key === 'Enter' && shown.length === 1) {
|
|
138
|
+
event.preventDefault();
|
|
139
|
+
tap(shown[0]);
|
|
140
|
+
setQuery('');
|
|
141
|
+
}
|
|
142
|
+
else if (event.key === 'Backspace' && !query && picked.length) {
|
|
143
|
+
const last = picked[picked.length - 1];
|
|
144
|
+
if (!last.disabled) {
|
|
145
|
+
tap(last);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
} })),
|
|
149
|
+
React.createElement("div", { className: "ta-picker-list" },
|
|
150
|
+
shown.length === 0 && React.createElement(empty_state_1.EmptyState, { compact: true, title: t('ta.people.noMatch') }),
|
|
151
|
+
PeoplePickerUtil.sections(shown).map(section => { var _a; return (React.createElement("div", { key: (_a = section.title) !== null && _a !== void 0 ? _a : '', className: "ta-picker-section" },
|
|
152
|
+
section.title && React.createElement("div", { className: "ta-picker-heading" }, section.title),
|
|
153
|
+
section.people.map(person => {
|
|
154
|
+
const on = value.includes(person.key);
|
|
155
|
+
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) },
|
|
156
|
+
!single && React.createElement(select_bar_1.SelectCheck, { checked: on, disabled: PeoplePickerUtil.locked(person, value, max) && !on }),
|
|
157
|
+
React.createElement(PersonFace, { person: person }),
|
|
158
|
+
React.createElement("span", { className: "ta-picker-text" },
|
|
159
|
+
React.createElement("span", { className: "ta-picker-line" },
|
|
160
|
+
React.createElement("span", { className: "ta-picker-name" }, person.name),
|
|
161
|
+
person.tag && React.createElement("span", { className: "ta-picker-tag" }, person.tag)),
|
|
162
|
+
person.detail && React.createElement("span", { className: "ta-picker-detail" }, person.detail)),
|
|
163
|
+
single && on && React.createElement(icon_1.Icon, { icon: lucide_react_1.Check, size: 16, className: "ta-picker-check" })));
|
|
164
|
+
}))); }))));
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=people-picker.js.map
|
|
@@ -144,7 +144,7 @@ function RelayDialog({ onClose }) {
|
|
|
144
144
|
React.createElement(RelayPicture, null),
|
|
145
145
|
React.createElement("p", null, t('ta.relay.hint')),
|
|
146
146
|
React.createElement("div", { className: "ta-relay-form" },
|
|
147
|
-
React.createElement("label", { className: "ta-field
|
|
147
|
+
React.createElement("label", { className: "ta-field" },
|
|
148
148
|
React.createElement(lucide_react_1.Smartphone, { size: 15, strokeWidth: 1.75, "aria-hidden": "true" }),
|
|
149
149
|
React.createElement("input", { placeholder: t('ta.relay.phone'), value: name, onChange: event => setName(event.target.value) })),
|
|
150
150
|
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() },
|
|
@@ -132,6 +132,8 @@ function useParts(scope, onScope, onDialog) {
|
|
|
132
132
|
// After the notices and who answers others, before what is kept.
|
|
133
133
|
order: 30,
|
|
134
134
|
rows: [
|
|
135
|
+
(0, settings_controls_1.row)('clipboard-links', [t('ta.settings.clipboardLinks'), t('ta.settings.clipboardLinksHint')], React.createElement(settings_controls_1.Row, { label: t('ta.settings.clipboardLinks'), description: t('ta.settings.clipboardLinksHint') },
|
|
136
|
+
React.createElement(settings_controls_1.Switch, { label: t('ta.settings.clipboardLinks'), checked: settings.clipboardLinks, onChange: clipboardLinks => store.update({ clipboardLinks }) }))),
|
|
135
137
|
(0, settings_controls_1.row)('trusted-domains', [t('ta.settings.trustedDomains'), t('ta.settings.trustedDomainsHint'), ...settings.trustedDomains], React.createElement(trusted_domains_1.TrustedDomains, null)),
|
|
136
138
|
],
|
|
137
139
|
},
|
|
@@ -8,6 +8,6 @@ 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;
|
|
13
13
|
//# sourceMappingURL=share-dialog.d.ts.map
|
|
@@ -40,6 +40,7 @@ const React = __importStar(require("react"));
|
|
|
40
40
|
const hooks_1 = require("../hooks");
|
|
41
41
|
const use_t_1 = require("../i18n/use-t");
|
|
42
42
|
const share_link_1 = require("../util/share-link");
|
|
43
|
+
const share_item_sheet_1 = require("./share-item-sheet");
|
|
43
44
|
const share_sheet_1 = require("./share-sheet");
|
|
44
45
|
/** The link of an extension: of its source when it is published, else of the relay, made by this computer. */
|
|
45
46
|
function useShared(target) {
|
|
@@ -74,12 +75,14 @@ function ShareDialog({ target, onClose }) {
|
|
|
74
75
|
const [shared, error] = useShared(target);
|
|
75
76
|
const packageId = target.packageId;
|
|
76
77
|
const days = (shared === null || shared === void 0 ? void 0 : shared.relayed) ? Math.max(1, Math.round((shared.expiresAt - Date.now()) / 86400000)) : 0;
|
|
77
|
-
return (React.createElement(share_sheet_1.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(lucide_react_1.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 }));
|
|
78
|
+
return (React.createElement(share_sheet_1.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(lucide_react_1.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 }));
|
|
78
79
|
}
|
|
79
|
-
/** The share asked for by a web extension, over the page. */
|
|
80
|
+
/** The share asked for by a web extension, over the page: an extension handed on, or the share sheet of something. */
|
|
80
81
|
function ShareHost() {
|
|
81
82
|
var _a, _b;
|
|
82
|
-
const [{ sharing }, host] = (0, hooks_1.useWebExtensions)();
|
|
83
|
-
return
|
|
83
|
+
const [{ sharing, sharingItem, shareWays }, host] = (0, hooks_1.useWebExtensions)();
|
|
84
|
+
return (React.createElement(React.Fragment, null,
|
|
85
|
+
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) }),
|
|
86
|
+
sharingItem && React.createElement(share_item_sheet_1.ShareItemSheet, { item: sharingItem, ways: shareWays, onClose: () => host.shareItem(undefined) })));
|
|
84
87
|
}
|
|
85
88
|
//# sourceMappingURL=share-dialog.js.map
|
|
@@ -35,10 +35,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.useShareFriends = useShareFriends;
|
|
37
37
|
exports.ShareToFriends = ShareToFriends;
|
|
38
|
-
const lucide_react_1 = require("lucide-react");
|
|
39
38
|
const React = __importStar(require("react"));
|
|
40
39
|
const use_t_1 = require("../i18n/use-t");
|
|
41
|
-
const
|
|
40
|
+
const people_picker_1 = require("./people-picker");
|
|
42
41
|
/** The friends of this Ta, once read; undefined while read, or where they cannot be. */
|
|
43
42
|
function useShareFriends(rooms) {
|
|
44
43
|
const [friends, setFriends] = React.useState();
|
|
@@ -75,15 +74,9 @@ function ShareToFriends({ rooms, notices, friends, link, title, onDone, }) {
|
|
|
75
74
|
setBusy(false);
|
|
76
75
|
}
|
|
77
76
|
};
|
|
77
|
+
const people = friends.map(friend => ({ key: friend.id, name: friend.name, seed: friend.id, look: friend.look, online: friend.online }));
|
|
78
78
|
return (React.createElement("div", { className: "ta-share-friends" },
|
|
79
|
-
React.createElement(
|
|
80
|
-
const on = chosen.includes(friend.id);
|
|
81
|
-
return (React.createElement("li", { key: friend.id },
|
|
82
|
-
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]) },
|
|
83
|
-
React.createElement(face_1.Face, { seed: friend.id, look: friend.look, size: 36, online: friend.online }),
|
|
84
|
-
React.createElement("span", { className: "ta-share-friend-name" }, friend.name),
|
|
85
|
-
React.createElement("span", { className: "ta-share-friend-check" }, on && React.createElement(lucide_react_1.Check, { size: 14 })))));
|
|
86
|
-
})),
|
|
79
|
+
React.createElement(people_picker_1.PeoplePicker, { people: people, value: chosen, onChange: setChosen, disabled: busy }),
|
|
87
80
|
React.createElement("div", { className: "ta-share-friends-actions" },
|
|
88
81
|
React.createElement("button", { type: "button", className: "ta-button", onClick: onDone }, t('ta.cancel')),
|
|
89
82
|
React.createElement("button", { type: "button", className: `ta-button ta-primary${busy ? ' ta-busy' : ''}`, disabled: busy || chosen.length === 0, onClick: () => void send() },
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { WebShareItem, WebShareWay } from '../extension/web-api-menus';
|
|
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;
|
|
13
|
+
//# sourceMappingURL=share-item-sheet.d.ts.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ShareItemSheet = ShareItemSheet;
|
|
37
|
+
const lucide_react_1 = require("lucide-react");
|
|
38
|
+
const React = __importStar(require("react"));
|
|
39
|
+
const icons_1 = require("../extension/icons");
|
|
40
|
+
const web_share_1 = require("../extension/web-share");
|
|
41
|
+
const hooks_1 = require("../hooks");
|
|
42
|
+
const use_t_1 = require("../i18n/use-t");
|
|
43
|
+
const empty_state_1 = require("./empty-state");
|
|
44
|
+
const share_sheet_1 = require("./share-sheet");
|
|
45
|
+
const web_dialog_1 = require("./web-dialog");
|
|
46
|
+
/**
|
|
47
|
+
* The share sheet of something (WebExtensionUI.share, docs/design/ta-links.md 4.2): what goes, as the other will see
|
|
48
|
+
* it, over a row of the ways that take it (registerShareWay: send to friends and group chats, post to Moments, a link).
|
|
49
|
+
* A way picked, the sheet closes and the way shows what it needs; the one place sharing starts, whatever is shared.
|
|
50
|
+
*/
|
|
51
|
+
function ShareItemSheet({ item, ways, onClose }) {
|
|
52
|
+
var _a;
|
|
53
|
+
const t = (0, use_t_1.useT)();
|
|
54
|
+
const [, notices] = (0, hooks_1.useNotices)();
|
|
55
|
+
const taking = web_share_1.WebShareUtil.ways(ways, item);
|
|
56
|
+
const Icon = (_a = icons_1.WEB_ICONS[web_share_1.WebShareUtil.icon(item)]) !== null && _a !== void 0 ? _a : lucide_react_1.Sparkles;
|
|
57
|
+
const name = web_share_1.WebShareUtil.name(item) || t('ta.share.thing');
|
|
58
|
+
const pick = (way) => {
|
|
59
|
+
onClose();
|
|
60
|
+
Promise.resolve()
|
|
61
|
+
.then(() => way.share(item))
|
|
62
|
+
.catch(reason => notices.error(reason));
|
|
63
|
+
};
|
|
64
|
+
return (React.createElement(web_dialog_1.WebDialog, { title: t('ta.share.titled', { name }), onClose: onClose },
|
|
65
|
+
React.createElement("div", { className: "ta-share" },
|
|
66
|
+
React.createElement("div", { className: "ta-share-card" },
|
|
67
|
+
React.createElement("div", { className: "ta-share-who" },
|
|
68
|
+
React.createElement("span", { className: "ta-share-face" },
|
|
69
|
+
React.createElement(Icon, { size: 22 })),
|
|
70
|
+
React.createElement("span", { className: "ta-share-who-text" },
|
|
71
|
+
React.createElement("strong", { className: "ta-share-name" }, name),
|
|
72
|
+
React.createElement("span", { className: "ta-share-gets" }, item.kind === 'file' ? t('ta.share.itemFile') : t('ta.share.itemWork'))))),
|
|
73
|
+
taking.length ? (React.createElement("div", { className: "ta-share-tiles" }, taking.map(way => (React.createElement(share_sheet_1.Tile, { key: way.key, icon: way.icon, label: web_share_1.WebShareUtil.label(way), onClick: () => pick(way) }))))) : (React.createElement(empty_state_1.EmptyState, { title: t('ta.share.noWay'), compact: true })))));
|
|
74
|
+
}
|
|
75
|
+
//# 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';
|
|
3
|
+
import type { WebIcon, WebShareSheetProps } from '../extension/web-extension-api';
|
|
4
4
|
import type { TaNotices } from '../notices/notices-protocol';
|
|
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,5 +19,5 @@ 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;
|
|
16
23
|
//# sourceMappingURL=share-sheet.d.ts.map
|
|
@@ -33,9 +33,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.Tile = Tile;
|
|
36
37
|
exports.ShareSheet = ShareSheet;
|
|
37
38
|
const lucide_react_1 = require("lucide-react");
|
|
38
39
|
const React = __importStar(require("react"));
|
|
40
|
+
const share_sheet_compat_1 = require("../extension/share-sheet-compat");
|
|
39
41
|
const use_t_1 = require("../i18n/use-t");
|
|
40
42
|
const empty_state_1 = require("./empty-state");
|
|
41
43
|
const qr_view_1 = require("./qr-view");
|
|
@@ -61,7 +63,7 @@ function Tile({ icon: Icon, label, onClick, disabled }) {
|
|
|
61
63
|
React.createElement(Icon, { size: 20 })),
|
|
62
64
|
React.createElement("span", { className: "ta-share-tile-label" }, label)));
|
|
63
65
|
}
|
|
64
|
-
function ShareSheet({ title, link, error, face, name, gets, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, }) {
|
|
66
|
+
function ShareSheet({ title, link, error, face, name, gets, invite, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, }) {
|
|
65
67
|
const t = (0, use_t_1.useT)();
|
|
66
68
|
const [copied, copy] = useCopied();
|
|
67
69
|
const [stopping, setStopping] = React.useState(false);
|
|
@@ -103,8 +105,8 @@ function ShareSheet({ title, link, error, face, name, gets, notes, password, own
|
|
|
103
105
|
React.createElement("button", { type: "button", className: "ta-button", onClick: () => copy(password, 'password') }, copied === 'password' ? t('ta.share.copied') : t('ta.share.copyPassword')))),
|
|
104
106
|
picking && link && friends ? (React.createElement(share_friends_1.ShareToFriends, { rooms: rooms, notices: notices, friends: friends, link: link, title: name || title, onDone: () => setPicking(false) })) : (React.createElement("div", { className: "ta-share-tiles" },
|
|
105
107
|
canFriends && React.createElement(Tile, { icon: lucide_react_1.Send, label: t('ta.share.friends'), disabled: !link, onClick: () => setPicking(true) }),
|
|
106
|
-
React.createElement(Tile, { icon: copied === 'link' ? lucide_react_1.Check : lucide_react_1.Copy, label: copied === 'link' ? t('ta.share.copied') : t('ta.share.copy'), disabled: !link, onClick: () => link && copy(link, 'link') }),
|
|
107
|
-
canSend && (React.createElement(Tile, { icon: lucide_react_1.Share2, label: t('ta.share.apps'), disabled: !link, onClick: () => link && void navigator.share({ title: name || title, url: link }).catch(() => undefined) })),
|
|
108
|
+
React.createElement(Tile, { icon: copied === 'link' ? lucide_react_1.Check : lucide_react_1.Copy, label: copied === 'link' ? t('ta.share.copied') : t('ta.share.copy'), disabled: !link, onClick: () => link && copy((0, share_sheet_compat_1.shareMessage)(invite, link), 'link') }),
|
|
109
|
+
canSend && (React.createElement(Tile, { icon: lucide_react_1.Share2, label: t('ta.share.apps'), disabled: !link, onClick: () => link && void navigator.share({ title: name || title, text: invite, url: link }).catch(() => undefined) })),
|
|
108
110
|
onRenew && React.createElement(Tile, { icon: lucide_react_1.RefreshCw, label: t('ta.share.renew'), disabled: !link, onClick: onRenew }))),
|
|
109
111
|
children,
|
|
110
112
|
lines.length > 0 && (React.createElement("div", { className: "ta-share-notes" }, lines.map(line => (React.createElement("p", { key: line }, line))))),
|
|
@@ -74,19 +74,19 @@ function SetupForm({ setup, onSave, onCancel }) {
|
|
|
74
74
|
const [busy, setBusy] = React.useState(false);
|
|
75
75
|
const set = (id, value) => setValues(current => ({ ...current, [id]: value }));
|
|
76
76
|
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()));
|
|
77
|
-
return (React.createElement("form", { className: "ta-
|
|
77
|
+
return (React.createElement("form", { className: "ta-form", onSubmit: event => {
|
|
78
78
|
event.preventDefault();
|
|
79
79
|
setBusy(true);
|
|
80
80
|
void onSave(values).finally(() => setBusy(false));
|
|
81
81
|
} },
|
|
82
|
-
[...shape.fields, { id: shape.secret, secret: true }].map(field => { var _a; return (React.createElement("label", { key: field.id, className: "ta-
|
|
83
|
-
React.createElement("span",
|
|
82
|
+
[...shape.fields, { id: shape.secret, secret: true }].map(field => { var _a; return (React.createElement("label", { key: field.id, className: "ta-form-item" },
|
|
83
|
+
React.createElement("span", { className: "ta-form-label" }, t(`ta.signInSetup.field.${field.id}`)),
|
|
84
84
|
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
|
|
85
85
|
? t('ta.signInSetup.secretKept')
|
|
86
86
|
: 'optional' in field && field.optional
|
|
87
87
|
? t('ta.signInSetup.optional')
|
|
88
88
|
: '', autoComplete: "off", spellCheck: false, autoCapitalize: "off", onChange: event => set(field.id, event.target.value) }))); }),
|
|
89
|
-
React.createElement("div", { className: "ta-
|
|
89
|
+
React.createElement("div", { className: "ta-form-actions" },
|
|
90
90
|
React.createElement("button", { type: "button", className: "ta-button", disabled: busy, onClick: onCancel }, t('ta.cancel')),
|
|
91
91
|
React.createElement("button", { type: "submit", className: `ta-button ta-primary${busy ? ' ta-busy' : ''}`, disabled: busy || missing }, t('ta.signInSetup.save')))));
|
|
92
92
|
}
|
|
@@ -59,7 +59,7 @@ function TrustedDomains() {
|
|
|
59
59
|
};
|
|
60
60
|
return (React.createElement(React.Fragment, null,
|
|
61
61
|
React.createElement(settings_controls_1.Row, { label: t('ta.settings.trustedDomains'), description: t('ta.settings.trustedDomainsHint'), stacked: true },
|
|
62
|
-
React.createElement("form", { className: "ta-trusted-add", onSubmit: event => {
|
|
62
|
+
React.createElement("form", { className: "ta-trusted-add ta-form-inline", onSubmit: event => {
|
|
63
63
|
event.preventDefault();
|
|
64
64
|
add();
|
|
65
65
|
} },
|