@celljs/ta-web 4.11.0 → 4.13.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 (281) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/esm/browser/assistant/assistant-extension.js +14 -0
  4. package/esm/browser/assistant/assistant-initiative.d.ts +27 -0
  5. package/esm/browser/assistant/assistant-initiative.js +76 -0
  6. package/esm/browser/assistant/assistant-task-source.d.ts +7 -0
  7. package/esm/browser/assistant/assistant-task-source.js +12 -2
  8. package/esm/browser/assistant/assistant-view.js +10 -6
  9. package/esm/browser/assistant/assistant.d.ts +5 -0
  10. package/esm/browser/assistant/assistant.js +25 -6
  11. package/esm/browser/chat/chat-view.js +6 -5
  12. package/esm/browser/components/app-nav.d.ts +3 -1
  13. package/esm/browser/components/app-nav.js +5 -2
  14. package/esm/browser/components/app-view.js +26 -13
  15. package/esm/browser/components/asks-badge.d.ts +5 -0
  16. package/esm/browser/components/asks-badge.js +8 -0
  17. package/esm/browser/components/chat-asks.d.ts +46 -0
  18. package/esm/browser/components/chat-asks.js +101 -0
  19. package/esm/browser/components/chat-list.d.ts +7 -1
  20. package/esm/browser/components/chat-list.js +46 -17
  21. package/esm/browser/components/composer-addon-util.d.ts +11 -0
  22. package/esm/browser/components/composer-addon-util.js +40 -0
  23. package/esm/browser/components/composer-addons.d.ts +1 -7
  24. package/esm/browser/components/composer-addons.js +1 -27
  25. package/esm/browser/components/composer-box.d.ts +1 -0
  26. package/esm/browser/components/composer-box.js +50 -28
  27. package/esm/browser/components/composer.d.ts +10 -1
  28. package/esm/browser/components/composer.js +61 -22
  29. package/esm/browser/components/connection-bar.js +31 -12
  30. package/esm/browser/components/conversation-scroll-hooks.d.ts +16 -0
  31. package/esm/browser/components/conversation-scroll-hooks.js +98 -0
  32. package/esm/browser/components/conversation-scroll-util.d.ts +35 -0
  33. package/esm/browser/components/conversation-scroll-util.js +74 -0
  34. package/esm/browser/components/conversation-scroll.d.ts +57 -33
  35. package/esm/browser/components/conversation-scroll.js +188 -123
  36. package/esm/browser/components/discover-view.js +5 -1
  37. package/esm/browser/components/earlier-messages.d.ts +10 -3
  38. package/esm/browser/components/earlier-messages.js +14 -8
  39. package/esm/browser/components/face.d.ts +24 -0
  40. package/esm/browser/components/face.js +42 -0
  41. package/esm/browser/components/folder-picker.d.ts +2 -0
  42. package/esm/browser/components/folder-picker.js +7 -0
  43. package/esm/browser/components/host-view.d.ts +1 -1
  44. package/esm/browser/components/markdown.js +4 -2
  45. package/esm/browser/components/media.js +25 -11
  46. package/esm/browser/components/mermaid-view.js +45 -3
  47. package/esm/browser/components/message-actions.js +1 -0
  48. package/esm/browser/components/message-footer.d.ts +4 -0
  49. package/esm/browser/components/message-footer.js +8 -1
  50. package/esm/browser/components/message-list.d.ts +15 -1
  51. package/esm/browser/components/message-list.js +204 -41
  52. package/esm/browser/components/phone-shell.d.ts +7 -2
  53. package/esm/browser/components/phone-shell.js +9 -3
  54. package/esm/browser/components/relay-services.d.ts +24 -0
  55. package/esm/browser/components/relay-services.js +249 -0
  56. package/esm/browser/components/relay-view.js +17 -1
  57. package/esm/browser/components/remote-hosts.js +1 -1
  58. package/esm/browser/components/session-view.d.ts +3 -1
  59. package/esm/browser/components/session-view.js +23 -7
  60. package/esm/browser/components/settings-controls.js +3 -3
  61. package/esm/browser/components/settings-parts.js +13 -1
  62. package/esm/browser/components/stop-times.d.ts +47 -0
  63. package/esm/browser/components/stop-times.js +81 -0
  64. package/esm/browser/components/ta-avatar.js +6 -0
  65. package/esm/browser/components/tool-result.d.ts +13 -0
  66. package/esm/browser/components/tool-result.js +138 -0
  67. package/esm/browser/components/tool-view.js +5 -15
  68. package/esm/browser/components/use-stop-times.d.ts +3 -0
  69. package/esm/browser/components/use-stop-times.js +17 -0
  70. package/esm/browser/components/web-composer.js +2 -1
  71. package/esm/browser/device/photo-picker.d.ts +14 -0
  72. package/esm/browser/device/photo-picker.js +48 -0
  73. package/esm/browser/device/row-swipe.d.ts +2 -0
  74. package/esm/browser/device/row-swipe.js +8 -2
  75. package/esm/browser/device/sheet-swipe.d.ts +1 -1
  76. package/esm/browser/device/sheet-swipe.js +17 -3
  77. package/esm/browser/extension/extension-view.d.ts +3 -1
  78. package/esm/browser/extension/extension-view.js +7 -0
  79. package/esm/browser/extension/icons.js +10 -1
  80. package/esm/browser/extension/web-api-components.d.ts +21 -3
  81. package/esm/browser/extension/web-api-contributions.d.ts +128 -0
  82. package/esm/browser/extension/web-extension-api.d.ts +45 -48
  83. package/esm/browser/extension/web-extension-context.d.ts +6 -1
  84. package/esm/browser/extension/web-extension-context.js +72 -7
  85. package/esm/browser/extension/web-extension-protocol.d.ts +18 -2
  86. package/esm/browser/extension/web-extension-protocol.js +2 -0
  87. package/esm/browser/extension/web-extension-run.d.ts +3 -2
  88. package/esm/browser/extension/web-extension-run.js +3 -0
  89. package/esm/browser/extension/web-extensions.d.ts +2 -8
  90. package/esm/browser/extension/web-extensions.js +12 -35
  91. package/esm/browser/extension/web-page-list.d.ts +25 -0
  92. package/esm/browser/extension/web-page-list.js +35 -0
  93. package/esm/browser/extension/web-session-notices.d.ts +6 -1
  94. package/esm/browser/extension/web-session-notices.js +30 -4
  95. package/esm/browser/extension/web-sharing.d.ts +5 -2
  96. package/esm/browser/extension/web-sharing.js +10 -1
  97. package/esm/browser/i18n/locales.d.ts +77 -1
  98. package/esm/browser/i18n/messages.d.ts +76 -0
  99. package/esm/browser/i18n/messages.js +154 -2
  100. package/esm/browser/links/links-protocol.d.ts +2 -0
  101. package/esm/browser/links/links.d.ts +7 -2
  102. package/esm/browser/links/links.js +16 -9
  103. package/esm/browser/markdown/code-renderers.d.ts +4 -0
  104. package/esm/browser/markdown/code-renderers.js +4 -0
  105. package/esm/browser/markdown/lazy.d.ts +8 -0
  106. package/esm/browser/markdown/lazy.js +35 -0
  107. package/esm/browser/markdown/mermaid.d.ts +15 -3
  108. package/esm/browser/markdown/mermaid.js +45 -6
  109. package/esm/browser/notices/notices-protocol.d.ts +5 -0
  110. package/esm/browser/notices/notices.d.ts +19 -0
  111. package/esm/browser/notices/notices.js +85 -2
  112. package/esm/browser/notices/session-notices.d.ts +5 -2
  113. package/esm/browser/notices/session-notices.js +10 -1
  114. package/esm/browser/style/base.d.ts +1 -1
  115. package/esm/browser/style/base.js +2 -1
  116. package/esm/browser/style/conversation.d.ts +1 -1
  117. package/esm/browser/style/conversation.js +53 -0
  118. package/esm/browser/style/device.js +3 -0
  119. package/esm/browser/style/layout.d.ts +1 -1
  120. package/esm/browser/style/layout.js +27 -9
  121. package/esm/browser/style/pages.d.ts +1 -1
  122. package/esm/browser/style/pages.js +5 -0
  123. package/esm/browser/style/phone.d.ts +1 -1
  124. package/esm/browser/style/phone.js +2 -0
  125. package/esm/browser/style/shell.d.ts +1 -1
  126. package/esm/browser/style/shell.js +16 -3
  127. package/esm/browser/style/surfaces.d.ts +1 -1
  128. package/esm/browser/style/surfaces.js +19 -0
  129. package/esm/browser/util/desktop.d.ts +18 -1
  130. package/esm/browser/util/desktop.js +13 -0
  131. package/esm/browser/util/frame.d.ts +2 -0
  132. package/esm/browser/util/frame.js +2 -0
  133. package/esm/browser/util/process.d.ts +69 -2
  134. package/esm/browser/util/process.js +163 -8
  135. package/esm/browser/util/progress.d.ts +6 -1
  136. package/esm/browser/util/progress.js +11 -2
  137. package/esm/browser/util/scroll-rest.d.ts +10 -0
  138. package/esm/browser/util/scroll-rest.js +44 -0
  139. package/esm/browser/util/tool-result.d.ts +32 -0
  140. package/esm/browser/util/tool-result.js +85 -0
  141. package/esm/browser/util/tool.js +7 -0
  142. package/lib/browser/assistant/assistant-extension.js +14 -0
  143. package/lib/browser/assistant/assistant-initiative.d.ts +28 -0
  144. package/lib/browser/assistant/assistant-initiative.js +80 -0
  145. package/lib/browser/assistant/assistant-task-source.d.ts +7 -0
  146. package/lib/browser/assistant/assistant-task-source.js +12 -2
  147. package/lib/browser/assistant/assistant-view.js +8 -4
  148. package/lib/browser/assistant/assistant.d.ts +5 -0
  149. package/lib/browser/assistant/assistant.js +24 -5
  150. package/lib/browser/chat/chat-view.js +6 -5
  151. package/lib/browser/components/app-nav.d.ts +3 -1
  152. package/lib/browser/components/app-nav.js +5 -2
  153. package/lib/browser/components/app-view.js +25 -12
  154. package/lib/browser/components/asks-badge.d.ts +6 -0
  155. package/lib/browser/components/asks-badge.js +44 -0
  156. package/lib/browser/components/chat-asks.d.ts +47 -0
  157. package/lib/browser/components/chat-asks.js +104 -0
  158. package/lib/browser/components/chat-list.d.ts +7 -1
  159. package/lib/browser/components/chat-list.js +46 -17
  160. package/lib/browser/components/composer-addon-util.d.ts +12 -0
  161. package/lib/browser/components/composer-addon-util.js +76 -0
  162. package/lib/browser/components/composer-addons.d.ts +1 -7
  163. package/lib/browser/components/composer-addons.js +2 -29
  164. package/lib/browser/components/composer-box.d.ts +1 -0
  165. package/lib/browser/components/composer-box.js +48 -26
  166. package/lib/browser/components/composer.d.ts +10 -1
  167. package/lib/browser/components/composer.js +61 -21
  168. package/lib/browser/components/connection-bar.js +30 -11
  169. package/lib/browser/components/conversation-scroll-hooks.d.ts +17 -0
  170. package/lib/browser/components/conversation-scroll-hooks.js +135 -0
  171. package/lib/browser/components/conversation-scroll-util.d.ts +36 -0
  172. package/lib/browser/components/conversation-scroll-util.js +78 -0
  173. package/lib/browser/components/conversation-scroll.d.ts +57 -33
  174. package/lib/browser/components/conversation-scroll.js +189 -158
  175. package/lib/browser/components/discover-view.js +5 -1
  176. package/lib/browser/components/earlier-messages.d.ts +10 -3
  177. package/lib/browser/components/earlier-messages.js +16 -9
  178. package/lib/browser/components/face.d.ts +25 -0
  179. package/lib/browser/components/face.js +79 -0
  180. package/lib/browser/components/folder-picker.d.ts +2 -0
  181. package/lib/browser/components/folder-picker.js +7 -0
  182. package/lib/browser/components/host-view.d.ts +1 -1
  183. package/lib/browser/components/markdown.js +3 -1
  184. package/lib/browser/components/media.js +24 -10
  185. package/lib/browser/components/mermaid-view.js +45 -3
  186. package/lib/browser/components/message-actions.js +1 -0
  187. package/lib/browser/components/message-footer.d.ts +4 -0
  188. package/lib/browser/components/message-footer.js +8 -0
  189. package/lib/browser/components/message-list.d.ts +15 -1
  190. package/lib/browser/components/message-list.js +200 -35
  191. package/lib/browser/components/phone-shell.d.ts +7 -2
  192. package/lib/browser/components/phone-shell.js +9 -3
  193. package/lib/browser/components/relay-services.d.ts +25 -0
  194. package/lib/browser/components/relay-services.js +286 -0
  195. package/lib/browser/components/relay-view.js +17 -1
  196. package/lib/browser/components/remote-hosts.js +1 -1
  197. package/lib/browser/components/session-view.d.ts +3 -1
  198. package/lib/browser/components/session-view.js +23 -7
  199. package/lib/browser/components/settings-controls.js +3 -3
  200. package/lib/browser/components/settings-parts.js +13 -1
  201. package/lib/browser/components/stop-times.d.ts +48 -0
  202. package/lib/browser/components/stop-times.js +85 -0
  203. package/lib/browser/components/ta-avatar.js +6 -0
  204. package/lib/browser/components/tool-result.d.ts +14 -0
  205. package/lib/browser/components/tool-result.js +175 -0
  206. package/lib/browser/components/tool-view.js +10 -20
  207. package/lib/browser/components/use-stop-times.d.ts +4 -0
  208. package/lib/browser/components/use-stop-times.js +53 -0
  209. package/lib/browser/components/web-composer.js +2 -1
  210. package/lib/browser/device/photo-picker.d.ts +15 -0
  211. package/lib/browser/device/photo-picker.js +51 -0
  212. package/lib/browser/device/row-swipe.d.ts +2 -0
  213. package/lib/browser/device/row-swipe.js +8 -2
  214. package/lib/browser/device/sheet-swipe.d.ts +1 -1
  215. package/lib/browser/device/sheet-swipe.js +17 -3
  216. package/lib/browser/extension/extension-view.d.ts +3 -1
  217. package/lib/browser/extension/extension-view.js +8 -1
  218. package/lib/browser/extension/icons.js +9 -0
  219. package/lib/browser/extension/web-api-components.d.ts +21 -3
  220. package/lib/browser/extension/web-api-contributions.d.ts +128 -0
  221. package/lib/browser/extension/web-extension-api.d.ts +45 -48
  222. package/lib/browser/extension/web-extension-context.d.ts +6 -1
  223. package/lib/browser/extension/web-extension-context.js +73 -8
  224. package/lib/browser/extension/web-extension-protocol.d.ts +18 -2
  225. package/lib/browser/extension/web-extension-protocol.js +2 -0
  226. package/lib/browser/extension/web-extension-run.d.ts +3 -2
  227. package/lib/browser/extension/web-extension-run.js +3 -0
  228. package/lib/browser/extension/web-extensions.d.ts +2 -8
  229. package/lib/browser/extension/web-extensions.js +12 -35
  230. package/lib/browser/extension/web-page-list.d.ts +26 -0
  231. package/lib/browser/extension/web-page-list.js +39 -0
  232. package/lib/browser/extension/web-session-notices.d.ts +6 -1
  233. package/lib/browser/extension/web-session-notices.js +30 -4
  234. package/lib/browser/extension/web-sharing.d.ts +5 -2
  235. package/lib/browser/extension/web-sharing.js +10 -1
  236. package/lib/browser/i18n/locales.d.ts +77 -1
  237. package/lib/browser/i18n/messages.d.ts +76 -0
  238. package/lib/browser/i18n/messages.js +154 -2
  239. package/lib/browser/links/links-protocol.d.ts +2 -0
  240. package/lib/browser/links/links.d.ts +7 -2
  241. package/lib/browser/links/links.js +16 -9
  242. package/lib/browser/markdown/code-renderers.d.ts +4 -0
  243. package/lib/browser/markdown/code-renderers.js +5 -1
  244. package/lib/browser/markdown/lazy.d.ts +8 -0
  245. package/lib/browser/markdown/lazy.js +37 -1
  246. package/lib/browser/markdown/mermaid.d.ts +15 -3
  247. package/lib/browser/markdown/mermaid.js +44 -5
  248. package/lib/browser/notices/notices-protocol.d.ts +5 -0
  249. package/lib/browser/notices/notices.d.ts +19 -0
  250. package/lib/browser/notices/notices.js +84 -1
  251. package/lib/browser/notices/session-notices.d.ts +5 -2
  252. package/lib/browser/notices/session-notices.js +10 -1
  253. package/lib/browser/style/base.d.ts +1 -1
  254. package/lib/browser/style/base.js +2 -1
  255. package/lib/browser/style/conversation.d.ts +1 -1
  256. package/lib/browser/style/conversation.js +53 -0
  257. package/lib/browser/style/device.js +3 -0
  258. package/lib/browser/style/layout.d.ts +1 -1
  259. package/lib/browser/style/layout.js +27 -9
  260. package/lib/browser/style/pages.d.ts +1 -1
  261. package/lib/browser/style/pages.js +5 -0
  262. package/lib/browser/style/phone.d.ts +1 -1
  263. package/lib/browser/style/phone.js +2 -0
  264. package/lib/browser/style/shell.d.ts +1 -1
  265. package/lib/browser/style/shell.js +16 -3
  266. package/lib/browser/style/surfaces.d.ts +1 -1
  267. package/lib/browser/style/surfaces.js +19 -0
  268. package/lib/browser/util/desktop.d.ts +18 -1
  269. package/lib/browser/util/desktop.js +13 -0
  270. package/lib/browser/util/frame.d.ts +2 -0
  271. package/lib/browser/util/frame.js +2 -0
  272. package/lib/browser/util/process.d.ts +69 -2
  273. package/lib/browser/util/process.js +165 -9
  274. package/lib/browser/util/progress.d.ts +6 -1
  275. package/lib/browser/util/progress.js +11 -2
  276. package/lib/browser/util/scroll-rest.d.ts +11 -0
  277. package/lib/browser/util/scroll-rest.js +47 -0
  278. package/lib/browser/util/tool-result.d.ts +33 -0
  279. package/lib/browser/util/tool-result.js +88 -0
  280. package/lib/browser/util/tool.js +7 -0
  281. package/package.json +7 -7
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ScrollGlide = exports.ScrollUtil = void 0;
4
+ var ScrollUtil;
5
+ (function (ScrollUtil) {
6
+ /** The first of `rows` (in order, as laid out) in a view scrolled to `top`; past what says earlier rows load. */
7
+ function firstRow(rows, top) {
8
+ var _a, _b;
9
+ let low = 0;
10
+ let high = rows.length - 1;
11
+ while (low < high) {
12
+ const middle = (low + high) >> 1;
13
+ const row = rows[middle];
14
+ if (row.offsetTop + row.offsetHeight > top) {
15
+ high = middle;
16
+ }
17
+ else {
18
+ low = middle + 1;
19
+ }
20
+ }
21
+ return ((_b = (_a = rows[low]) === null || _a === void 0 ? void 0 : _a.dataset) === null || _b === void 0 ? void 0 : _b.scrollSkip) !== undefined && low + 1 < rows.length ? rows[low + 1] : rows[low];
22
+ }
23
+ ScrollUtil.firstRow = firstRow;
24
+ /**
25
+ * The row read in a view scrolled to `top`, `height` high: the first that starts in it, which keeps its place as
26
+ * the row above it (only partly in sight) grows or shrinks; else the one over all of the view (firstRow).
27
+ */
28
+ function readRow(rows, top, height) {
29
+ const first = firstRow(rows, top);
30
+ if (!first || first.offsetTop >= top) {
31
+ return first;
32
+ }
33
+ for (let index = 0; index < rows.length; index++) {
34
+ if (rows[index] === first) {
35
+ const next = rows[index + 1];
36
+ return next && next.offsetTop < top + height ? next : first;
37
+ }
38
+ }
39
+ return first;
40
+ }
41
+ ScrollUtil.readRow = readRow;
42
+ })(ScrollUtil || (exports.ScrollUtil = ScrollUtil = {}));
43
+ /**
44
+ * A view gliding where it goes rather than jumping there: each frame it goes the share of the way left it would
45
+ * in that time by an exponential ease of GLIDE_MS, however often the end of the way moves (more coming in).
46
+ */
47
+ class ScrollGlide {
48
+ constructor(frames, now) {
49
+ this.frames = frames;
50
+ this.now = now;
51
+ }
52
+ /** Gliding: `step` moves the view by the share of the way left it is given, each frame, until it answers false. */
53
+ start(step) {
54
+ if (this.frame !== undefined) {
55
+ return;
56
+ }
57
+ let last = this.now();
58
+ const next = () => {
59
+ this.frame = undefined;
60
+ const now = this.now();
61
+ const share = 1 - Math.exp(-Math.max(1, now - last) / ScrollGlide.GLIDE_MS);
62
+ last = now;
63
+ if (step(share)) {
64
+ this.frame = this.frames.request(next);
65
+ }
66
+ };
67
+ this.frame = this.frames.request(next);
68
+ }
69
+ stop() {
70
+ if (this.frame !== undefined) {
71
+ this.frames.cancel(this.frame);
72
+ this.frame = undefined;
73
+ }
74
+ }
75
+ }
76
+ exports.ScrollGlide = ScrollGlide;
77
+ ScrollGlide.GLIDE_MS = 70;
78
+ //# sourceMappingURL=conversation-scroll-util.js.map
@@ -1,10 +1,15 @@
1
- import * as React from 'react';
1
+ import { type FrameScheduler } from '../util/frame';
2
+ import { type ScrollRow } from './conversation-scroll-util';
2
3
  /** A message of the user in the thread: where the view goes when one is sent. */
