@celljs/ta-web 4.43.0 → 4.44.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 (171) hide show
  1. package/esm/browser/apps/app-window.js +2 -2
  2. package/esm/browser/assistant/assistant-chat-list.js +2 -1
  3. package/esm/browser/assistant/assistant-extension.js +16 -2
  4. package/esm/browser/assistant/assistant-protocol.d.ts +6 -0
  5. package/esm/browser/assistant/assistant-task-source.js +3 -0
  6. package/esm/browser/assistant/assistant-task-util.d.ts +2 -0
  7. package/esm/browser/assistant/assistant-task-util.js +5 -0
  8. package/esm/browser/assistant/assistant.d.ts +3 -0
  9. package/esm/browser/assistant/assistant.js +26 -2
  10. package/esm/browser/components/app-shell-hooks.d.ts +2 -1
  11. package/esm/browser/components/app-shell-hooks.js +4 -3
  12. package/esm/browser/components/app-shell-state.js +2 -2
  13. package/esm/browser/components/chat-list-row.js +4 -4
  14. package/esm/browser/components/chat-list-util.d.ts +2 -2
  15. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  16. package/esm/browser/components/custom-host.d.ts +4 -1
  17. package/esm/browser/components/custom-host.js +8 -2
  18. package/esm/browser/components/earlier-messages.d.ts +4 -1
  19. package/esm/browser/components/earlier-messages.js +5 -2
  20. package/esm/browser/components/host-view.d.ts +1 -1
  21. package/esm/browser/components/message-list.js +2 -1
  22. package/esm/browser/components/message-steps.js +8 -5
  23. package/esm/browser/components/settings-choices.d.ts +2 -1
  24. package/esm/browser/components/settings-choices.js +2 -1
  25. package/esm/browser/components/settings-parts.js +23 -3
  26. package/esm/browser/components/share-dialog.js +1 -1
  27. package/esm/browser/components/share-friends.d.ts +18 -2
  28. package/esm/browser/components/share-friends.js +62 -4
  29. package/esm/browser/components/share-sheet.d.ts +4 -3
  30. package/esm/browser/components/share-sheet.js +11 -3
  31. package/esm/browser/extension/web-api-chats.d.ts +23 -0
  32. package/esm/browser/extension/web-api-skins.d.ts +95 -0
  33. package/esm/browser/extension/web-api-skins.js +2 -0
  34. package/esm/browser/extension/web-api-spec.js +2 -0
  35. package/esm/browser/extension/web-extension-api.d.ts +4 -25
  36. package/esm/browser/extension/web-extension-context.js +1 -0
  37. package/esm/browser/extension/web-extension-protocol.d.ts +3 -1
  38. package/esm/browser/extension/web-extension-protocol.js +1 -0
  39. package/esm/browser/extension/web-extension-run.d.ts +3 -2
  40. package/esm/browser/extension/web-extension-run.js +3 -0
  41. package/esm/browser/extension/web-share-ui.js +6 -1
  42. package/esm/browser/i18n/en/assistant.d.ts +4 -0
  43. package/esm/browser/i18n/en/assistant.js +4 -0
  44. package/esm/browser/i18n/en/common.d.ts +0 -3
  45. package/esm/browser/i18n/en/common.js +0 -3
  46. package/esm/browser/i18n/en/discover.d.ts +4 -1
  47. package/esm/browser/i18n/en/discover.js +4 -1
  48. package/esm/browser/i18n/en/settings.d.ts +8 -0
  49. package/esm/browser/i18n/en/settings.js +8 -0
  50. package/esm/browser/i18n/ja/assistant.js +4 -0
  51. package/esm/browser/i18n/ja/common.js +0 -3
  52. package/esm/browser/i18n/ja/discover.js +4 -1
  53. package/esm/browser/i18n/ja/settings.js +8 -0
  54. package/esm/browser/i18n/locales.d.ts +17 -5
  55. package/esm/browser/i18n/messages.d.ts +16 -4
  56. package/esm/browser/i18n/zh/assistant.js +4 -0
  57. package/esm/browser/i18n/zh/common.js +0 -3
  58. package/esm/browser/i18n/zh/discover.js +4 -1
  59. package/esm/browser/i18n/zh/settings.js +8 -0
  60. package/esm/browser/i18n/zh-tw/assistant.js +4 -0
  61. package/esm/browser/i18n/zh-tw/common.js +0 -3
  62. package/esm/browser/i18n/zh-tw/discover.js +4 -1
  63. package/esm/browser/i18n/zh-tw/settings.js +8 -0
  64. package/esm/browser/links/clipboard-links.d.ts +4 -8
  65. package/esm/browser/links/clipboard-links.js +9 -51
  66. package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
  67. package/esm/browser/settings/settings-protocol.d.ts +24 -0
  68. package/esm/browser/settings/settings-protocol.js +9 -0
  69. package/esm/browser/settings/settings.d.ts +4 -1
  70. package/esm/browser/settings/settings.js +16 -3
  71. package/esm/browser/skin/skin-layer.d.ts +8 -0
  72. package/esm/browser/skin/skin-layer.js +118 -0
  73. package/esm/browser/skin/skin-util.d.ts +40 -0
  74. package/esm/browser/skin/skin-util.js +120 -0
  75. package/esm/browser/style/conversation.d.ts +1 -1
  76. package/esm/browser/style/conversation.js +3 -2
  77. package/esm/browser/style/skins.d.ts +9 -0
  78. package/esm/browser/style/skins.js +107 -0
  79. package/esm/browser/style/surfaces.d.ts +1 -1
  80. package/esm/browser/style/surfaces.js +8 -0
  81. package/esm/browser/style.js +2 -0
  82. package/esm/browser/util/fresh-rows.d.ts +21 -0
  83. package/esm/browser/util/fresh-rows.js +36 -0
  84. package/esm/browser/util/process.d.ts +12 -22
  85. package/esm/browser/util/process.js +49 -39
  86. package/lib/browser/apps/app-window.js +2 -2
  87. package/lib/browser/assistant/assistant-chat-list.js +2 -1
  88. package/lib/browser/assistant/assistant-extension.js +15 -1
  89. package/lib/browser/assistant/assistant-protocol.d.ts +6 -0
  90. package/lib/browser/assistant/assistant-task-source.js +3 -0
  91. package/lib/browser/assistant/assistant-task-util.d.ts +2 -0
  92. package/lib/browser/assistant/assistant-task-util.js +5 -0
  93. package/lib/browser/assistant/assistant.d.ts +3 -0
  94. package/lib/browser/assistant/assistant.js +26 -2
  95. package/lib/browser/components/app-shell-hooks.d.ts +2 -1
  96. package/lib/browser/components/app-shell-hooks.js +4 -3
  97. package/lib/browser/components/app-shell-state.js +2 -2
  98. package/lib/browser/components/chat-list-row.js +4 -4
  99. package/lib/browser/components/chat-list-util.d.ts +2 -2
  100. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  101. package/lib/browser/components/custom-host.d.ts +4 -1
  102. package/lib/browser/components/custom-host.js +8 -2
  103. package/lib/browser/components/earlier-messages.d.ts +4 -1
  104. package/lib/browser/components/earlier-messages.js +5 -2
  105. package/lib/browser/components/host-view.d.ts +1 -1
  106. package/lib/browser/components/message-list.js +2 -1
  107. package/lib/browser/components/message-steps.js +8 -5
  108. package/lib/browser/components/settings-choices.d.ts +2 -1
  109. package/lib/browser/components/settings-choices.js +2 -1
  110. package/lib/browser/components/settings-parts.js +21 -1
  111. package/lib/browser/components/share-dialog.js +1 -1
  112. package/lib/browser/components/share-friends.d.ts +18 -2
  113. package/lib/browser/components/share-friends.js +65 -4
  114. package/lib/browser/components/share-sheet.d.ts +4 -3
  115. package/lib/browser/components/share-sheet.js +10 -2
  116. package/lib/browser/extension/web-api-chats.d.ts +23 -0
  117. package/lib/browser/extension/web-api-skins.d.ts +96 -0
  118. package/lib/browser/extension/web-api-skins.js +3 -0
  119. package/lib/browser/extension/web-api-spec.js +2 -0
  120. package/lib/browser/extension/web-extension-api.d.ts +4 -25
  121. package/lib/browser/extension/web-extension-context.js +1 -0
  122. package/lib/browser/extension/web-extension-protocol.d.ts +3 -1
  123. package/lib/browser/extension/web-extension-protocol.js +1 -0
  124. package/lib/browser/extension/web-extension-run.d.ts +3 -2
  125. package/lib/browser/extension/web-extension-run.js +3 -0
  126. package/lib/browser/extension/web-share-ui.js +6 -1
  127. package/lib/browser/i18n/en/assistant.d.ts +4 -0
  128. package/lib/browser/i18n/en/assistant.js +4 -0
  129. package/lib/browser/i18n/en/common.d.ts +0 -3
  130. package/lib/browser/i18n/en/common.js +0 -3
  131. package/lib/browser/i18n/en/discover.d.ts +4 -1
  132. package/lib/browser/i18n/en/discover.js +4 -1
  133. package/lib/browser/i18n/en/settings.d.ts +8 -0
  134. package/lib/browser/i18n/en/settings.js +8 -0
  135. package/lib/browser/i18n/ja/assistant.js +4 -0
  136. package/lib/browser/i18n/ja/common.js +0 -3
  137. package/lib/browser/i18n/ja/discover.js +4 -1
  138. package/lib/browser/i18n/ja/settings.js +8 -0
  139. package/lib/browser/i18n/locales.d.ts +17 -5
  140. package/lib/browser/i18n/messages.d.ts +16 -4
  141. package/lib/browser/i18n/zh/assistant.js +4 -0
  142. package/lib/browser/i18n/zh/common.js +0 -3
  143. package/lib/browser/i18n/zh/discover.js +4 -1
  144. package/lib/browser/i18n/zh/settings.js +8 -0
  145. package/lib/browser/i18n/zh-tw/assistant.js +4 -0
  146. package/lib/browser/i18n/zh-tw/common.js +0 -3
  147. package/lib/browser/i18n/zh-tw/discover.js +4 -1
  148. package/lib/browser/i18n/zh-tw/settings.js +8 -0
  149. package/lib/browser/links/clipboard-links.d.ts +4 -8
  150. package/lib/browser/links/clipboard-links.js +10 -52
  151. package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
  152. package/lib/browser/settings/settings-protocol.d.ts +24 -0
  153. package/lib/browser/settings/settings-protocol.js +10 -1
  154. package/lib/browser/settings/settings.d.ts +4 -1
  155. package/lib/browser/settings/settings.js +16 -3
  156. package/lib/browser/skin/skin-layer.d.ts +9 -0
  157. package/lib/browser/skin/skin-layer.js +154 -0
  158. package/lib/browser/skin/skin-util.d.ts +41 -0
  159. package/lib/browser/skin/skin-util.js +123 -0
  160. package/lib/browser/style/conversation.d.ts +1 -1
  161. package/lib/browser/style/conversation.js +3 -2
  162. package/lib/browser/style/skins.d.ts +10 -0
  163. package/lib/browser/style/skins.js +110 -0
  164. package/lib/browser/style/surfaces.d.ts +1 -1
  165. package/lib/browser/style/surfaces.js +8 -0
  166. package/lib/browser/style.js +2 -0
  167. package/lib/browser/util/fresh-rows.d.ts +22 -0
  168. package/lib/browser/util/fresh-rows.js +40 -0
  169. package/lib/browser/util/process.d.ts +12 -22
  170. package/lib/browser/util/process.js +49 -40
  171. package/package.json +7 -7
