@celljs/ta-web 4.11.0 → 4.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/esm/browser/assistant/assistant-view.js +5 -2
- package/esm/browser/chat/chat-view.js +6 -5
- package/esm/browser/components/app-view.js +8 -4
- package/esm/browser/components/composer-box.d.ts +1 -0
- package/esm/browser/components/composer-box.js +50 -28
- package/esm/browser/components/composer.d.ts +3 -0
- package/esm/browser/components/composer.js +28 -2
- package/esm/browser/components/conversation-scroll-hooks.d.ts +16 -0
- package/esm/browser/components/conversation-scroll-hooks.js +98 -0
- package/esm/browser/components/conversation-scroll-util.d.ts +30 -0
- package/esm/browser/components/conversation-scroll-util.js +56 -0
- package/esm/browser/components/conversation-scroll.d.ts +45 -31
- package/esm/browser/components/conversation-scroll.js +125 -123
- package/esm/browser/components/face.d.ts +24 -0
- package/esm/browser/components/face.js +42 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/media.js +59 -10
- package/esm/browser/components/message-actions.js +1 -0
- package/esm/browser/components/message-footer.d.ts +2 -0
- package/esm/browser/components/message-list.d.ts +3 -1
- package/esm/browser/components/message-list.js +55 -23
- package/esm/browser/components/phone-shell.js +2 -0
- package/esm/browser/components/session-view.d.ts +3 -1
- package/esm/browser/components/session-view.js +7 -3
- package/esm/browser/components/stop-times.d.ts +47 -0
- package/esm/browser/components/stop-times.js +81 -0
- package/esm/browser/components/use-stop-times.d.ts +3 -0
- package/esm/browser/components/use-stop-times.js +17 -0
- package/esm/browser/device/photo-picker.d.ts +14 -0
- package/esm/browser/device/photo-picker.js +48 -0
- package/esm/browser/device/row-swipe.d.ts +2 -0
- package/esm/browser/device/row-swipe.js +8 -2
- package/esm/browser/device/sheet-swipe.d.ts +1 -1
- package/esm/browser/device/sheet-swipe.js +17 -3
- package/esm/browser/extension/icons.js +2 -1
- package/esm/browser/extension/web-api-components.d.ts +18 -0
- package/esm/browser/extension/web-api-contributions.d.ts +9 -0
- package/esm/browser/extension/web-extension-api.d.ts +22 -2
- package/esm/browser/extension/web-extension-context.js +9 -1
- package/esm/browser/extension/web-extension-protocol.d.ts +13 -1
- package/esm/browser/extension/web-extension-protocol.js +1 -0
- package/esm/browser/extension/web-extensions.js +3 -0
- package/esm/browser/i18n/locales.d.ts +11 -1
- package/esm/browser/i18n/messages.d.ts +10 -0
- package/esm/browser/i18n/messages.js +20 -0
- package/esm/browser/links/links-protocol.d.ts +2 -0
- package/esm/browser/links/links.d.ts +7 -2
- package/esm/browser/links/links.js +16 -9
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +2 -0
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +3 -0
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +3 -0
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +2 -0
- package/esm/browser/style/surfaces.d.ts +1 -1
- package/esm/browser/style/surfaces.js +19 -0
- package/esm/browser/util/frame.d.ts +2 -0
- package/esm/browser/util/frame.js +2 -0
- package/esm/browser/util/process.d.ts +43 -1
- package/esm/browser/util/process.js +84 -3
- package/lib/browser/assistant/assistant-view.js +5 -2
- package/lib/browser/chat/chat-view.js +6 -5
- package/lib/browser/components/app-view.js +8 -4
- package/lib/browser/components/composer-box.d.ts +1 -0
- package/lib/browser/components/composer-box.js +48 -26
- package/lib/browser/components/composer.d.ts +3 -0
- package/lib/browser/components/composer.js +28 -2
- package/lib/browser/components/conversation-scroll-hooks.d.ts +17 -0
- package/lib/browser/components/conversation-scroll-hooks.js +135 -0
- package/lib/browser/components/conversation-scroll-util.d.ts +31 -0
- package/lib/browser/components/conversation-scroll-util.js +60 -0
- package/lib/browser/components/conversation-scroll.d.ts +45 -31
- package/lib/browser/components/conversation-scroll.js +126 -158
- package/lib/browser/components/face.d.ts +25 -0
- package/lib/browser/components/face.js +79 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/media.js +59 -10
- package/lib/browser/components/message-actions.js +1 -0
- package/lib/browser/components/message-footer.d.ts +2 -0
- package/lib/browser/components/message-list.d.ts +3 -1
- package/lib/browser/components/message-list.js +53 -21
- package/lib/browser/components/phone-shell.js +2 -0
- package/lib/browser/components/session-view.d.ts +3 -1
- package/lib/browser/components/session-view.js +8 -4
- package/lib/browser/components/stop-times.d.ts +48 -0
- package/lib/browser/components/stop-times.js +85 -0
- package/lib/browser/components/use-stop-times.d.ts +4 -0
- package/lib/browser/components/use-stop-times.js +53 -0
- package/lib/browser/device/photo-picker.d.ts +15 -0
- package/lib/browser/device/photo-picker.js +51 -0
- package/lib/browser/device/row-swipe.d.ts +2 -0
- package/lib/browser/device/row-swipe.js +8 -2
- package/lib/browser/device/sheet-swipe.d.ts +1 -1
- package/lib/browser/device/sheet-swipe.js +17 -3
- package/lib/browser/extension/icons.js +1 -0
- package/lib/browser/extension/web-api-components.d.ts +18 -0
- package/lib/browser/extension/web-api-contributions.d.ts +9 -0
- package/lib/browser/extension/web-extension-api.d.ts +22 -2
- package/lib/browser/extension/web-extension-context.js +10 -2
- package/lib/browser/extension/web-extension-protocol.d.ts +13 -1
- package/lib/browser/extension/web-extension-protocol.js +1 -0
- package/lib/browser/extension/web-extensions.js +3 -0
- package/lib/browser/i18n/locales.d.ts +11 -1
- package/lib/browser/i18n/messages.d.ts +10 -0
- package/lib/browser/i18n/messages.js +20 -0
- package/lib/browser/links/links-protocol.d.ts +2 -0
- package/lib/browser/links/links.d.ts +7 -2
- package/lib/browser/links/links.js +16 -9
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +2 -0
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +3 -0
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +3 -0
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +2 -0
- package/lib/browser/style/surfaces.d.ts +1 -1
- package/lib/browser/style/surfaces.js +19 -0
- package/lib/browser/util/frame.d.ts +2 -0
- package/lib/browser/util/frame.js +2 -0
- package/lib/browser/util/process.d.ts +43 -1
- package/lib/browser/util/process.js +86 -4
- package/package.json +7 -7
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export var ScrollUtil;
|
|
2
|
+
(function (ScrollUtil) {
|
|
3
|
+
/** The first of `rows` (in order, as laid out) in a view scrolled to `top`; past what says earlier rows load. */
|
|
4
|
+
function firstRow(rows, top) {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
let low = 0;
|
|
7
|
+
let high = rows.length - 1;
|
|
8
|
+
while (low < high) {
|
|
9
|
+
const middle = (low + high) >> 1;
|
|
10
|
+
const row = rows[middle];
|
|
11
|
+
if (row.offsetTop + row.offsetHeight > top) {
|
|
12
|
+
high = middle;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
low = middle + 1;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
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];
|
|
19
|
+
}
|
|
20
|
+
ScrollUtil.firstRow = firstRow;
|
|
21
|
+
})(ScrollUtil || (ScrollUtil = {}));
|
|
22
|
+
/**
|
|
23
|
+
* A view gliding where it goes rather than jumping there: each frame it goes the share of the way left it would
|
|
24
|
+
* in that time by an exponential ease of GLIDE_MS, however often the end of the way moves (more coming in).
|
|
25
|
+
*/
|
|
26
|
+
export class ScrollGlide {
|
|
27
|
+
constructor(frames, now) {
|
|
28
|
+
this.frames = frames;
|
|
29
|
+
this.now = now;
|
|
30
|
+
}
|
|
31
|
+
/** Gliding: `step` moves the view by the share of the way left it is given, each frame, until it answers false. */
|
|
32
|
+
start(step) {
|
|
33
|
+
if (this.frame !== undefined) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
let last = this.now();
|
|
37
|
+
const next = () => {
|
|
38
|
+
this.frame = undefined;
|
|
39
|
+
const now = this.now();
|
|
40
|
+
const share = 1 - Math.exp(-Math.max(1, now - last) / ScrollGlide.GLIDE_MS);
|
|
41
|
+
last = now;
|
|
42
|
+
if (step(share)) {
|
|
43
|
+
this.frame = this.frames.request(next);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
this.frame = this.frames.request(next);
|
|
47
|
+
}
|
|
48
|
+
stop() {
|
|
49
|
+
if (this.frame !== undefined) {
|
|
50
|
+
this.frames.cancel(this.frame);
|
|
51
|
+
this.frame = undefined;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
ScrollGlide.GLIDE_MS = 70;
|
|
56
|
+
//# sourceMappingURL=conversation-scroll-util.js.map
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type FrameScheduler } from '../util/frame.js';
|
|
2
|
+
import { type ScrollRow } from './conversation-scroll-util.js';
|
|
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.
|
|
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,7 +70,15 @@ 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;
|
|
@@ -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
|
-
|
|
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,20 +119,36 @@ 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
|
-
|
|
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
154
|
/** The first row in the view, while it does not follow. */
|
|
@@ -128,18 +157,3 @@ export declare class ConversationScroller {
|
|
|
128
157
|
/** Whether what `element` opened goes on past the bottom of the view. */
|
|
129
158
|
private past;
|
|
130
159
|
}
|
|
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];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { FrameUtil } from '../util/frame.js';
|
|
2
|
+
import { ScrollGlide, ScrollUtil } from './conversation-scroll-util.js';
|
|
3
3
|
/** A message of the user in the thread: where the view goes when one is sent. */
|
|
4
4
|
export const ASK_CLASS = 'ta-thread-ask';
|
|
5
5
|
/** How long a part of a message opened or closed by a click keeps its place (a motion of its height). */
|
|
@@ -24,12 +24,17 @@ const TOGGLE = '[aria-expanded], summary';
|
|
|
24
24
|
* follow its answer.
|
|
25
25
|
*/
|
|
26
26
|
const SCROLL_END_MS = 150;
|
|
27
|
+
/** At most this share of the view is left to glide: more coming at once (a block, what came while away) jumps the rest. */
|
|
28
|
+
const GLIDE_MAX = 0.5;
|
|
27
29
|
function hasScrollEnd() {
|
|
28
30
|
return typeof window !== 'undefined' && 'onscrollend' in window;
|
|
29
31
|
}
|
|
30
32
|
/** A row of the thread under which earlier rows come in (what says they load): the row read is the one after it. */
|
|
31
33
|
export const SCROLL_SKIP = { 'data-scroll-skip': '' };
|
|
32
|
-
|
|
34
|
+
/** The thread while the mouse holds the scroll bar: what grows past its height is clipped, and no row shrinks for it. */
|
|
35
|
+
export const HELD_CLASS = 'ta-scroll-held';
|
|
36
|
+
/** Whether motion is reduced in the settings: scrolls go at once. */
|
|
37
|
+
export function calm() {
|
|
33
38
|
return typeof document !== 'undefined' && document.documentElement.hasAttribute('data-reduce-motion');
|
|
34
39
|
}
|
|
35
40
|
function isElement(value) {
|
|
@@ -52,7 +57,9 @@ function scrollsInside(target, view, up) {
|
|
|
52
57
|
* holds a row for each message.
|
|
53
58
|
*
|
|
54
59
|
* - At the bottom, the view follows what comes in, after layout, on a change of the size of the thread or of
|
|
55
|
-
* the view.
|
|
60
|
+
* the view. What grew in sight glides into the view (GLIDE_MS); what grew above it moves the view with it at once,
|
|
61
|
+
* so that no row in sight moves for it; the view changing its height (the message box, the keyboard) goes at once.
|
|
62
|
+
* The user scrolling up, by however little, leaves it where they took it: a wheel, a finger, a key,
|
|
56
63
|
* the scroll bar, whatever else moved the view up. Back down near the bottom, it follows again.
|
|
57
64
|
* - Away from the bottom, what the user reads stays where it is: the row at the top of the view keeps its place
|
|
58
65
|
* as rows above it change their height (earlier messages coming in, pictures, rows laid out as they come into
|
|
@@ -60,7 +67,8 @@ function scrollsInside(target, view, up) {
|
|
|
60
67
|
* keyboard of a phone), as in a chat app.
|
|
61
68
|
* - A part of a message opened or closed by a click (what has `aria-expanded`, a `summary`) stays where it was
|
|
62
69
|
* clicked; opened past the bottom, the view stops following, for the user to read it.
|
|
63
|
-
* - While the user holds the view (a finger on it, the mouse on its scroll bar), nothing moves it under them
|
|
70
|
+
* - While the user holds the view (a finger on it, the mouse on its scroll bar), nothing moves it under them; the
|
|
71
|
+
* thread keeps its height while the scroll bar is held (`HELD_CLASS`), so that the thumb does not move under the mouse.
|
|
64
72
|
* - A message the user sends goes to the top of the view, and the answer comes in under it: the thread keeps
|
|
65
73
|
* the room for that until the answer fills it (`send`), and the message keeps to the top as rows above it
|
|
66
74
|
* change their height (the turn it was sent into folding its steps).
|
|
@@ -70,7 +78,7 @@ export class ConversationScroller {
|
|
|
70
78
|
static of(view) {
|
|
71
79
|
return ConversationScroller.views.get(view);
|
|
72
80
|
}
|
|
73
|
-
constructor(view, thread, now = () => performance.now()) {
|
|
81
|
+
constructor(view, thread, now = () => performance.now(), frames) {
|
|
74
82
|
this.view = view;
|
|
75
83
|
this.thread = thread;
|
|
76
84
|
this.now = now;
|
|
@@ -78,6 +86,12 @@ export class ConversationScroller {
|
|
|
78
86
|
/** On a smooth way to the bottom (`toBottom`): what comes in meanwhile moves the end of the way. */
|
|
79
87
|
this.chasing = false;
|
|
80
88
|
this.held = false;
|
|
89
|
+
/**
|
|
90
|
+
* The mouse holds the scroll bar: the thread keeps its height until let go. The browser puts the view where
|
|
91
|
+
* the thumb is at each move of the mouse, by the height of the thread: a reply growing under it would move
|
|
92
|
+
* the view back and forth, and the thumb with it.
|
|
93
|
+
*/
|
|
94
|
+
this.frozen = false;
|
|
81
95
|
/** When the user last moved the view by hand (HAND_MS). */
|
|
82
96
|
this.handAt = Number.NEGATIVE_INFINITY;
|
|
83
97
|
/**
|
|
@@ -87,8 +101,10 @@ export class ConversationScroller {
|
|
|
87
101
|
this.room = 0;
|
|
88
102
|
this.padding = 0;
|
|
89
103
|
this.nativeEnd = hasScrollEnd();
|
|
104
|
+
this.glider = frames && new ScrollGlide(frames, now);
|
|
90
105
|
this.top = view.scrollTop;
|
|
91
106
|
this.height = view.clientHeight;
|
|
107
|
+
this.extent = view.scrollHeight;
|
|
92
108
|
}
|
|
93
109
|
/** Whether the view follows what comes in. */
|
|
94
110
|
get atLatest() {
|
|
@@ -96,7 +112,9 @@ export class ConversationScroller {
|
|
|
96
112
|
}
|
|
97
113
|
/** Listens to `view` (the view of this scroller) and its thread; returns what stops it. */
|
|
98
114
|
attach(view, thread) {
|
|
115
|
+
var _a;
|
|
99
116
|
ConversationScroller.views.set(view, this);
|
|
117
|
+
(_a = this.glider) !== null && _a !== void 0 ? _a : (this.glider = new ScrollGlide(FrameUtil.animation, this.now));
|
|
100
118
|
thread.style.paddingBottom = '';
|
|
101
119
|
this.padding = Number.parseFloat(getComputedStyle(thread).paddingBottom) || 0;
|
|
102
120
|
const onScroll = () => {
|
|
@@ -123,10 +141,16 @@ export class ConversationScroller {
|
|
|
123
141
|
// The mouse on the scroll bar (or beside the thread): the view itself is the target.
|
|
124
142
|
const onPointerDown = (event) => {
|
|
125
143
|
if (event.pointerType === 'mouse' && event.button === 0 && event.target === view) {
|
|
126
|
-
this.hold();
|
|
144
|
+
this.hold(true);
|
|
127
145
|
}
|
|
128
146
|
};
|
|
129
147
|
const onPointerUp = () => this.release();
|
|
148
|
+
// Let go outside the window, where no pointerup may come: the mouse moves with no button held.
|
|
149
|
+
const onPointerMove = (event) => {
|
|
150
|
+
if (this.frozen && event.buttons === 0) {
|
|
151
|
+
this.release();
|
|
152
|
+
}
|
|
153
|
+
};
|
|
130
154
|
// Captured: before the click opens or closes what it is on (React handles it after, on the root).
|
|
131
155
|
const onClick = (event) => this.clicked(event.target);
|
|
132
156
|
const passive = { passive: true };
|
|
@@ -142,11 +166,15 @@ export class ConversationScroller {
|
|
|
142
166
|
view.addEventListener('click', onClick, true);
|
|
143
167
|
window.addEventListener('pointerup', onPointerUp, passive);
|
|
144
168
|
window.addEventListener('pointercancel', onPointerUp, passive);
|
|
169
|
+
window.addEventListener('pointermove', onPointerMove, passive);
|
|
145
170
|
const observer = typeof ResizeObserver !== 'undefined' ? new ResizeObserver(() => this.resized()) : undefined;
|
|
146
171
|
observer === null || observer === void 0 ? void 0 : observer.observe(thread);
|
|
147
172
|
// The view itself changes its height under what is around it (the message box, the keyboard of a phone).
|
|
148
173
|
observer === null || observer === void 0 ? void 0 : observer.observe(view);
|
|
149
174
|
return () => {
|
|
175
|
+
var _a;
|
|
176
|
+
this.freeze(false);
|
|
177
|
+
(_a = this.glider) === null || _a === void 0 ? void 0 : _a.stop();
|
|
150
178
|
ConversationScroller.views.delete(view);
|
|
151
179
|
view.removeEventListener('scroll', onScroll);
|
|
152
180
|
view.removeEventListener('scrollend', onScrollEnd);
|
|
@@ -161,11 +189,13 @@ export class ConversationScroller {
|
|
|
161
189
|
view.removeEventListener('click', onClick, true);
|
|
162
190
|
window.removeEventListener('pointerup', onPointerUp);
|
|
163
191
|
window.removeEventListener('pointercancel', onPointerUp);
|
|
192
|
+
window.removeEventListener('pointermove', onPointerMove);
|
|
164
193
|
observer === null || observer === void 0 ? void 0 : observer.disconnect();
|
|
165
194
|
};
|
|
166
195
|
}
|
|
167
196
|
/** To the bottom at once, following from there: a conversation opened, loaded again or rewound. */
|
|
168
197
|
reset() {
|
|
198
|
+
this.freeze(false);
|
|
169
199
|
this.makeRoom(0);
|
|
170
200
|
this.sent = undefined;
|
|
171
201
|
this.heading = undefined;
|
|
@@ -218,10 +248,13 @@ export class ConversationScroller {
|
|
|
218
248
|
return;
|
|
219
249
|
}
|
|
220
250
|
const distance = view.scrollHeight - top - view.clientHeight;
|
|
251
|
+
// More than a screen up with the thread as it was: a search in the page. As it changed, the browser's: in
|
|
252
|
+
// WebKit the view put back to the top while the steps of a turn fold into its reply, the event after.
|
|
253
|
+
const searched = -moved > view.clientHeight && view.scrollHeight === this.extent;
|
|
221
254
|
if (distance < 1) {
|
|
222
255
|
this.following = true;
|
|
223
256
|
}
|
|
224
|
-
else if (moved <= -1 && (this.held || this.now() - this.handAt < HAND_MS ||
|
|
257
|
+
else if (moved <= -1 && (this.held || this.now() - this.handAt < HAND_MS || searched)) {
|
|
225
258
|
// Up, by the user (the scroll bar dragged, a fling), or by more than a screen for them (a search in the
|
|
226
259
|
// page, which goes to what is out of sight): the view stays where it was taken.
|
|
227
260
|
this.following = false;
|
|
@@ -283,8 +316,12 @@ export class ConversationScroller {
|
|
|
283
316
|
}
|
|
284
317
|
this.touchY = y;
|
|
285
318
|
}
|
|
286
|
-
|
|
319
|
+
/** `bar`: the mouse on the scroll bar, rather than a finger on the view. */
|
|
320
|
+
hold(bar = false) {
|
|
287
321
|
this.held = true;
|
|
322
|
+
if (bar) {
|
|
323
|
+
this.freeze(true);
|
|
324
|
+
}
|
|
288
325
|
this.byUser();
|
|
289
326
|
}
|
|
290
327
|
/** Let go: what came in meanwhile shows, if the view follows. */
|
|
@@ -293,6 +330,7 @@ export class ConversationScroller {
|
|
|
293
330
|
return;
|
|
294
331
|
}
|
|
295
332
|
this.held = false;
|
|
333
|
+
this.freeze(false);
|
|
296
334
|
this.touchY = undefined;
|
|
297
335
|
if (this.following && this.heading === undefined && !this.chasing) {
|
|
298
336
|
this.toBottomNow();
|
|
@@ -307,11 +345,12 @@ export class ConversationScroller {
|
|
|
307
345
|
/** The thread or the view changed its size. */
|
|
308
346
|
resized() {
|
|
309
347
|
const { view } = this;
|
|
348
|
+
this.extent = view.scrollHeight;
|
|
310
349
|
const height = view.clientHeight;
|
|
311
350
|
const shrunk = this.height - height;
|
|
312
351
|
this.height = height;
|
|
313
|
-
const sent = this.
|
|
314
|
-
if (sent
|
|
352
|
+
const sent = this.sentRow();
|
|
353
|
+
if (sent) {
|
|
315
354
|
const top = this.place(sent);
|
|
316
355
|
if (this.heading !== undefined && Math.abs(top - this.heading) >= 1) {
|
|
317
356
|
this.heading = top;
|
|
@@ -336,7 +375,7 @@ export class ConversationScroller {
|
|
|
336
375
|
view.scrollTo({ top: view.scrollHeight - view.clientHeight, behavior: 'smooth' });
|
|
337
376
|
}
|
|
338
377
|
else if (!this.held) {
|
|
339
|
-
this.
|
|
378
|
+
this.follow(shrunk !== 0);
|
|
340
379
|
}
|
|
341
380
|
return;
|
|
342
381
|
}
|
|
@@ -346,6 +385,26 @@ export class ConversationScroller {
|
|
|
346
385
|
this.moveTo(((anchor === null || anchor === void 0 ? void 0 : anchor.row.isConnected) ? anchor.row.offsetTop - anchor.offset : this.top) + shrunk);
|
|
347
386
|
this.remember();
|
|
348
387
|
}
|
|
388
|
+
/**
|
|
389
|
+
* The row of the message sent, while it is there. Rows are drawn by the place of their message: one coming in
|
|
390
|
+
* before it (what an extension adds to the turn) gives its row to that one, which may show nothing, and the
|
|
391
|
+
* message to the next row; the view would else go to the top of the thread.
|
|
392
|
+
*/
|
|
393
|
+
sentRow() {
|
|
394
|
+
var _a;
|
|
395
|
+
const sent = this.sent;
|
|
396
|
+
if (!(sent === null || sent === void 0 ? void 0 : sent.isConnected) || sent.classList.contains(ASK_CLASS)) {
|
|
397
|
+
return (sent === null || sent === void 0 ? void 0 : sent.isConnected) ? sent : undefined;
|
|
398
|
+
}
|
|
399
|
+
const rows = this.thread.children;
|
|
400
|
+
for (let index = rows.length - 1; index >= 0; index--) {
|
|
401
|
+
if ((_a = rows[index].classList) === null || _a === void 0 ? void 0 : _a.contains(ASK_CLASS)) {
|
|
402
|
+
this.sent = rows[index];
|
|
403
|
+
return rows[index];
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
return undefined;
|
|
407
|
+
}
|
|
349
408
|
/** Where the view goes for the message sent to be at its top, with the room under the thread for that. */
|
|
350
409
|
place(message) {
|
|
351
410
|
// offsetTop: from the thread; the transform of the message coming in does not count.
|
|
@@ -353,6 +412,14 @@ export class ConversationScroller {
|
|
|
353
412
|
this.makeRoom(room);
|
|
354
413
|
return top;
|
|
355
414
|
}
|
|
415
|
+
freeze(on) {
|
|
416
|
+
if (on === this.frozen) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
this.frozen = on;
|
|
420
|
+
this.thread.style.height = on ? `${this.thread.offsetHeight}px` : '';
|
|
421
|
+
this.thread.classList.toggle(HELD_CLASS, on);
|
|
422
|
+
}
|
|
356
423
|
makeRoom(room) {
|
|
357
424
|
if (room !== this.room) {
|
|
358
425
|
this.room = room;
|
|
@@ -363,6 +430,7 @@ export class ConversationScroller {
|
|
|
363
430
|
this.heading = undefined;
|
|
364
431
|
this.following = true;
|
|
365
432
|
this.top = this.view.scrollTop;
|
|
433
|
+
this.see();
|
|
366
434
|
}
|
|
367
435
|
/** The user moves the view: a smooth scroll on its way is theirs now, the message sent no longer holds the top. */
|
|
368
436
|
byUser() {
|
|
@@ -382,7 +450,49 @@ export class ConversationScroller {
|
|
|
382
450
|
this.remember();
|
|
383
451
|
}
|
|
384
452
|
}
|
|
453
|
+
/**
|
|
454
|
+
* To the bottom, following what grew: at once when `now` (the view changed its height) or the view cannot glide;
|
|
455
|
+
* else the row at the top of the view keeps its place (what grew above it is out of sight), and the rest glides.
|
|
456
|
+
*/
|
|
457
|
+
follow(now) {
|
|
458
|
+
const { view } = this;
|
|
459
|
+
const seen = this.seen;
|
|
460
|
+
if (now || !this.glider || calm() || !(seen === null || seen === void 0 ? void 0 : seen.row.isConnected)) {
|
|
461
|
+
this.toBottomNow();
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
const bottom = view.scrollHeight - view.clientHeight;
|
|
465
|
+
// Never up: a move up of more than a screen would count as the user's (a search in the page).
|
|
466
|
+
const top = Math.max(seen.row.offsetTop - seen.offset, view.scrollTop, bottom - view.clientHeight * GLIDE_MAX);
|
|
467
|
+
this.moveTo(top);
|
|
468
|
+
this.see();
|
|
469
|
+
if (bottom - view.scrollTop >= 1) {
|
|
470
|
+
this.glide();
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
glide() {
|
|
474
|
+
var _a;
|
|
475
|
+
(_a = this.glider) === null || _a === void 0 ? void 0 : _a.start(share => {
|
|
476
|
+
const { view } = this;
|
|
477
|
+
const behind = view.scrollHeight - view.clientHeight - view.scrollTop;
|
|
478
|
+
if (!this.following || this.held || this.chasing || this.heading !== undefined || behind < 1) {
|
|
479
|
+
return false;
|
|
480
|
+
}
|
|
481
|
+
// The last pixel of the way at once: the view lands on the bottom, not short of it.
|
|
482
|
+
const move = Math.max(1, behind * share);
|
|
483
|
+
this.moveTo(behind - move < 1 ? view.scrollHeight - view.clientHeight : view.scrollTop + move);
|
|
484
|
+
this.see();
|
|
485
|
+
return true;
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
/** The row at the top of the view now (`seen`). */
|
|
489
|
+
see() {
|
|
490
|
+
const row = ScrollUtil.firstRow(this.thread.children, this.view.scrollTop);
|
|
491
|
+
this.seen = row ? { row, offset: row.offsetTop - this.view.scrollTop } : undefined;
|
|
492
|
+
}
|
|
385
493
|
toBottomNow() {
|
|
494
|
+
var _a;
|
|
495
|
+
(_a = this.glider) === null || _a === void 0 ? void 0 : _a.stop();
|
|
386
496
|
const { view } = this;
|
|
387
497
|
const bottom = view.scrollHeight - view.clientHeight;
|
|
388
498
|
if (bottom - view.scrollTop >= 1) {
|
|
@@ -390,6 +500,7 @@ export class ConversationScroller {
|
|
|
390
500
|
}
|
|
391
501
|
this.top = view.scrollTop;
|
|
392
502
|
this.anchor = undefined;
|
|
503
|
+
this.see();
|
|
393
504
|
}
|
|
394
505
|
moveTo(top) {
|
|
395
506
|
const { view } = this;
|
|
@@ -401,27 +512,13 @@ export class ConversationScroller {
|
|
|
401
512
|
}
|
|
402
513
|
/** The first row in the view, while it does not follow. */
|
|
403
514
|
remember() {
|
|
404
|
-
var _a, _b;
|
|
405
515
|
if (this.following) {
|
|
406
516
|
this.anchor = undefined;
|
|
517
|
+
this.see();
|
|
407
518
|
return;
|
|
408
519
|
}
|
|
409
|
-
const
|
|
410
|
-
|
|
411
|
-
let low = 0;
|
|
412
|
-
let high = rows.length - 1;
|
|
413
|
-
while (low < high) {
|
|
414
|
-
const middle = (low + high) >> 1;
|
|
415
|
-
const row = rows[middle];
|
|
416
|
-
if (row.offsetTop + row.offsetHeight > top) {
|
|
417
|
-
high = middle;
|
|
418
|
-
}
|
|
419
|
-
else {
|
|
420
|
-
low = middle + 1;
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
const row = ((_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];
|
|
424
|
-
this.anchor = row ? { row, offset: row.offsetTop - top } : undefined;
|
|
520
|
+
const row = ScrollUtil.firstRow(this.thread.children, this.view.scrollTop);
|
|
521
|
+
this.anchor = row ? { row, offset: row.offsetTop - this.view.scrollTop } : undefined;
|
|
425
522
|
}
|
|
426
523
|
offsetOf(element) {
|
|
427
524
|
return element.getBoundingClientRect().top - this.view.getBoundingClientRect().top;
|
|
@@ -434,99 +531,4 @@ export class ConversationScroller {
|
|
|
434
531
|
}
|
|
435
532
|
}
|
|
436
533
|
ConversationScroller.views = new WeakMap();
|
|
437
|
-
/**
|
|
438
|
-
* The scrolling of a conversation (ConversationScroller), whose thread is the first child of the element of the
|
|
439
|
-
* returned ref. Opened, and when messages of the user go (a rewind), the view goes to the bottom.
|
|
440
|
-
*
|
|
441
|
-
* `asked`: how many messages of the user there are; the thread marks them with ASK_CLASS.
|
|
442
|
-
*/
|
|
443
|
-
export function useConversationScroll(asked, options = {}) {
|
|
444
|
-
const { sentTo = 'top', key } = options;
|
|
445
|
-
const ref = React.useRef(null);
|
|
446
|
-
const attached = React.useRef(undefined);
|
|
447
|
-
const before = React.useRef(undefined);
|
|
448
|
-
// After each render, the view may only now be there (a page that shows it once its data came).
|
|
449
|
-
React.useLayoutEffect(() => {
|
|
450
|
-
var _a, _b;
|
|
451
|
-
const view = ref.current;
|
|
452
|
-
const thread = view === null || view === void 0 ? void 0 : view.firstElementChild;
|
|
453
|
-
if (((_a = attached.current) === null || _a === void 0 ? void 0 : _a.view) === view) {
|
|
454
|
-
return;
|
|
455
|
-
}
|
|
456
|
-
(_b = attached.current) === null || _b === void 0 ? void 0 : _b.detach();
|
|
457
|
-
attached.current = undefined;
|
|
458
|
-
if (view && thread instanceof HTMLElement) {
|
|
459
|
-
const scroller = new ConversationScroller(view, thread);
|
|
460
|
-
attached.current = { view, scroller, detach: scroller.attach(view, thread) };
|
|
461
|
-
}
|
|
462
|
-
});
|
|
463
|
-
React.useLayoutEffect(() => () => {
|
|
464
|
-
var _a;
|
|
465
|
-
(_a = attached.current) === null || _a === void 0 ? void 0 : _a.detach();
|
|
466
|
-
attached.current = undefined;
|
|
467
|
-
}, []);
|
|
468
|
-
React.useLayoutEffect(() => {
|
|
469
|
-
var _a, _b;
|
|
470
|
-
const previous = before.current;
|
|
471
|
-
before.current = { asked, key };
|
|
472
|
-
const current = (_a = attached.current) === null || _a === void 0 ? void 0 : _a.scroller;
|
|
473
|
-
const thread = (_b = ref.current) === null || _b === void 0 ? void 0 : _b.firstElementChild;
|
|
474
|
-
if (!current || !thread) {
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
477
|
-
// One more: sent now. More at once is the conversation loaded again, which opens at its bottom.
|
|
478
|
-
const sent = previous !== undefined && previous.key === key && asked === previous.asked + 1;
|
|
479
|
-
const asks = sent && sentTo === 'top' ? thread.getElementsByClassName(ASK_CLASS) : undefined;
|
|
480
|
-
const message = asks === null || asks === void 0 ? void 0 : asks[asks.length - 1];
|
|
481
|
-
if (message) {
|
|
482
|
-
current.send(message);
|
|
483
|
-
}
|
|
484
|
-
else {
|
|
485
|
-
current.reset();
|
|
486
|
-
}
|
|
487
|
-
}, [asked, key, sentTo]);
|
|
488
|
-
return ref;
|
|
489
|
-
}
|
|
490
|
-
/** Away from the bottom by more than half of the view: the button back to the latest shows. */
|
|
491
|
-
const AWAY_SHARE = 0.5;
|
|
492
|
-
/** Lower than this (a phone held sideways, its keyboard open) the view has no room for the button. */
|
|
493
|
-
const AWAY_MIN_PX = 240;
|
|
494
|
-
/** Whether the conversation of `ref` is scrolled up from its latest, and a way back to it. */
|
|
495
|
-
export function useAwayFromBottom(ref) {
|
|
496
|
-
const [away, setAway] = React.useState(false);
|
|
497
|
-
React.useEffect(() => {
|
|
498
|
-
const element = ref.current;
|
|
499
|
-
if (!element) {
|
|
500
|
-
return;
|
|
501
|
-
}
|
|
502
|
-
let frame = 0;
|
|
503
|
-
const measure = () => {
|
|
504
|
-
cancelAnimationFrame(frame);
|
|
505
|
-
frame = requestAnimationFrame(() => {
|
|
506
|
-
const { scrollHeight, scrollTop, clientHeight } = element;
|
|
507
|
-
setAway(clientHeight >= AWAY_MIN_PX && scrollHeight - scrollTop - clientHeight > clientHeight * AWAY_SHARE);
|
|
508
|
-
});
|
|
509
|
-
};
|
|
510
|
-
element.addEventListener('scroll', measure, { passive: true });
|
|
511
|
-
// The keyboard and a turn of the phone change the height of the view, not where it is.
|
|
512
|
-
const observer = typeof ResizeObserver !== 'undefined' ? new ResizeObserver(measure) : undefined;
|
|
513
|
-
observer === null || observer === void 0 ? void 0 : observer.observe(element);
|
|
514
|
-
return () => {
|
|
515
|
-
cancelAnimationFrame(frame);
|
|
516
|
-
observer === null || observer === void 0 ? void 0 : observer.disconnect();
|
|
517
|
-
element.removeEventListener('scroll', measure);
|
|
518
|
-
};
|
|
519
|
-
}, [ref]);
|
|
520
|
-
const back = React.useCallback(() => {
|
|
521
|
-
const element = ref.current;
|
|
522
|
-
const scroller = element ? ConversationScroller.of(element) : undefined;
|
|
523
|
-
if (scroller) {
|
|
524
|
-
scroller.toBottom();
|
|
525
|
-
}
|
|
526
|
-
else {
|
|
527
|
-
element === null || element === void 0 ? void 0 : element.scrollTo({ top: element.scrollHeight, behavior: calm() ? 'auto' : 'smooth' });
|
|
528
|
-
}
|
|
529
|
-
}, [ref]);
|
|
530
|
-
return [away, back];
|
|
531
|
-
}
|
|
532
534
|
//# sourceMappingURL=conversation-scroll.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface FaceProps {
|
|
3
|
+
/** One of the 16 faces; else the face of `seed`. */
|
|
4
|
+
face?: number;
|
|
5
|
+
seed?: string;
|
|
6
|
+
size: number;
|
|
7
|
+
/** At work: the eyes look about. */
|
|
8
|
+
working?: boolean;
|
|
9
|
+
/** A dot at its corner: green online, grey not; none without. */
|
|
10
|
+
online?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** One face; the eyes, cheeks and mouth are the same on every shape. */
|
|
13
|
+
export declare function Face({ face: given, seed, size, working, online }: FaceProps): React.JSX.Element;
|
|
14
|
+
export interface GroupFaceProps {
|
|
15
|
+
/** Those of the group, the one in front first: their faces, or their ids (`seed` of {@link Face}). */
|
|
16
|
+
members: readonly {
|
|
17
|
+
face?: number;
|
|
18
|
+
seed?: string;
|
|
19
|
+
working?: boolean;
|
|
20
|
+
}[];
|
|
21
|
+
size: number;
|
|
22
|
+
}
|
|
23
|
+
/** A group, as a channel is drawn: the first in front, the next behind; one alone is drawn whole. */
|
|
24
|
+
export declare function GroupFace({ members, size }: GroupFaceProps): React.JSX.Element;
|