3
4
  export declare const ASK_CLASS = "ta-thread-ask";
4
5
  /** A row of the thread under which earlier rows come in (what says they load): the row read is the one after it. */
5
6
  export declare const SCROLL_SKIP: {
6
7
  readonly 'data-scroll-skip': '';
7
8
  };
9
+ /** The thread while the mouse holds the scroll bar: what grows past its height is clipped, and no row shrinks for it. */
10
+ export declare const HELD_CLASS = "ta-scroll-held";
11
+ /** Whether motion is reduced in the settings: scrolls go at once. */
12
+ export declare function calm(): boolean;
8
13
  /** What the scrolling of a conversation reads of its view. */
9
14
  export interface ScrollView {
10
15
  scrollTop: number;
@@ -15,23 +20,16 @@ export interface ScrollView {
15
20
  top: number;
16
21
  };
17
22
  }
18
- /** A row of the thread. */
19
- export interface ScrollRow {
20
- /** From the top of the thread. */
21
- readonly offsetTop: number;
22
- readonly offsetHeight: number;
23
- readonly isConnected: boolean;
24
- /** `scrollSkip`: SCROLL_SKIP. */
25
- readonly dataset?: {
26
- readonly scrollSkip?: string;
27
- };
28
- }
29
23
  /** The thread in the view: its rows (HTML elements: ScrollRow), and the room under them for the answer to a message sent. */
