@celljs/ta-relay 4.17.0 → 4.18.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 (68) hide show
  1. package/esm/common/index.d.ts +1 -0
  2. package/esm/common/index.js +1 -0
  3. package/esm/common/relay-faces.d.ts +1 -1
  4. package/esm/common/relay-faces.js +56 -1
  5. package/esm/common/relay-files.d.ts +14 -3
  6. package/esm/common/relay-files.js +41 -16
  7. package/esm/common/relay-friend-sends.d.ts +64 -0
  8. package/esm/common/relay-friend-sends.js +126 -0
  9. package/esm/common/relay-group-invites.d.ts +76 -0
  10. package/esm/common/relay-group-invites.js +163 -0
  11. package/esm/common/relay-hubs-protocol.d.ts +3 -1
  12. package/esm/common/relay-hubs.d.ts +19 -0
  13. package/esm/common/relay-hubs.js +58 -0
  14. package/esm/common/relay-open-in-ta.d.ts +11 -0
  15. package/esm/common/relay-open-in-ta.js +34 -0
  16. package/esm/common/relay-protocol.d.ts +2 -2
  17. package/esm/common/relay-protocol.js +5 -2
  18. package/esm/guest/guest-i18n.d.ts +1 -0
  19. package/esm/guest/guest-i18n.js +45 -41
  20. package/esm/guest/guest-style.d.ts +1 -1
  21. package/esm/guest/guest-style.js +2 -0
  22. package/esm/guest/guest.js +7 -2
  23. package/esm/join/join-i18n.d.ts +1 -0
  24. package/esm/join/join-i18n.js +4 -0
  25. package/esm/join/join.js +4 -1
  26. package/esm/node/relay-files-host.d.ts +2 -0
  27. package/esm/node/relay-files-host.js +24 -5
  28. package/esm/viewer/viewer-i18n.d.ts +1 -0
  29. package/esm/viewer/viewer-i18n.js +4 -0
  30. package/esm/viewer/viewer-style.d.ts +1 -1
  31. package/esm/viewer/viewer-style.js +2 -0
  32. package/esm/viewer/viewer.js +3 -1
  33. package/lib/common/index.d.ts +1 -0
  34. package/lib/common/index.js +1 -0
  35. package/lib/common/relay-faces.d.ts +1 -1
  36. package/lib/common/relay-faces.js +56 -1
  37. package/lib/common/relay-files.d.ts +14 -3
  38. package/lib/common/relay-files.js +42 -17
  39. package/lib/common/relay-friend-sends.d.ts +65 -0
  40. package/lib/common/relay-friend-sends.js +130 -0
  41. package/lib/common/relay-group-invites.d.ts +77 -0
  42. package/lib/common/relay-group-invites.js +167 -0
  43. package/lib/common/relay-hubs-protocol.d.ts +3 -1
  44. package/lib/common/relay-hubs.d.ts +19 -0
  45. package/lib/common/relay-hubs.js +58 -0
  46. package/lib/common/relay-open-in-ta.d.ts +12 -0
  47. package/lib/common/relay-open-in-ta.js +37 -0
  48. package/lib/common/relay-protocol.d.ts +2 -2
  49. package/lib/common/relay-protocol.js +5 -2
  50. package/lib/guest/guest-i18n.d.ts +1 -0
  51. package/lib/guest/guest-i18n.js +45 -41
  52. package/lib/guest/guest-style.d.ts +1 -1
  53. package/lib/guest/guest-style.js +2 -0
  54. package/lib/guest/guest.js +7 -2
  55. package/lib/join/join-i18n.d.ts +1 -0
  56. package/lib/join/join-i18n.js +4 -0
  57. package/lib/join/join.js +4 -1
  58. package/lib/node/relay-files-host.d.ts +2 -0
  59. package/lib/node/relay-files-host.js +23 -4
  60. package/lib/viewer/viewer-i18n.d.ts +1 -0
  61. package/lib/viewer/viewer-i18n.js +4 -0
  62. package/lib/viewer/viewer-style.d.ts +1 -1
  63. package/lib/viewer/viewer-style.js +2 -0
  64. package/lib/viewer/viewer.js +3 -1
  65. package/package.json +3 -3
  66. package/viewer/join.html +12 -3
  67. package/viewer/page.html +18 -9
  68. package/viewer/room.html +19 -8
