@netless/fastboard-core 0.3.2-canary.6 → 0.3.4-canary.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/package.json +3 -4
- package/src/behaviors/index.ts +10 -0
- package/src/impl/FastboardApp.ts +60 -10
- package/src/impl/FastboardPlayer.ts +9 -8
- package/src/impl/index.ts +0 -1
- package/src/index.ts +1 -0
- package/dist/index.d.ts +0 -337
- package/dist/index.js +0 -659
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -637
- package/dist/index.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/fastboard-core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4-canary.0",
|
|
4
4
|
"description": "A tiny wrapper of white-web-sdk and @netless/window-manager.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
],
|
|
10
10
|
"repository": "netless-io/fastboard",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@netless/app-slide": "^0.
|
|
12
|
+
"@netless/app-slide": "^0.2.1"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"@netless/window-manager": ">=0.4.0",
|
|
@@ -21,6 +21,5 @@
|
|
|
21
21
|
"build": "tsup"
|
|
22
22
|
},
|
|
23
23
|
"module": "dist/index.mjs",
|
|
24
|
-
"types": "dist/index.d.ts"
|
|
25
|
-
"readme": "## @netless/fastboard-core\n\nA tiny wrapper of white-web-sdk and @netless/window-manager.\n\nUsed by [@netless/fastboard-ui](https://github.com/netless-io/fastboard/tree/main/packages/fastboard-ui).\n\n### License\n\nMIT @ [netless](https://github.com/netless-io)\n"
|
|
24
|
+
"types": "dist/index.d.ts"
|
|
26
25
|
}
|
package/src/behaviors/index.ts
CHANGED
|
@@ -50,3 +50,13 @@ for (const kind in DefaultApps) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export const register = WindowManager.register.bind(WindowManager);
|
|
53
|
+
|
|
54
|
+
declare let __NAME__: string, __VERSION__: string;
|
|
55
|
+
|
|
56
|
+
export const version = __VERSION__;
|
|
57
|
+
|
|
58
|
+
if (typeof window !== "undefined") {
|
|
59
|
+
let str = (window as { __netlessUA?: string }).__netlessUA || "";
|
|
60
|
+
str += ` ${__NAME__}@${version} `;
|
|
61
|
+
(window as { __netlessUA?: string }).__netlessUA = str;
|
|
62
|
+
}
|
package/src/impl/FastboardApp.ts
CHANGED
|
@@ -69,6 +69,9 @@ class FastboardAppBase {
|
|
|
69
69
|
return () => this.manager.mainView.callbacks.off(name, listener);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Destroy fastboard (disconnect from the whiteboard room).
|
|
74
|
+
*/
|
|
72
75
|
public destroy() {
|
|
73
76
|
this._destroyed = true;
|
|
74
77
|
this.manager.destroy();
|
|
@@ -104,21 +107,32 @@ export type {
|
|
|
104
107
|
WindowManager,
|
|
105
108
|
};
|
|
106
109
|
|
|
110
|
+
/** pencil, eraser, rectangle... */
|
|
107
111
|
export type Appliance = `${ApplianceNames}`;
|
|
112
|
+
/** triangle, star... */
|
|
108
113
|
export type Shape = `${ShapeType}`;
|
|
109
114
|
|
|
115
|
+
/** Params for static docs, they are rendered as many images. */
|
|
110
116
|
export interface InsertDocsStatic {
|
|
111
117
|
readonly fileType: "pdf";
|
|
118
|
+
/** Unique string for binding whiteboard view to the doc. Must start with `/`. */
|
|
112
119
|
readonly scenePath: string;
|
|
120
|
+
/** @example [{ name: '1', ppt: { src: 'url/to/ppt/1.png' } }] */
|
|
113
121
|
readonly scenes: SceneDefinition[];
|
|
122
|
+
/** Window title. */
|
|
114
123
|
readonly title?: string;
|
|
115
124
|
}
|
|
116
125
|
|
|
126
|
+
/** Params for slides, they are rendered in @netless/app-slide with animations. */
|
|
117
127
|
export interface InsertDocsDynamic {
|
|
118
128
|
readonly fileType: "pptx";
|
|
129
|
+
/** Unique string for binding whiteboard view to the doc. Must start with `/`. */
|
|
119
130
|
readonly scenePath: string;
|
|
131
|
+
/** Conversion task id, see https://developer.netless.link/server-en/home/server-conversion#get-query-task-conversion-progress. */
|
|
120
132
|
readonly taskId: string;
|
|
133
|
+
/** Window title. */
|
|
121
134
|
readonly title?: string;
|
|
135
|
+
/** Where the slide resource placed. @default `https://convertcdn.netless.link/dynamicConvert` */
|
|
122
136
|
readonly url?: string;
|
|
123
137
|
/** @example [{ name: '1' }, { name: '2' }, { name: '3' }] */
|
|
124
138
|
readonly scenes?: SceneDefinition[];
|
|
@@ -130,9 +144,11 @@ export type SetMemberStateFn = (partialMemberState: Partial<MemberState>) => voi
|
|
|
130
144
|
|
|
131
145
|
export type RoomStateChanged = (diff: Partial<RoomState>) => void;
|
|
132
146
|
|
|
147
|
+
/** App download progress. */
|
|
133
148
|
export interface AppsStatus {
|
|
134
149
|
[kind: string]: {
|
|
135
150
|
status: "idle" | "loading" | "failed";
|
|
151
|
+
/** Exist if status is `failed`. */
|
|
136
152
|
reason?: string;
|
|
137
153
|
};
|
|
138
154
|
}
|
|
@@ -160,8 +176,8 @@ export class FastboardApp extends FastboardAppBase {
|
|
|
160
176
|
readonly writable = writable(
|
|
161
177
|
this.room.isWritable,
|
|
162
178
|
set => {
|
|
163
|
-
this._addRoomListener("onEnableWriteNowChanged", () => set(this.room.isWritable));
|
|
164
179
|
set(this.room.isWritable);
|
|
180
|
+
return this._addRoomListener("onEnableWriteNowChanged", () => set(this.room.isWritable));
|
|
165
181
|
},
|
|
166
182
|
this.room.setWritable.bind(this.room)
|
|
167
183
|
);
|
|
@@ -170,16 +186,16 @@ export class FastboardApp extends FastboardAppBase {
|
|
|
170
186
|
* Is current room online?
|
|
171
187
|
*/
|
|
172
188
|
readonly phase = readable<RoomPhase>(this.room.phase, set => {
|
|
173
|
-
this._addRoomListener("onPhaseChanged", set);
|
|
174
189
|
set(this.room.phase);
|
|
190
|
+
return this._addRoomListener("onPhaseChanged", set);
|
|
175
191
|
});
|
|
176
192
|
|
|
177
193
|
/**
|
|
178
194
|
* Current window-manager's windows' state (is it maximized?).
|
|
179
195
|
*/
|
|
180
196
|
readonly boxState = readable(this.manager.boxState, set => {
|
|
181
|
-
this._addManagerListener("boxStateChange", set);
|
|
182
197
|
set(this.manager.boxState);
|
|
198
|
+
return this._addManagerListener("boxStateChange", set);
|
|
183
199
|
});
|
|
184
200
|
|
|
185
201
|
/**
|
|
@@ -187,24 +203,24 @@ export class FastboardApp extends FastboardAppBase {
|
|
|
187
203
|
* @example "HelloWorld-1A2b3C4d"
|
|
188
204
|
*/
|
|
189
205
|
readonly focusedApp = readable(this.manager.focused, set => {
|
|
190
|
-
this._addManagerListener("focusedChange", set);
|
|
191
206
|
set(this.manager.focused);
|
|
207
|
+
return this._addManagerListener("focusedChange", set);
|
|
192
208
|
});
|
|
193
209
|
|
|
194
210
|
/**
|
|
195
211
|
* How many times can I call `app.redo()`?
|
|
196
212
|
*/
|
|
197
213
|
readonly canRedoSteps = readable(this.manager.canRedoSteps, set => {
|
|
198
|
-
this._addManagerListener("canRedoStepsChange", set);
|
|
199
214
|
set(this.manager.canRedoSteps);
|
|
215
|
+
return this._addManagerListener("canRedoStepsChange", set);
|
|
200
216
|
});
|
|
201
217
|
|
|
202
218
|
/**
|
|
203
219
|
* How many times can I call `app.undo()`?
|
|
204
220
|
*/
|
|
205
221
|
readonly canUndoSteps = readable(this.manager.canUndoSteps, set => {
|
|
206
|
-
this._addManagerListener("canUndoStepsChange", set);
|
|
207
222
|
set(this.manager.canUndoSteps);
|
|
223
|
+
return this._addManagerListener("canUndoStepsChange", set);
|
|
208
224
|
});
|
|
209
225
|
|
|
210
226
|
/**
|
|
@@ -213,8 +229,8 @@ export class FastboardApp extends FastboardAppBase {
|
|
|
213
229
|
* Change the camera position by `app.moveCamera()`.
|
|
214
230
|
*/
|
|
215
231
|
readonly camera = readable(this.manager.camera, set => {
|
|
216
|
-
this._addMainViewListener("onCameraUpdated", set);
|
|
217
232
|
set(this.manager.camera);
|
|
233
|
+
return this._addMainViewListener("onCameraUpdated", set);
|
|
218
234
|
});
|
|
219
235
|
|
|
220
236
|
/**
|
|
@@ -223,8 +239,8 @@ export class FastboardApp extends FastboardAppBase {
|
|
|
223
239
|
* Change the tool by `app.setAppliance()`.
|
|
224
240
|
*/
|
|
225
241
|
readonly memberState = readable(this.room.state.memberState, set => {
|
|
226
|
-
this._addRoomListener("onRoomStateChanged", ({ memberState: m }) => m && set(m));
|
|
227
242
|
set(this.room.state.memberState);
|
|
243
|
+
return this._addRoomListener("onRoomStateChanged", ({ memberState: m }) => m && set(m));
|
|
228
244
|
});
|
|
229
245
|
|
|
230
246
|
/**
|
|
@@ -233,8 +249,8 @@ export class FastboardApp extends FastboardAppBase {
|
|
|
233
249
|
readonly sceneIndex = writable(
|
|
234
250
|
this.manager.mainViewSceneIndex,
|
|
235
251
|
set => {
|
|
236
|
-
this._addManagerListener("mainViewSceneIndexChange", set);
|
|
237
252
|
set(this.manager.mainViewSceneIndex);
|
|
253
|
+
return this._addManagerListener("mainViewSceneIndexChange", set);
|
|
238
254
|
},
|
|
239
255
|
this.manager.setMainViewSceneIndex.bind(this.manager)
|
|
240
256
|
);
|
|
@@ -243,8 +259,8 @@ export class FastboardApp extends FastboardAppBase {
|
|
|
243
259
|
* How many pages are in the main view?
|
|
244
260
|
*/
|
|
245
261
|
readonly sceneLength = readable(this.manager.mainViewScenesLength, set => {
|
|
246
|
-
this._addManagerListener("mainViewScenesLengthChange", set);
|
|
247
262
|
set(this.manager.mainViewScenesLength);
|
|
263
|
+
return this._addManagerListener("mainViewScenesLengthChange", set);
|
|
248
264
|
});
|
|
249
265
|
|
|
250
266
|
private _appsStatus: AppsStatus = {};
|
|
@@ -309,36 +325,64 @@ export class FastboardApp extends FastboardAppBase {
|
|
|
309
325
|
});
|
|
310
326
|
}
|
|
311
327
|
|
|
328
|
+
/**
|
|
329
|
+
* Set pencil and shape's thickness.
|
|
330
|
+
*/
|
|
312
331
|
setStrokeWidth(strokeWidth: number) {
|
|
313
332
|
this._assertNotDestroyed();
|
|
314
333
|
this.manager.mainView.setMemberState({ strokeWidth });
|
|
315
334
|
}
|
|
316
335
|
|
|
336
|
+
/**
|
|
337
|
+
* Set pencil and shape's color.
|
|
338
|
+
*/
|
|
317
339
|
setStrokeColor(strokeColor: Color) {
|
|
318
340
|
this._assertNotDestroyed();
|
|
319
341
|
this.manager.mainView.setMemberState({ strokeColor });
|
|
320
342
|
}
|
|
321
343
|
|
|
344
|
+
/**
|
|
345
|
+
* Set text size. Default is 16.
|
|
346
|
+
*/
|
|
322
347
|
setTextSize(textSize: number) {
|
|
323
348
|
this._assertNotDestroyed();
|
|
324
349
|
this.manager.mainView.setMemberState({ textSize });
|
|
325
350
|
}
|
|
326
351
|
|
|
352
|
+
/**
|
|
353
|
+
* Set text color.
|
|
354
|
+
*
|
|
355
|
+
* @example
|
|
356
|
+
* setTextColor([0x66, 0xcc, 0xff])
|
|
357
|
+
*/
|
|
327
358
|
setTextColor(textColor: Color) {
|
|
328
359
|
this._assertNotDestroyed();
|
|
329
360
|
this.manager.mainView.setMemberState({ textColor });
|
|
330
361
|
}
|
|
331
362
|
|
|
363
|
+
/**
|
|
364
|
+
* Goto previous page (the main whiteboard view).
|
|
365
|
+
*/
|
|
332
366
|
prevPage() {
|
|
333
367
|
this._assertNotDestroyed();
|
|
334
368
|
return this.manager.prevPage();
|
|
335
369
|
}
|
|
336
370
|
|
|
371
|
+
/**
|
|
372
|
+
* Goto next page (the main whiteboard view).
|
|
373
|
+
*/
|
|
337
374
|
nextPage() {
|
|
338
375
|
this._assertNotDestroyed();
|
|
339
376
|
return this.manager.nextPage();
|
|
340
377
|
}
|
|
341
378
|
|
|
379
|
+
/**
|
|
380
|
+
* Add one page to the main whiteboard view.
|
|
381
|
+
*
|
|
382
|
+
* @example
|
|
383
|
+
* addPage({ after: true }) // add one page right after current one.
|
|
384
|
+
* nextPage() // then, goto that page.
|
|
385
|
+
*/
|
|
342
386
|
addPage(params?: AddPageParams) {
|
|
343
387
|
this._assertNotDestroyed();
|
|
344
388
|
return this.manager.addPage(params);
|
|
@@ -346,6 +390,9 @@ export class FastboardApp extends FastboardAppBase {
|
|
|
346
390
|
|
|
347
391
|
/**
|
|
348
392
|
* Insert an image to the main view.
|
|
393
|
+
*
|
|
394
|
+
* @example
|
|
395
|
+
* insertImage("https://i.imgur.com/CzXTtJV.jpg")
|
|
349
396
|
*/
|
|
350
397
|
async insertImage(url: string) {
|
|
351
398
|
this._assertNotDestroyed();
|
|
@@ -447,6 +494,7 @@ export class FastboardApp extends FastboardAppBase {
|
|
|
447
494
|
|
|
448
495
|
/**
|
|
449
496
|
* Insert the Monaco Code Editor app.
|
|
497
|
+
* @deprecated Use `app.manager.addApp({ kind: 'Monaco' })` instead.
|
|
450
498
|
*/
|
|
451
499
|
insertCodeEditor() {
|
|
452
500
|
this._assertNotDestroyed();
|
|
@@ -458,6 +506,7 @@ export class FastboardApp extends FastboardAppBase {
|
|
|
458
506
|
|
|
459
507
|
/**
|
|
460
508
|
* Insert the Countdown app.
|
|
509
|
+
* @deprecated Use `app.manager.addApp({ kind: 'Countdown' })` instead.
|
|
461
510
|
*/
|
|
462
511
|
insertCountdown() {
|
|
463
512
|
this._assertNotDestroyed();
|
|
@@ -469,6 +518,7 @@ export class FastboardApp extends FastboardAppBase {
|
|
|
469
518
|
|
|
470
519
|
/**
|
|
471
520
|
* Insert the GeoGebra app.
|
|
521
|
+
* @deprecated Use `app.manager.addApp({ kind: 'GeoGebra' })` instead.
|
|
472
522
|
*/
|
|
473
523
|
insertGeoGebra() {
|
|
474
524
|
this._assertNotDestroyed();
|
|
@@ -80,8 +80,8 @@ export class FastboardPlayer extends FastboardPlayerBase {
|
|
|
80
80
|
readonly currentTime = writable(
|
|
81
81
|
this.player.progressTime,
|
|
82
82
|
set => {
|
|
83
|
-
this._addPlayerListener("onProgressTimeChanged", set);
|
|
84
83
|
set(this.player.progressTime);
|
|
84
|
+
return this._addPlayerListener("onProgressTimeChanged", set);
|
|
85
85
|
},
|
|
86
86
|
this.player.seekToProgressTime.bind(this.player)
|
|
87
87
|
);
|
|
@@ -90,16 +90,16 @@ export class FastboardPlayer extends FastboardPlayerBase {
|
|
|
90
90
|
* Player state, like "is it playing?".
|
|
91
91
|
*/
|
|
92
92
|
readonly phase = readable<PlayerPhase>(this.player.phase, set => {
|
|
93
|
-
this._addPlayerListener("onPhaseChanged", set);
|
|
94
93
|
set(this.player.phase);
|
|
94
|
+
return this._addPlayerListener("onPhaseChanged", set);
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
98
|
* Will become true after buffering.
|
|
99
99
|
*/
|
|
100
100
|
readonly canplay = readable(this.player.isPlayable, set => {
|
|
101
|
-
this._addPlayerListener("onIsPlayableChanged", set);
|
|
102
101
|
set(this.player.isPlayable);
|
|
102
|
+
return this._addPlayerListener("onIsPlayableChanged", set);
|
|
103
103
|
});
|
|
104
104
|
|
|
105
105
|
private _setPlaybackRate!: (value: number) => void;
|
|
@@ -129,8 +129,8 @@ export class FastboardPlayer extends FastboardPlayerBase {
|
|
|
129
129
|
* Get state of room at that time, like "who was in the room?".
|
|
130
130
|
*/
|
|
131
131
|
readonly state = readable<PlayerState>(this.player.state, set => {
|
|
132
|
-
this._addPlayerListener("onPlayerStateChanged", () => set(this.player.state));
|
|
133
132
|
set(this.player.state);
|
|
133
|
+
return this._addPlayerListener("onPlayerStateChanged", () => set(this.player.state));
|
|
134
134
|
});
|
|
135
135
|
|
|
136
136
|
/**
|
|
@@ -185,7 +185,7 @@ export interface FastboardReplayOptions {
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
/**
|
|
188
|
-
* Create a
|
|
188
|
+
* Create a FastboardPlayer instance.
|
|
189
189
|
* @example
|
|
190
190
|
* let player = await replayFastboard({
|
|
191
191
|
* sdkConfig: {
|
|
@@ -193,9 +193,10 @@ export interface FastboardReplayOptions {
|
|
|
193
193
|
* region: 'cn-hz',
|
|
194
194
|
* },
|
|
195
195
|
* replayRoom: {
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
196
|
+
* room: "room uuid",
|
|
197
|
+
* roomToken: "NETLESSROOM_...",
|
|
198
|
+
* beginTimestamp: 1646619090394,
|
|
199
|
+
* duration: 70448,
|
|
199
200
|
* },
|
|
200
201
|
* })
|
|
201
202
|
*/
|
package/src/impl/index.ts
CHANGED
package/src/index.ts
CHANGED
package/dist/index.d.ts
DELETED
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
import { Size, SceneDefinition, ConvertedFile, RoomPhase as RoomPhase$1, ApplianceNames, ShapeType, MemberState, RoomState, Camera, AnimationMode, Rectangle, Color, ConversionResponse, WhiteWebSdkConfiguration, JoinRoomParams, RoomCallbacks, WhiteWebSdk, Room, HotKeys, ViewCallbacks, PlayerPhase as PlayerPhase$1, PlayerState, PlayerSeekingResult, ReplayRoomParams, PlayerCallbacks, Player } from 'white-web-sdk';
|
|
2
|
-
export { AnimationMode, ApplianceNames, Camera, Color, ConversionResponse, HotKey, HotKeys, JoinRoomParams, MemberState, PlayerSeekingResult, Rectangle, Room, RoomCallbacks, RoomState, SceneDefinition, ShapeType, ViewCallbacks, WhiteWebSdk, WhiteWebSdkConfiguration } from 'white-web-sdk';
|
|
3
|
-
import { AddPageParams, MountParams, WindowManager, PublicEvent, RegisterParams } from '@netless/window-manager';
|
|
4
|
-
export { AddPageParams, MountParams, PublicEvent, WindowManager } from '@netless/window-manager';
|
|
5
|
-
export { PreviewParams, default as SlideApp, Controller as SlideController, AppOptions as SlideOptions, SlidePreviewer, addHooks as addSlideHooks, previewSlide, apps as slideApps } from '@netless/app-slide';
|
|
6
|
-
|
|
7
|
-
declare type Subscriber<T> = (value: T) => void;
|
|
8
|
-
declare type Unsubscriber = () => void;
|
|
9
|
-
declare type Updater<T> = (value: T) => T;
|
|
10
|
-
declare type StartStopNotifier<T> = (set: Subscriber<T>) => Unsubscriber | void;
|
|
11
|
-
interface Readable<T> {
|
|
12
|
-
readonly value: T;
|
|
13
|
-
subscribe(this: void, run: Subscriber<T>): Unsubscriber;
|
|
14
|
-
reaction(this: void, run: Subscriber<T>): Unsubscriber;
|
|
15
|
-
}
|
|
16
|
-
interface Writable<T> extends Readable<T> {
|
|
17
|
-
set(this: void, value: T): void;
|
|
18
|
-
update(this: void, updater: Updater<T>): void;
|
|
19
|
-
}
|
|
20
|
-
declare function readable<T>(value: T, start?: StartStopNotifier<T>): Readable<T>;
|
|
21
|
-
declare function writable<T>(value: T, start: StartStopNotifier<T> | undefined, set: Subscriber<T>): Writable<T>;
|
|
22
|
-
|
|
23
|
-
declare function getImageSize(url: string, fallback: Size): Promise<Size>;
|
|
24
|
-
declare function makeSlideParams(scenes: SceneDefinition[]): {
|
|
25
|
-
scenes: SceneDefinition[];
|
|
26
|
-
taskId: string;
|
|
27
|
-
url: string;
|
|
28
|
-
};
|
|
29
|
-
declare function convertedFileToScene(f: ConvertedFile, i: number): SceneDefinition;
|
|
30
|
-
|
|
31
|
-
declare function genUID(): string;
|
|
32
|
-
|
|
33
|
-
declare const warnings: {
|
|
34
|
-
readonly "no-ppt-in-scenes": "You're probably inserting the slide app in a wrong way, there shouldn't exist `scenes[0].ppt`.";
|
|
35
|
-
};
|
|
36
|
-
declare function warn(id: keyof typeof warnings): void;
|
|
37
|
-
|
|
38
|
-
declare class FastboardAppBase {
|
|
39
|
-
readonly sdk: WhiteWebSdk;
|
|
40
|
-
readonly room: Room;
|
|
41
|
-
readonly manager: WindowManager;
|
|
42
|
-
readonly hotKeys: Partial<HotKeys>;
|
|
43
|
-
constructor(sdk: WhiteWebSdk, room: Room, manager: WindowManager, hotKeys: Partial<HotKeys>);
|
|
44
|
-
protected _destroyed: boolean;
|
|
45
|
-
protected _assertNotDestroyed(): void;
|
|
46
|
-
protected _addRoomListener<K extends keyof RoomCallbacks>(name: K, listener: RoomCallbacks[K]): () => void;
|
|
47
|
-
protected _addManagerListener<K extends keyof PublicEvent>(name: K, listener: (value: PublicEvent[K]) => void): () => void;
|
|
48
|
-
protected _addMainViewListener<K extends keyof ViewCallbacks>(name: K, listener: ViewCallbacks[K]): () => void;
|
|
49
|
-
destroy(): Promise<void>;
|
|
50
|
-
}
|
|
51
|
-
declare type RoomPhase = `${RoomPhase$1}`;
|
|
52
|
-
|
|
53
|
-
declare type Appliance = `${ApplianceNames}`;
|
|
54
|
-
declare type Shape = `${ShapeType}`;
|
|
55
|
-
interface InsertDocsStatic {
|
|
56
|
-
readonly fileType: "pdf";
|
|
57
|
-
readonly scenePath: string;
|
|
58
|
-
readonly scenes: SceneDefinition[];
|
|
59
|
-
readonly title?: string;
|
|
60
|
-
}
|
|
61
|
-
interface InsertDocsDynamic {
|
|
62
|
-
readonly fileType: "pptx";
|
|
63
|
-
readonly scenePath: string;
|
|
64
|
-
readonly taskId: string;
|
|
65
|
-
readonly title?: string;
|
|
66
|
-
readonly url?: string;
|
|
67
|
-
/** @example [{ name: '1' }, { name: '2' }, { name: '3' }] */
|
|
68
|
-
readonly scenes?: SceneDefinition[];
|
|
69
|
-
}
|
|
70
|
-
declare type InsertDocsParams = InsertDocsStatic | InsertDocsDynamic;
|
|
71
|
-
declare type SetMemberStateFn = (partialMemberState: Partial<MemberState>) => void;
|
|
72
|
-
declare type RoomStateChanged = (diff: Partial<RoomState>) => void;
|
|
73
|
-
interface AppsStatus {
|
|
74
|
-
[kind: string]: {
|
|
75
|
-
status: "idle" | "loading" | "failed";
|
|
76
|
-
reason?: string;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
declare class FastboardApp extends FastboardAppBase {
|
|
80
|
-
/**
|
|
81
|
-
* Render this app to some DOM.
|
|
82
|
-
*/
|
|
83
|
-
bindContainer(container: HTMLElement): void;
|
|
84
|
-
/**
|
|
85
|
-
* Move window-manager's collector to some place.
|
|
86
|
-
*/
|
|
87
|
-
bindCollector(container: HTMLElement): void;
|
|
88
|
-
/**
|
|
89
|
-
* Is current room writable?
|
|
90
|
-
*/
|
|
91
|
-
readonly writable: Writable<boolean>;
|
|
92
|
-
/**
|
|
93
|
-
* Is current room online?
|
|
94
|
-
*/
|
|
95
|
-
readonly phase: Readable<"connecting" | "connected" | "reconnecting" | "disconnecting" | "disconnected">;
|
|
96
|
-
/**
|
|
97
|
-
* Current window-manager's windows' state (is it maximized?).
|
|
98
|
-
*/
|
|
99
|
-
readonly boxState: Readable<"normal" | "minimized" | "maximized" | undefined>;
|
|
100
|
-
/**
|
|
101
|
-
* Current window-manager's focused app's id.
|
|
102
|
-
* @example "HelloWorld-1A2b3C4d"
|
|
103
|
-
*/
|
|
104
|
-
readonly focusedApp: Readable<string | undefined>;
|
|
105
|
-
/**
|
|
106
|
-
* How many times can I call `app.redo()`?
|
|
107
|
-
*/
|
|
108
|
-
readonly canRedoSteps: Readable<number>;
|
|
109
|
-
/**
|
|
110
|
-
* How many times can I call `app.undo()`?
|
|
111
|
-
*/
|
|
112
|
-
readonly canUndoSteps: Readable<number>;
|
|
113
|
-
/**
|
|
114
|
-
* Current camera information of main view.
|
|
115
|
-
*
|
|
116
|
-
* Change the camera position by `app.moveCamera()`.
|
|
117
|
-
*/
|
|
118
|
-
readonly camera: Readable<Camera>;
|
|
119
|
-
/**
|
|
120
|
-
* Current tool's info, like "is using pencil?", "what color?".
|
|
121
|
-
*
|
|
122
|
-
* Change the tool by `app.setAppliance()`.
|
|
123
|
-
*/
|
|
124
|
-
readonly memberState: Readable<MemberState>;
|
|
125
|
-
/**
|
|
126
|
-
* 0..n-1, current index of main view scenes.
|
|
127
|
-
*/
|
|
128
|
-
readonly sceneIndex: Writable<number>;
|
|
129
|
-
/**
|
|
130
|
-
* How many pages are in the main view?
|
|
131
|
-
*/
|
|
132
|
-
readonly sceneLength: Readable<number>;
|
|
133
|
-
private _appsStatus;
|
|
134
|
-
/**
|
|
135
|
-
* Apps status.
|
|
136
|
-
*/
|
|
137
|
-
readonly appsStatus: Readable<AppsStatus>;
|
|
138
|
-
/**
|
|
139
|
-
* Undo a step on main view.
|
|
140
|
-
*/
|
|
141
|
-
undo(): void;
|
|
142
|
-
/**
|
|
143
|
-
* Redo a step on main view.
|
|
144
|
-
*/
|
|
145
|
-
redo(): void;
|
|
146
|
-
/**
|
|
147
|
-
* Move current main view's camera position.
|
|
148
|
-
*/
|
|
149
|
-
moveCamera(camera: Partial<Camera> & {
|
|
150
|
-
animationMode?: AnimationMode | undefined;
|
|
151
|
-
}): void;
|
|
152
|
-
/**
|
|
153
|
-
* Move current main view's camera to include a rectangle.
|
|
154
|
-
*/
|
|
155
|
-
moveCameraToContain(rectangle: Rectangle & {
|
|
156
|
-
animationMode?: AnimationMode;
|
|
157
|
-
}): void;
|
|
158
|
-
/**
|
|
159
|
-
* Delete all things on the main view.
|
|
160
|
-
*/
|
|
161
|
-
cleanCurrentScene(): void;
|
|
162
|
-
/**
|
|
163
|
-
* Set current tool, like "pencil".
|
|
164
|
-
*/
|
|
165
|
-
setAppliance(appliance: ApplianceNames | Appliance, shape?: ShapeType | Shape): void;
|
|
166
|
-
setStrokeWidth(strokeWidth: number): void;
|
|
167
|
-
setStrokeColor(strokeColor: Color): void;
|
|
168
|
-
setTextSize(textSize: number): void;
|
|
169
|
-
setTextColor(textColor: Color): void;
|
|
170
|
-
prevPage(): Promise<boolean>;
|
|
171
|
-
nextPage(): Promise<boolean>;
|
|
172
|
-
addPage(params?: AddPageParams): Promise<void>;
|
|
173
|
-
/**
|
|
174
|
-
* Insert an image to the main view.
|
|
175
|
-
*/
|
|
176
|
-
insertImage(url: string): Promise<void>;
|
|
177
|
-
/**
|
|
178
|
-
* Insert PDF/PPTX from conversion result.
|
|
179
|
-
* @param status https://developer.netless.link/server-en/home/server-conversion#get-query-task-conversion-progress
|
|
180
|
-
*/
|
|
181
|
-
insertDocs(filename: string, status: ConversionResponse): Promise<string | undefined>;
|
|
182
|
-
/**
|
|
183
|
-
* Manual way.
|
|
184
|
-
* @example
|
|
185
|
-
* app.insertDocs({
|
|
186
|
-
* fileType: 'pptx',
|
|
187
|
-
* scenePath: `/pptx/${conversion.taskId}`,
|
|
188
|
-
* taskId: conversion.taskId,
|
|
189
|
-
* title: 'Title',
|
|
190
|
-
* })
|
|
191
|
-
*/
|
|
192
|
-
insertDocs(params: InsertDocsParams): Promise<string | undefined>;
|
|
193
|
-
private _insertDocsImpl;
|
|
194
|
-
/**
|
|
195
|
-
* Insert the Media Player app.
|
|
196
|
-
*/
|
|
197
|
-
insertMedia(title: string, src: string): Promise<string | undefined>;
|
|
198
|
-
/**
|
|
199
|
-
* Insert the Monaco Code Editor app.
|
|
200
|
-
*/
|
|
201
|
-
insertCodeEditor(): Promise<string | undefined>;
|
|
202
|
-
/**
|
|
203
|
-
* Insert the Countdown app.
|
|
204
|
-
*/
|
|
205
|
-
insertCountdown(): Promise<string | undefined>;
|
|
206
|
-
/**
|
|
207
|
-
* Insert the GeoGebra app.
|
|
208
|
-
*/
|
|
209
|
-
insertGeoGebra(): Promise<string | undefined>;
|
|
210
|
-
}
|
|
211
|
-
interface FastboardOptions {
|
|
212
|
-
sdkConfig: Omit<WhiteWebSdkConfiguration, "useMobXState"> & {
|
|
213
|
-
region: NonNullable<WhiteWebSdkConfiguration["region"]>;
|
|
214
|
-
};
|
|
215
|
-
joinRoom: Omit<JoinRoomParams, "useMultiViews" | "disableNewPencil" | "disableMagixEventDispatchLimit"> & {
|
|
216
|
-
callbacks?: Partial<RoomCallbacks>;
|
|
217
|
-
};
|
|
218
|
-
managerConfig?: Omit<MountParams, "room">;
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Create a FastboardApp instance.
|
|
222
|
-
* @example
|
|
223
|
-
* let app = await createFastboard({
|
|
224
|
-
* sdkConfig: {
|
|
225
|
-
* appIdentifier: import.meta.env.VITE_APPID,
|
|
226
|
-
* region: 'cn-hz',
|
|
227
|
-
* },
|
|
228
|
-
* joinRoom: {
|
|
229
|
-
* uid: unique_id,
|
|
230
|
-
* uuid: import.meta.env.VITE_ROOM_UUID,
|
|
231
|
-
* roomToken: import.meta.env.VITE_ROOM_TOKEN,
|
|
232
|
-
* },
|
|
233
|
-
* })
|
|
234
|
-
*/
|
|
235
|
-
declare function createFastboard({ sdkConfig, joinRoom: { callbacks, ...joinRoomParams }, managerConfig, }: FastboardOptions): Promise<FastboardApp>;
|
|
236
|
-
|
|
237
|
-
declare class FastboardPlayerBase {
|
|
238
|
-
readonly sdk: WhiteWebSdk;
|
|
239
|
-
readonly player: Player;
|
|
240
|
-
readonly manager: WindowManager;
|
|
241
|
-
constructor(sdk: WhiteWebSdk, player: Player, manager: WindowManager);
|
|
242
|
-
protected _destroyed: boolean;
|
|
243
|
-
protected _assertNotDestroyed(): void;
|
|
244
|
-
protected _addPlayerListener<K extends keyof PlayerCallbacks>(name: K, listener: PlayerCallbacks[K]): () => void;
|
|
245
|
-
protected _addManagerListener<K extends keyof PublicEvent>(name: K, listener: (value: PublicEvent[K]) => void): () => void;
|
|
246
|
-
protected _addMainViewListener<K extends keyof ViewCallbacks>(name: K, listener: ViewCallbacks[K]): () => void;
|
|
247
|
-
destroy(): void;
|
|
248
|
-
}
|
|
249
|
-
declare type PlayerPhase = `${PlayerPhase$1}`;
|
|
250
|
-
|
|
251
|
-
declare class FastboardPlayer extends FastboardPlayerBase {
|
|
252
|
-
/**
|
|
253
|
-
* Render this player to some DOM.
|
|
254
|
-
*/
|
|
255
|
-
bindContainer(container: HTMLElement): void;
|
|
256
|
-
/**
|
|
257
|
-
* Move window-manager's collector to some place.
|
|
258
|
-
*/
|
|
259
|
-
bindCollector(container: HTMLElement): void;
|
|
260
|
-
/**
|
|
261
|
-
* Player current time in milliseconds.
|
|
262
|
-
*/
|
|
263
|
-
readonly currentTime: Writable<number>;
|
|
264
|
-
/**
|
|
265
|
-
* Player state, like "is it playing?".
|
|
266
|
-
*/
|
|
267
|
-
readonly phase: Readable<"waitingFirstFrame" | "playing" | "pause" | "stop" | "ended" | "buffering">;
|
|
268
|
-
/**
|
|
269
|
-
* Will become true after buffering.
|
|
270
|
-
*/
|
|
271
|
-
readonly canplay: Readable<boolean>;
|
|
272
|
-
private _setPlaybackRate;
|
|
273
|
-
/**
|
|
274
|
-
* Playback speed, default `1`.
|
|
275
|
-
*/
|
|
276
|
-
readonly playbackRate: Writable<number>;
|
|
277
|
-
/**
|
|
278
|
-
* Playback duration in milliseconds.
|
|
279
|
-
*/
|
|
280
|
-
readonly duration: Readable<number>;
|
|
281
|
-
/**
|
|
282
|
-
* Get state of room at that time, like "who was in the room?".
|
|
283
|
-
*/
|
|
284
|
-
readonly state: Readable<PlayerState>;
|
|
285
|
-
/**
|
|
286
|
-
* Seek to some time in milliseconds.
|
|
287
|
-
*/
|
|
288
|
-
seek(timestamp: number): Promise<PlayerSeekingResult>;
|
|
289
|
-
/**
|
|
290
|
-
* Change player state to playing.
|
|
291
|
-
*/
|
|
292
|
-
play(): void;
|
|
293
|
-
/**
|
|
294
|
-
* Change player state to paused.
|
|
295
|
-
*/
|
|
296
|
-
pause(): void;
|
|
297
|
-
/**
|
|
298
|
-
* Change player state to stopped.
|
|
299
|
-
*/
|
|
300
|
-
stop(): void;
|
|
301
|
-
/**
|
|
302
|
-
* Set playback speed, a shortcut for `speed.set(x)`.
|
|
303
|
-
*/
|
|
304
|
-
setPlaybackRate(value: number): void;
|
|
305
|
-
}
|
|
306
|
-
interface FastboardReplayOptions {
|
|
307
|
-
sdkConfig: Omit<WhiteWebSdkConfiguration, "useMobXState"> & {
|
|
308
|
-
region: NonNullable<WhiteWebSdkConfiguration["region"]>;
|
|
309
|
-
};
|
|
310
|
-
replayRoom: Omit<ReplayRoomParams, "useMultiViews"> & {
|
|
311
|
-
callbacks?: Partial<PlayerCallbacks>;
|
|
312
|
-
};
|
|
313
|
-
managerConfig?: Omit<MountParams, "room">;
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* Create a FastboardApp instance.
|
|
317
|
-
* @example
|
|
318
|
-
* let player = await replayFastboard({
|
|
319
|
-
* sdkConfig: {
|
|
320
|
-
* appIdentifier: import.meta.env.VITE_APPID,
|
|
321
|
-
* region: 'cn-hz',
|
|
322
|
-
* },
|
|
323
|
-
* replayRoom: {
|
|
324
|
-
* uid: unique_id,
|
|
325
|
-
* uuid: import.meta.env.VITE_ROOM_UUID,
|
|
326
|
-
* roomToken: import.meta.env.VITE_ROOM_TOKEN,
|
|
327
|
-
* },
|
|
328
|
-
* })
|
|
329
|
-
*/
|
|
330
|
-
declare function replayFastboard({ sdkConfig, replayRoom: { callbacks, ...replayRoomParams }, managerConfig, }: FastboardReplayOptions): Promise<FastboardPlayer>;
|
|
331
|
-
|
|
332
|
-
interface AppsConfig {
|
|
333
|
-
[kind: string]: Omit<RegisterParams, "kind">;
|
|
334
|
-
}
|
|
335
|
-
declare const register: typeof WindowManager.register;
|
|
336
|
-
|
|
337
|
-
export { Appliance, AppsConfig, AppsStatus, FastboardApp, FastboardOptions, FastboardPlayer, FastboardReplayOptions, InsertDocsDynamic, InsertDocsParams, InsertDocsStatic, PlayerPhase, Readable, RoomPhase, RoomStateChanged, SetMemberStateFn, Shape, StartStopNotifier, Subscriber, Unsubscriber, Updater, Writable, convertedFileToScene, createFastboard, genUID, getImageSize, makeSlideParams, readable, register, replayFastboard, warn, writable };
|