30
24
  export interface ScrollThread {
31
25
  readonly children: ArrayLike<object>;
32
26
  readonly offsetHeight: number;
33
27
  readonly style: {
34
28
  paddingBottom: string;
29
+ height: string;
30
+ };
31
+ readonly classList: {
32
+ toggle(token: string, force?: boolean): boolean;
35
33
  };
36
34
  }
37
35
  /**
@@ -39,7 +37,9 @@ export interface ScrollThread {
39
37
  * holds a row for each message.
40
38
  *
41
39
  * - At the bottom, the view follows what comes in, after layout, on a change of the size of the thread or of
42
- * the view. The user scrolling up, by however little, leaves it where they took it: a wheel, a finger, a key,
40
+ * the view. What grew in sight glides into the view (GLIDE_MS); what grew above it moves the view with it at once,
41
+ * so that no row in sight moves for it; the view changing its height (the message box, the keyboard) goes at once.
42
+ * The user scrolling up, by however little, leaves it where they took it: a wheel, a finger, a key,
43
43
  * the scroll bar, whatever else moved the view up. Back down near the bottom, it follows again.
44
44
  * - Away from the bottom, what the user reads stays where it is: the row at the top of the view keeps its place
45
45
  * as rows above it change their height (earlier messages coming in, pictures, rows laid out as they come into
@@ -47,7 +47,8 @@ export interface ScrollThread {
47
47
  * keyboard of a phone), as in a chat app.
48
48
  * - A part of a message opened or closed by a click (what has `aria-expanded`, a `summary`) stays where it was
49
49
  * clicked; opened past the bottom, the view stops following, for the user to read it.
50
- * - While the user holds the view (a finger on it, the mouse on its scroll bar), nothing moves it under them.
50
+ * - While the user holds the view (a finger on it, the mouse on its scroll bar), nothing moves it under them; the
51
+ * thread keeps its height while the scroll bar is held (`HELD_CLASS`), so that the thumb does not move under the mouse.
51
52
  * - A message the user sends goes to the top of the view, and the answer comes in under it: the thread keeps
52
53
  * the room for that until the answer fills it (`send`), and the message keeps to the top as rows above it
53
54
  * change their height (the turn it was sent into folding its steps).
@@ -69,11 +70,19 @@ export declare class ConversationScroller {
69
70
  /** Where the view was when it last moved, and how high it was. */
