@aperture-browser/session-react 0.0.0-nightly.146.5cdbddb967e9 → 0.0.0-nightly.149.08402157055a
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.md +10 -15
- package/dist/headless.d.ts +199 -295
- package/dist/headless.js +617 -2
- package/dist/headless.js.map +1 -0
- package/dist/index.d.ts +596 -94
- package/dist/index.js +5692 -2177
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -2
- package/package.json +8 -8
- package/dist/headless-yiQOTTfe.js +0 -2279
- package/dist/headless-yiQOTTfe.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
# @aperture-browser/session-react
|
|
2
2
|
|
|
3
|
-
React components
|
|
3
|
+
React components for watching and controlling one [Aperture](https://github.com/tarik02/aperture) session: the workbench with its tab strip, toolbar and menus, or the picture alone.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
npm install @aperture-browser/session-react
|
|
6
|
+
npm install @aperture-browser/session-react@beta react react-dom effect
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
+
While Aperture is in beta its packages are under the dist-tag `beta`; a package has the version of the server it speaks to.
|
|
10
|
+
|
|
9
11
|
```tsx
|
|
10
|
-
import {
|
|
11
|
-
import { ApertureSession, shareSessionAccess } from "@aperture-browser/session-react";
|
|
12
|
+
import { ApertureSession } from "@aperture-browser/session-react";
|
|
12
13
|
import "@aperture-browser/session-react/styles.css";
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return
|
|
17
|
-
<div style={{ height: 600 }}>
|
|
18
|
-
<ApertureSession access={access} />
|
|
19
|
-
</div>
|
|
20
|
-
);
|
|
15
|
+
// `url` is the session's base; `token` a ticket your backend asked the control plane for.
|
|
16
|
+
export function Browser({ url, token }: { url: string; token: string }) {
|
|
17
|
+
return <ApertureSession url={url} token={token} name="Ada" theme="system" />;
|
|
21
18
|
}
|
|
22
19
|
```
|
|
23
20
|
|
|
24
|
-
`@aperture-browser/session-react/headless` has the
|
|
25
|
-
|
|
26
|
-
Documentation: https://aperture-browser-docs.pages.dev/docs/packages/session-react
|
|
21
|
+
`features` turns parts of the workbench off (`{ tabs: false, recordings: false }`); `contributions` adds to its slots, replaces what is in them and leaves things out. `@aperture-browser/session-react/headless` has the hooks and the picture without the workbench's styles.
|
|
27
22
|
|
|
28
|
-
|
|
23
|
+
A ticket runs out: ask for a fresh one when the page is opened again.
|
package/dist/headless.d.ts
CHANGED
|
@@ -1,320 +1,224 @@
|
|
|
1
|
-
import { CSSProperties,
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import { BrowserInputMessage, CollaborationCursor, CollaborationError, CollaborationLeaseMode, CollaborationPaintEvent, CollaborationPaintPoint, CollaborationParticipant, CollaborationPhase, CollaborationRole, LiveSessionCommandResult, LiveSessionConnection, LiveSessionError, LiveSessionError as LiveSessionError$1, LiveSessionPresentation, LiveSessionPresentationQuality, LiveSessionRasterFrame, LiveSessionTarget, SessionAccess, SessionAccess as SessionAccess$1, ViewportPreset } from "@aperture-browser/live-session";
|
|
5
|
-
import * as ManagedRuntime from "effect/ManagedRuntime";
|
|
6
|
-
import * as HttpClient from "effect/http/HttpClient";
|
|
7
|
-
import { ApiRequestError, ApiServices, BrowserStatus, IceServer, Recording, RecordingSettings } from "@aperture-browser/api-client";
|
|
1
|
+
import { CSSProperties, ReactNode } from "react";
|
|
2
|
+
import { ConnectOptions, HeldTab, Member, Recording, Role, Screenshot, Session, SessionError, Snapshot, StartRecording, Target, Uploaded, connect } from "@aperture-browser/session-client";
|
|
3
|
+
export type * from "@aperture-browser/session-client";
|
|
8
4
|
|
|
9
|
-
//#region
|
|
10
|
-
interface InputDimensions {
|
|
11
|
-
width: number;
|
|
12
|
-
height: number;
|
|
13
|
-
}
|
|
14
|
-
interface LiveSessionMediaSize {
|
|
15
|
-
width: number;
|
|
16
|
-
height: number;
|
|
17
|
-
deviceScaleFactor: number;
|
|
18
|
-
canvasWidth: number;
|
|
19
|
-
canvasHeight: number;
|
|
20
|
-
}
|
|
21
|
-
type LiveSessionMediaSelection = {
|
|
22
|
-
kind: "jpeg";
|
|
23
|
-
} | {
|
|
24
|
-
kind: "webrtc";
|
|
25
|
-
quality: LiveSessionPresentationQuality;
|
|
26
|
-
} | {
|
|
27
|
-
kind: "webrtc-retry";
|
|
28
|
-
};
|
|
29
|
-
interface CollaborationControl {
|
|
30
|
-
phase: CollaborationPhase;
|
|
31
|
-
role: CollaborationRole;
|
|
32
|
-
clientId: string;
|
|
33
|
-
holderClientId: string | null;
|
|
34
|
-
leaseMode: CollaborationLeaseMode | null;
|
|
35
|
-
hasControl: boolean;
|
|
36
|
-
canRequestControl: boolean;
|
|
37
|
-
lastError: CollaborationError | null;
|
|
38
|
-
participants: readonly CollaborationParticipant[];
|
|
39
|
-
cursors: ReadonlyMap<string, CollaborationCursor>;
|
|
40
|
-
paintEvents: Stream.Stream<CollaborationPaintEvent>;
|
|
41
|
-
followingClientId: string | null;
|
|
42
|
-
claim: (targetId: string, mode: CollaborationLeaseMode) => boolean;
|
|
43
|
-
release: () => boolean;
|
|
44
|
-
setActiveTarget: (targetId: string | null) => boolean;
|
|
45
|
-
follow: (clientId: string | null) => boolean;
|
|
46
|
-
sendCursor: (targetId: string, x: number, y: number, dimensions: InputDimensions) => boolean;
|
|
47
|
-
sendPaintPoint: (point: CollaborationPaintPoint) => boolean;
|
|
48
|
-
clearCursor: () => boolean;
|
|
49
|
-
sendInput: (message: BrowserInputMessage, dimensions: InputDimensions) => boolean;
|
|
50
|
-
}
|
|
51
|
-
interface UseLiveSessionOptions {
|
|
52
|
-
access: SessionAccess$1 | null;
|
|
53
|
-
displayName?: string | null;
|
|
54
|
-
enabled: boolean;
|
|
55
|
-
webrtcSupported: boolean;
|
|
56
|
-
iceServers: readonly IceServer[];
|
|
57
|
-
autoSize: () => boolean;
|
|
58
|
-
}
|
|
59
|
-
/** Session-wide auto-size arbitration, known only when the server supports it. */
|
|
60
|
-
interface LiveSessionViewportOwnership {
|
|
61
|
-
ownerClientId: string | null;
|
|
62
|
-
autoSize: boolean;
|
|
63
|
-
}
|
|
64
|
-
interface LiveSessionControl {
|
|
65
|
-
phase: "idle" | "connecting" | "connected" | "disconnected" | "error";
|
|
66
|
-
targets: readonly LiveSessionTarget[];
|
|
67
|
-
activeTargetId: string | null;
|
|
68
|
-
/** The newest raster frame, starting with the current one. */
|
|
69
|
-
frames: Stream.Stream<LiveSessionRasterFrame | null>;
|
|
70
|
-
mediaStream: MediaStream | null;
|
|
71
|
-
mediaSize: LiveSessionMediaSize | null;
|
|
72
|
-
transport: "webrtc" | "websocket" | null;
|
|
73
|
-
presentation: LiveSessionPresentation | null;
|
|
74
|
-
mediaSwitching: boolean;
|
|
75
|
-
recordings: readonly Recording[];
|
|
76
|
-
viewportOwnership: LiveSessionViewportOwnership | null;
|
|
77
|
-
collaboration: CollaborationControl;
|
|
78
|
-
sendBrowserInput: (message: BrowserInputMessage, dimensions: InputDimensions) => boolean;
|
|
79
|
-
selectTarget: (targetId: string) => boolean;
|
|
80
|
-
requestSelectTarget: (targetId: string) => Effect.Effect<void, LiveSessionConnection.LiveSessionError>;
|
|
81
|
-
command: (type: string, payload?: Record<string, unknown>) => boolean;
|
|
82
|
-
request: (type: string, payload?: Record<string, unknown>) => Effect.Effect<LiveSessionCommandResult, LiveSessionConnection.LiveSessionError>;
|
|
83
|
-
selectPresentation: (selection: LiveSessionMediaSelection) => Effect.Effect<void, LiveSessionConnection.LiveSessionError>;
|
|
84
|
-
reconnect: () => void;
|
|
85
|
-
}
|
|
86
|
-
declare const collaborationPaintLifetimeMs = 7000;
|
|
87
|
-
declare function useLiveSession({
|
|
88
|
-
access: accessOption,
|
|
89
|
-
displayName,
|
|
90
|
-
enabled,
|
|
91
|
-
webrtcSupported,
|
|
92
|
-
iceServers: iceServersOption,
|
|
93
|
-
autoSize
|
|
94
|
-
}: UseLiveSessionOptions): LiveSessionControl;
|
|
95
|
-
//#endregion
|
|
96
|
-
//#region src/hooks/use-browser-control.d.ts
|
|
97
|
-
interface SessionNotice {
|
|
98
|
-
readonly level: "error" | "success";
|
|
99
|
-
readonly message: string;
|
|
100
|
-
}
|
|
101
|
-
interface UseBrowserControlOptions {
|
|
102
|
-
access: SessionAccess$1 | null;
|
|
103
|
-
displayName?: string | null;
|
|
104
|
-
enabled?: boolean;
|
|
105
|
-
webrtcProducerSupported?: boolean;
|
|
106
|
-
webrtcIceServers?: readonly IceServer[];
|
|
107
|
-
onNotice?: (notice: SessionNotice) => void;
|
|
108
|
-
}
|
|
109
|
-
interface BrowserViewportSize {
|
|
110
|
-
width: number;
|
|
111
|
-
height: number;
|
|
112
|
-
}
|
|
113
|
-
interface BrowserCommands {
|
|
114
|
-
readonly navigate: (url: string) => Effect.Effect<void, LiveSessionError$1>;
|
|
115
|
-
readonly historyBack: () => Effect.Effect<void, LiveSessionError$1>;
|
|
116
|
-
readonly historyForward: () => Effect.Effect<void, LiveSessionError$1>;
|
|
117
|
-
readonly reload: (targetId?: string) => Effect.Effect<void, LiveSessionError$1>;
|
|
118
|
-
readonly stopLoading: () => Effect.Effect<void, LiveSessionError$1>;
|
|
119
|
-
readonly createTarget: (url?: string) => Effect.Effect<string | null, LiveSessionError$1>;
|
|
120
|
-
readonly closeTarget: (targetId: string) => Effect.Effect<void, LiveSessionError$1>;
|
|
121
|
-
readonly activateTarget: (targetId: string) => Effect.Effect<void, LiveSessionError$1>;
|
|
122
|
-
}
|
|
123
|
-
type BrowserMediaPath = "webrtc-live" | "websocket-live";
|
|
124
|
-
type BrowserMediaPhase = "idle" | "connecting" | "live" | "failed";
|
|
125
|
-
interface UseBrowserControlResult {
|
|
126
|
-
phase: LiveSessionControl["phase"];
|
|
127
|
-
targets: readonly LiveSessionTarget[];
|
|
128
|
-
activeTargetId: string | null;
|
|
129
|
-
activeTarget: LiveSessionTarget | null;
|
|
130
|
-
frames: Stream.Stream<LiveSessionRasterFrame | null>;
|
|
131
|
-
mediaPhase: BrowserMediaPhase;
|
|
132
|
-
mediaStream: MediaStream | null;
|
|
133
|
-
mediaStreamSettings: LiveSessionPresentationQuality | null;
|
|
134
|
-
mediaVideoProfiles: LiveSessionPresentation["profiles"];
|
|
135
|
-
mediaSize: {
|
|
136
|
-
width: number;
|
|
137
|
-
height: number;
|
|
138
|
-
deviceScaleFactor: number;
|
|
139
|
-
canvasWidth: number;
|
|
140
|
-
canvasHeight: number;
|
|
141
|
-
} | null;
|
|
142
|
-
mediaPath: BrowserMediaPath;
|
|
143
|
-
mediaTargetId: string | null;
|
|
144
|
-
mediaSwitching: boolean;
|
|
145
|
-
viewport: ViewportPreset;
|
|
146
|
-
browserViewportSize: BrowserViewportSize | null;
|
|
147
|
-
viewportAutoSync: boolean;
|
|
148
|
-
/** Whether this client's auto-size currently resizes the browser. */
|
|
149
|
-
viewportAutoSizeActive: boolean;
|
|
150
|
-
/** Session-wide auto-size owner, or null when the server does not arbitrate auto-size. */
|
|
151
|
-
viewportOwnership: LiveSessionViewportOwnership | null;
|
|
152
|
-
/** Auto-size preference new session clients start with, persisted in local storage. */
|
|
153
|
-
viewportAutoSizeDefault: boolean;
|
|
154
|
-
captured: boolean;
|
|
155
|
-
recordings: readonly Recording[];
|
|
156
|
-
/** Loads a JPEG preview of one tab, or is null while the session has no access. */
|
|
157
|
-
loadTargetThumbnail: ((targetId: string) => Effect.Effect<Blob, ApiRequestError, HttpClient.HttpClient>) | null;
|
|
158
|
-
/** Owners and editors can start, stop, and download recordings. */
|
|
159
|
-
canRecord: boolean;
|
|
160
|
-
recordingBusy: boolean;
|
|
161
|
-
remoteCursorEnabled: boolean;
|
|
162
|
-
/** Whether agent actions are slowed down so this client can follow them. */
|
|
163
|
-
watchableAutomation: boolean;
|
|
164
|
-
collaboration: CollaborationControl;
|
|
165
|
-
commands: BrowserCommands;
|
|
166
|
-
setCaptured: (captured: boolean) => void;
|
|
167
|
-
setInputDimensions: (size: BrowserViewportSize) => void;
|
|
168
|
-
setViewport: (viewport: ViewportPreset) => void;
|
|
169
|
-
setBrowserViewportSize: (size: BrowserViewportSize) => void;
|
|
170
|
-
setViewportAutoSync: (enabled: boolean) => void;
|
|
171
|
-
setViewportToBrowserSize: () => void;
|
|
172
|
-
setViewportAutoSizeDefault: (enabled: boolean) => void;
|
|
173
|
-
takeOverViewport: () => void;
|
|
174
|
-
setWebRTCStreamSettings: (settings: LiveSessionPresentationQuality) => boolean;
|
|
175
|
-
selectMediaStream: (selection: LiveSessionMediaSelection) => boolean;
|
|
176
|
-
sendInput: (message: BrowserInputMessage) => boolean;
|
|
177
|
-
activateTarget: (targetId: string) => void;
|
|
178
|
-
reorderTargets: (sourceTargetId: string, destinationTargetId: string, placement: "before" | "after") => void;
|
|
179
|
-
createTarget: (url?: string) => void;
|
|
180
|
-
duplicateTarget: (target: LiveSessionTarget) => void;
|
|
181
|
-
closeTarget: (targetId: string) => void;
|
|
182
|
-
navigate: (url: string) => void;
|
|
183
|
-
reload: (targetId: string) => void;
|
|
184
|
-
stopLoading: () => void;
|
|
185
|
-
historyBack: () => void;
|
|
186
|
-
historyForward: () => void;
|
|
187
|
-
startRecording: (mode: "tab" | "viewer", settings: RecordingSettings) => void;
|
|
188
|
-
stopRecording: (recordingId: string) => void;
|
|
189
|
-
cancelRecording: (recordingId: string) => void;
|
|
190
|
-
setRemoteCursorEnabled: (enabled: boolean) => void;
|
|
191
|
-
setWatchableAutomation: (enabled: boolean) => void;
|
|
192
|
-
reconnect: () => void;
|
|
193
|
-
}
|
|
194
|
-
declare function useBrowserControl({
|
|
195
|
-
access,
|
|
196
|
-
displayName,
|
|
197
|
-
enabled,
|
|
198
|
-
webrtcProducerSupported,
|
|
199
|
-
webrtcIceServers,
|
|
200
|
-
onNotice
|
|
201
|
-
}: UseBrowserControlOptions): UseBrowserControlResult;
|
|
5
|
+
//#region \0rolldown/runtime.js
|
|
202
6
|
//#endregion
|
|
203
7
|
//#region src/components/session-viewport.d.ts
|
|
204
8
|
interface SessionViewportProps {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
onPaintingEnabledChange?: (enabled: boolean) => void;
|
|
210
|
-
onNotice?: (notice: SessionNotice) => void;
|
|
211
|
-
className?: string;
|
|
212
|
-
style?: CSSProperties;
|
|
213
|
-
renderOverlay?: (overlay: SessionViewportOverlay) => ReactNode;
|
|
9
|
+
readonly className?: string | undefined;
|
|
10
|
+
readonly style?: CSSProperties | undefined;
|
|
11
|
+
/** Laid over the picture, such as the connection's state. */
|
|
12
|
+
readonly children?: ReactNode;
|
|
214
13
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
readonly status: SessionViewportStatus;
|
|
219
|
-
readonly placeholder: SessionViewportPlaceholder | null;
|
|
220
|
-
readonly cursorHint: {
|
|
221
|
-
readonly text: string;
|
|
222
|
-
readonly x: number;
|
|
223
|
-
readonly y: number;
|
|
224
|
-
} | null;
|
|
225
|
-
readonly followedCursor: {
|
|
226
|
-
readonly name: string;
|
|
227
|
-
readonly x: number;
|
|
228
|
-
readonly y: number;
|
|
229
|
-
} | null;
|
|
230
|
-
readonly collaborationError: string | null;
|
|
14
|
+
interface Size {
|
|
15
|
+
readonly width: number;
|
|
16
|
+
readonly height: number;
|
|
231
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* The watched target's picture, and its input: the pointer, the wheel, the keyboard, the
|
|
20
|
+
* clipboard and what is dropped on it. The picture is shown at the target's own size, and
|
|
21
|
+
* smaller where the stage has no room for that.
|
|
22
|
+
*/
|
|
232
23
|
declare function SessionViewport({
|
|
233
|
-
control,
|
|
234
|
-
viewport,
|
|
235
|
-
localCursorEnabled,
|
|
236
|
-
paintingEnabled,
|
|
237
|
-
onPaintingEnabledChange,
|
|
238
|
-
onNotice,
|
|
239
24
|
className,
|
|
240
25
|
style,
|
|
241
|
-
|
|
26
|
+
children
|
|
242
27
|
}: SessionViewportProps): import("react").JSX.Element;
|
|
28
|
+
/** The place the picture of a target has in a stage: its own size, or smaller to fit. */
|
|
29
|
+
declare function pictureBox(stage: Size, target: Size): Size;
|
|
243
30
|
//#endregion
|
|
244
|
-
//#region src/
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
readonly
|
|
248
|
-
|
|
249
|
-
|
|
31
|
+
//#region src/hooks/use-actions.d.ts
|
|
32
|
+
interface TabSound {
|
|
33
|
+
/** The tab plays something now. */
|
|
34
|
+
readonly sounds: boolean;
|
|
35
|
+
/** The tab is muted for this client. */
|
|
36
|
+
readonly muted: boolean;
|
|
37
|
+
readonly toggle: () => void;
|
|
38
|
+
}
|
|
39
|
+
/** A tab's sound, as this client hears it. */
|
|
40
|
+
declare function useTabSound(target: Target | undefined): TabSound;
|
|
41
|
+
interface InputState {
|
|
42
|
+
readonly open: boolean;
|
|
43
|
+
/** This member may open, close and take tabs elsewhere, and give them another size. */
|
|
44
|
+
readonly changes: boolean;
|
|
45
|
+
/** This member may give the watched tab input. */
|
|
46
|
+
readonly gives: boolean;
|
|
47
|
+
}
|
|
48
|
+
/** What this member may do in the session now. */
|
|
49
|
+
declare function useInputState(): InputState;
|
|
250
50
|
//#endregion
|
|
251
|
-
//#region src/
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
|
|
257
|
-
readonly
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
declare function useBaseUrl(): string | undefined;
|
|
51
|
+
//#region src/hooks/use-address.d.ts
|
|
52
|
+
interface AddressControl {
|
|
53
|
+
/** What the address field shows: what is typed, or the watched tab's address. */
|
|
54
|
+
readonly value: string;
|
|
55
|
+
/** Whether this member may take the watched tab elsewhere. */
|
|
56
|
+
readonly navigates: boolean;
|
|
57
|
+
readonly type: (value: string) => void;
|
|
58
|
+
/** Lets go of what was typed and not sent. */
|
|
59
|
+
readonly reset: () => void;
|
|
60
|
+
/** Takes the watched tab to what was typed; false when that is nothing. */
|
|
61
|
+
readonly submit: (value: string) => boolean;
|
|
62
|
+
}
|
|
63
|
+
/** The watched tab's address, as a field to type another into. */
|
|
64
|
+
declare function useAddress(): AddressControl;
|
|
65
|
+
/** What is typed into an address field as a URL: an address as it is, anything else a search. */
|
|
66
|
+
declare function addressOf(value: string): string;
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/hooks/use-fit.d.ts
|
|
270
69
|
/**
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
70
|
+
* Has the viewport fit the window, unless that was switched off when this browser was last
|
|
71
|
+
* here, and remembers when it is switched on or off. `follows` is false where the embedder
|
|
72
|
+
* wants targets left at the size they have.
|
|
274
73
|
*/
|
|
275
|
-
declare function
|
|
74
|
+
declare function useRememberedFit(follows?: boolean): void;
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/hooks/use-recordings.d.ts
|
|
77
|
+
interface RecordingsControl {
|
|
78
|
+
/** Newest first. */
|
|
79
|
+
readonly recordings: readonly Recording[];
|
|
80
|
+
/** Newest first. */
|
|
81
|
+
readonly screenshots: readonly Screenshot[];
|
|
82
|
+
/** A start or a stop is on its way. */
|
|
83
|
+
readonly busy: boolean;
|
|
84
|
+
readonly refresh: () => void;
|
|
85
|
+
/** Rejects with what the session answered. */
|
|
86
|
+
readonly start: (options?: StartRecording) => Promise<Recording>;
|
|
87
|
+
readonly stop: (id: string) => Promise<Recording>;
|
|
88
|
+
/** Takes a screenshot of a target and keeps it in the session's files. */
|
|
89
|
+
readonly takeScreenshot: (tab: number) => Promise<Screenshot>;
|
|
90
|
+
}
|
|
91
|
+
declare const recordingRuns: (recording: Recording) => boolean;
|
|
92
|
+
declare const recordingIsEdited: (recording: Recording) => boolean;
|
|
276
93
|
/**
|
|
277
|
-
*
|
|
278
|
-
*
|
|
94
|
+
* The session's recordings and screenshots. The live protocol does not tell of them, so they are asked for
|
|
95
|
+
* again and again: often while one runs or is edited, seldom otherwise.
|
|
279
96
|
*/
|
|
280
|
-
declare function
|
|
97
|
+
declare function useRecordings(enabled?: boolean): RecordingsControl;
|
|
98
|
+
/** Something the session kept of a tab: a recording that ended, or a screenshot. */
|
|
99
|
+
type Kept = {
|
|
100
|
+
readonly kind: "recording";
|
|
101
|
+
readonly id: string;
|
|
102
|
+
readonly at: number;
|
|
103
|
+
readonly recording: Recording;
|
|
104
|
+
} | {
|
|
105
|
+
readonly kind: "screenshot";
|
|
106
|
+
readonly id: string;
|
|
107
|
+
readonly at: number;
|
|
108
|
+
readonly screenshot: Screenshot;
|
|
109
|
+
};
|
|
110
|
+
/** The recordings that ended and the screenshots as one list, newest first. */
|
|
111
|
+
declare function keptOf(control: RecordingsControl): readonly Kept[];
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/hooks/use-stored.d.ts
|
|
281
114
|
/**
|
|
282
|
-
*
|
|
283
|
-
*
|
|
115
|
+
* A choice this browser remembers, the same for everything on the page that uses the key.
|
|
116
|
+
* It lasts for the page where storage is unavailable.
|
|
284
117
|
*/
|
|
285
|
-
declare function
|
|
286
|
-
readonly signal?: AbortSignal;
|
|
287
|
-
}) => Promise<A>;
|
|
118
|
+
declare function useStored<Value>(key: string, fallback: Value, valid: (value: unknown) => value is Value): readonly [Value, (value: Value) => void];
|
|
288
119
|
//#endregion
|
|
289
|
-
//#region src/
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
readonly
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
120
|
+
//#region src/hooks/use-uploads.d.ts
|
|
121
|
+
/** A file on its way into the session. */
|
|
122
|
+
interface UploadInProgress {
|
|
123
|
+
readonly name: string;
|
|
124
|
+
readonly loaded: number;
|
|
125
|
+
readonly total: number;
|
|
126
|
+
}
|
|
127
|
+
interface UploadsControl {
|
|
128
|
+
/** The files that are in the session for its browser to take. */
|
|
129
|
+
readonly uploads: readonly Uploaded[];
|
|
130
|
+
readonly inProgress: readonly UploadInProgress[];
|
|
131
|
+
readonly refresh: () => void;
|
|
132
|
+
/**
|
|
133
|
+
* Puts files into the session. Gives those that got there; `onFailure` hears of each
|
|
134
|
+
* that did not.
|
|
135
|
+
*/
|
|
136
|
+
readonly upload: (files: readonly File[], onFailure?: (file: File, cause: unknown) => void) => Promise<Uploaded[]>;
|
|
137
|
+
/** Rejects with what the session answered. */
|
|
138
|
+
readonly remove: (name: string) => Promise<void>;
|
|
139
|
+
}
|
|
140
|
+
/** The session's uploads. A file put there by another member shows at the next `refresh`. */
|
|
141
|
+
declare function useUploads(enabled?: boolean): UploadsControl;
|
|
298
142
|
//#endregion
|
|
299
143
|
//#region src/session.d.ts
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
readonly
|
|
305
|
-
readonly displayName?: string | null;
|
|
306
|
-
readonly onNotice?: (notice: SessionNotice) => void;
|
|
144
|
+
interface SessionConnection {
|
|
145
|
+
/** None until the page has mounted, and none between two connections. */
|
|
146
|
+
readonly session: Session | null;
|
|
147
|
+
/** Ends the connection there is and makes a new one: a closed connection does not come back. */
|
|
148
|
+
readonly reconnect: () => void;
|
|
307
149
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Connects to a session for as long as the component is mounted. Another address, name or
|
|
152
|
+
* first way of the picture makes another connection.
|
|
153
|
+
*/
|
|
154
|
+
declare function useConnectedSession({
|
|
155
|
+
url,
|
|
156
|
+
token,
|
|
157
|
+
name,
|
|
158
|
+
pixels
|
|
159
|
+
}: ConnectOptions): SessionConnection;
|
|
160
|
+
interface SessionProviderProps {
|
|
161
|
+
readonly session: Session;
|
|
162
|
+
/** Offered where the connection is closed, when there is a way to make another. */
|
|
163
|
+
readonly reconnect?: (() => void) | undefined;
|
|
164
|
+
readonly children?: ReactNode;
|
|
312
165
|
}
|
|
313
|
-
declare function
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
}:
|
|
166
|
+
declare function SessionProvider({
|
|
167
|
+
session,
|
|
168
|
+
reconnect,
|
|
169
|
+
children
|
|
170
|
+
}: SessionProviderProps): import("react").JSX.Element;
|
|
171
|
+
declare function useSession(): Session;
|
|
172
|
+
declare function useReconnect(): (() => void) | undefined;
|
|
173
|
+
declare function useSessionSnapshot(): Snapshot;
|
|
174
|
+
/** The target that is watched. */
|
|
175
|
+
declare function useWatchedTarget(): Target | undefined;
|
|
176
|
+
type LeaseState = /** The role lets this member watch only. */"view-only" /** Nobody holds the watched tab: whoever gives it input holds it. */ | "free" | "yours" /** This member holds the tab and another asks for it. */ | "asked-of-you" | "theirs" /** Another holds the tab and this member has asked for it. */ | "you-asked" /** Another holds the tab and a third member has asked for it. */ | "theirs-asked";
|
|
177
|
+
interface Lease {
|
|
178
|
+
readonly state: LeaseState;
|
|
179
|
+
/** The member this client is, once the session told. */
|
|
180
|
+
readonly you: Member | undefined;
|
|
181
|
+
readonly role: Role | undefined;
|
|
182
|
+
/** Whether this member's role lets it give input and change the session's tabs. */
|
|
183
|
+
readonly givesInput: boolean;
|
|
184
|
+
readonly held: HeldTab | undefined;
|
|
185
|
+
readonly holder: Member | undefined;
|
|
186
|
+
readonly asker: Member | undefined;
|
|
187
|
+
}
|
|
188
|
+
/** Who holds the lease of the watched tab, and what this member may do about it. */
|
|
189
|
+
declare function useLease(): Lease;
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/hooks/use-timeline.d.ts
|
|
192
|
+
/** A stretch of the raw video the edit kept, and how much faster it plays there. */
|
|
193
|
+
interface TimelinePiece {
|
|
194
|
+
readonly raw_start_ms: number;
|
|
195
|
+
readonly raw_end_ms: number;
|
|
196
|
+
readonly speed: number;
|
|
197
|
+
readonly edited_start_ms: number;
|
|
198
|
+
}
|
|
199
|
+
/** Something that happened while the recording ran, in the raw video's time and the edit's. */
|
|
200
|
+
interface TimelineEvent {
|
|
201
|
+
/** `call` for a tool of the automation, `press`, `move`, `wheel`, `caption` and so on. */
|
|
202
|
+
readonly kind: string;
|
|
203
|
+
readonly at_ms: number;
|
|
204
|
+
readonly end_ms: number;
|
|
205
|
+
readonly edited_at_ms: number;
|
|
206
|
+
readonly edited_end_ms: number;
|
|
207
|
+
readonly [field: string]: unknown;
|
|
208
|
+
}
|
|
209
|
+
/** A recording's timeline, as the session writes it next to the edit. */
|
|
210
|
+
interface RecordingTimeline {
|
|
211
|
+
readonly duration_ms: number;
|
|
212
|
+
readonly edited_duration_ms: number;
|
|
213
|
+
/** The video's size in pixels. */
|
|
214
|
+
readonly width: number;
|
|
215
|
+
readonly height: number;
|
|
216
|
+
readonly map: readonly TimelinePiece[];
|
|
217
|
+
readonly events: readonly TimelineEvent[];
|
|
218
|
+
readonly events_dropped: number;
|
|
219
|
+
}
|
|
220
|
+
/** The timeline of a recording whose edit is made; none before, and where there is no edit. */
|
|
221
|
+
declare function useRecordingTimeline(recording: Recording | undefined): RecordingTimeline | undefined;
|
|
318
222
|
//#endregion
|
|
319
|
-
export {
|
|
223
|
+
export { AddressControl, InputState, Kept, Lease, LeaseState, RecordingTimeline, RecordingsControl, SessionConnection, SessionError, SessionProvider, SessionProviderProps, SessionViewport, SessionViewportProps, TabSound, TimelineEvent, TimelinePiece, UploadInProgress, UploadsControl, addressOf, connect, keptOf, __reExport as n, pictureBox, recordingIsEdited, recordingRuns, __exportAll as t, useAddress, useConnectedSession, useInputState, useLease, useReconnect, useRecordingTimeline, useRecordings, useRememberedFit, useSession, useSessionSnapshot, useStored, useTabSound, useUploads, useWatchedTarget };
|
|
320
224
|
//# sourceMappingURL=headless.d.ts.map
|