@@ -1,6 +1,4 @@
1
1
  import { LinkText } from './link-text.js';
2
- /** What the Ta app on a phone posts to its page of the clipboard (`ta-clipboard`): a link may be there, or the text read when asked. */
3
- export const CLIPBOARD_EVENT = 'ta-clipboard';
4
2
  /**
5
3
  * The links of Ta offered once (docs/design/ta-links.md 7): kept by a hash of each, never the link, whose fragment holds
6
4
  * its key; the newest {@link SeenLinks.MAX}, in the storage of the device.
@@ -65,9 +63,9 @@ SeenLinks.MAX = 200;
65
63
  *
66
64
  * Cheap and quiet: nothing runs on a timer; the clipboard is read when the page comes to the front, at most once a
67
65
  * second, and only where it may be read without asking the user (Ta Desktop; a browser that was allowed; the Ta app of
68
- * Android, when it changed). The Ta app of iOS says only that a link may be there, which iOS tells without reading, and
69
- * reads it when the user taps Open. A text read is looked through once (LinkText); what the user copied in Ta itself is
70
- * never offered back.
66
+ * Android, when it changed). The Ta app of iOS looks at nothing as Ta comes back: iOS tells without asking only that some
67
+ * web link is there, any link copied on the phone or on a Mac near it, so it offers a link of Ta when pasted, as a
68
+ * browser does. A text read is looked through once (LinkText); what the user copied in Ta itself is never offered back.
71
69
  */