70
71
  private top;
71
72
  private height;
73
+ /** How high the thread was when the view last moved or it changed its size: a move up as it changes is the browser's. */
74
+ private extent;
72
75
  private held;
76
+ /**
77
+ * The mouse holds the scroll bar: the thread keeps its height until let go. The browser puts the view where
78
+ * the thumb is at each move of the mouse, by the height of the thread: a reply growing under it would move
79
+ * the view back and forth, and the thumb with it.
80
+ */
81
+ private frozen;
73
82
  /** When the user last moved the view by hand (HAND_MS). */
74
83
  private handAt;
75
84
  private touchY;
76
- /** The row at the top of the view while it does not follow, and how far it starts below the top of the view. */
85
+ /** What the user reads while the view does not follow (ScrollAnchor). */
77
86
  private anchor;
78
87
  /** What the user just opened or closed, and how far it was below the top of the view. */
79
88
  private toggled;
@@ -86,7 +95,11 @@ export declare class ConversationScroller {
86
95
  /** The `scrollend` of a browser without one (SCROLL_END_MS). */
87
96
  private endTimer;
88
97
  private readonly nativeEnd;
89
- constructor(view: ScrollView, thread: ScrollThread, now?: () => number);
98
+ /** The view on its way to the bottom (`attach`, or given frames); without it the view goes there at once. */
99
+ private glider;
100
+ /** The row at the top of the view when it last followed, and how far it started below the top of the view. */
101
+ private seen;
102
+ constructor(view: ScrollView, thread: ScrollThread, now?: () => number, frames?: FrameScheduler);
90
103
  /** Whether the view follows what comes in. */
91
104
  get atLatest(): boolean;
92
105
  /** Listens to `view` (the view of this scroller) and its thread; returns what stops it. */
@@ -106,41 +119,52 @@ export declare class ConversationScroller {
106
119
  key(key: string, shift: boolean): void;
107
120
  touchStart(y: number | undefined): void;
108
121
  touchMove(y: number | undefined, target: EventTarget | null): void;
109
- hold(): void;
122
+ /** `bar`: the mouse on the scroll bar, rather than a finger on the view. */
123
+ hold(bar?: boolean): void;
110
124
  /** Let go: what came in meanwhile shows, if the view follows. */
111
125
  release(): void;
112
126
  clicked(target: EventTarget | null): void;
113
127
  /** The thread or the view changed its size. */
114
128
  resized(): void;
129
+ /**
130
+ * The row of the message sent, while it is there. Rows are drawn by the place of their message: one coming in
131
+ * before it (what an extension adds to the turn) gives its row to that one, which may show nothing, and the
132
+ * message to the next row; the view would else go to the top of the thread.
133
+ */
134
+ private sentRow;
115
135
  /** Where the view goes for the message sent to be at its top, with the room under the thread for that. */
116
136
  private place;
137
+ private freeze;
117
138
  private makeRoom;
118
139
  private arrive;
119
140
  /** The user moves the view: a smooth scroll on its way is theirs now, the message sent no longer holds the top. */
120
141
  private byUser;
121
142
  /** The user moves the view up: it stops following before the scroll comes, which a follow would undo. */
122
143
  private leave;
144
+ /**
145
+ * To the bottom, following what grew: at once when `now` (the view changed its height) or the view cannot glide;
146
+ * else the row at the top of the view keeps its place (what grew above it is out of sight), and the rest glides.
147
+ */
148
+ private follow;
149
+ private glide;
150
+ /** The row at the top of the view now (`seen`). */
151
+ private see;
123
152
  private toBottomNow;
124
153
  private moveTo;
125
- /** The first row in the view, while it does not follow. */
154
+ /** What the user reads, while the view does not follow (ScrollAnchor). */
126
155
  private remember;
156
+ /** Where the anchor is now, from the top of the thread; undefined once it is gone. */
157
+ private anchorAt;
158
+ /**
159
+ * What moved above the anchor before the view heard of it, kept out of sight. The scroll of a frame comes before
160
+ * the observer of sizes: rows drawn in front of the view meanwhile (earlier messages, a diagram drawn) would
161
+ * else be taken as where the user is, and what they read would go down by all of them.
162
+ */
163
+ private keepAnchor;
164
+ /** The first part of `row` (a row begun above the view) that starts in the view, as deep as it takes to find one. */
165
+ private partIn;
127
166
  private offsetOf;
128
167
  /** Whether what `element` opened goes on past the bottom of the view. */
129
168
  private past;
130
169
  }
131
- export interface ConversationScrollOptions {
132
- /** Where a message sent goes: to the top of the view with its answer under it (a conversation), or to the bottom (a group chat). */
133
- sentTo?: 'top' | 'bottom';
134
- /** Another key (another chat in the same view) goes to the bottom. */
135
- key?: string;
136
- }
137
- /**
138
- * The scrolling of a conversation (ConversationScroller), whose thread is the first child of the element of the
139
- * returned ref. Opened, and when messages of the user go (a rewind), the view goes to the bottom.
140
- *
141
- * `asked`: how many messages of the user there are; the thread marks them with ASK_CLASS.
142
- */
143
- export declare function useConversationScroll(asked: number, options?: ConversationScrollOptions): React.RefObject<HTMLDivElement | null>;
144
- /** Whether the conversation of `ref` is scrolled up from its latest, and a way back to it. */
145
- export declare function useAwayFromBottom(ref: React.RefObject<HTMLDivElement | null>): [boolean, () => void];
146
170
  //# sourceMappingURL=conversation-scroll.d.ts.map