@@ -1 +1 @@
1
- export declare const GUEST_STYLE = "\n:root{color-scheme:light dark;--bg:#fff;--fg:#1f1f1f;--muted:#737373;--faint:#a3a3a3;--line:#ececec;--soft:#f5f5f5;--bubble:#f2f2f2;--mine:#e7f6ec;--mine-fg:#14532d;--code:#f6f6f6;--accent:#16a34a;--red:#dc2626;--radius:16px}\n@media (prefers-color-scheme:dark){:root{--bg:#191919;--fg:#ececec;--muted:#a3a3a3;--faint:#6b6b6b;--line:#2c2c2c;--soft:#222;--bubble:#262626;--mine:#1f3a2a;--mine-fg:#d1fae5;--code:#232323;--accent:#4ade80;--red:#f87171}}\n*{box-sizing:border-box}\nhtml,body{margin:0;height:100%;background:var(--bg);color:var(--fg);font:15px/1.6 -apple-system,BlinkMacSystemFont,\"Segoe UI\",\"PingFang SC\",\"Hiragino Sans GB\",\"Microsoft YaHei\",sans-serif;-webkit-font-smoothing:antialiased;overscroll-behavior:none}\nbutton{font:inherit;color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}\n.app{display:flex;flex-direction:column;height:100dvh;max-width:760px;margin:0 auto}\n.top{flex:none;display:flex;align-items:center;gap:10px;min-height:54px;padding:8px 10px 8px 16px;padding-top:max(8px,env(safe-area-inset-top));border-bottom:1px solid var(--line);background:var(--bg)}\n.logo{width:26px;height:26px;border-radius:8px;background:var(--fg);color:var(--bg);display:grid;place-items:center;font-weight:700;font-size:13px;flex:none}\n.heading{flex:1;min-width:0;display:flex;flex-direction:column}\n.heading b{font-size:15px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.heading b span{color:var(--muted);font-weight:500;margin-left:4px}\n.heading small{font-size:11.5px;line-height:15px;color:var(--accent)}\n.heading small.quiet{color:var(--muted)}\n.icon{flex:none;width:36px;height:36px;display:grid;place-items:center;border:0;border-radius:10px;background:none;font-size:20px;line-height:1;color:var(--muted)}\n.icon:hover{background:var(--soft);color:var(--fg)}\n.center{flex:1;display:flex;flex-direction:column;justify-content:center;padding:24px 22px calc(32px + env(safe-area-inset-bottom));max-width:440px;width:100%;margin:0 auto;gap:14px}\n.card-face{align-self:center}\n.lead{margin:0;text-align:center;color:var(--muted);font-size:14px}\n.room-name{margin:0;text-align:center;font-size:21px;font-weight:600;line-height:1.35;word-break:break-word}\n.hint{margin:0;text-align:center;color:var(--muted);font-size:13px}\n.small{margin:0;color:var(--faint);font-size:12px;line-height:1.55;text-align:center}\nlabel.field{display:flex;flex-direction:column;gap:6px;font-size:13px;color:var(--muted);margin-top:6px}\ninput.text{font:inherit;font-size:16px;color:var(--fg);background:var(--soft);border:1px solid var(--line);border-radius:12px;padding:11px 13px;outline:none}\ninput.text:focus{border-color:var(--accent)}\n.primary{border:0;border-radius:12px;padding:12px 16px;background:#16a34a;color:#fff;font-weight:600;font-size:15px}\n.primary:disabled{opacity:.55;cursor:default}\n.plain{border:0;background:none;color:var(--muted);font-size:13.5px;padding:8px}\n.plain:hover{color:var(--fg)}\n.danger{color:var(--red)}\n.error{margin:0;text-align:center;color:var(--red);font-size:13px}\n.spin{width:22px;height:22px;border-radius:50%;border:2px solid var(--line);border-top-color:var(--accent);animation:spin .9s linear infinite;align-self:center}\n@keyframes spin{to{transform:rotate(360deg)}}\n.face{flex:none;display:inline-flex;position:relative;user-select:none}\n.face svg{display:block;overflow:visible}\n.ta-face-eyes{transform-box:fill-box;transform-origin:center;animation:blink 5.2s infinite}\n.face[data-face=\"1\"] .ta-face-eyes,.face[data-face=\"5\"] .ta-face-eyes,.face[data-face=\"9\"] .ta-face-eyes,.face[data-face=\"13\"] .ta-face-eyes{animation-delay:-1.7s}\n.face[data-face=\"2\"] .ta-face-eyes,.face[data-face=\"6\"] .ta-face-eyes,.face[data-face=\"10\"] .ta-face-eyes,.face[data-face=\"14\"] .ta-face-eyes{animation-delay:-3.1s}\n.face[data-face=\"3\"] .ta-face-eyes,.face[data-face=\"7\"] .ta-face-eyes,.face[data-face=\"11\"] .ta-face-eyes,.face[data-face=\"15\"] .ta-face-eyes{animation-delay:-4.4s}\n@keyframes blink{0%,94%,100%{transform:scaleY(1)}97%{transform:scaleY(.1)}}\n@media (prefers-reduced-motion:reduce){.face *{animation:none!important}}\n@media (prefers-color-scheme:dark){.face[data-face=\"11\"] .ta-face-body>g>circle{fill:#4a4a52}}\n.face i{position:absolute;right:-1px;bottom:-1px;width:28%;height:28%;min-width:7px;min-height:7px;border-radius:50%;border:2px solid var(--bg);background:var(--faint)}\n.face i.on{background:var(--accent)}\n.banner{flex:none;margin:10px 14px 0;padding:8px 12px;border-radius:12px;background:var(--soft);color:var(--muted);font-size:12.5px;line-height:1.5}\n.list{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:none;padding:10px 14px 12px;display:flex;flex-direction:column;gap:4px}\n.empty{margin:14vh auto 0;max-width:300px;text-align:center;color:var(--muted);font-size:13px}\n.when{align-self:center;margin:14px 0 6px;color:var(--faint);font-size:11.5px;font-variant-numeric:tabular-nums}\n.msg{display:flex;align-items:flex-start;gap:10px}\n.msg.first{margin-top:10px}\n.msg .slot{width:32px;flex:none;display:flex;justify-content:center}\n.msg .col{display:flex;flex-direction:column;align-items:flex-start;min-width:0;max-width:calc(100% - 84px)}\n.msg .who{display:flex;align-items:center;gap:6px;margin:0 2px 4px;color:var(--muted);font-size:12px;line-height:16px}\n.msg.double .bubble{border:1px dashed var(--soft);background:none}\n.bubble{min-width:0;max-width:100%;padding:8px 13px;border-radius:5px var(--radius) var(--radius) var(--radius);background:var(--bubble);word-break:break-word}\n.mine{display:flex;justify-content:flex-end;margin:6px 0 2px}\n.mine .bubble{max-width:78%;border-radius:var(--radius) 5px var(--radius) var(--radius);background:var(--mine);color:var(--mine-fg)}\n.bubble>:first-child{margin-top:0}.bubble>:last-child{margin-bottom:0}\n.bubble p{margin:0 0 .6em}\n.bubble ul,.bubble ol{margin:0 0 .6em;padding-left:1.3em}\n.bubble a{color:inherit;text-decoration:underline;text-underline-offset:2px}\n.bubble code{font:13px ui-monospace,SFMono-Regular,Menlo,monospace;background:var(--code);padding:1px 4px;border-radius:5px}\n.bubble pre{margin:0 0 .6em;padding:8px 10px;background:var(--code);border-radius:10px;overflow-x:auto}\n.bubble pre code{background:none;padding:0}\n.bubble blockquote{margin:0 0 .6em;padding-left:10px;border-left:3px solid var(--line);color:var(--muted)}\n.failed{align-self:flex-end;color:var(--red);font-size:12px;margin:2px 4px 0}\n.box{flex:none;display:flex;align-items:flex-end;gap:8px;padding:8px 12px calc(10px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--bg)}\n.box textarea{flex:1;min-width:0;resize:none;max-height:160px;font:inherit;font-size:16px;line-height:1.45;color:var(--fg);background:var(--soft);border:1px solid var(--line);border-radius:18px;padding:8px 14px;outline:none}\n.box textarea:focus{border-color:var(--accent)}\n.box .primary{flex:none;border-radius:18px;padding:8px 16px;min-height:40px}\n.foot{flex:none;text-align:center;color:var(--faint);font-size:11px;padding:0 0 6px}\n.sheet{position:fixed;inset:0;z-index:5;display:flex;align-items:flex-end;justify-content:center;background:rgba(0,0,0,.32)}\n.sheet .panel{width:100%;max-width:520px;max-height:80dvh;overflow-y:auto;background:var(--bg);border-radius:18px 18px 0 0;padding:14px 8px calc(14px + env(safe-area-inset-bottom))}\n@media (min-width:700px){.sheet{align-items:center}.sheet .panel{border-radius:18px}}\n.panel h3{margin:4px 14px 8px;font-size:13px;font-weight:500;color:var(--muted)}\n.member{display:flex;align-items:center;gap:10px;padding:8px 12px}\n.member .nm{flex:1;min-width:0;display:flex;align-items:center;gap:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.tag{flex:none;padding:0 6px;border-radius:6px;background:var(--soft);color:var(--muted);font-size:11px;line-height:18px}\n.member .st{font-size:12px;color:var(--muted)}\n.member .st.on{color:var(--accent)}\n.row{display:block;width:100%;text-align:left;border:0;background:none;padding:12px 14px;border-radius:12px;font-size:14.5px}\n.row:hover{background:var(--soft)}\n.sep{height:1px;margin:6px 12px;background:var(--line)}\n";
1
+ export declare const GUEST_STYLE = "\n:root{color-scheme:light dark;--bg:#fff;--fg:#1f1f1f;--muted:#737373;--faint:#a3a3a3;--line:#ececec;--soft:#f5f5f5;--bubble:#f2f2f2;--mine:#e7f6ec;--mine-fg:#14532d;--code:#f6f6f6;--accent:#16a34a;--red:#dc2626;--radius:16px}\n@media (prefers-color-scheme:dark){:root{--bg:#191919;--fg:#ececec;--muted:#a3a3a3;--faint:#6b6b6b;--line:#2c2c2c;--soft:#222;--bubble:#262626;--mine:#1f3a2a;--mine-fg:#d1fae5;--code:#232323;--accent:#4ade80;--red:#f87171}}\n*{box-sizing:border-box}\nhtml,body{margin:0;height:100%;background:var(--bg);color:var(--fg);font:15px/1.6 -apple-system,BlinkMacSystemFont,\"Segoe UI\",\"PingFang SC\",\"Hiragino Sans GB\",\"Microsoft YaHei\",sans-serif;-webkit-font-smoothing:antialiased;overscroll-behavior:none}\nbutton{font:inherit;color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}\n.app{display:flex;flex-direction:column;height:100dvh;max-width:760px;margin:0 auto}\n.top{flex:none;display:flex;align-items:center;gap:10px;min-height:54px;padding:8px 10px 8px 16px;padding-top:max(8px,env(safe-area-inset-top));border-bottom:1px solid var(--line);background:var(--bg)}\n.open-in-ta{flex:none;display:inline-flex;align-items:center;height:32px;padding:0 14px;border-radius:16px;background:var(--fg);color:var(--bg);font-size:13.5px;font-weight:600;text-decoration:none;white-space:nowrap;-webkit-tap-highlight-color:transparent}\n.open-in-ta:active{opacity:.8}\n.logo{width:26px;height:26px;border-radius:8px;background:var(--fg);color:var(--bg);display:grid;place-items:center;font-weight:700;font-size:13px;flex:none}\n.heading{flex:1;min-width:0;display:flex;flex-direction:column}\n.heading b{font-size:15px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.heading b span{color:var(--muted);font-weight:500;margin-left:4px}\n.heading small{font-size:11.5px;line-height:15px;color:var(--accent)}\n.heading small.quiet{color:var(--muted)}\n.icon{flex:none;width:36px;height:36px;display:grid;place-items:center;border:0;border-radius:10px;background:none;font-size:20px;line-height:1;color:var(--muted)}\n.icon:hover{background:var(--soft);color:var(--fg)}\n.center{flex:1;display:flex;flex-direction:column;justify-content:center;padding:24px 22px calc(32px + env(safe-area-inset-bottom));max-width:440px;width:100%;margin:0 auto;gap:14px}\n.card-face{align-self:center}\n.lead{margin:0;text-align:center;color:var(--muted);font-size:14px}\n.room-name{margin:0;text-align:center;font-size:21px;font-weight:600;line-height:1.35;word-break:break-word}\n.hint{margin:0;text-align:center;color:var(--muted);font-size:13px}\n.small{margin:0;color:var(--faint);font-size:12px;line-height:1.55;text-align:center}\nlabel.field{display:flex;flex-direction:column;gap:6px;font-size:13px;color:var(--muted);margin-top:6px}\ninput.text{font:inherit;font-size:16px;color:var(--fg);background:var(--soft);border:1px solid var(--line);border-radius:12px;padding:11px 13px;outline:none}\ninput.text:focus{border-color:var(--accent)}\n.primary{border:0;border-radius:12px;padding:12px 16px;background:#16a34a;color:#fff;font-weight:600;font-size:15px}\n.primary:disabled{opacity:.55;cursor:default}\n.plain{border:0;background:none;color:var(--muted);font-size:13.5px;padding:8px}\n.plain:hover{color:var(--fg)}\n.danger{color:var(--red)}\n.error{margin:0;text-align:center;color:var(--red);font-size:13px}\n.spin{width:22px;height:22px;border-radius:50%;border:2px solid var(--line);border-top-color:var(--accent);animation:spin .9s linear infinite;align-self:center}\n@keyframes spin{to{transform:rotate(360deg)}}\n.face{flex:none;display:inline-flex;position:relative;user-select:none}\n.face svg{display:block;overflow:visible}\n.ta-face-eyes{transform-box:fill-box;transform-origin:center;animation:blink 5.2s infinite}\n.face[data-face=\"1\"] .ta-face-eyes,.face[data-face=\"5\"] .ta-face-eyes,.face[data-face=\"9\"] .ta-face-eyes,.face[data-face=\"13\"] .ta-face-eyes{animation-delay:-1.7s}\n.face[data-face=\"2\"] .ta-face-eyes,.face[data-face=\"6\"] .ta-face-eyes,.face[data-face=\"10\"] .ta-face-eyes,.face[data-face=\"14\"] .ta-face-eyes{animation-delay:-3.1s}\n.face[data-face=\"3\"] .ta-face-eyes,.face[data-face=\"7\"] .ta-face-eyes,.face[data-face=\"11\"] .ta-face-eyes,.face[data-face=\"15\"] .ta-face-eyes{animation-delay:-4.4s}\n@keyframes blink{0%,94%,100%{transform:scaleY(1)}97%{transform:scaleY(.1)}}\n@media (prefers-reduced-motion:reduce){.face *{animation:none!important}}\n@media (prefers-color-scheme:dark){.face[data-face=\"11\"] .ta-face-body>g>circle{fill:#4a4a52}}\n.face i{position:absolute;right:-1px;bottom:-1px;width:28%;height:28%;min-width:7px;min-height:7px;border-radius:50%;border:2px solid var(--bg);background:var(--faint)}\n.face i.on{background:var(--accent)}\n.banner{flex:none;margin:10px 14px 0;padding:8px 12px;border-radius:12px;background:var(--soft);color:var(--muted);font-size:12.5px;line-height:1.5}\n.list{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:none;padding:10px 14px 12px;display:flex;flex-direction:column;gap:4px}\n.empty{margin:14vh auto 0;max-width:300px;text-align:center;color:var(--muted);font-size:13px}\n.when{align-self:center;margin:14px 0 6px;color:var(--faint);font-size:11.5px;font-variant-numeric:tabular-nums}\n.msg{display:flex;align-items:flex-start;gap:10px}\n.msg.first{margin-top:10px}\n.msg .slot{width:32px;flex:none;display:flex;justify-content:center}\n.msg .col{display:flex;flex-direction:column;align-items:flex-start;min-width:0;max-width:calc(100% - 84px)}\n.msg .who{display:flex;align-items:center;gap:6px;margin:0 2px 4px;color:var(--muted);font-size:12px;line-height:16px}\n.msg.double .bubble{border:1px dashed var(--soft);background:none}\n.bubble{min-width:0;max-width:100%;padding:8px 13px;border-radius:5px var(--radius) var(--radius) var(--radius);background:var(--bubble);word-break:break-word}\n.mine{display:flex;justify-content:flex-end;margin:6px 0 2px}\n.mine .bubble{max-width:78%;border-radius:var(--radius) 5px var(--radius) var(--radius);background:var(--mine);color:var(--mine-fg)}\n.bubble>:first-child{margin-top:0}.bubble>:last-child{margin-bottom:0}\n.bubble p{margin:0 0 .6em}\n.bubble ul,.bubble ol{margin:0 0 .6em;padding-left:1.3em}\n.bubble a{color:inherit;text-decoration:underline;text-underline-offset:2px}\n.bubble code{font:13px ui-monospace,SFMono-Regular,Menlo,monospace;background:var(--code);padding:1px 4px;border-radius:5px}\n.bubble pre{margin:0 0 .6em;padding:8px 10px;background:var(--code);border-radius:10px;overflow-x:auto}\n.bubble pre code{background:none;padding:0}\n.bubble blockquote{margin:0 0 .6em;padding-left:10px;border-left:3px solid var(--line);color:var(--muted)}\n.failed{align-self:flex-end;color:var(--red);font-size:12px;margin:2px 4px 0}\n.box{flex:none;display:flex;align-items:flex-end;gap:8px;padding:8px 12px calc(10px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--bg)}\n.box textarea{flex:1;min-width:0;resize:none;max-height:160px;font:inherit;font-size:16px;line-height:1.45;color:var(--fg);background:var(--soft);border:1px solid var(--line);border-radius:18px;padding:8px 14px;outline:none}\n.box textarea:focus{border-color:var(--accent)}\n.box .primary{flex:none;border-radius:18px;padding:8px 16px;min-height:40px}\n.foot{flex:none;text-align:center;color:var(--faint);font-size:11px;padding:0 0 6px}\n.sheet{position:fixed;inset:0;z-index:5;display:flex;align-items:flex-end;justify-content:center;background:rgba(0,0,0,.32)}\n.sheet .panel{width:100%;max-width:520px;max-height:80dvh;overflow-y:auto;background:var(--bg);border-radius:18px 18px 0 0;padding:14px 8px calc(14px + env(safe-area-inset-bottom))}\n@media (min-width:700px){.sheet{align-items:center}.sheet .panel{border-radius:18px}}\n.panel h3{margin:4px 14px 8px;font-size:13px;font-weight:500;color:var(--muted)}\n.member{display:flex;align-items:center;gap:10px;padding:8px 12px}\n.member .nm{flex:1;min-width:0;display:flex;align-items:center;gap:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.tag{flex:none;padding:0 6px;border-radius:6px;background:var(--soft);color:var(--muted);font-size:11px;line-height:18px}\n.member .st{font-size:12px;color:var(--muted)}\n.member .st.on{color:var(--accent)}\n.row{display:block;width:100%;text-align:left;border:0;background:none;padding:12px 14px;border-radius:12px;font-size:14.5px}\n.row:hover{background:var(--soft)}\n.sep{height:1px;margin:6px 12px;background:var(--line)}\n";
@@ -6,6 +6,8 @@ html,body{margin:0;height:100%;background:var(--bg);color:var(--fg);font:15px/1.
6
6
  button{font:inherit;color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}
7
7
  .app{display:flex;flex-direction:column;height:100dvh;max-width:760px;margin:0 auto}
8
8
  .top{flex:none;display:flex;align-items:center;gap:10px;min-height:54px;padding:8px 10px 8px 16px;padding-top:max(8px,env(safe-area-inset-top));border-bottom:1px solid var(--line);background:var(--bg)}
9
+ .open-in-ta{flex:none;display:inline-flex;align-items:center;height:32px;padding:0 14px;border-radius:16px;background:var(--fg);color:var(--bg);font-size:13.5px;font-weight:600;text-decoration:none;white-space:nowrap;-webkit-tap-highlight-color:transparent}
10
+ .open-in-ta:active{opacity:.8}
9
11
  .logo{width:26px;height:26px;border-radius:8px;background:var(--fg);color:var(--bg);display:grid;place-items:center;font-weight:700;font-size:13px;flex:none}
10
12
  .heading{flex:1;min-width:0;display:flex;flex-direction:column}
11
13
  .heading b{font-size:15px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@@ -1,6 +1,7 @@
1
1
  import { FaceUtil } from '../common/relay-faces.js';
2
2
  import { RelayHubUtil } from '../common/relay-hub-util.js';
3
3
  import { RelayHubs } from '../common/relay-hubs.js';
4
+ import { RelayOpenInTa } from '../common/relay-open-in-ta.js';
4
5
  import { RelayRoomChat } from '../common/relay-room-chat.js';
5
6
  import { ViewerMarkdown } from '../viewer/viewer-markdown.js';
6
7
  import { GuestI18n } from './guest-i18n.js';
@@ -36,6 +37,10 @@ class BrowserStore {
36
37
  }
37
38
  }
38
39
  }
