@netless/fastboard-core 0.3.13-canary.3 → 0.3.13
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/dist/index.d.ts +1 -474
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/dist/lite.js +1 -1
- package/dist/lite.js.map +1 -1
- package/dist/lite.mjs +1 -1
- package/dist/lite.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,475 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export { AnimationMode, ApplianceNames, Camera, CameraState, Color, ConversionResponse, HotKey, HotKeys, JoinRoomParams, MemberState, PlayerSeekingResult, Rectangle, Room, RoomCallbacks, RoomState, SceneDefinition, ShapeType, ViewCallbacks, WhiteWebSdk, WhiteWebSdkConfiguration } from 'white-web-sdk';
|
|
3
|
-
import { AddPageParams, MountParams, NetlessApp, WindowManager, PublicEvent } from '@netless/window-manager';
|
|
4
|
-
export { AddPageParams, MountParams, NetlessApp, PublicEvent, WindowManager } from '@netless/window-manager';
|
|
5
|
-
import { SyncedStore } from '@netless/synced-store';
|
|
6
|
-
export { Diff, DiffOne, Storage, SyncedStore } from '@netless/synced-store';
|
|
1
|
+
export * from './lite';
|
|
7
2
|
export { PreviewParams, default as SlideApp, AppResult as SlideController, AppOptions as SlideOptions, SlidePreviewer, addHooks as addSlideHooks, previewSlide, apps as slideApps } from '@netless/app-slide';
|
|
8
|
-
|
|
9
|
-
type Subscriber<T> = (value: T) => void;
|
|
10
|
-
type Unsubscriber = () => void;
|
|
11
|
-
type Updater<T> = (value: T) => T;
|
|
12
|
-
type StartStopNotifier<T> = (set: Subscriber<T>) => Unsubscriber | void;
|
|
13
|
-
interface Readable<T> {
|
|
14
|
-
readonly value: T;
|
|
15
|
-
subscribe(this: void, run: Subscriber<T>): Unsubscriber;
|
|
16
|
-
reaction(this: void, run: Subscriber<T>): Unsubscriber;
|
|
17
|
-
}
|
|
18
|
-
interface Writable<T> extends Readable<T> {
|
|
19
|
-
set(this: void, value: T): void;
|
|
20
|
-
update(this: void, updater: Updater<T>): void;
|
|
21
|
-
}
|
|
22
|
-
declare function readable<T>(value: T, start?: StartStopNotifier<T>): Readable<T>;
|
|
23
|
-
declare function writable<T>(value: T, start: StartStopNotifier<T> | undefined, set: Subscriber<T>): Writable<T>;
|
|
24
|
-
|
|
25
|
-
declare function getImageSize(url: string, fallback: Size, crossOrigin?: boolean | string): Promise<Size>;
|
|
26
|
-
declare function makeSlideParams(scenes: SceneDefinition[]): {
|
|
27
|
-
scenes: SceneDefinition[];
|
|
28
|
-
taskId: string;
|
|
29
|
-
url: string;
|
|
30
|
-
};
|
|
31
|
-
declare function convertedFileToScene(f: ConvertedFile, i: number): SceneDefinition;
|
|
32
|
-
|
|
33
|
-
declare function genUID(): string;
|
|
34
|
-
|
|
35
|
-
declare const warnings: {
|
|
36
|
-
readonly "no-ppt-in-scenes": "You're probably inserting the slide app in a wrong way, there shouldn't exist `scenes[0].ppt`.";
|
|
37
|
-
};
|
|
38
|
-
declare function warn(id: keyof typeof warnings): void;
|
|
39
|
-
|
|
40
|
-
declare class FastboardAppBase<TEventData extends Record<string, any> = any> {
|
|
41
|
-
readonly sdk: WhiteWebSdk;
|
|
42
|
-
readonly room: Room;
|
|
43
|
-
readonly manager: WindowManager;
|
|
44
|
-
readonly hotKeys: Partial<HotKeys>;
|
|
45
|
-
readonly syncedStore: SyncedStore<TEventData>;
|
|
46
|
-
constructor(sdk: WhiteWebSdk, room: Room, manager: WindowManager, hotKeys: Partial<HotKeys>, syncedStore: SyncedStore<TEventData>);
|
|
47
|
-
protected _destroyed: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Destroy fastboard (disconnect from the whiteboard room).
|
|
50
|
-
*/
|
|
51
|
-
destroy(): Promise<void>;
|
|
52
|
-
}
|
|
53
|
-
type RoomPhase = `${RoomPhase$1}`;
|
|
54
|
-
|
|
55
|
-
/** pencil, eraser, rectangle... */
|
|
56
|
-
type Appliance = `${ApplianceNames}`;
|
|
57
|
-
/** triangle, star... */
|
|
58
|
-
type Shape = `${ShapeType}`;
|
|
59
|
-
/** Params for static docs, they are rendered as many images. */
|
|
60
|
-
interface InsertDocsStatic {
|
|
61
|
-
readonly fileType: "pdf";
|
|
62
|
-
/** Unique string for binding whiteboard view to the doc. Must start with `/`. */
|
|
63
|
-
readonly scenePath: string;
|
|
64
|
-
/** @example [{ name: '1', ppt: { src: 'url/to/ppt/1.png' } }] */
|
|
65
|
-
readonly scenes: SceneDefinition[];
|
|
66
|
-
/** Window title. */
|
|
67
|
-
readonly title?: string;
|
|
68
|
-
}
|
|
69
|
-
/** Params for slides, they are rendered in @netless/app-slide with animations. */
|
|
70
|
-
interface InsertDocsDynamic {
|
|
71
|
-
readonly fileType: "pptx";
|
|
72
|
-
/** Unique string for binding whiteboard view to the doc. Must start with `/`. */
|
|
73
|
-
readonly scenePath: string;
|
|
74
|
-
/** Conversion task id, see https://developer.netless.link/server-en/home/server-conversion#get-query-task-conversion-progress. */
|
|
75
|
-
readonly taskId: string;
|
|
76
|
-
/** Window title. */
|
|
77
|
-
readonly title?: string;
|
|
78
|
-
/** Where the slide resource placed. @default `https://convertcdn.netless.link/dynamicConvert` */
|
|
79
|
-
readonly url?: string;
|
|
80
|
-
/** @example [{ name: '1' }, { name: '2' }, { name: '3' }] */
|
|
81
|
-
readonly scenes?: SceneDefinition[];
|
|
82
|
-
}
|
|
83
|
-
type InsertDocsParams = InsertDocsStatic | InsertDocsDynamic;
|
|
84
|
-
interface ProjectorResponse {
|
|
85
|
-
uuid: string;
|
|
86
|
-
status: "Waiting" | "Converting" | "Finished" | "Fail";
|
|
87
|
-
type: "dynamic" | "static";
|
|
88
|
-
/** 0..100 */
|
|
89
|
-
convertedPercentage: number;
|
|
90
|
-
/** https://example.org/path/to/dynamicConvert, only when type=dynamic */
|
|
91
|
-
prefix?: string;
|
|
92
|
-
pageCount?: number;
|
|
93
|
-
/** {1:"{prefix}/{taskId}/preview/1.png"}, only when type=dynamic and preview=true */
|
|
94
|
-
previews?: Record<number, string>;
|
|
95
|
-
/** {prefix}/{taskId}/jsonOutput/note.json */
|
|
96
|
-
note?: string;
|
|
97
|
-
/** {1:{width,height,url}}, only when type=static */
|
|
98
|
-
images?: Record<number, {
|
|
99
|
-
width: number;
|
|
100
|
-
height: number;
|
|
101
|
-
url: string;
|
|
102
|
-
}>;
|
|
103
|
-
/** 20xxxxx */
|
|
104
|
-
errorCode?: string;
|
|
105
|
-
errorMessage?: string;
|
|
106
|
-
}
|
|
107
|
-
type SetMemberStateFn = (partialMemberState: Partial<MemberState>) => void;
|
|
108
|
-
type RoomStateChanged = (diff: Partial<RoomState>) => void;
|
|
109
|
-
/** App download progress. */
|
|
110
|
-
interface AppsStatus {
|
|
111
|
-
[kind: string]: {
|
|
112
|
-
status: "idle" | "loading" | "failed";
|
|
113
|
-
/** Exist if status is `failed`. */
|
|
114
|
-
reason?: string;
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
declare class FastboardApp<TEventData extends Record<string, any> = any> extends FastboardAppBase<TEventData> {
|
|
118
|
-
/**
|
|
119
|
-
* Render this app to some DOM.
|
|
120
|
-
*/
|
|
121
|
-
bindContainer(container: HTMLElement): void;
|
|
122
|
-
/**
|
|
123
|
-
* Move window-manager's collector to some place.
|
|
124
|
-
*/
|
|
125
|
-
bindCollector(container: HTMLElement): void;
|
|
126
|
-
/**
|
|
127
|
-
* Is current room writable?
|
|
128
|
-
*/
|
|
129
|
-
readonly writable: Writable<boolean>;
|
|
130
|
-
/**
|
|
131
|
-
* Is current room online?
|
|
132
|
-
*/
|
|
133
|
-
readonly phase: Readable<"connecting" | "connected" | "reconnecting" | "disconnecting" | "disconnected">;
|
|
134
|
-
/**
|
|
135
|
-
* Current window-manager's windows' state (is it maximized?).
|
|
136
|
-
*/
|
|
137
|
-
readonly boxState: Readable<"normal" | "minimized" | "maximized" | undefined>;
|
|
138
|
-
/**
|
|
139
|
-
* Current window-manager's focused app's id.
|
|
140
|
-
* @example "HelloWorld-1A2b3C4d"
|
|
141
|
-
*/
|
|
142
|
-
readonly focusedApp: Readable<string | undefined>;
|
|
143
|
-
/**
|
|
144
|
-
* How many times can I call `app.redo()`?
|
|
145
|
-
*/
|
|
146
|
-
readonly canRedoSteps: Readable<number>;
|
|
147
|
-
/**
|
|
148
|
-
* How many times can I call `app.undo()`?
|
|
149
|
-
*/
|
|
150
|
-
readonly canUndoSteps: Readable<number>;
|
|
151
|
-
/**
|
|
152
|
-
* Current camera information of main view.
|
|
153
|
-
*
|
|
154
|
-
* Change the camera position by `app.moveCamera()`.
|
|
155
|
-
*/
|
|
156
|
-
readonly camera: Readable<CameraState>;
|
|
157
|
-
/**
|
|
158
|
-
* Current tool's info, like "is using pencil?", "what color?".
|
|
159
|
-
*
|
|
160
|
-
* Change the tool by `app.setAppliance()`.
|
|
161
|
-
*/
|
|
162
|
-
readonly memberState: Readable<MemberState>;
|
|
163
|
-
/**
|
|
164
|
-
* 0..n-1, current index of main view scenes.
|
|
165
|
-
*/
|
|
166
|
-
readonly sceneIndex: Writable<number>;
|
|
167
|
-
/**
|
|
168
|
-
* How many pages are in the main view?
|
|
169
|
-
*/
|
|
170
|
-
readonly sceneLength: Readable<number>;
|
|
171
|
-
/**
|
|
172
|
-
* Apps status.
|
|
173
|
-
*/
|
|
174
|
-
readonly appsStatus: Readable<AppsStatus>;
|
|
175
|
-
/**
|
|
176
|
-
* Undo a step on main view.
|
|
177
|
-
*/
|
|
178
|
-
undo(): void;
|
|
179
|
-
/**
|
|
180
|
-
* Redo a step on main view.
|
|
181
|
-
*/
|
|
182
|
-
redo(): void;
|
|
183
|
-
/**
|
|
184
|
-
* Move current main view's camera position.
|
|
185
|
-
*/
|
|
186
|
-
moveCamera(camera: Partial<Camera> & {
|
|
187
|
-
animationMode?: AnimationMode | undefined;
|
|
188
|
-
}): void;
|
|
189
|
-
/**
|
|
190
|
-
* Move current main view's camera to include a rectangle.
|
|
191
|
-
*/
|
|
192
|
-
moveCameraToContain(rectangle: Rectangle & {
|
|
193
|
-
animationMode?: AnimationMode;
|
|
194
|
-
}): void;
|
|
195
|
-
/**
|
|
196
|
-
* Delete all things on the main view.
|
|
197
|
-
*/
|
|
198
|
-
cleanCurrentScene(): void;
|
|
199
|
-
/**
|
|
200
|
-
* Set current tool, like "pencil".
|
|
201
|
-
*/
|
|
202
|
-
setAppliance(appliance: ApplianceNames | Appliance, shape?: ShapeType | Shape): void;
|
|
203
|
-
/**
|
|
204
|
-
* Set pencil and shape's thickness.
|
|
205
|
-
*/
|
|
206
|
-
setStrokeWidth(strokeWidth: number): void;
|
|
207
|
-
/**
|
|
208
|
-
* Set pencil and shape's color.
|
|
209
|
-
*/
|
|
210
|
-
setStrokeColor(strokeColor: Color): void;
|
|
211
|
-
/**
|
|
212
|
-
* Set text size. Default is 16.
|
|
213
|
-
*/
|
|
214
|
-
setTextSize(textSize: number): void;
|
|
215
|
-
/**
|
|
216
|
-
* Set text color.
|
|
217
|
-
*
|
|
218
|
-
* @example
|
|
219
|
-
* setTextColor([0x66, 0xcc, 0xff])
|
|
220
|
-
*/
|
|
221
|
-
setTextColor(textColor: Color): void;
|
|
222
|
-
/**
|
|
223
|
-
* Toggle dotted line effect on pencil.
|
|
224
|
-
*/
|
|
225
|
-
toggleDottedLine(force?: boolean): void;
|
|
226
|
-
/**
|
|
227
|
-
* Set pencil eraser size.
|
|
228
|
-
*/
|
|
229
|
-
setPencilEraserSize(size: number): void;
|
|
230
|
-
/**
|
|
231
|
-
* Goto previous page (the main whiteboard view).
|
|
232
|
-
*/
|
|
233
|
-
prevPage(): Promise<boolean>;
|
|
234
|
-
/**
|
|
235
|
-
* Goto next page (the main whiteboard view).
|
|
236
|
-
*/
|
|
237
|
-
nextPage(): Promise<boolean>;
|
|
238
|
-
/**
|
|
239
|
-
* Goto any page (index range: 0..n-1)
|
|
240
|
-
*/
|
|
241
|
-
jumpPage(index: number): Promise<boolean>;
|
|
242
|
-
/**
|
|
243
|
-
* Add one page to the main whiteboard view.
|
|
244
|
-
*
|
|
245
|
-
* @example
|
|
246
|
-
* addPage({ after: true }) // add one page right after current one.
|
|
247
|
-
* nextPage() // then, goto that page.
|
|
248
|
-
*/
|
|
249
|
-
addPage(params?: AddPageParams): Promise<void>;
|
|
250
|
-
/**
|
|
251
|
-
* Remove one page at given index or current page (by default).
|
|
252
|
-
*
|
|
253
|
-
* Requires `@netless/window-manager` >= 0.4.30.
|
|
254
|
-
*
|
|
255
|
-
* @example
|
|
256
|
-
* removePage() // remove current page
|
|
257
|
-
*/
|
|
258
|
-
removePage(index?: number): Promise<boolean>;
|
|
259
|
-
/**
|
|
260
|
-
* Insert an image to the main view.
|
|
261
|
-
*
|
|
262
|
-
* @param crossOrigin Whether to load the image with CORS enabled, default is `true`.
|
|
263
|
-
*
|
|
264
|
-
* @example
|
|
265
|
-
* insertImage("https://i.imgur.com/CzXTtJV.jpg")
|
|
266
|
-
*/
|
|
267
|
-
insertImage(url: string, crossOrigin?: boolean | string): Promise<void>;
|
|
268
|
-
/**
|
|
269
|
-
* Insert PDF/PPTX from conversion result.
|
|
270
|
-
* @param status https://developer.netless.link/server-en/home/server-conversion#get-query-task-conversion-progress
|
|
271
|
-
*/
|
|
272
|
-
insertDocs(filename: string, status: ConversionResponse): Promise<string | undefined>;
|
|
273
|
-
/**
|
|
274
|
-
* Insert PDF/PPTX from projector conversion result.
|
|
275
|
-
* @param response https://developer.netless.link/server-zh/home/server-projector#get-%E6%9F%A5%E8%AF%A2%E4%BB%BB%E5%8A%A1%E8%BD%AC%E6%8D%A2%E8%BF%9B%E5%BA%A6
|
|
276
|
-
*/
|
|
277
|
-
insertDocs(filename: string, response: ProjectorResponse): Promise<string | undefined>;
|
|
278
|
-
/**
|
|
279
|
-
* Manual way.
|
|
280
|
-
* @example
|
|
281
|
-
* app.insertDocs({
|
|
282
|
-
* fileType: 'pptx',
|
|
283
|
-
* scenePath: `/pptx/${conversion.taskId}`,
|
|
284
|
-
* taskId: conversion.taskId,
|
|
285
|
-
* title: 'Title',
|
|
286
|
-
* })
|
|
287
|
-
*/
|
|
288
|
-
insertDocs(params: InsertDocsParams): Promise<string | undefined>;
|
|
289
|
-
/**
|
|
290
|
-
* Insert the Media Player app.
|
|
291
|
-
*/
|
|
292
|
-
insertMedia(title: string, src: string): Promise<string | undefined>;
|
|
293
|
-
/**
|
|
294
|
-
* Insert the Monaco Code Editor app.
|
|
295
|
-
* @deprecated Use `app.manager.addApp({ kind: 'Monaco' })` instead.
|
|
296
|
-
*/
|
|
297
|
-
insertCodeEditor(): Promise<string | undefined>;
|
|
298
|
-
/**
|
|
299
|
-
* Insert the Countdown app.
|
|
300
|
-
* @deprecated Use `app.manager.addApp({ kind: 'Countdown' })` instead.
|
|
301
|
-
*/
|
|
302
|
-
insertCountdown(): Promise<string | undefined>;
|
|
303
|
-
/**
|
|
304
|
-
* Insert the GeoGebra app.
|
|
305
|
-
* @deprecated Use `app.manager.addApp({ kind: 'GeoGebra' })` instead.
|
|
306
|
-
*/
|
|
307
|
-
insertGeoGebra(): Promise<string | undefined>;
|
|
308
|
-
}
|
|
309
|
-
interface FastboardOptions {
|
|
310
|
-
sdkConfig: Omit<WhiteWebSdkConfiguration, "useMobXState"> & {
|
|
311
|
-
region: NonNullable<WhiteWebSdkConfiguration["region"]>;
|
|
312
|
-
};
|
|
313
|
-
joinRoom: Omit<JoinRoomParams, "useMultiViews" | "disableNewPencil" | "disableMagixEventDispatchLimit"> & {
|
|
314
|
-
callbacks?: Partial<Omit<RoomCallbacks, "onCanRedoStepsUpdate" | "onCanUndoStepsUpdate">>;
|
|
315
|
-
};
|
|
316
|
-
managerConfig?: Omit<MountParams, "room">;
|
|
317
|
-
netlessApps?: NetlessApp[];
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* Create a FastboardApp instance.
|
|
321
|
-
* @example
|
|
322
|
-
* let app = await createFastboard({
|
|
323
|
-
* sdkConfig: {
|
|
324
|
-
* appIdentifier: import.meta.env.VITE_APPID,
|
|
325
|
-
* region: 'cn-hz',
|
|
326
|
-
* },
|
|
327
|
-
* joinRoom: {
|
|
328
|
-
* uid: unique_id,
|
|
329
|
-
* uuid: import.meta.env.VITE_ROOM_UUID,
|
|
330
|
-
* roomToken: import.meta.env.VITE_ROOM_TOKEN,
|
|
331
|
-
* },
|
|
332
|
-
* })
|
|
333
|
-
*/
|
|
334
|
-
declare function createFastboard<TEventData extends Record<string, any> = any>({ sdkConfig, joinRoom: { callbacks, ...joinRoomParams }, managerConfig, netlessApps, }: FastboardOptions): Promise<FastboardApp<TEventData>>;
|
|
335
|
-
|
|
336
|
-
declare class FastboardPlayerBase<TEventData extends Record<string, any> = any> {
|
|
337
|
-
readonly sdk: WhiteWebSdk;
|
|
338
|
-
readonly player: Player;
|
|
339
|
-
readonly manager: WindowManager;
|
|
340
|
-
readonly syncedStore: SyncedStore<TEventData>;
|
|
341
|
-
constructor(sdk: WhiteWebSdk, player: Player, manager: WindowManager, syncedStore: SyncedStore<TEventData>);
|
|
342
|
-
protected _destroyed: boolean;
|
|
343
|
-
destroy(): void;
|
|
344
|
-
}
|
|
345
|
-
type PlayerPhase = `${PlayerPhase$1}`;
|
|
346
|
-
|
|
347
|
-
declare class FastboardPlayer<TEventData extends Record<string, any> = any> extends FastboardPlayerBase<TEventData> {
|
|
348
|
-
/**
|
|
349
|
-
* Render this player to some DOM.
|
|
350
|
-
*/
|
|
351
|
-
bindContainer(container: HTMLElement): void;
|
|
352
|
-
/**
|
|
353
|
-
* Move window-manager's collector to some place.
|
|
354
|
-
*/
|
|
355
|
-
bindCollector(container: HTMLElement): void;
|
|
356
|
-
/**
|
|
357
|
-
* Player current time in milliseconds.
|
|
358
|
-
*/
|
|
359
|
-
readonly currentTime: Writable<number>;
|
|
360
|
-
/**
|
|
361
|
-
* Player state, like "is it playing?".
|
|
362
|
-
*/
|
|
363
|
-
readonly phase: Readable<"waitingFirstFrame" | "playing" | "pause" | "stop" | "ended" | "buffering">;
|
|
364
|
-
/**
|
|
365
|
-
* Will become true after buffering.
|
|
366
|
-
*/
|
|
367
|
-
readonly canplay: Readable<boolean>;
|
|
368
|
-
/**
|
|
369
|
-
* Playback speed, default `1`.
|
|
370
|
-
*/
|
|
371
|
-
readonly playbackRate: Writable<number>;
|
|
372
|
-
/**
|
|
373
|
-
* Playback duration in milliseconds.
|
|
374
|
-
*/
|
|
375
|
-
readonly duration: Readable<number>;
|
|
376
|
-
/**
|
|
377
|
-
* Get state of room at that time, like "who was in the room?".
|
|
378
|
-
*/
|
|
379
|
-
readonly state: Readable<PlayerState>;
|
|
380
|
-
/**
|
|
381
|
-
* Seek to some time in milliseconds.
|
|
382
|
-
*/
|
|
383
|
-
seek(timestamp: number): Promise<PlayerSeekingResult>;
|
|
384
|
-
/**
|
|
385
|
-
* Change player state to playing.
|
|
386
|
-
*/
|
|
387
|
-
play(): void;
|
|
388
|
-
/**
|
|
389
|
-
* Change player state to paused.
|
|
390
|
-
*/
|
|
391
|
-
pause(): void;
|
|
392
|
-
/**
|
|
393
|
-
* Change player state to stopped.
|
|
394
|
-
*/
|
|
395
|
-
stop(): void;
|
|
396
|
-
/**
|
|
397
|
-
* Set playback speed, a shortcut for `speed.set(x)`.
|
|
398
|
-
*/
|
|
399
|
-
setPlaybackRate(value: number): void;
|
|
400
|
-
}
|
|
401
|
-
interface FastboardReplayOptions {
|
|
402
|
-
sdkConfig: Omit<WhiteWebSdkConfiguration, "useMobXState"> & {
|
|
403
|
-
region: NonNullable<WhiteWebSdkConfiguration["region"]>;
|
|
404
|
-
};
|
|
405
|
-
replayRoom: Omit<ReplayRoomParams, "useMultiViews"> & {
|
|
406
|
-
callbacks?: Partial<PlayerCallbacks>;
|
|
407
|
-
};
|
|
408
|
-
managerConfig?: Omit<MountParams, "room">;
|
|
409
|
-
netlessApps?: NetlessApp[];
|
|
410
|
-
}
|
|
411
|
-
/**
|
|
412
|
-
* Create a FastboardPlayer instance.
|
|
413
|
-
* @example
|
|
414
|
-
* let player = await replayFastboard({
|
|
415
|
-
* sdkConfig: {
|
|
416
|
-
* appIdentifier: import.meta.env.VITE_APPID,
|
|
417
|
-
* region: 'cn-hz',
|
|
418
|
-
* },
|
|
419
|
-
* replayRoom: {
|
|
420
|
-
* room: "room uuid",
|
|
421
|
-
* roomToken: "NETLESSROOM_...",
|
|
422
|
-
* beginTimestamp: 1646619090394,
|
|
423
|
-
* duration: 70448,
|
|
424
|
-
* },
|
|
425
|
-
* })
|
|
426
|
-
*/
|
|
427
|
-
declare function replayFastboard<TEventData extends Record<string, any> = any>({ sdkConfig, replayRoom: { callbacks, ...replayRoomParams }, managerConfig, netlessApps, }: FastboardReplayOptions): Promise<FastboardPlayer<TEventData>>;
|
|
428
|
-
|
|
429
|
-
declare function addRoomListener<K extends keyof RoomCallbacks>(room: Room, name: K, listener: RoomCallbacks[K]): () => void;
|
|
430
|
-
declare function addPlayerListener<K extends keyof PlayerCallbacks>(player: Player, name: K, listener: PlayerCallbacks[K]): () => void;
|
|
431
|
-
/**
|
|
432
|
-
* Note: view listeners will be invalid on reconnection.
|
|
433
|
-
* You have to rebind them after the phase changed.
|
|
434
|
-
* @example
|
|
435
|
-
* const bindCamera = () => addViewListener(mainView, "onCameraUpdated", setCamera)
|
|
436
|
-
* let dispose = bindCamera(), phase_ = "disconnected"
|
|
437
|
-
* setCamera(mainView.camera)
|
|
438
|
-
* addRoomListener(room, "onPhaseChanged", (phase) => {
|
|
439
|
-
* if (phase === "connected" && phase_ === "reconnecting") {
|
|
440
|
-
* dispose()
|
|
441
|
-
* dispose = bindCamera()
|
|
442
|
-
* setCamera(mainView.camera)
|
|
443
|
-
* }
|
|
444
|
-
* phase_ = phase
|
|
445
|
-
* })
|
|
446
|
-
*/
|
|
447
|
-
declare function addViewListener<K extends keyof ViewCallbacks>(view: View, name: K, listener: (value: ViewCallbacks[K]) => void): () => void;
|
|
448
|
-
declare function addManagerListener<K extends keyof PublicEvent>(manager: WindowManager, name: K, listener: (value: PublicEvent[K]) => void): () => void;
|
|
449
|
-
|
|
450
|
-
interface DocsEventOptions {
|
|
451
|
-
/** If provided, will dispatch to the specific app. Default to the focused app. */
|
|
452
|
-
appId?: string;
|
|
453
|
-
/** Used by `jumpToPage` event, range from 1 to total pages count. */
|
|
454
|
-
page?: number;
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* Send specific command to the static docs / slide app.
|
|
458
|
-
* Only works for apps that were created by `insertDocs()`.
|
|
459
|
-
*
|
|
460
|
-
* Returns false if failed to find the app or not writable.
|
|
461
|
-
*
|
|
462
|
-
* For static docs, `nextPage` equals to `nextStep`, as with `prevPage` and `prevStep`.
|
|
463
|
-
*
|
|
464
|
-
* @example
|
|
465
|
-
* ```js
|
|
466
|
-
* // send "next page" to the focused app
|
|
467
|
-
* dispatchDocsEvent(fastboard, "nextPage")
|
|
468
|
-
*
|
|
469
|
-
* // send "prev page" to some app
|
|
470
|
-
* dispatchDocsEvent(fastboard, "prevPage", {appId:"Slide-1a2b3c4d"})
|
|
471
|
-
* ```
|
|
472
|
-
*/
|
|
473
|
-
declare function dispatchDocsEvent(fastboard: FastboardApp | WindowManager, event: "prevPage" | "nextPage" | "prevStep" | "nextStep" | "jumpToPage", options?: DocsEventOptions): boolean;
|
|
474
|
-
|
|
475
|
-
export { Appliance, AppsStatus, DocsEventOptions, FastboardApp, FastboardOptions, FastboardPlayer, FastboardReplayOptions, InsertDocsDynamic, InsertDocsParams, InsertDocsStatic, PlayerPhase, ProjectorResponse, Readable, RoomPhase, RoomStateChanged, SetMemberStateFn, Shape, StartStopNotifier, Subscriber, Unsubscriber, Updater, Writable, addManagerListener, addPlayerListener, addRoomListener, addViewListener, convertedFileToScene, createFastboard, dispatchDocsEvent, genUID, getImageSize, makeSlideParams, readable, replayFastboard, warn, writable };
|
package/dist/index.js
CHANGED
|
@@ -241,7 +241,7 @@ for (const kind in DefaultApps) {
|
|
|
241
241
|
windowManager.WindowManager.register(__spreadValues({ kind }, options));
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
var version = "0.3.13
|
|
244
|
+
var version = "0.3.13";
|
|
245
245
|
if (typeof window !== "undefined") {
|
|
246
246
|
let str = window.__netlessUA || "";
|
|
247
247
|
str += ` ${"@netless/fastboard"}@${version} `;
|
|
@@ -909,12 +909,6 @@ async function replayFastboard(_a) {
|
|
|
909
909
|
await player.seekToProgressTime(0);
|
|
910
910
|
return new FastboardPlayer(sdk, player, manager, syncedStore$1);
|
|
911
911
|
}
|
|
912
|
-
windowManager.WindowManager.register({
|
|
913
|
-
kind: "Slide",
|
|
914
|
-
appOptions: { debug: false },
|
|
915
|
-
src: SlideApp__default.default,
|
|
916
|
-
addHooks: SlideApp.addHooks
|
|
917
|
-
});
|
|
918
912
|
|
|
919
913
|
// src/helpers/listen.ts
|
|
920
914
|
function addRoomListener(room, name, listener) {
|
|
@@ -1007,6 +1001,12 @@ function dispatchDocsEvent(fastboard, event, options = {}) {
|
|
|
1007
1001
|
return false;
|
|
1008
1002
|
}
|
|
1009
1003
|
}
|
|
1004
|
+
windowManager.WindowManager.register({
|
|
1005
|
+
kind: "Slide",
|
|
1006
|
+
appOptions: { debug: false },
|
|
1007
|
+
src: SlideApp__default.default,
|
|
1008
|
+
addHooks: SlideApp.addHooks
|
|
1009
|
+
});
|
|
1010
1010
|
|
|
1011
1011
|
Object.defineProperty(exports, 'SlideApp', {
|
|
1012
1012
|
enumerable: true,
|
|
@@ -1037,7 +1037,9 @@ exports.genUID = genUID;
|
|
|
1037
1037
|
exports.getImageSize = getImageSize;
|
|
1038
1038
|
exports.makeSlideParams = makeSlideParams;
|
|
1039
1039
|
exports.readable = readable;
|
|
1040
|
+
exports.register = register;
|
|
1040
1041
|
exports.replayFastboard = replayFastboard;
|
|
1042
|
+
exports.version = version;
|
|
1041
1043
|
exports.warn = warn;
|
|
1042
1044
|
exports.writable = writable;
|
|
1043
1045
|
//# sourceMappingURL=index.js.map
|