72
70
  export class ClipboardLinks {
73
71
  constructor(host, seen = new SeenLinks(ClipboardLinks.storage())) {
@@ -86,13 +84,11 @@ export class ClipboardLinks {
86
84
  const visible = () => doc.visibilityState === 'visible' && this.check(scope);
87
85
  const paste = (event) => { var _a; var _b; return this.pasted((_b = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text/plain')) !== null && _b !== void 0 ? _b : ''); };
88
86
  const copy = (event) => this.mine(ClipboardLinks.selected(scope, event.target), scope);
89
- const native = (event) => this.heard(event.detail, scope);
90
87
  scope.addEventListener('focus', check);
91
88
  doc.addEventListener('visibilitychange', visible);
92
89
  doc.addEventListener('paste', paste, true);
93
90
  doc.addEventListener('copy', copy, true);
94
91
  doc.addEventListener('cut', copy, true);
95
- scope.addEventListener(CLIPBOARD_EVENT, native);
96
92
  const stopOpen = this.host.onOpen(url => {
97
93
  this.opened.add(url);
98
94
  this.seen.add([url]);
@@ -105,7 +101,6 @@ export class ClipboardLinks {
105
101
  doc.removeEventListener('paste', paste, true);
106
102
  doc.removeEventListener('copy', copy, true);
107
103
  doc.removeEventListener('cut', copy, true);
108
- scope.removeEventListener(CLIPBOARD_EVENT, native);
109
104
  stopOpen();
110
105
  unwrap();
111
106
  };
@@ -117,8 +112,8 @@ export class ClipboardLinks {
117
112
  }
118
113
  /** Ta came to the front: what was copied meanwhile, where it may be read without asking. */
119
114
  check(scope = window) {
120
- var _a, _b, _c;
121
- var _d;
115
+ var _a;
116
+ var _b;
122
117
  const now = Date.now();
123
118
  if (!this.ready || !this.host.enabled() || scope.document.visibilityState === 'hidden' || now - this.lastCheck < ClipboardLinks.THROTTLE_MS) {
124
119
  return;
@@ -126,13 +121,10 @@ export class ClipboardLinks {
126
121
  this.lastCheck = now;
127
122
  const native = scope;
128
123
  if (native.taClipboardAndroid) {
129
- this.take((_d = native.taClipboardAndroid.read()) !== null && _d !== void 0 ? _d : '', 'clipboard');
130
- }
131
- else if ((_b = (_a = native.webkit) === null || _a === void 0 ? void 0 : _a.messageHandlers) === null || _b === void 0 ? void 0 : _b.taClipboard) {
132
- native.webkit.messageHandlers.taClipboard.postMessage('peek');
124
+ this.take((_b = native.taClipboardAndroid.read()) !== null && _b !== void 0 ? _b : '', 'clipboard');
133
125
  }
134
126
  else if (this.readable && scope.document.hasFocus()) {
135
- (_c = scope.navigator.clipboard) === null || _c === void 0 ? void 0 : _c.readText().then(text => this.take(text, 'clipboard'), () => undefined);
127
+ (_a = scope.navigator.clipboard) === null || _a === void 0 ? void 0 : _a.readText().then(text => this.take(text, 'clipboard'), () => undefined);
136
128
  }
137
129
  }
138
130
  /** A text of the clipboard or pasted: its links of Ta not offered before, offered now. */
@@ -168,7 +160,7 @@ export class ClipboardLinks {
168
160
  }
169
161
  }, ClipboardLinks.PASTE_WAIT_MS);
170
162
  }
171
- /** Copied in Ta: never offered back, and the app of a phone counts the clipboard as seen. */
163
+ /** Copied in Ta: never offered back, and the app of Android counts the clipboard as seen. */
172
164
  mine(text, scope) {
173
165
  if (text) {
174
166
  this.lastText = text;
@@ -176,41 +168,7 @@ export class ClipboardLinks {
176
168
  }
177
169
  const native = scope;
178
170
  // Once the clipboard holds it: the copy event comes before.
179
- setTimeout(() => {
180
- var _a, _b, _c, _d;
181
- (_c = (_b = (_a = native.webkit) === null || _a === void 0 ? void 0 : _a.messageHandlers) === null || _b === void 0 ? void 0 : _b.taClipboard) === null || _c === void 0 ? void 0 : _c.postMessage('mine');
182
- (_d = native.taClipboardAndroid) === null || _d === void 0 ? void 0 : _d.mine();
183
- }, 50);
184
- }
185
- /** What the Ta app of iOS said: a link may be in the clipboard, or the text read once the user tapped Open. */
186
- heard(detail, scope) {
187
- const said = (detail !== null && detail !== void 0 ? detail : {});
188
- if (said.url === true && this.ready && this.host.enabled()) {
189
- this.host.notices.notify(this.host.say('ta.clip.maybe'), {
190
- level: 'info',
191
- key: ClipboardLinks.KEY,
192
- detail: this.host.say('ta.clip.maybeDetail'),
193
- action: {
194
- label: this.host.say('ta.clip.open'),
195
- run: () => { var _a, _b, _c; return (_c = (_b = (_a = scope.webkit) === null || _a === void 0 ? void 0 : _a.messageHandlers) === null || _b === void 0 ? void 0 : _b.taClipboard) === null || _c === void 0 ? void 0 : _c.postMessage('read'); },
196
- },
197
- });
198
- }
199
- else if (typeof said.text === 'string') {
200
- // The user asked: offered again if seen, opened at once when it is one.
201
- const found = this.host.find(said.text);
202
- this.lastText = said.text;
203
- this.seen.add(found.map(link => link.url));
204
- if (found.length === 1) {
205
- this.host.open(found[0].url);
206
- }
207
- else if (found.length) {
208
- this.offer(found, 'clipboard');
209
- }
210
- else {
211
- this.host.notices.notify(this.host.say('ta.clip.none'), { level: 'info', key: ClipboardLinks.KEY });
212
- }
213
- }
171
+ setTimeout(() => { var _a; return (_a = native.taClipboardAndroid) === null || _a === void 0 ? void 0 : _a.mine(); }, 50);
214
172
  }
215
173
  /** One notice: the words the link came with and what it is, and Open; for several, a button each. */
216
174
  offer(found, from) {