@celljs/ta-web 4.47.1 → 4.49.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.
Files changed (247) hide show
  1. package/esm/browser/assistant/assistant-role.d.ts +1 -1
  2. package/esm/browser/assistant/assistant-role.js +1 -1
  3. package/esm/browser/assistant/assistant-task-source.js +6 -1
  4. package/esm/browser/assistant/assistant-task-util.d.ts +1 -0
  5. package/esm/browser/assistant/assistant-task-util.js +9 -3
  6. package/esm/browser/assistant/assistant-view.js +4 -2
  7. package/esm/browser/cloud/cloud-sign-in.d.ts +26 -4
  8. package/esm/browser/cloud/cloud-sign-in.js +88 -18
  9. package/esm/browser/components/app-nav.d.ts +3 -1
  10. package/esm/browser/components/app-nav.js +3 -3
  11. package/esm/browser/components/app-view.js +16 -6
  12. package/esm/browser/components/asks-badge.d.ts +12 -0
  13. package/esm/browser/components/asks-badge.js +17 -1
  14. package/esm/browser/components/chat-list-row.d.ts +4 -1
  15. package/esm/browser/components/chat-list-row.js +7 -1
  16. package/esm/browser/components/chats-dot.d.ts +4 -1
  17. package/esm/browser/components/chats-dot.js +6 -2
  18. package/esm/browser/components/cloud-sign-in-view.d.ts +2 -1
  19. package/esm/browser/components/cloud-sign-in-view.js +28 -5
  20. package/esm/browser/components/composer-box-protocol.d.ts +5 -3
  21. package/esm/browser/components/composer-box.js +11 -11
  22. package/esm/browser/components/composer.d.ts +8 -1
  23. package/esm/browser/components/composer.js +57 -34
  24. package/esm/browser/components/host-view.d.ts +1 -1
  25. package/esm/browser/components/lightbox.d.ts +15 -1
  26. package/esm/browser/components/lightbox.js +14 -2
  27. package/esm/browser/components/link.js +8 -3
  28. package/esm/browser/components/markdown.d.ts +4 -2
  29. package/esm/browser/components/markdown.js +13 -4
  30. package/esm/browser/components/media.d.ts +6 -0
  31. package/esm/browser/components/media.js +9 -1
  32. package/esm/browser/components/message-images.d.ts +5 -0
  33. package/esm/browser/components/message-images.js +40 -4
  34. package/esm/browser/components/message-user.js +4 -2
  35. package/esm/browser/components/partner-row.js +4 -4
  36. package/esm/browser/components/phone-shell.d.ts +2 -0
  37. package/esm/browser/components/phone-shell.js +2 -2
  38. package/esm/browser/components/sending.d.ts +19 -0
  39. package/esm/browser/components/sending.js +27 -0
  40. package/esm/browser/components/session-view.js +4 -3
  41. package/esm/browser/components/settings-choices.js +1 -0
  42. package/esm/browser/components/settings-parts.js +28 -17
  43. package/esm/browser/components/share-dialog.js +3 -2
  44. package/esm/browser/components/share-item-sheet.js +1 -1
  45. package/esm/browser/components/share-sheet.d.ts +4 -2
  46. package/esm/browser/components/share-sheet.js +16 -2
  47. package/esm/browser/components/sign-in-accounts.js +7 -1
  48. package/esm/browser/components/unseen-drop.d.ts +2 -2
  49. package/esm/browser/components/unseen-drop.js +1 -1
  50. package/esm/browser/device/app-badge.d.ts +8 -0
  51. package/esm/browser/device/app-badge.js +28 -0
  52. package/esm/browser/device/code-scan.js +1 -1
  53. package/esm/browser/extension/web-api-code.d.ts +26 -0
  54. package/esm/browser/extension/web-api-components.d.ts +31 -0
  55. package/esm/browser/extension/web-api-menus.d.ts +15 -0
  56. package/esm/browser/extension/web-api-messages.d.ts +15 -0
  57. package/esm/browser/extension/web-api-messages.js +2 -0
  58. package/esm/browser/extension/web-api-partners.d.ts +16 -0
  59. package/esm/browser/extension/web-api-spec.js +1 -0
  60. package/esm/browser/extension/web-extension-api.d.ts +7 -13
  61. package/esm/browser/extension/web-extension-context.js +2 -0
  62. package/esm/browser/extension/web-session-notices.js +11 -2
  63. package/esm/browser/extension/web-share-ui.js +1 -0
  64. package/esm/browser/extension/web-share.js +3 -3
  65. package/esm/browser/extension/web-sharing.js +1 -1
  66. package/esm/browser/i18n/en/assistant.d.ts +2 -0
  67. package/esm/browser/i18n/en/assistant.js +2 -0
  68. package/esm/browser/i18n/en/chat.d.ts +11 -0
  69. package/esm/browser/i18n/en/chat.js +13 -2
  70. package/esm/browser/i18n/en/common.d.ts +4 -0
  71. package/esm/browser/i18n/en/common.js +4 -0
  72. package/esm/browser/i18n/en/service.d.ts +5 -0
  73. package/esm/browser/i18n/en/service.js +5 -0
  74. package/esm/browser/i18n/en/settings.d.ts +6 -0
  75. package/esm/browser/i18n/en/settings.js +8 -2
  76. package/esm/browser/i18n/ja/assistant.js +2 -0
  77. package/esm/browser/i18n/ja/chat.js +13 -2
  78. package/esm/browser/i18n/ja/common.js +4 -0
  79. package/esm/browser/i18n/ja/service.js +5 -0
  80. package/esm/browser/i18n/ja/settings.js +10 -4
  81. package/esm/browser/i18n/locales.d.ts +29 -1
  82. package/esm/browser/i18n/messages.d.ts +28 -0
  83. package/esm/browser/i18n/zh/assistant.js +2 -0
  84. package/esm/browser/i18n/zh/chat.js +13 -2
  85. package/esm/browser/i18n/zh/common.js +4 -0
  86. package/esm/browser/i18n/zh/service.js +5 -0
  87. package/esm/browser/i18n/zh/settings.js +8 -2
  88. package/esm/browser/i18n/zh-tw/assistant.js +2 -0
  89. package/esm/browser/i18n/zh-tw/chat.js +13 -2
  90. package/esm/browser/i18n/zh-tw/common.js +4 -0
  91. package/esm/browser/i18n/zh-tw/service.js +5 -0
  92. package/esm/browser/i18n/zh-tw/settings.js +8 -2
  93. package/esm/browser/links/links.js +1 -1
  94. package/esm/browser/notices/session-notices.d.ts +4 -4
  95. package/esm/browser/notices/session-notices.js +3 -6
  96. package/esm/browser/partners/partners-util.d.ts +6 -0
  97. package/esm/browser/partners/partners-util.js +22 -0
  98. package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
  99. package/esm/browser/settings/agent-settings.d.ts +2 -0
  100. package/esm/browser/settings/agent-settings.js +2 -0
  101. package/esm/browser/settings/settings-protocol.d.ts +8 -0
  102. package/esm/browser/settings/settings-protocol.js +5 -0
  103. package/esm/browser/style/base.d.ts +1 -1
  104. package/esm/browser/style/base.js +3 -0
  105. package/esm/browser/style/chat-list.d.ts +1 -1
  106. package/esm/browser/style/chat-list.js +8 -3
  107. package/esm/browser/style/conversation-column.d.ts +1 -1
  108. package/esm/browser/style/conversation-column.js +6 -1
  109. package/esm/browser/style/conversation.d.ts +1 -1
  110. package/esm/browser/style/conversation.js +18 -0
  111. package/esm/browser/style/phone.d.ts +1 -1
  112. package/esm/browser/style/phone.js +2 -0
  113. package/esm/browser/util/composer.d.ts +18 -3
  114. package/esm/browser/util/composer.js +31 -5
  115. package/esm/browser/util/desktop.d.ts +8 -1
  116. package/esm/browser/util/desktop.js +10 -0
  117. package/esm/browser/util/image-shrink.d.ts +5 -1
  118. package/esm/browser/util/image-shrink.js +1 -1
  119. package/esm/browser/util/markdown.d.ts +3 -5
  120. package/esm/browser/util/markdown.js +5 -29
  121. package/esm/browser/util/process.js +2 -2
  122. package/lib/browser/assistant/assistant-role.d.ts +1 -1
  123. package/lib/browser/assistant/assistant-role.js +1 -1
  124. package/lib/browser/assistant/assistant-task-source.js +5 -0
  125. package/lib/browser/assistant/assistant-task-util.d.ts +1 -0
  126. package/lib/browser/assistant/assistant-task-util.js +8 -2
  127. package/lib/browser/assistant/assistant-view.js +4 -2
  128. package/lib/browser/cloud/cloud-sign-in.d.ts +26 -4
  129. package/lib/browser/cloud/cloud-sign-in.js +89 -19
  130. package/lib/browser/components/app-nav.d.ts +3 -1
  131. package/lib/browser/components/app-nav.js +2 -2
  132. package/lib/browser/components/app-view.js +16 -6
  133. package/lib/browser/components/asks-badge.d.ts +12 -0
  134. package/lib/browser/components/asks-badge.js +19 -1
  135. package/lib/browser/components/chat-list-row.d.ts +4 -1
  136. package/lib/browser/components/chat-list-row.js +7 -1
  137. package/lib/browser/components/chats-dot.d.ts +4 -1
  138. package/lib/browser/components/chats-dot.js +6 -2
  139. package/lib/browser/components/cloud-sign-in-view.d.ts +2 -1
  140. package/lib/browser/components/cloud-sign-in-view.js +28 -5
  141. package/lib/browser/components/composer-box-protocol.d.ts +5 -3
  142. package/lib/browser/components/composer-box.js +11 -11
  143. package/lib/browser/components/composer.d.ts +8 -1
  144. package/lib/browser/components/composer.js +56 -33
  145. package/lib/browser/components/host-view.d.ts +1 -1
  146. package/lib/browser/components/lightbox.d.ts +15 -1
  147. package/lib/browser/components/lightbox.js +15 -2
  148. package/lib/browser/components/link.js +8 -3
  149. package/lib/browser/components/markdown.d.ts +4 -2
  150. package/lib/browser/components/markdown.js +11 -2
  151. package/lib/browser/components/media.d.ts +6 -0
  152. package/lib/browser/components/media.js +10 -2
  153. package/lib/browser/components/message-images.d.ts +5 -0
  154. package/lib/browser/components/message-images.js +40 -4
  155. package/lib/browser/components/message-user.js +4 -2
  156. package/lib/browser/components/partner-row.js +4 -4
  157. package/lib/browser/components/phone-shell.d.ts +2 -0
  158. package/lib/browser/components/phone-shell.js +1 -1
  159. package/lib/browser/components/sending.d.ts +20 -0
  160. package/lib/browser/components/sending.js +63 -0
  161. package/lib/browser/components/session-view.js +4 -3
  162. package/lib/browser/components/settings-choices.js +1 -0
  163. package/lib/browser/components/settings-parts.js +26 -15
  164. package/lib/browser/components/share-dialog.js +3 -2
  165. package/lib/browser/components/share-item-sheet.js +1 -1
  166. package/lib/browser/components/share-sheet.d.ts +4 -2
  167. package/lib/browser/components/share-sheet.js +16 -2
  168. package/lib/browser/components/sign-in-accounts.js +7 -1
  169. package/lib/browser/components/unseen-drop.d.ts +2 -2
  170. package/lib/browser/components/unseen-drop.js +1 -1
  171. package/lib/browser/device/app-badge.d.ts +9 -0
  172. package/lib/browser/device/app-badge.js +31 -0
  173. package/lib/browser/device/code-scan.js +1 -1
  174. package/lib/browser/extension/web-api-code.d.ts +26 -0
  175. package/lib/browser/extension/web-api-components.d.ts +31 -0
  176. package/lib/browser/extension/web-api-menus.d.ts +15 -0
  177. package/lib/browser/extension/web-api-messages.d.ts +16 -0
  178. package/lib/browser/extension/web-api-messages.js +3 -0
  179. package/lib/browser/extension/web-api-partners.d.ts +16 -0
  180. package/lib/browser/extension/web-api-spec.js +1 -0
  181. package/lib/browser/extension/web-extension-api.d.ts +7 -13
  182. package/lib/browser/extension/web-extension-context.js +2 -0
  183. package/lib/browser/extension/web-session-notices.js +10 -1
  184. package/lib/browser/extension/web-share-ui.js +1 -0
  185. package/lib/browser/extension/web-share.js +3 -3
  186. package/lib/browser/extension/web-sharing.js +1 -1
  187. package/lib/browser/i18n/en/assistant.d.ts +2 -0
  188. package/lib/browser/i18n/en/assistant.js +2 -0
  189. package/lib/browser/i18n/en/chat.d.ts +11 -0
  190. package/lib/browser/i18n/en/chat.js +13 -2
  191. package/lib/browser/i18n/en/common.d.ts +4 -0
  192. package/lib/browser/i18n/en/common.js +4 -0
  193. package/lib/browser/i18n/en/service.d.ts +5 -0
  194. package/lib/browser/i18n/en/service.js +5 -0
  195. package/lib/browser/i18n/en/settings.d.ts +6 -0
  196. package/lib/browser/i18n/en/settings.js +8 -2
  197. package/lib/browser/i18n/ja/assistant.js +2 -0
  198. package/lib/browser/i18n/ja/chat.js +13 -2
  199. package/lib/browser/i18n/ja/common.js +4 -0
  200. package/lib/browser/i18n/ja/service.js +5 -0
  201. package/lib/browser/i18n/ja/settings.js +10 -4
  202. package/lib/browser/i18n/locales.d.ts +29 -1
  203. package/lib/browser/i18n/messages.d.ts +28 -0
  204. package/lib/browser/i18n/zh/assistant.js +2 -0
  205. package/lib/browser/i18n/zh/chat.js +13 -2
  206. package/lib/browser/i18n/zh/common.js +4 -0
  207. package/lib/browser/i18n/zh/service.js +5 -0
  208. package/lib/browser/i18n/zh/settings.js +8 -2
  209. package/lib/browser/i18n/zh-tw/assistant.js +2 -0
  210. package/lib/browser/i18n/zh-tw/chat.js +13 -2
  211. package/lib/browser/i18n/zh-tw/common.js +4 -0
  212. package/lib/browser/i18n/zh-tw/service.js +5 -0
  213. package/lib/browser/i18n/zh-tw/settings.js +8 -2
  214. package/lib/browser/links/links.js +1 -1
  215. package/lib/browser/notices/session-notices.d.ts +4 -4
  216. package/lib/browser/notices/session-notices.js +3 -6
  217. package/lib/browser/partners/partners-util.d.ts +6 -0
  218. package/lib/browser/partners/partners-util.js +22 -0
  219. package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
  220. package/lib/browser/settings/agent-settings.d.ts +2 -0
  221. package/lib/browser/settings/agent-settings.js +3 -1
  222. package/lib/browser/settings/settings-protocol.d.ts +8 -0
  223. package/lib/browser/settings/settings-protocol.js +6 -1
  224. package/lib/browser/style/base.d.ts +1 -1
  225. package/lib/browser/style/base.js +3 -0
  226. package/lib/browser/style/chat-list.d.ts +1 -1
  227. package/lib/browser/style/chat-list.js +8 -3
  228. package/lib/browser/style/conversation-column.d.ts +1 -1
  229. package/lib/browser/style/conversation-column.js +6 -1
  230. package/lib/browser/style/conversation.d.ts +1 -1
  231. package/lib/browser/style/conversation.js +18 -0
  232. package/lib/browser/style/phone.d.ts +1 -1
  233. package/lib/browser/style/phone.js +2 -0
  234. package/lib/browser/util/composer.d.ts +18 -3
  235. package/lib/browser/util/composer.js +31 -5
  236. package/lib/browser/util/desktop.d.ts +8 -1
  237. package/lib/browser/util/desktop.js +10 -0
  238. package/lib/browser/util/image-shrink.d.ts +5 -1
  239. package/lib/browser/util/image-shrink.js +1 -1
  240. package/lib/browser/util/markdown.d.ts +3 -5
  241. package/lib/browser/util/markdown.js +5 -29
  242. package/lib/browser/util/process.js +1 -1
  243. package/package.json +7 -7
  244. package/esm/browser/util/share-link.d.ts +0 -21
  245. package/esm/browser/util/share-link.js +0 -61
  246. package/lib/browser/util/share-link.d.ts +0 -22
  247. 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
- * The path of a file a target names: a relative or absolute path, or a `file:` URL of this machine;
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.47.1",
3
+ "version": "4.49.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.47.1",
37
- "@celljs/react": "4.47.1",
38
- "@celljs/ta-client": "4.47.1",
39
- "@celljs/ta-protocol": "4.47.1",
40
- "@celljs/ta-relay": "4.47.1",
41
- "@celljs/widget": "4.47.1",
36
+ "@celljs/core": "4.49.0",
37
+ "@celljs/react": "4.49.0",
38
+ "@celljs/ta-client": "4.49.0",
39
+ "@celljs/ta-protocol": "4.49.0",
40
+ "@celljs/ta-relay": "4.49.0",
41
+ "@celljs/widget": "4.49.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