40
+ /** Open in Ta: the link of this page, handed to the Ta app by the system (`ta://open?link=`). */
41
+ function openInTa() {
42
+ return Object.assign(el('a', t('openInTa')), { className: 'open-in-ta', href: RelayOpenInTa.link(location.href) });
43
+ }
39
44
  function div(className, ...children) {
40
45
  const node = el('div');
41
46
  node.className = className;
@@ -142,7 +147,7 @@ class GuestPage {
142
147
  const logo = el('span', 'Ta');
143
148
  logo.className = 'logo';
144
149
  const heading = div('heading', Object.assign(el('b'), { textContent: t('title') }));
145
- return div('top', logo, heading);
150
+ return div('top', logo, heading, openInTa());
146
151
  }
147
152
  join(error) {
148
153
  document.title = t('title');
@@ -382,7 +387,7 @@ function main() {
382
387
  if (link.kind) {
383
388
  // A room a package keeps for itself (friends of Moments): only a Ta joins it.
384
389
  const logo = Object.assign(el('span', 'Ta'), { className: 'logo' });
385
- document.body.replaceChildren(div('app', div('top', logo), div('center', Object.assign(el('p', t('inTa', { by: link.by })), { className: 'hint' }))));
390
+ document.body.replaceChildren(div('app', div('top', logo, openInTa()), div('center', Object.assign(el('p', t('inTa', { by: link.by })), { className: 'hint' }))));
386
391
  return;
387
392
  }
388
393
  new GuestPage(link).start();
@@ -1,5 +1,6 @@
1
1
  import { type PageLanguage } from '../common/page-language.js';
2
2
  declare const zh: {
3
+ openInTa: string;
3
4
  title: string;
4
5
  invalid: string;
5
6
  invited: string;
@@ -1,5 +1,6 @@
1
1
  import { linkLanguage } from '../common/page-language.js';
2
2
  const zh = {
3
+ openInTa: '在 Ta 中打开',
3
4
  title: '加入 Ta',
4
5
  invalid: '这不是一个完整的 Ta 邀请链接,请检查是否复制完整。',
5
6
  invited: '{owner}邀请你一起用 Ta',
@@ -47,6 +48,7 @@ const zh = {
47
48
  'role.guest': '访客',
48
49
  };
49
50
  const zhTw = {
51
+ openInTa: '在 Ta 中開啟',
50
52
  title: '加入 Ta',
51
53
  invalid: '這不是一個完整的 Ta 邀請連結,請檢查是否複製完整。',
52
54
  invited: '{owner}邀請你一起用 Ta',
@@ -94,6 +96,7 @@ const zhTw = {
94
96
  'role.guest': '訪客',
95
97
  };
96
98
  const en = {
99
+ openInTa: 'Open in Ta',
97
100
  title: 'Join a Ta',
98
101
  invalid: 'This is not a whole link that invites into a Ta: check that it was copied in full.',
99
102
  invited: '{owner} invites you to work in their Ta',
@@ -141,6 +144,7 @@ const en = {
141
144
  'role.guest': 'Guest',
142
145
  };
143
146
  const ja = {
147
+ openInTa: 'Ta で開く',
144
148
  title: 'Ta に参加',
145
149
  invalid: 'これは Ta への完全な招待リンクではありません。全体がコピーされているか確認してください。',
146
150
  invited: '{owner}さんが Ta での作業にあなたを招待しています',
package/esm/join/join.js CHANGED
@@ -1,4 +1,5 @@
1
1
  var _a;
2
+ import { RelayOpenInTa } from '../common/relay-open-in-ta.js';
2
3
  import { RELAY_WEB_PATH, RelayTeamJoining, RelayTeamLinkUtil, } from '../common/relay-team.js';
3
4
  import { GUEST_STYLE } from '../guest/guest-style.js';
4
5
  import { JoinI18n } from './join-i18n.js';
@@ -224,7 +225,9 @@ class JoinPage {
224
225
  const heading = el('div', 'heading');
225
226
  heading.append(el('b', undefined, t('title')));
226
227
  const top = el('div', 'top');
227
- top.append(logo, heading);
228
+ const open = el('a', 'open-in-ta', t('openInTa'));
229
+ open.href = RelayOpenInTa.link(location.href);
230
+ top.append(logo, heading, open);
228
231
  const center = el('div', 'center');
229
232
  center.append(...children);
230
233
  const app = el('div', 'app');
@@ -16,6 +16,8 @@ export declare class RelayFilesHost {
16
16
  protected readonly base: string;
17
17
  protected reading: number;
18
18
  protected readonly running: Set<AbortController>;
19
+ /** Asked for past {@link RELAY_FILES_MAX_PARALLEL}: read in turn, not turned away (a page of an older Ta asks for all at once). */
20
+ protected readonly waiting: ((go: boolean) => void)[];
19
21
  constructor(options: RelayFilesHostOptions);
20
22
  /** A frame of the device: a file to read, or something of a version it does not know. */
21
23
  receive(text: string): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import { RelayBytes } from '../common/relay-bytes.js';
2
- import { RELAY_FILE_CHUNK_BYTES, RELAY_FILE_MAX_BYTES, RELAY_FILES_MAX_PARALLEL, RELAY_FILES_PREFIX, RELAY_FILES_TIMEOUT_MS, } from '../common/relay-files.js';
2
+ import { RELAY_FILE_CHUNK_BYTES, RELAY_FILE_MAX_BYTES, RELAY_FILES_MAX_PARALLEL, RELAY_FILES_MAX_WAITING, RELAY_FILES_PREFIX, RELAY_FILES_TIMEOUT_MS, } from '../common/relay-files.js';
3
3
  /**
4
4
  * The files of the workspace on a channel of a device (RelayFiles): asks them of the ta serve of this
5
5
  * machine and sends them back sealed. It asks for nothing but a path of {@link RELAY_FILES_PREFIX}, with
@@ -11,6 +11,8 @@ export class RelayFilesHost {
11
11
  this.options = options;
12
12
  this.reading = 0;
13
13
  this.running = new Set();
14
+ /** Asked for past {@link RELAY_FILES_MAX_PARALLEL}: read in turn, not turned away (a page of an older Ta asks for all at once). */
15
+ this.waiting = [];
14
16
  // Only ever loopback, whatever the address of the socket says: what this reaches is one server.
15
17
  this.base = `http://127.0.0.1:${new URL(options.localUrl).port}`;
16
18
  }
@@ -30,6 +32,9 @@ export class RelayFilesHost {
30
32
  }
31
33
  /** The device went: what it asked for is not read to the end. */
32
34
  close() {
35
+ for (const go of this.waiting.splice(0)) {
36
+ go(false);
37
+ }
33
38
  for (const controller of this.running) {
34
39
  controller.abort();
35
40
  }
@@ -58,12 +63,20 @@ export class RelayFilesHost {
58
63
  return;
59
64
  }
60
65
  if (this.reading >= RELAY_FILES_MAX_PARALLEL) {
61
- this.options.send({ t: 'error', id, message: 'Too many files are loading at once.' });
62
- return;
66
+ if (this.waiting.length >= RELAY_FILES_MAX_WAITING) {
67
+ this.options.send({ t: 'error', id, message: 'Too many files are loading at once.' });
68
+ return;
69
+ }
70
+ // A read that ends hands its place to this one: no more than the most are read at once.
71
+ if (!(await new Promise(go => this.waiting.push(go)))) {
72
+ return;
73
+ }
74
+ }
75
+ else {
76
+ this.reading++;
63
77
  }
64
78
  const controller = new AbortController();
65
79
  this.running.add(controller);
66
- this.reading++;
67
80
  const timer = setTimeout(() => controller.abort(), RELAY_FILES_TIMEOUT_MS);
68
81
  try {
69
82
  const response = await fetch(target, { signal: controller.signal, redirect: 'error', headers: { accept: '*/*' } });
@@ -123,7 +136,13 @@ export class RelayFilesHost {
123
136
  finally {
124
137
  clearTimeout(timer);
125
138
  this.running.delete(controller);
126
- this.reading--;
139
+ const next = this.waiting.shift();
140
+ if (next) {
141
+ next(true);
142
+ }
143
+ else {
144
+ this.reading--;
145
+ }
127
146
  }
128
147
  }
129
148
  }
@@ -1,5 +1,6 @@
1
1
  import { type PageLanguage } from '../common/page-language.js';
2
2
  declare const zh: {
3
+ openInTa: string;
3
4
  title: string;
4
5
  loading: string;
5
6
  conversation: string;
@@ -1,5 +1,6 @@
1
1
  import { pageLanguage } from '../common/page-language.js';
2
2
  const zh = {
3
+ openInTa: '在 Ta 中打开',
3
4
  title: 'Ta 分享',
4
5
  loading: '正在打开…',
5
6
  conversation: '对话',
@@ -49,6 +50,7 @@ const zh = {
49
50
  use: '使用 {name}',
50
51
  };
51
52
  const zhTw = {
53
+ openInTa: '在 Ta 中開啟',
52
54
  title: 'Ta 分享',
53
55
  loading: '正在開啟…',
54
56
  conversation: '對話',
@@ -98,6 +100,7 @@ const zhTw = {
98
100
  use: '使用 {name}',
99
101
  };
100
102
  const en = {
103
+ openInTa: 'Open in Ta',
101
104
  title: 'Shared from Ta',
102
105
  loading: 'Opening…',
103
106
  conversation: 'Conversation',
@@ -147,6 +150,7 @@ const en = {
147
150
  use: 'Use {name}',
148
151
  };
149
152
  const ja = {
153
+ openInTa: 'Ta で開く',
150
154
  title: 'Ta から共有',
151
155
  loading: '開いています…',
152
156
  conversation: '会話',
@@ -1 +1 @@
1
- export declare const VIEWER_STYLE = "\n:root{color-scheme:light dark;--bg:#fff;--fg:#1f1f1f;--muted:#737373;--faint:#a3a3a3;--line:#ececec;--soft:#f5f5f5;--bubble:#f2f2f2;--code:#f6f6f6;--accent:#16a34a;--warn:#d97706;--radius:14px}\n@media (prefers-color-scheme:dark){:root{--bg:#191919;--fg:#ececec;--muted:#a3a3a3;--faint:#6b6b6b;--line:#2c2c2c;--soft:#222;--bubble:#2a2a2a;--code:#232323;--accent:#4ade80;--warn:#fbbf24}}\n*{box-sizing:border-box}\nhtml,body{margin:0;background:var(--bg);color:var(--fg);font:15px/1.65 -apple-system,BlinkMacSystemFont,\"Segoe UI\",\"PingFang SC\",\"Hiragino Sans GB\",\"Microsoft YaHei\",sans-serif;-webkit-font-smoothing:antialiased}\n.top{position:sticky;top:0;z-index:2;display:flex;align-items:center;gap:10px;padding:10px 16px;background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:saturate(1.6) blur(12px);-webkit-backdrop-filter:saturate(1.6) blur(12px);border-bottom:1px solid var(--line)}\n.logo{width:26px;height:26px;border-radius:8px;background:var(--fg);color:var(--bg);display:grid;place-items:center;font-weight:700;font-size:13px;flex:none}\n.top .name{font-weight:600;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}\n.top button{flex:none}\nmain{max-width:760px;margin:0 auto;padding:28px 18px 40px}\nmain.wide{max-width:none;padding:0}\nh1.title{font-size:22px;line-height:1.35;margin:0 0 6px;letter-spacing:-.01em;word-break:break-word}\n.meta{color:var(--muted);font-size:13px;margin:0 0 22px;display:flex;flex-wrap:wrap;gap:4px 12px}\n.notes{color:var(--muted);font-size:12.5px;margin:-10px 0 22px;display:flex;flex-direction:column;gap:2px}\n.msg{margin:0 0 18px}\n.msg.user{display:flex;justify-content:flex-end}\n.msg.user .bubble{background:var(--bubble);border-radius:var(--radius) var(--radius) 4px var(--radius);padding:9px 14px;max-width:85%;white-space:pre-wrap;word-break:break-word}\n.msg.ta .text>:first-child{margin-top:0}.msg.ta .text>:last-child{margin-bottom:0}\n.text{word-break:break-word}\n.text p{margin:0 0 .75em}\n.text h2,.text h3,.text h4,.text h5,.text h6{margin:1.2em 0 .5em;line-height:1.35}\n.text h2{font-size:1.25em}.text h3{font-size:1.1em}.text h4,.text h5,.text h6{font-size:1em}\n.text ul,.text ol{margin:0 0 .75em;padding-left:1.4em}.text li{margin:.2em 0}\n.text blockquote{margin:0 0 .75em;padding:2px 0 2px 12px;border-left:3px solid var(--line);color:var(--muted)}\n.text a{color:inherit;text-decoration:underline;text-decoration-color:var(--faint);text-underline-offset:2px}\n.text code{font:12.5px/1.5 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;background:var(--code);padding:1px 5px;border-radius:5px}\n.text pre{background:var(--code);border-radius:10px;padding:12px 14px;overflow:auto;margin:0 0 .85em}\n.text pre code{background:none;padding:0;font-size:12.5px;white-space:pre}\n.text hr{border:0;border-top:1px solid var(--line);margin:1.2em 0}\n.text .table{overflow:auto;margin:0 0 .85em}\n.text table{border-collapse:collapse;font-size:14px}\n.text th,.text td{border:1px solid var(--line);padding:5px 10px;text-align:left;vertical-align:top}\n.text th{background:var(--soft);font-weight:600}\n.tools{margin:4px 0 10px;display:flex;flex-direction:column;gap:1px}\n.tool{display:flex;align-items:baseline;gap:8px;color:var(--muted);font-size:13.5px;min-width:0;padding:2px 0}\n.tool .dot{width:6px;height:6px;border-radius:50%;background:var(--accent);flex:none;transform:translateY(-2px)}\n.tool.failed .dot{background:var(--faint)}\n.tool .verb{flex:none}\n.tool .target{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--fg);opacity:.8}\n.tool .target.code{font:12.5px ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}\ndetails.out{margin:0 0 6px 14px}\ndetails.out summary{cursor:pointer;color:var(--faint);font-size:12.5px;list-style:none}\ndetails.out summary::-webkit-details-marker{display:none}\ndetails.out pre{margin:6px 0 0;background:var(--code);border-radius:8px;padding:10px 12px;max-height:280px;overflow:auto;font:12px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;white-space:pre-wrap;word-break:break-word}\n.err{color:var(--warn);font-size:13.5px}\n.card{max-width:380px;margin:12vh auto 0;padding:28px 24px;border:1px solid var(--line);border-radius:18px;text-align:center}\n.card h2{font-size:17px;margin:12px 0 6px}\n.card p{color:var(--muted);font-size:13.5px;margin:0 0 16px}\n.card .icon{width:44px;height:44px;border-radius:50%;background:var(--soft);color:var(--muted);display:grid;place-items:center;margin:0 auto}\n.card form{display:flex;gap:8px}\n.card input{flex:1;min-width:0;font:inherit;padding:9px 12px;border-radius:10px;border:1px solid var(--line);background:var(--bg);color:var(--fg);outline:none}\n.card input:focus{border-color:var(--muted)}\n.card .error{color:var(--warn);font-size:13px;margin:10px 0 0;min-height:1em}\nbutton{font:inherit;font-size:13.5px;padding:8px 14px;border-radius:10px;border:1px solid var(--line);background:var(--bg);color:var(--fg);cursor:pointer}\nbutton.primary{background:var(--fg);color:var(--bg);border-color:var(--fg)}\nbutton:disabled{opacity:.5;cursor:default}\n.spin{width:22px;height:22px;border:2px solid var(--line);border-top-color:var(--muted);border-radius:50%;margin:0 auto;animation:spin .8s linear infinite}\n@keyframes spin{to{transform:rotate(360deg)}}\n@media (prefers-reduced-motion:reduce){.spin{animation-duration:3s}}\n.agent-head{display:flex;flex-direction:column;align-items:center;text-align:center;gap:4px;margin:8px 0 22px}\n.agent-face{width:64px;height:64px;border-radius:50%;background:var(--soft);color:#fff;display:grid;place-items:center;font-size:24px;font-weight:700;margin-bottom:8px;box-shadow:0 0 0 1px var(--line)}\n.agent-head h1.title{margin:0}.agent-head .meta{margin:0;justify-content:center}\n.agent-role{border:1px solid var(--line);border-radius:var(--radius);padding:14px 16px;background:var(--soft)}\n.agent-role>:first-child{margin-top:0}.agent-role>:last-child{margin-bottom:0}\n.agent .notes{margin:10px 0 0}\n.agent-hint{color:var(--muted);font-size:13.5px;text-align:center;margin:18px 0 0}\n.foot{max-width:760px;margin:0 auto;padding:18px 18px 40px;color:var(--faint);font-size:12.5px;border-top:1px solid var(--line);display:flex;flex-direction:column;gap:4px}\n.page{display:block;width:100%;height:calc(100vh - 48px);height:calc(100dvh - 48px);border:0;background:#fff}\n.file img{max-width:100%;border-radius:10px;display:block;margin:0 auto}\n.file pre{white-space:pre-wrap;word-break:break-word;background:var(--code);border-radius:10px;padding:14px;font:12.5px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace}\n";
1
+ export declare const VIEWER_STYLE = "\n:root{color-scheme:light dark;--bg:#fff;--fg:#1f1f1f;--muted:#737373;--faint:#a3a3a3;--line:#ececec;--soft:#f5f5f5;--bubble:#f2f2f2;--code:#f6f6f6;--accent:#16a34a;--warn:#d97706;--radius:14px}\n@media (prefers-color-scheme:dark){:root{--bg:#191919;--fg:#ececec;--muted:#a3a3a3;--faint:#6b6b6b;--line:#2c2c2c;--soft:#222;--bubble:#2a2a2a;--code:#232323;--accent:#4ade80;--warn:#fbbf24}}\n*{box-sizing:border-box}\nhtml,body{margin:0;background:var(--bg);color:var(--fg);font:15px/1.65 -apple-system,BlinkMacSystemFont,\"Segoe UI\",\"PingFang SC\",\"Hiragino Sans GB\",\"Microsoft YaHei\",sans-serif;-webkit-font-smoothing:antialiased}\n.top{position:sticky;top:0;z-index:2;display:flex;align-items:center;gap:10px;padding:10px 16px;background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:saturate(1.6) blur(12px);-webkit-backdrop-filter:saturate(1.6) blur(12px);border-bottom:1px solid var(--line)}\n.open-in-ta{flex:none;display:inline-flex;align-items:center;height:32px;padding:0 14px;border-radius:16px;background:var(--fg);color:var(--bg);font-size:13.5px;font-weight:600;text-decoration:none;white-space:nowrap;-webkit-tap-highlight-color:transparent}\n.open-in-ta:active{opacity:.8}\n.logo{width:26px;height:26px;border-radius:8px;background:var(--fg);color:var(--bg);display:grid;place-items:center;font-weight:700;font-size:13px;flex:none}\n.top .name{font-weight:600;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}\n.top button{flex:none}\nmain{max-width:760px;margin:0 auto;padding:28px 18px 40px}\nmain.wide{max-width:none;padding:0}\nh1.title{font-size:22px;line-height:1.35;margin:0 0 6px;letter-spacing:-.01em;word-break:break-word}\n.meta{color:var(--muted);font-size:13px;margin:0 0 22px;display:flex;flex-wrap:wrap;gap:4px 12px}\n.notes{color:var(--muted);font-size:12.5px;margin:-10px 0 22px;display:flex;flex-direction:column;gap:2px}\n.msg{margin:0 0 18px}\n.msg.user{display:flex;justify-content:flex-end}\n.msg.user .bubble{background:var(--bubble);border-radius:var(--radius) var(--radius) 4px var(--radius);padding:9px 14px;max-width:85%;white-space:pre-wrap;word-break:break-word}\n.msg.ta .text>:first-child{margin-top:0}.msg.ta .text>:last-child{margin-bottom:0}\n.text{word-break:break-word}\n.text p{margin:0 0 .75em}\n.text h2,.text h3,.text h4,.text h5,.text h6{margin:1.2em 0 .5em;line-height:1.35}\n.text h2{font-size:1.25em}.text h3{font-size:1.1em}.text h4,.text h5,.text h6{font-size:1em}\n.text ul,.text ol{margin:0 0 .75em;padding-left:1.4em}.text li{margin:.2em 0}\n.text blockquote{margin:0 0 .75em;padding:2px 0 2px 12px;border-left:3px solid var(--line);color:var(--muted)}\n.text a{color:inherit;text-decoration:underline;text-decoration-color:var(--faint);text-underline-offset:2px}\n.text code{font:12.5px/1.5 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;background:var(--code);padding:1px 5px;border-radius:5px}\n.text pre{background:var(--code);border-radius:10px;padding:12px 14px;overflow:auto;margin:0 0 .85em}\n.text pre code{background:none;padding:0;font-size:12.5px;white-space:pre}\n.text hr{border:0;border-top:1px solid var(--line);margin:1.2em 0}\n.text .table{overflow:auto;margin:0 0 .85em}\n.text table{border-collapse:collapse;font-size:14px}\n.text th,.text td{border:1px solid var(--line);padding:5px 10px;text-align:left;vertical-align:top}\n.text th{background:var(--soft);font-weight:600}\n.tools{margin:4px 0 10px;display:flex;flex-direction:column;gap:1px}\n.tool{display:flex;align-items:baseline;gap:8px;color:var(--muted);font-size:13.5px;min-width:0;padding:2px 0}\n.tool .dot{width:6px;height:6px;border-radius:50%;background:var(--accent);flex:none;transform:translateY(-2px)}\n.tool.failed .dot{background:var(--faint)}\n.tool .verb{flex:none}\n.tool .target{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--fg);opacity:.8}\n.tool .target.code{font:12.5px ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}\ndetails.out{margin:0 0 6px 14px}\ndetails.out summary{cursor:pointer;color:var(--faint);font-size:12.5px;list-style:none}\ndetails.out summary::-webkit-details-marker{display:none}\ndetails.out pre{margin:6px 0 0;background:var(--code);border-radius:8px;padding:10px 12px;max-height:280px;overflow:auto;font:12px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;white-space:pre-wrap;word-break:break-word}\n.err{color:var(--warn);font-size:13.5px}\n.card{max-width:380px;margin:12vh auto 0;padding:28px 24px;border:1px solid var(--line);border-radius:18px;text-align:center}\n.card h2{font-size:17px;margin:12px 0 6px}\n.card p{color:var(--muted);font-size:13.5px;margin:0 0 16px}\n.card .icon{width:44px;height:44px;border-radius:50%;background:var(--soft);color:var(--muted);display:grid;place-items:center;margin:0 auto}\n.card form{display:flex;gap:8px}\n.card input{flex:1;min-width:0;font:inherit;padding:9px 12px;border-radius:10px;border:1px solid var(--line);background:var(--bg);color:var(--fg);outline:none}\n.card input:focus{border-color:var(--muted)}\n.card .error{color:var(--warn);font-size:13px;margin:10px 0 0;min-height:1em}\nbutton{font:inherit;font-size:13.5px;padding:8px 14px;border-radius:10px;border:1px solid var(--line);background:var(--bg);color:var(--fg);cursor:pointer}\nbutton.primary{background:var(--fg);color:var(--bg);border-color:var(--fg)}\nbutton:disabled{opacity:.5;cursor:default}\n.spin{width:22px;height:22px;border:2px solid var(--line);border-top-color:var(--muted);border-radius:50%;margin:0 auto;animation:spin .8s linear infinite}\n@keyframes spin{to{transform:rotate(360deg)}}\n@media (prefers-reduced-motion:reduce){.spin{animation-duration:3s}}\n.agent-head{display:flex;flex-direction:column;align-items:center;text-align:center;gap:4px;margin:8px 0 22px}\n.agent-face{width:64px;height:64px;border-radius:50%;background:var(--soft);color:#fff;display:grid;place-items:center;font-size:24px;font-weight:700;margin-bottom:8px;box-shadow:0 0 0 1px var(--line)}\n.agent-head h1.title{margin:0}.agent-head .meta{margin:0;justify-content:center}\n.agent-role{border:1px solid var(--line);border-radius:var(--radius);padding:14px 16px;background:var(--soft)}\n.agent-role>:first-child{margin-top:0}.agent-role>:last-child{margin-bottom:0}\n.agent .notes{margin:10px 0 0}\n.agent-hint{color:var(--muted);font-size:13.5px;text-align:center;margin:18px 0 0}\n.foot{max-width:760px;margin:0 auto;padding:18px 18px 40px;color:var(--faint);font-size:12.5px;border-top:1px solid var(--line);display:flex;flex-direction:column;gap:4px}\n.page{display:block;width:100%;height:calc(100vh - 48px);height:calc(100dvh - 48px);border:0;background:#fff}\n.file img{max-width:100%;border-radius:10px;display:block;margin:0 auto}\n.file pre{white-space:pre-wrap;word-break:break-word;background:var(--code);border-radius:10px;padding:14px;font:12.5px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace}\n";
@@ -4,6 +4,8 @@ export const VIEWER_STYLE = `
4
4
  *{box-sizing:border-box}
5
5
  html,body{margin:0;background:var(--bg);color:var(--fg);font:15px/1.65 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;-webkit-font-smoothing:antialiased}
6
6
  .top{position:sticky;top:0;z-index:2;display:flex;align-items:center;gap:10px;padding:10px 16px;background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:saturate(1.6) blur(12px);-webkit-backdrop-filter:saturate(1.6) blur(12px);border-bottom:1px solid var(--line)}
7
+ .open-in-ta{flex:none;display:inline-flex;align-items:center;height:32px;padding:0 14px;border-radius:16px;background:var(--fg);color:var(--bg);font-size:13.5px;font-weight:600;text-decoration:none;white-space:nowrap;-webkit-tap-highlight-color:transparent}
8
+ .open-in-ta:active{opacity:.8}
7
9
  .logo{width:26px;height:26px;border-radius:8px;background:var(--fg);color:var(--bg);display:grid;place-items:center;font-weight:700;font-size:13px;flex:none}
8
10
  .top .name{font-weight:600;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}
9
11
  .top button{flex:none}
@@ -1,6 +1,7 @@
1
1
  import { RELAY_AGENT_KIND, RelayAgentCards } from '../common/relay-card.js';
2
2
  import { RelayContentError, RelayContentHandoff, RelayContentUtil } from '../common/relay-content.js';
3
3
  import { RELAY_CONVERSATION_KIND } from '../common/relay-conversation.js';
4
+ import { RelayOpenInTa } from '../common/relay-open-in-ta.js';
4
5
  import { RELAY_FRAME_PATH } from '../common/relay-protocol.js';
5
6
  import { RELAY_WEB_PATH } from '../common/relay-team.js';
6
7
  import { ViewerI18n } from './viewer-i18n.js';
@@ -316,7 +317,8 @@ function chrome(name) {
316
317
  });
317
318
  const title = el('span', name);
318
319
  title.className = 'name';
319
- top.append(Object.assign(el('span', 'Ta'), { className: 'logo' }), title, copy);
320
+ const open = Object.assign(el('a', t('openInTa')), { className: 'open-in-ta', href: RelayOpenInTa.link(location.href) });
321
+ top.append(Object.assign(el('span', 'Ta'), { className: 'logo' }), title, open, copy);
320
322
  const main = el('main');
321
323
  document.body.replaceChildren(top, main);
322
324
  return main;
@@ -8,6 +8,7 @@ export * from './relay-conversation';
8
8
  export * from './relay-faces';
9
9
  export * from './relay-files';
10
10
  export * from './relay-friends';
11
+ export * from './relay-group-invites';
11
12
  export * from './relay-host-calls';
12
13
  export * from './relay-hub';
13
14
  export * from './relay-hub-util';
@@ -24,6 +24,7 @@ __exportStar(require("./relay-conversation"), exports);
24
24
  __exportStar(require("./relay-faces"), exports);
25
25
  __exportStar(require("./relay-files"), exports);
26
26
  __exportStar(require("./relay-friends"), exports);
27
+ __exportStar(require("./relay-group-invites"), exports);
27
28
  __exportStar(require("./relay-host-calls"), exports);
28
29
  __exportStar(require("./relay-hub"), exports);
29
30
  __exportStar(require("./relay-hub-util"), exports);
@@ -1,5 +1,5 @@
1
1
  /** How many faces there are. */
2
- export declare const FACE_COUNT = 16;
2
+ export declare const FACE_COUNT = 25;
3
3
  /** An element of SVG: its tag, its attributes as written in SVG (`stroke-width`, `class`), what is in it. */
4
4
  export interface FaceNode {
5
5
  tag: string;
@@ -8,7 +8,7 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.FaceUtil = exports.FACE_COUNT = void 0;
10
10
  /** How many faces there are. */
11
- exports.FACE_COUNT = 16;
11
+ exports.FACE_COUNT = 25;
12
12
  const BLUE = '#4285F4';
13
13
  const RED = '#EA4335';
14
14
  const YELLOW = '#FBBC05';
@@ -48,6 +48,15 @@ const LOOKS = [
48
48
  { color: PINK, eye: '#4A1428', cheek: 'rgba(160, 20, 70, 0.3)', eyeY: 24, gap: 7.4 }, // drop
49
49
  { color: LILAC, eye: '#2A1A5E', cheek: CHEEK, eyeY: 25, gap: 8 }, // rabbit
50
50
  { color: YELLOW, eye: INK, cheek: CHEEK_WARM, eyeY: 25, gap: 7.4 }, // triangle
51
+ { color: BLUE, eye: WHITE, cheek: CHEEK, eyeY: 19.5, gap: 8 }, // shield
52
+ { color: CREAM, eye: '#4A3420', cheek: 'rgba(240, 120, 120, 0.5)', eyeY: 23.5, gap: 8 }, // house
53
+ { color: GREEN, eye: WHITE, cheek: CHEEK, eyeY: 21, gap: 8 }, // trapezoid
54
+ { color: PINK, eye: '#4A1428', cheek: 'rgba(160, 20, 70, 0.3)', eyeY: 19.5, gap: 8.4 }, // pill
55
+ { color: RED, eye: WHITE, cheek: CHEEK_DEEP, accent: '#B3261E', eyeY: 20, gap: 8.4 }, // lantern
56
+ { color: SKY, eye: WHITE, cheek: CHEEK, eyeY: 23.5, gap: 8 }, // cloud
57
+ { color: VIOLET, eye: WHITE, cheek: CHEEK, accent: '#6B3FD4', eyeY: 22, gap: 8 }, // jar
58
+ { color: TEAL, eye: WHITE, cheek: CHEEK, accent: '#1B8A84', eyeY: 25, gap: 7.6 }, // gourd
59
+ { color: MINT, eye: '#1D3B27', cheek: CHEEK, accent: '#4AAE6C', eyeY: 22.5, gap: 9 }, // frog
51
60
  ];
52
61
  /** The corners of a polygon of `count` sides around (cx, cy), the first straight up; `inner` makes it a star. */
53
62
  function corners(count, radius, cx, cy, inner) {
@@ -141,6 +150,52 @@ function shape(face, look) {
141
150
  ]);
142
151
  case 15:
143
152
  return rounded('20,7 35,33 5,33', color, 6);
153
+ case 16:
154
+ return node('path', {
155
+ d: 'M20 6.5l12 4.2v8.4c0 7.4-4.9 12.6-12 15.9-7.1-3.3-12-8.5-12-15.9v-8.4Z',
156
+ fill: color,
157
+ stroke: color,
158
+ 'stroke-width': 3,
159
+ 'stroke-linejoin': 'round',
160
+ });
161
+ case 17:
162
+ return rounded('20,7 32.5,17.5 32.5,33 7.5,33 7.5,17.5', color, 4.5);
163
+ case 18:
164
+ return rounded('14,9 26,9 32.5,32 7.5,32', color, 6);
165
+ case 19:
166
+ return node('rect', { x: 4.5, y: 10.5, width: 31, height: 19.5, rx: 9.75, fill: color });
167
+ case 20:
168
+ return node('g', {}, [
169
+ node('rect', { x: 14, y: 5.5, width: 12, height: 4.5, rx: 1.6, fill: accent }),
170
+ node('rect', { x: 14, y: 30.5, width: 12, height: 4.5, rx: 1.6, fill: accent }),
171
+ node('ellipse', { cx: 20, cy: 20.25, rx: 15, ry: 12.25, fill: color }),
172
+ ]);
173
+ case 21:
174
+ return node('g', {}, [
175
+ node('circle', { cx: 13.5, cy: 21.5, r: 7, fill: color }),
176
+ node('circle', { cx: 21.5, cy: 16.5, r: 9, fill: color }),
177
+ node('circle', { cx: 28.5, cy: 22.5, r: 6.5, fill: color }),
178
+ node('rect', { x: 5.5, y: 21, width: 29, height: 12, rx: 6, fill: color }),
179
+ ]);
180
+ case 22:
181
+ return node('g', {}, [
182
+ node('rect', { x: 12.5, y: 5.5, width: 15, height: 5.5, rx: 2, fill: accent }),
183
+ node('rect', { x: 7.5, y: 9.5, width: 25, height: 25.5, rx: 6.5, fill: color }),
184
+ ]);
185
+ case 23:
186
+ return node('g', {}, [
187
+ node('rect', { x: 18.8, y: 3.5, width: 2.4, height: 6, rx: 1.2, fill: accent }),
188
+ node('circle', { cx: 20, cy: 13, r: 6.5, fill: color }),
189
+ node('circle', { cx: 20, cy: 25, r: 11.5, fill: color }),
190
+ ]);
191
+ case 24:
192
+ return node('g', {}, [
193
+ node('circle', { cx: 12, cy: 13, r: 5.5, fill: color }),
194
+ node('circle', { cx: 28, cy: 13, r: 5.5, fill: color }),
195
+ node('circle', { cx: 12, cy: 13, r: 2.2, fill: accent }),
196
+ node('circle', { cx: 28, cy: 13, r: 2.2, fill: accent }),
197
+ node('ellipse', { cx: 20, cy: 23.5, rx: 15.5, ry: 11.5, fill: color }),
198
+ ]);
144
199
  default:
145
200
  return node('circle', { cx: 20, cy: 21, r: 14.5, fill: color });
146
201
  }
@@ -47,9 +47,11 @@ export declare const RELAY_FILES_PREFIX = "/api/files/";
47
47
  export declare const RELAY_FILE_CHUNK_BYTES: number;
48
48
  /** The largest file a device reads this way: a video of a workspace is previewed by its first bytes, not all of it. */
49
49
  export declare const RELAY_FILE_MAX_BYTES: number;
50
- /** Files read at once on one channel; a page that loads its pictures asks for several. */
50
+ /** Files read at once on one channel; a page that loads its pictures asks for more, which wait their turn. */
51
51
  export declare const RELAY_FILES_MAX_PARALLEL = 4;
52
- /** For one file, all of it. */
52
+ /** Files waiting their turn on one channel, at most: past them a page asks for more than it can show. */
53
+ export declare const RELAY_FILES_MAX_WAITING = 256;
54
+ /** For one file, all of it, from when it is read, not while it waits its turn. */
53
55
  export declare const RELAY_FILES_TIMEOUT_MS = 30000;
54
56
  /** A file as the page gets it: its type as ta serve answers it, and the bytes. */
55
57
  export interface RelayFileBytes {
@@ -65,6 +67,7 @@ export declare namespace RelayFilesUtil {
65
67
  }
66
68
  /** One file asked for, and what came of it so far. */
67
69
  interface Pending {
70
+ readonly url: string;
68
71
  readonly chunks: Uint8Array[];
69
72
  received: number;
70
73
  head?: {
@@ -73,7 +76,8 @@ interface Pending {
73
76
  };
74
77
  readonly resolve: (bytes: RelayFileBytes) => void;
75
78
  readonly reject: (error: Error) => void;
76
- readonly timer: ReturnType<typeof setTimeout>;
79
+ /** Set once it is asked of the host: before, it waits its turn. */
80
+ timer?: ReturnType<typeof setTimeout>;
77
81
  }
78
82
  export interface RelayFilesOptions {
79
83
  /** For one file. Default RELAY_FILES_TIMEOUT_MS. */
@@ -90,9 +94,14 @@ export declare class RelayFiles {
90
94
  protected opening?: Promise<void>;
91
95
  protected called: number;
92
96
  protected readonly pending: Map<number, Pending>;
97
+ /** Asked for but not yet of the host: no more than {@link RELAY_FILES_MAX_PARALLEL} are read at once. */
98
+ protected readonly waiting: number[];
99
+ protected asked: number;
93
100
  constructor(pairing: RelayPairing, options?: RelayFilesOptions);
94
101
  /** The bytes of a URL of {@link RELAY_FILES_PREFIX}, as ta serve answers them. */
95
102
  get(url: string): Promise<RelayFileBytes>;
103
+ /** Asks the host for the files waiting, as many as it reads at once: more would be turned away. */
104
+ protected ask(): void;
96
105
  /** Whether the channel is open: the page may keep one for as long as it shows files. */
97
106
  get open(): boolean;
98
107
  close(): void;
@@ -102,6 +111,8 @@ export declare class RelayFiles {
102
111
  protected receive(text: string): void;
103
112
  protected settle(id: number, error: Error): void;
104
113
  protected finish(id: number, bytes: RelayFileBytes): void;
114
+ /** A file came or will not: the next one waiting is asked for. */
115
+ protected done(id: number): Pending | undefined;
105
116
  /** The channel went: what was asked for is not coming. */
106
117
  protected fail(error: Error): void;
107
118
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RelayFiles = exports.RelayFilesUtil = exports.RELAY_FILES_TIMEOUT_MS = exports.RELAY_FILES_MAX_PARALLEL = exports.RELAY_FILE_MAX_BYTES = exports.RELAY_FILE_CHUNK_BYTES = exports.RELAY_FILES_PREFIX = void 0;
3
+ exports.RelayFiles = exports.RelayFilesUtil = exports.RELAY_FILES_TIMEOUT_MS = exports.RELAY_FILES_MAX_WAITING = exports.RELAY_FILES_MAX_PARALLEL = exports.RELAY_FILE_MAX_BYTES = exports.RELAY_FILE_CHUNK_BYTES = exports.RELAY_FILES_PREFIX = void 0;
4
4
  const relay_bytes_1 = require("./relay-bytes");
5
5
  const relay_socket_1 = require("./relay-socket");
6
6
  /** The only paths of ta serve a device may ask for: the ones answered without its token. */
@@ -9,9 +9,11 @@ exports.RELAY_FILES_PREFIX = '/api/files/';
9
9
  exports.RELAY_FILE_CHUNK_BYTES = 192 * 1024;
10
10
  /** The largest file a device reads this way: a video of a workspace is previewed by its first bytes, not all of it. */
11
11
  exports.RELAY_FILE_MAX_BYTES = 128 * 1024 * 1024;
12
- /** Files read at once on one channel; a page that loads its pictures asks for several. */
12
+ /** Files read at once on one channel; a page that loads its pictures asks for more, which wait their turn. */
13
13
  exports.RELAY_FILES_MAX_PARALLEL = 4;
14
- /** For one file, all of it. */
14
+ /** Files waiting their turn on one channel, at most: past them a page asks for more than it can show. */
15
+ exports.RELAY_FILES_MAX_WAITING = 256;
16
+ /** For one file, all of it, from when it is read, not while it waits its turn. */
15
17
  exports.RELAY_FILES_TIMEOUT_MS = 30000;
16
18
  var RelayFilesUtil;
17
19
  (function (RelayFilesUtil) {
@@ -42,6 +44,9 @@ class RelayFiles {
42
44
  this.options = options;
43
45
  this.called = 1;
44
46
  this.pending = new Map();
47
+ /** Asked for but not yet of the host: no more than {@link RELAY_FILES_MAX_PARALLEL} are read at once. */
48
+ this.waiting = [];
49
+ this.asked = 0;
45
50
  }
46
51
  /** The bytes of a URL of {@link RELAY_FILES_PREFIX}, as ta serve answers them. */
47
52
  async get(url) {
@@ -51,13 +56,26 @@ class RelayFiles {
51
56
  await this.connect();
52
57
  const id = this.called++;
53
58
  return new Promise((resolve, reject) => {
54
- var _a;
55
- const timeout = (_a = this.options.timeoutMs) !== null && _a !== void 0 ? _a : exports.RELAY_FILES_TIMEOUT_MS;
56
- const timer = setTimeout(() => this.settle(id, new Error('The file took too long to come.')), timeout);
57
- this.pending.set(id, { chunks: [], received: 0, resolve, reject, timer });
58
- this.send({ t: 'get', id, url });
59
+ this.pending.set(id, { url, chunks: [], received: 0, resolve, reject });
60
+ this.waiting.push(id);
61
+ this.ask();
59
62
  });
60
63
  }
64
+ /** Asks the host for the files waiting, as many as it reads at once: more would be turned away. */
65
+ ask() {
66
+ var _a;
67
+ while (this.asked < exports.RELAY_FILES_MAX_PARALLEL && this.waiting.length > 0) {
68
+ const id = this.waiting.shift();
69
+ const pending = this.pending.get(id);
70
+ if (!pending) {
71
+ continue;
72
+ }
73
+ this.asked++;
74
+ const timeout = (_a = this.options.timeoutMs) !== null && _a !== void 0 ? _a : exports.RELAY_FILES_TIMEOUT_MS;
75
+ pending.timer = setTimeout(() => this.settle(id, new Error('The file took too long to come.')), timeout);
76
+ this.send({ t: 'get', id, url: pending.url });
77
+ }
78
+ }
61
79
  /** Whether the channel is open: the page may keep one for as long as it shows files. */
62
80
  get open() {
63
81
  var _a;
@@ -148,23 +166,30 @@ class RelayFiles {
148
166
  }
149
167
  }
150
168
  settle(id, error) {
151
- const pending = this.pending.get(id);
152
- if (pending) {
153
- this.pending.delete(id);
154
- clearTimeout(pending.timer);
155
- pending.reject(error);
156
- }
169
+ var _a;
170
+ (_a = this.done(id)) === null || _a === void 0 ? void 0 : _a.reject(error);
157
171
  }
158
172
  finish(id, bytes) {
173
+ var _a;
174
+ (_a = this.done(id)) === null || _a === void 0 ? void 0 : _a.resolve(bytes);
175
+ }
176
+ /** A file came or will not: the next one waiting is asked for. */
177
+ done(id) {
159
178
  const pending = this.pending.get(id);
160
- if (pending) {
161
- this.pending.delete(id);
179
+ if (!pending) {
180
+ return undefined;
181
+ }
182
+ this.pending.delete(id);
183
+ if (pending.timer !== undefined) {
162
184
  clearTimeout(pending.timer);
163
- pending.resolve(bytes);
185
+ this.asked--;
164
186
  }
187
+ this.ask();
188
+ return pending;
165
189
  }
166
190
  /** The channel went: what was asked for is not coming. */
167
191
  fail(error) {
192
+ this.waiting.length = 0;
168
193
  for (const [id] of [...this.pending]) {
169
194
  this.settle(id, error);
170
195
  }