@celljs/ta-web 4.47.1 → 4.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/browser/assistant/assistant-role.d.ts +1 -1
- package/esm/browser/assistant/assistant-role.js +1 -1
- package/esm/browser/assistant/assistant-task-source.js +6 -1
- package/esm/browser/assistant/assistant-task-util.d.ts +1 -0
- package/esm/browser/assistant/assistant-task-util.js +9 -3
- package/esm/browser/assistant/assistant-view.js +4 -2
- package/esm/browser/cloud/cloud-sign-in.d.ts +26 -4
- package/esm/browser/cloud/cloud-sign-in.js +88 -18
- package/esm/browser/components/app-nav.d.ts +3 -1
- package/esm/browser/components/app-nav.js +3 -3
- package/esm/browser/components/app-view.js +16 -6
- package/esm/browser/components/asks-badge.d.ts +12 -0
- package/esm/browser/components/asks-badge.js +17 -1
- package/esm/browser/components/chat-list-row.d.ts +4 -1
- package/esm/browser/components/chat-list-row.js +7 -1
- package/esm/browser/components/chats-dot.d.ts +4 -1
- package/esm/browser/components/chats-dot.js +6 -2
- package/esm/browser/components/cloud-sign-in-view.d.ts +2 -1
- package/esm/browser/components/cloud-sign-in-view.js +28 -5
- package/esm/browser/components/composer-box-protocol.d.ts +5 -3
- package/esm/browser/components/composer-box.js +11 -11
- package/esm/browser/components/composer.d.ts +8 -1
- package/esm/browser/components/composer.js +57 -34
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/lightbox.d.ts +15 -1
- package/esm/browser/components/lightbox.js +14 -2
- package/esm/browser/components/link.js +8 -3
- package/esm/browser/components/markdown.d.ts +4 -2
- package/esm/browser/components/markdown.js +13 -4
- package/esm/browser/components/media.d.ts +6 -0
- package/esm/browser/components/media.js +9 -1
- package/esm/browser/components/message-images.d.ts +5 -0
- package/esm/browser/components/message-images.js +40 -4
- package/esm/browser/components/message-user.js +4 -2
- package/esm/browser/components/partner-row.js +4 -4
- package/esm/browser/components/phone-shell.d.ts +2 -0
- package/esm/browser/components/phone-shell.js +2 -2
- package/esm/browser/components/sending.d.ts +19 -0
- package/esm/browser/components/sending.js +27 -0
- package/esm/browser/components/session-view.js +4 -3
- package/esm/browser/components/settings-choices.js +1 -0
- package/esm/browser/components/settings-parts.js +28 -17
- package/esm/browser/components/share-dialog.js +3 -2
- package/esm/browser/components/share-item-sheet.js +1 -1
- package/esm/browser/components/share-sheet.d.ts +4 -2
- package/esm/browser/components/share-sheet.js +16 -2
- package/esm/browser/components/sign-in-accounts.js +7 -1
- package/esm/browser/components/unseen-drop.d.ts +2 -2
- package/esm/browser/components/unseen-drop.js +1 -1
- package/esm/browser/device/app-badge.d.ts +8 -0
- package/esm/browser/device/app-badge.js +28 -0
- package/esm/browser/device/code-scan.js +1 -1
- package/esm/browser/extension/web-api-code.d.ts +26 -0
- package/esm/browser/extension/web-api-components.d.ts +31 -0
- package/esm/browser/extension/web-api-menus.d.ts +15 -0
- package/esm/browser/extension/web-api-messages.d.ts +15 -0
- package/esm/browser/extension/web-api-messages.js +2 -0
- package/esm/browser/extension/web-api-partners.d.ts +16 -0
- package/esm/browser/extension/web-api-spec.js +1 -0
- package/esm/browser/extension/web-extension-api.d.ts +7 -13
- package/esm/browser/extension/web-extension-context.js +2 -0
- package/esm/browser/extension/web-session-notices.js +11 -2
- package/esm/browser/extension/web-share-ui.js +1 -0
- package/esm/browser/extension/web-share.js +3 -3
- package/esm/browser/extension/web-sharing.js +1 -1
- package/esm/browser/i18n/en/assistant.d.ts +2 -0
- package/esm/browser/i18n/en/assistant.js +2 -0
- package/esm/browser/i18n/en/chat.d.ts +11 -0
- package/esm/browser/i18n/en/chat.js +13 -2
- package/esm/browser/i18n/en/common.d.ts +4 -0
- package/esm/browser/i18n/en/common.js +4 -0
- package/esm/browser/i18n/en/service.d.ts +5 -0
- package/esm/browser/i18n/en/service.js +5 -0
- package/esm/browser/i18n/en/settings.d.ts +6 -0
- package/esm/browser/i18n/en/settings.js +8 -2
- package/esm/browser/i18n/ja/assistant.js +2 -0
- package/esm/browser/i18n/ja/chat.js +13 -2
- package/esm/browser/i18n/ja/common.js +4 -0
- package/esm/browser/i18n/ja/service.js +5 -0
- package/esm/browser/i18n/ja/settings.js +10 -4
- package/esm/browser/i18n/locales.d.ts +29 -1
- package/esm/browser/i18n/messages.d.ts +28 -0
- package/esm/browser/i18n/zh/assistant.js +2 -0
- package/esm/browser/i18n/zh/chat.js +13 -2
- package/esm/browser/i18n/zh/common.js +4 -0
- package/esm/browser/i18n/zh/service.js +5 -0
- package/esm/browser/i18n/zh/settings.js +8 -2
- package/esm/browser/i18n/zh-tw/assistant.js +2 -0
- package/esm/browser/i18n/zh-tw/chat.js +13 -2
- package/esm/browser/i18n/zh-tw/common.js +4 -0
- package/esm/browser/i18n/zh-tw/service.js +5 -0
- package/esm/browser/i18n/zh-tw/settings.js +8 -2
- package/esm/browser/links/links.js +1 -1
- package/esm/browser/notices/session-notices.d.ts +4 -4
- package/esm/browser/notices/session-notices.js +3 -6
- package/esm/browser/partners/partners-util.d.ts +6 -0
- package/esm/browser/partners/partners-util.js +22 -0
- package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/esm/browser/settings/agent-settings.d.ts +2 -0
- package/esm/browser/settings/agent-settings.js +2 -0
- package/esm/browser/settings/settings-protocol.d.ts +8 -0
- package/esm/browser/settings/settings-protocol.js +5 -0
- package/esm/browser/style/base.d.ts +1 -1
- package/esm/browser/style/base.js +3 -0
- package/esm/browser/style/chat-list.d.ts +1 -1
- package/esm/browser/style/chat-list.js +8 -3
- package/esm/browser/style/conversation-column.d.ts +1 -1
- package/esm/browser/style/conversation-column.js +6 -1
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +18 -0
- package/esm/browser/style/phone.d.ts +1 -1
- package/esm/browser/style/phone.js +2 -0
- package/esm/browser/util/composer.d.ts +18 -3
- package/esm/browser/util/composer.js +31 -5
- package/esm/browser/util/desktop.d.ts +8 -1
- package/esm/browser/util/desktop.js +10 -0
- package/esm/browser/util/image-shrink.d.ts +5 -1
- package/esm/browser/util/image-shrink.js +1 -1
- package/esm/browser/util/markdown.d.ts +3 -5
- package/esm/browser/util/markdown.js +5 -29
- package/esm/browser/util/process.js +2 -2
- package/lib/browser/assistant/assistant-role.d.ts +1 -1
- package/lib/browser/assistant/assistant-role.js +1 -1
- package/lib/browser/assistant/assistant-task-source.js +5 -0
- package/lib/browser/assistant/assistant-task-util.d.ts +1 -0
- package/lib/browser/assistant/assistant-task-util.js +8 -2
- package/lib/browser/assistant/assistant-view.js +4 -2
- package/lib/browser/cloud/cloud-sign-in.d.ts +26 -4
- package/lib/browser/cloud/cloud-sign-in.js +89 -19
- package/lib/browser/components/app-nav.d.ts +3 -1
- package/lib/browser/components/app-nav.js +2 -2
- package/lib/browser/components/app-view.js +16 -6
- package/lib/browser/components/asks-badge.d.ts +12 -0
- package/lib/browser/components/asks-badge.js +19 -1
- package/lib/browser/components/chat-list-row.d.ts +4 -1
- package/lib/browser/components/chat-list-row.js +7 -1
- package/lib/browser/components/chats-dot.d.ts +4 -1
- package/lib/browser/components/chats-dot.js +6 -2
- package/lib/browser/components/cloud-sign-in-view.d.ts +2 -1
- package/lib/browser/components/cloud-sign-in-view.js +28 -5
- package/lib/browser/components/composer-box-protocol.d.ts +5 -3
- package/lib/browser/components/composer-box.js +11 -11
- package/lib/browser/components/composer.d.ts +8 -1
- package/lib/browser/components/composer.js +56 -33
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/lightbox.d.ts +15 -1
- package/lib/browser/components/lightbox.js +15 -2
- package/lib/browser/components/link.js +8 -3
- package/lib/browser/components/markdown.d.ts +4 -2
- package/lib/browser/components/markdown.js +11 -2
- package/lib/browser/components/media.d.ts +6 -0
- package/lib/browser/components/media.js +10 -2
- package/lib/browser/components/message-images.d.ts +5 -0
- package/lib/browser/components/message-images.js +40 -4
- package/lib/browser/components/message-user.js +4 -2
- package/lib/browser/components/partner-row.js +4 -4
- package/lib/browser/components/phone-shell.d.ts +2 -0
- package/lib/browser/components/phone-shell.js +1 -1
- package/lib/browser/components/sending.d.ts +20 -0
- package/lib/browser/components/sending.js +63 -0
- package/lib/browser/components/session-view.js +4 -3
- package/lib/browser/components/settings-choices.js +1 -0
- package/lib/browser/components/settings-parts.js +26 -15
- package/lib/browser/components/share-dialog.js +3 -2
- package/lib/browser/components/share-item-sheet.js +1 -1
- package/lib/browser/components/share-sheet.d.ts +4 -2
- package/lib/browser/components/share-sheet.js +16 -2
- package/lib/browser/components/sign-in-accounts.js +7 -1
- package/lib/browser/components/unseen-drop.d.ts +2 -2
- package/lib/browser/components/unseen-drop.js +1 -1
- package/lib/browser/device/app-badge.d.ts +9 -0
- package/lib/browser/device/app-badge.js +31 -0
- package/lib/browser/device/code-scan.js +1 -1
- package/lib/browser/extension/web-api-code.d.ts +26 -0
- package/lib/browser/extension/web-api-components.d.ts +31 -0
- package/lib/browser/extension/web-api-menus.d.ts +15 -0
- package/lib/browser/extension/web-api-messages.d.ts +16 -0
- package/lib/browser/extension/web-api-messages.js +3 -0
- package/lib/browser/extension/web-api-partners.d.ts +16 -0
- package/lib/browser/extension/web-api-spec.js +1 -0
- package/lib/browser/extension/web-extension-api.d.ts +7 -13
- package/lib/browser/extension/web-extension-context.js +2 -0
- package/lib/browser/extension/web-session-notices.js +10 -1
- package/lib/browser/extension/web-share-ui.js +1 -0
- package/lib/browser/extension/web-share.js +3 -3
- package/lib/browser/extension/web-sharing.js +1 -1
- package/lib/browser/i18n/en/assistant.d.ts +2 -0
- package/lib/browser/i18n/en/assistant.js +2 -0
- package/lib/browser/i18n/en/chat.d.ts +11 -0
- package/lib/browser/i18n/en/chat.js +13 -2
- package/lib/browser/i18n/en/common.d.ts +4 -0
- package/lib/browser/i18n/en/common.js +4 -0
- package/lib/browser/i18n/en/service.d.ts +5 -0
- package/lib/browser/i18n/en/service.js +5 -0
- package/lib/browser/i18n/en/settings.d.ts +6 -0
- package/lib/browser/i18n/en/settings.js +8 -2
- package/lib/browser/i18n/ja/assistant.js +2 -0
- package/lib/browser/i18n/ja/chat.js +13 -2
- package/lib/browser/i18n/ja/common.js +4 -0
- package/lib/browser/i18n/ja/service.js +5 -0
- package/lib/browser/i18n/ja/settings.js +10 -4
- package/lib/browser/i18n/locales.d.ts +29 -1
- package/lib/browser/i18n/messages.d.ts +28 -0
- package/lib/browser/i18n/zh/assistant.js +2 -0
- package/lib/browser/i18n/zh/chat.js +13 -2
- package/lib/browser/i18n/zh/common.js +4 -0
- package/lib/browser/i18n/zh/service.js +5 -0
- package/lib/browser/i18n/zh/settings.js +8 -2
- package/lib/browser/i18n/zh-tw/assistant.js +2 -0
- package/lib/browser/i18n/zh-tw/chat.js +13 -2
- package/lib/browser/i18n/zh-tw/common.js +4 -0
- package/lib/browser/i18n/zh-tw/service.js +5 -0
- package/lib/browser/i18n/zh-tw/settings.js +8 -2
- package/lib/browser/links/links.js +1 -1
- package/lib/browser/notices/session-notices.d.ts +4 -4
- package/lib/browser/notices/session-notices.js +3 -6
- package/lib/browser/partners/partners-util.d.ts +6 -0
- package/lib/browser/partners/partners-util.js +22 -0
- package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/lib/browser/settings/agent-settings.d.ts +2 -0
- package/lib/browser/settings/agent-settings.js +3 -1
- package/lib/browser/settings/settings-protocol.d.ts +8 -0
- package/lib/browser/settings/settings-protocol.js +6 -1
- package/lib/browser/style/base.d.ts +1 -1
- package/lib/browser/style/base.js +3 -0
- package/lib/browser/style/chat-list.d.ts +1 -1
- package/lib/browser/style/chat-list.js +8 -3
- package/lib/browser/style/conversation-column.d.ts +1 -1
- package/lib/browser/style/conversation-column.js +6 -1
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +18 -0
- package/lib/browser/style/phone.d.ts +1 -1
- package/lib/browser/style/phone.js +2 -0
- package/lib/browser/util/composer.d.ts +18 -3
- package/lib/browser/util/composer.js +31 -5
- package/lib/browser/util/desktop.d.ts +8 -1
- package/lib/browser/util/desktop.js +10 -0
- package/lib/browser/util/image-shrink.d.ts +5 -1
- package/lib/browser/util/image-shrink.js +1 -1
- package/lib/browser/util/markdown.d.ts +3 -5
- package/lib/browser/util/markdown.js +5 -29
- package/lib/browser/util/process.js +1 -1
- package/package.json +7 -7
- package/esm/browser/util/share-link.d.ts +0 -21
- package/esm/browser/util/share-link.js +0 -61
- package/lib/browser/util/share-link.d.ts +0 -22
- package/lib/browser/util/share-link.js +0 -64
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MarkdownUtil = exports.MARKDOWN_TINTS = exports.CALLOUT_KINDS = void 0;
|
|
4
|
+
const local_refs_1 = require("@celljs/ta-protocol/lib/common/local-refs");
|
|
4
5
|
const link_1 = require("./link");
|
|
5
6
|
exports.CALLOUT_KINDS = ['note', 'tip', 'important', 'warning', 'caution'];
|
|
6
7
|
exports.MARKDOWN_TINTS = ['red', 'orange', 'yellow', 'green', 'blue', 'purple', 'gray'];
|
|
@@ -10,7 +11,6 @@ const RULE = /^\s*([-*_])(\s*\1){2,}\s*$/;
|
|
|
10
11
|
const BULLET = /^\s*[-*+]\s+(.*)$/;
|
|
11
12
|
const NUMBERED = /^\s*\d+[.)]\s+(.*)$/;
|
|
12
13
|
const TABLE_SEPARATOR = /^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)*\|?\s*$/;
|
|
13
|
-
const SCHEME = /^[a-z][a-z\d+.-]*:/i;
|
|
14
14
|
/** Data URLs of media, which show without a request; scripts in an SVG image do not run. */
|
|
15
15
|
const DATA_MEDIA = /^data:(image|video|audio)\/[\w.+-]+[;,]/i;
|
|
16
16
|
const EXTENSIONS = {
|
|
@@ -382,7 +382,7 @@ var MarkdownUtil;
|
|
|
382
382
|
if (link) {
|
|
383
383
|
const href = (_d = link[2]) !== null && _d !== void 0 ? _d : link[3];
|
|
384
384
|
const target = link_1.LinkUtil.parse(href);
|
|
385
|
-
if ((target === null || target === void 0 ? void 0 : target.type) === 'path' && !target.selection && localPath(href) !== undefined && media(href, false)) {
|
|
385
|
+
if ((target === null || target === void 0 ? void 0 : target.type) === 'path' && !target.selection && MarkdownUtil.localPath(href) !== undefined && media(href, false)) {
|
|
386
386
|
// A link to a picture or a video of the workspace shows it.
|
|
387
387
|
push({ type: 'media', src: href, alt: link[1] });
|
|
388
388
|
}
|
|
@@ -432,39 +432,15 @@ var MarkdownUtil;
|
|
|
432
432
|
if (data) {
|
|
433
433
|
return data[1].toLowerCase();
|
|
434
434
|
}
|
|
435
|
-
if (!/^https?:/i.test(src) && localPath(src) === undefined) {
|
|
435
|
+
if (!/^https?:/i.test(src) && MarkdownUtil.localPath(src) === undefined) {
|
|
436
436
|
return undefined;
|
|
437
437
|
}
|
|
438
438
|
const extension = (_a = /\.(\w+)$/.exec(src.split(/[?#]/)[0])) === null || _a === void 0 ? void 0 : _a[1].toLowerCase();
|
|
439
439
|
return (extension && EXTENSIONS[extension]) || (guess ? 'image' : undefined);
|
|
440
440
|
}
|
|
441
441
|
MarkdownUtil.media = media;
|
|
442
|
-
/**
|
|
443
|
-
|
|
444
|
-
* undefined for URLs, which the page loads as they are.
|
|
445
|
-
*/
|
|
446
|
-
function localPath(src) {
|
|
447
|
-
let path = src;
|
|
448
|
-
if (/^file:/i.test(src)) {
|
|
449
|
-
const url = /^file:\/\/(?:localhost)?(\/[^?#]*)/i.exec(src);
|
|
450
|
-
if (!url) {
|
|
451
|
-
return undefined;
|
|
452
|
-
}
|
|
453
|
-
path = url[1];
|
|
454
|
-
}
|
|
455
|
-
else if (SCHEME.test(src) || src.startsWith('//')) {
|
|
456
|
-
return undefined;
|
|
457
|
-
}
|
|
458
|
-
path = path.split(/[?#]/)[0];
|
|
459
|
-
try {
|
|
460
|
-
path = decodeURI(path);
|
|
461
|
-
}
|
|
462
|
-
catch (_a) {
|
|
463
|
-
// Kept as written.
|
|
464
|
-
}
|
|
465
|
-
return path || undefined;
|
|
466
|
-
}
|
|
467
|
-
MarkdownUtil.localPath = localPath;
|
|
442
|
+
/** The path of a file a target names (LocalRefs.localPath); undefined for URLs, which the page loads as they are. */
|
|
443
|
+
MarkdownUtil.localPath = local_refs_1.LocalRefs.localPath;
|
|
468
444
|
/** `$$` or `\\[` starting at line `start`: its block and the line it ends on. */
|
|
469
445
|
function mathBlock(lines, start) {
|
|
470
446
|
const first = lines[start].trim();
|
|
@@ -198,7 +198,7 @@ var ProcessUtil;
|
|
|
198
198
|
steps.push({ kind: 'summary', key, text: summary });
|
|
199
199
|
return;
|
|
200
200
|
}
|
|
201
|
-
const { said, told } = ta_protocol_1.TaPictureNote.take(block.text);
|
|
201
|
+
const { said, told } = ta_protocol_1.TaPictureNote.take(ta_protocol_1.TaMessageContext.echoed(ta_protocol_1.TaToolLeak.strip(block.text)));
|
|
202
202
|
if (told.size) {
|
|
203
203
|
steps.push({ kind: 'pictures', key: `${key}.p`, told: [...told] });
|
|
204
204
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-web",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.48.0",
|
|
4
4
|
"description": "The web client of ta serve: sessions, streaming messages, tool runs with diffs, and dialogs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cell-component"
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@celljs/core": "4.
|
|
37
|
-
"@celljs/react": "4.
|
|
38
|
-
"@celljs/ta-client": "4.
|
|
39
|
-
"@celljs/ta-protocol": "4.
|
|
40
|
-
"@celljs/ta-relay": "4.
|
|
41
|
-
"@celljs/widget": "4.
|
|
36
|
+
"@celljs/core": "4.48.0",
|
|
37
|
+
"@celljs/react": "4.48.0",
|
|
38
|
+
"@celljs/ta-client": "4.48.0",
|
|
39
|
+
"@celljs/ta-protocol": "4.48.0",
|
|
40
|
+
"@celljs/ta-relay": "4.48.0",
|
|
41
|
+
"@celljs/widget": "4.48.0",
|
|
42
42
|
"@types/three": "^0.187.0",
|
|
43
43
|
"@xterm/addon-fit": "^0.11.0",
|
|
44
44
|
"@xterm/addon-unicode11": "^0.9.0",
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Links of extensions (ta-launcher.md): `ta://open?source=<source>` carries where an extension comes from, a
|
|
3
|
-
* package of npm or Git, or a link of the relay to a package of someone's computer (TaRelayServer.sharePackage).
|
|
4
|
-
* Pure, for the tests.
|
|
5
|
-
*/
|
|
6
|
-
export declare namespace ShareLinkUtil {
|
|
7
|
-
function link(source: string): string;
|
|
8
|
-
/** A link of the relay to a package of someone's computer: it works while that computer runs Ta. */
|
|
9
|
-
function relayed(source: string): boolean;
|
|
10
|
-
/** A source anyone can open by itself, without the computer it came from: npm or Git. */
|
|
11
|
-
function published(source: string | undefined): source is string;
|
|
12
|
-
/** What a link, `#open=<source>` of an address of Ta Web, or a source itself carries; undefined for anything else (a path of this computer too). */
|
|
13
|
-
function sourceOf(text: string): string | undefined;
|
|
14
|
-
/**
|
|
15
|
-
* Whether a link brings an extension: `ta://open?source=`, `#open=` of an address of Ta Web, a source of npm or Git
|
|
16
|
-
* that is not a plain page of the web, or a link of the relay to a package of someone's computer.
|
|
17
|
-
*/
|
|
18
|
-
function ofExtension(text: string): boolean;
|
|
19
|
-
/** The name a link of the relay gives its package, to ask about before it comes. */
|
|
20
|
-
function nameOf(source: string): string | undefined;
|
|
21
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Links of extensions (ta-launcher.md): `ta://open?source=<source>` carries where an extension comes from, a
|
|
3
|
-
* package of npm or Git, or a link of the relay to a package of someone's computer (TaRelayServer.sharePackage).
|
|
4
|
-
* Pure, for the tests.
|
|
5
|
-
*/
|
|
6
|
-
export var ShareLinkUtil;
|
|
7
|
-
(function (ShareLinkUtil) {
|
|
8
|
-
const RELAYED = /^https?:\/\/[^/\s]+\/share#v=1&/i;
|
|
9
|
-
const PUBLISHED = /^(npm:\S+|git:\S+|git@\S+|https?:\/\/\S+)$/i;
|
|
10
|
-
function link(source) {
|
|
11
|
-
return `ta://open?source=${encodeURIComponent(source)}`;
|
|
12
|
-
}
|
|
13
|
-
ShareLinkUtil.link = link;
|
|
14
|
-
/** A link of the relay to a package of someone's computer: it works while that computer runs Ta. */
|
|
15
|
-
function relayed(source) {
|
|
16
|
-
return RELAYED.test(source);
|
|
17
|
-
}
|
|
18
|
-
ShareLinkUtil.relayed = relayed;
|
|
19
|
-
/** A source anyone can open by itself, without the computer it came from: npm or Git. */
|
|
20
|
-
function published(source) {
|
|
21
|
-
return !!source && PUBLISHED.test(source) && !relayed(source);
|
|
22
|
-
}
|
|
23
|
-
ShareLinkUtil.published = published;
|
|
24
|
-
/** What a link, `#open=<source>` of an address of Ta Web, or a source itself carries; undefined for anything else (a path of this computer too). */
|
|
25
|
-
function sourceOf(text) {
|
|
26
|
-
var _a;
|
|
27
|
-
const trimmed = text.trim();
|
|
28
|
-
const found = (_a = /^ta:\/\/open\?(?:[^#]*&)?source=([^&#]+)/i.exec(trimmed)) !== null && _a !== void 0 ? _a : /#open=([^&]+)$/.exec(trimmed);
|
|
29
|
-
let source = trimmed;
|
|
30
|
-
if (found) {
|
|
31
|
-
try {
|
|
32
|
-
source = decodeURIComponent(found[1]).trim();
|
|
33
|
-
}
|
|
34
|
-
catch (_b) {
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return PUBLISHED.test(source) ? source : undefined;
|
|
39
|
-
}
|
|
40
|
-
ShareLinkUtil.sourceOf = sourceOf;
|
|
41
|
-
/**
|
|
42
|
-
* Whether a link brings an extension: `ta://open?source=`, `#open=` of an address of Ta Web, a source of npm or Git
|
|
43
|
-
* that is not a plain page of the web, or a link of the relay to a package of someone's computer.
|
|
44
|
-
*/
|
|
45
|
-
function ofExtension(text) {
|
|
46
|
-
const trimmed = text.trim();
|
|
47
|
-
const source = sourceOf(trimmed);
|
|
48
|
-
return !!source && (source !== trimmed || !/^https?:\/\/\S+$/i.test(trimmed) || relayed(trimmed));
|
|
49
|
-
}
|
|
50
|
-
ShareLinkUtil.ofExtension = ofExtension;
|
|
51
|
-
/** The name a link of the relay gives its package, to ask about before it comes. */
|
|
52
|
-
function nameOf(source) {
|
|
53
|
-
var _a;
|
|
54
|
-
if (!relayed(source)) {
|
|
55
|
-
return undefined;
|
|
56
|
-
}
|
|
57
|
-
return (_a = new URLSearchParams(source.slice(source.indexOf('#') + 1)).get('n')) !== null && _a !== void 0 ? _a : undefined;
|
|
58
|
-
}
|
|
59
|
-
ShareLinkUtil.nameOf = nameOf;
|
|
60
|
-
})(ShareLinkUtil || (ShareLinkUtil = {}));
|
|
61
|
-
//# sourceMappingURL=share-link.js.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Links of extensions (ta-launcher.md): `ta://open?source=<source>` carries where an extension comes from, a
|
|
3
|
-
* package of npm or Git, or a link of the relay to a package of someone's computer (TaRelayServer.sharePackage).
|
|
4
|
-
* Pure, for the tests.
|
|
5
|
-
*/
|
|
6
|
-
export declare namespace ShareLinkUtil {
|
|
7
|
-
function link(source: string): string;
|
|
8
|
-
/** A link of the relay to a package of someone's computer: it works while that computer runs Ta. */
|
|
9
|
-
function relayed(source: string): boolean;
|
|
10
|
-
/** A source anyone can open by itself, without the computer it came from: npm or Git. */
|
|
11
|
-
function published(source: string | undefined): source is string;
|
|
12
|
-
/** What a link, `#open=<source>` of an address of Ta Web, or a source itself carries; undefined for anything else (a path of this computer too). */
|
|
13
|
-
function sourceOf(text: string): string | undefined;
|
|
14
|
-
/**
|
|
15
|
-
* Whether a link brings an extension: `ta://open?source=`, `#open=` of an address of Ta Web, a source of npm or Git
|
|
16
|
-
* that is not a plain page of the web, or a link of the relay to a package of someone's computer.
|
|
17
|
-
*/
|
|
18
|
-
function ofExtension(text: string): boolean;
|
|
19
|
-
/** The name a link of the relay gives its package, to ask about before it comes. */
|
|
20
|
-
function nameOf(source: string): string | undefined;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=share-link.d.ts.map
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ShareLinkUtil = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Links of extensions (ta-launcher.md): `ta://open?source=<source>` carries where an extension comes from, a
|
|
6
|
-
* package of npm or Git, or a link of the relay to a package of someone's computer (TaRelayServer.sharePackage).
|
|
7
|
-
* Pure, for the tests.
|
|
8
|
-
*/
|
|
9
|
-
var ShareLinkUtil;
|
|
10
|
-
(function (ShareLinkUtil) {
|
|
11
|
-
const RELAYED = /^https?:\/\/[^/\s]+\/share#v=1&/i;
|
|
12
|
-
const PUBLISHED = /^(npm:\S+|git:\S+|git@\S+|https?:\/\/\S+)$/i;
|
|
13
|
-
function link(source) {
|
|
14
|
-
return `ta://open?source=${encodeURIComponent(source)}`;
|
|
15
|
-
}
|
|
16
|
-
ShareLinkUtil.link = link;
|
|
17
|
-
/** A link of the relay to a package of someone's computer: it works while that computer runs Ta. */
|
|
18
|
-
function relayed(source) {
|
|
19
|
-
return RELAYED.test(source);
|
|
20
|
-
}
|
|
21
|
-
ShareLinkUtil.relayed = relayed;
|
|
22
|
-
/** A source anyone can open by itself, without the computer it came from: npm or Git. */
|
|
23
|
-
function published(source) {
|
|
24
|
-
return !!source && PUBLISHED.test(source) && !relayed(source);
|
|
25
|
-
}
|
|
26
|
-
ShareLinkUtil.published = published;
|
|
27
|
-
/** What a link, `#open=<source>` of an address of Ta Web, or a source itself carries; undefined for anything else (a path of this computer too). */
|
|
28
|
-
function sourceOf(text) {
|
|
29
|
-
var _a;
|
|
30
|
-
const trimmed = text.trim();
|
|
31
|
-
const found = (_a = /^ta:\/\/open\?(?:[^#]*&)?source=([^&#]+)/i.exec(trimmed)) !== null && _a !== void 0 ? _a : /#open=([^&]+)$/.exec(trimmed);
|
|
32
|
-
let source = trimmed;
|
|
33
|
-
if (found) {
|
|
34
|
-
try {
|
|
35
|
-
source = decodeURIComponent(found[1]).trim();
|
|
36
|
-
}
|
|
37
|
-
catch (_b) {
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return PUBLISHED.test(source) ? source : undefined;
|
|
42
|
-
}
|
|
43
|
-
ShareLinkUtil.sourceOf = sourceOf;
|
|
44
|
-
/**
|
|
45
|
-
* Whether a link brings an extension: `ta://open?source=`, `#open=` of an address of Ta Web, a source of npm or Git
|
|
46
|
-
* that is not a plain page of the web, or a link of the relay to a package of someone's computer.
|
|
47
|
-
*/
|
|
48
|
-
function ofExtension(text) {
|
|
49
|
-
const trimmed = text.trim();
|
|
50
|
-
const source = sourceOf(trimmed);
|
|
51
|
-
return !!source && (source !== trimmed || !/^https?:\/\/\S+$/i.test(trimmed) || relayed(trimmed));
|
|
52
|
-
}
|
|
53
|
-
ShareLinkUtil.ofExtension = ofExtension;
|
|
54
|
-
/** The name a link of the relay gives its package, to ask about before it comes. */
|
|
55
|
-
function nameOf(source) {
|
|
56
|
-
var _a;
|
|
57
|
-
if (!relayed(source)) {
|
|
58
|
-
return undefined;
|
|
59
|
-
}
|
|
60
|
-
return (_a = new URLSearchParams(source.slice(source.indexOf('#') + 1)).get('n')) !== null && _a !== void 0 ? _a : undefined;
|
|
61
|
-
}
|
|
62
|
-
ShareLinkUtil.nameOf = nameOf;
|
|
63
|
-
})(ShareLinkUtil || (exports.ShareLinkUtil = ShareLinkUtil = {}));
|
|
64
|
-
//# sourceMappingURL=share-link.js.map
|