import { Size, SceneDefinition, ConvertedFile, RoomPhase as RoomPhase$1, ShapeType, MemberState, RoomState, CameraState, Camera, AnimationMode, Rectangle, Color, ConversionResponse, WhiteWebSdkConfiguration, JoinRoomParams, RoomCallbacks, WhiteWebSdk, Room, HotKeys, PlayerPhase as PlayerPhase$1, PlayerState, PlayerSeekingResult, ReplayRoomParams, PlayerCallbacks, Player, ViewCallbacks, View } from 'white-web-sdk'; 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'; import { AddPageParams, DocsEvent, DocsEventOptions, DispatchDocsEventResult, PageStateOptions, UnifiedPageState, MountParams, NetlessApp, WindowManager, RegisterParams, PublicEvent } from '@netless/window-manager'; export { AddPageParams, DispatchDocsEventFailureReason, DispatchDocsEventResult, DocsEvent, DocsEventOptions, MountParams, NetlessApp, PageStateOptions, PublicEvent, UnifiedPageState, WindowManager } from '@netless/window-manager'; import { SyncedStore } from '@netless/synced-store'; export { Diff, DiffOne, Storage, SyncedStore } from '@netless/synced-store'; import { ApplianceNames, ShapeType as ShapeType$1, MemberState as MemberState$1, AppliancePluginOptions, ApplianceAdaptor, AppliancePluginInstance } from '@netless/appliance-plugin'; export { ApplianceAdaptor, AppliancePluginInstance, AppliancePluginOptions, ApplianceNames as ExtendApplianceNames, MemberState as ExtendMemberState, ShapeType as ExtendShapeType } from '@netless/appliance-plugin'; import { AppInMainViewOptions, AppInMainViewInstance } from '@netless/app-in-mainview-plugin'; export { PreviewParams, default as SlideApp, AppResult as SlideController, AppOptions as SlideOptions, SlidePreviewer, addHooks as addSlideHooks, previewSlide, apps as slideApps } from '@netless/app-slide'; type Subscriber = (value: T) => void; type Unsubscriber = () => void; type Updater = (value: T) => T; type StartStopNotifier = (set: Subscriber) => Unsubscriber | void; interface Readable { readonly value: T; subscribe(this: void, run: Subscriber): Unsubscriber; reaction(this: void, run: Subscriber): Unsubscriber; dispose(value?: T): void; } interface Writable extends Readable { set(this: void, value: T): void; update(this: void, updater: Updater): void; } declare function readable(value: T, start?: StartStopNotifier): Readable; declare function writable(value: T, start: StartStopNotifier | undefined, set: Subscriber): Writable; declare function getImageSize(url: string, fallback: Size, crossOrigin?: boolean | string): Promise; declare function makeSlideParams(scenes: SceneDefinition[]): { scenes: SceneDefinition[]; taskId: string; url: string; }; declare function convertedFileToScene(f: ConvertedFile, i: number): SceneDefinition; declare function genUID(): string; declare const warnings: { readonly "no-ppt-in-scenes": "You're probably inserting the slide app in a wrong way, there shouldn't exist `scenes[0].ppt`."; }; declare function warn(id: keyof typeof warnings): void; declare class FastboardAppBase = any> { readonly sdk: WhiteWebSdk; readonly room: Room; readonly manager: WindowManager; readonly hotKeys: Partial; readonly syncedStore: SyncedStore; readonly appliancePlugin?: AppliancePluginInstance | undefined; readonly appInMainViewPlugin?: AppInMainViewInstance | undefined; constructor(sdk: WhiteWebSdk, room: Room, manager: WindowManager, hotKeys: Partial, syncedStore: SyncedStore, appliancePlugin?: AppliancePluginInstance | undefined, appInMainViewPlugin?: AppInMainViewInstance | undefined); protected _destroyed: boolean; private _destroyTask?; /** * Destroy fastboard (disconnect from the whiteboard room). */ destroy(): Promise; } type RoomPhase = `${RoomPhase$1}`; /** pencil, eraser, rectangle... */ type Appliance = `${ApplianceNames}`; /** triangle, star... */ type Shape = `${ShapeType | ShapeType$1}`; /** Params for static docs, they are rendered as many images. */ interface InsertDocsStatic { readonly fileType: "pdf"; /** Unique string for binding whiteboard view to the doc. Must start with `/`. */ readonly scenePath: string; /** @example [{ name: '1', ppt: { src: 'url/to/ppt/1.png' } }] */ readonly scenes: SceneDefinition[]; /** Window title. */ readonly title?: string; } /** Params for slides, they are rendered in @netless/app-slide with animations. */ interface InsertDocsDynamic { readonly fileType: "pptx"; /** Unique string for binding whiteboard view to the doc. Must start with `/`. */ readonly scenePath: string; /** Conversion task id, see https://developer.netless.link/server-en/home/server-conversion#get-query-task-conversion-progress. */ readonly taskId: string; /** Window title. */ readonly title?: string; /** Where the slide resource placed. @default `https://convertcdn.netless.link/dynamicConvert` */ readonly url?: string; /** @example [{ name: '1' }, { name: '2' }, { name: '3' }] */ readonly scenes?: SceneDefinition[]; } type InsertDocsParams = InsertDocsStatic | InsertDocsDynamic; interface InsertDocsOptions { /** Renderer for static documents. Dynamic documents always use Slide. @default "docsViewer" */ readonly staticRenderer?: "docsViewer" | "presentation"; } interface ProjectorResponse { uuid: string; status: "Waiting" | "Converting" | "Finished" | "Fail"; type: "dynamic" | "static"; /** 0..100 */ convertedPercentage: number; /** https://example.org/path/to/{static,dynamic}Convert */ prefix?: string; pageCount?: number; /** {1:"{prefix}/{taskId}/preview/1.png"}, only when type=dynamic and preview=true */ previews?: Record; /** {prefix}/{taskId}/jsonOutput/note.json */ note?: string; /** {1:{width,height,url}}, only when type=static */ images?: Record; /** 20xxxxx */ errorCode?: string; errorMessage?: string; } type SetMemberStateFn = (partialMemberState: Partial) => void; type RoomStateChanged = (diff: Partial) => void; /** App download progress. */ interface AppsStatus { [kind: string]: { status: "idle" | "loading" | "failed"; /** Exist if status is `failed`. */ reason?: string; }; } declare class FastboardApp = any> extends FastboardAppBase { /** * Render this app to some DOM. */ bindContainer(container: HTMLElement): void; /** * Move window-manager's collector to some place. */ bindCollector(container: HTMLElement): void; /** * Is current room writable? */ readonly writable: Writable; /** * Is current room online? */ readonly phase: Readable<"connecting" | "connected" | "reconnecting" | "disconnecting" | "disconnected">; /** * Current window-manager's windows' state (is it maximized?). */ readonly boxState: Readable<"normal" | "minimized" | "maximized" | undefined>; /** * Current window-manager's focused app's id. * @example "HelloWorld-1A2b3C4d" */ readonly focusedApp: Readable; /** * How many times can I call `app.redo()`? */ readonly canRedoSteps: Readable; /** * How many times can I call `app.undo()`? */ readonly canUndoSteps: Readable; /** * Current camera information of main view. * * Change the camera position by `app.moveCamera()`. */ readonly camera: Readable; /** * Current tool's info, like "is using pencil?", "what color?". * * Change the tool by `app.setAppliance()`. */ readonly memberState: Readable; /** * 0..n-1, current index of main view scenes. */ readonly sceneIndex: Writable; /** * How many pages are in the main view? */ readonly sceneLength: Readable; /** * Apps status. */ readonly appsStatus: Readable; /** * visible Apps, when appInMainViewPlugin is not enabled, it will be empty. */ readonly visibleApps: Readable>; /** * Returns `writable && phase === "connected"`. */ get canOperate(): boolean; /** * Undo a step on main view. */ undo(): void; /** * Redo a step on main view. */ redo(): void; /** * Move current main view's camera position. */ moveCamera(camera: Partial & { animationMode?: AnimationMode | undefined; }): void; /** * Move current main view's camera to include a rectangle. */ moveCameraToContain(rectangle: Rectangle & { animationMode?: AnimationMode; }): void; /** * Delete all things on the main view. */ cleanCurrentScene(): void; /** * Set current tool, like "pencil". */ setAppliance(appliance: ApplianceNames | Appliance, shape?: ShapeType | ShapeType$1 | Shape): void; /** * Set pencil and shape's thickness. */ setStrokeWidth(strokeWidth: number): void; /** Extended stroke, polygon, star, text/background and eraser configuration. */ setMemberState(state: Partial): void; /** * Set pencil and shape's color. */ setStrokeColor(strokeColor: Color): void; /** * Set text size. Default is 16. */ setTextSize(textSize: number): void; /** * Set text color. * * @example * setTextColor([0x66, 0xcc, 0xff]) */ setTextColor(textColor: Color): void; /** * Toggle dotted line effect on pencil. */ toggleDottedLine(force?: boolean): void; /** * Set pencil eraser size. */ setPencilEraserSize(size: number): void; /** * Goto previous page (the main whiteboard view). */ prevPage(): Promise; /** * Goto next page (the main whiteboard view). */ nextPage(): Promise; /** * Goto any page (index range: 0..n-1) */ jumpPage(index: number): Promise; /** * Add one page to the main whiteboard view. * * @example * addPage({ after: true }) // add one page right after current one. * nextPage() // then, goto that page. */ addPage(params?: AddPageParams): Promise; /** * Remove one page at given index or current page (by default). * * Requires `@netless/window-manager` >= 0.4.30. * * @example * removePage() // remove current page */ removePage(index?: number): Promise; /** * Insert an image to the main view. * * @param crossOrigin Whether to load the image with CORS enabled, default is `true`. * * @example * insertImage("https://i.imgur.com/CzXTtJV.jpg") */ insertImage(url: string, crossOrigin?: boolean | string): Promise; /** * Insert PDF/PPTX from conversion result. * @param status https://developer.netless.link/server-en/home/server-conversion#get-query-task-conversion-progress */ insertDocs(filename: string, status: ConversionResponse, options?: InsertDocsOptions): Promise; /** * Insert PDF/PPTX from projector conversion result. * @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 */ insertDocs(filename: string, response: ProjectorResponse, options?: InsertDocsOptions): Promise; /** * Manual way. * @example * app.insertDocs({ * fileType: 'pptx', * scenePath: `/pptx/${conversion.taskId}`, * taskId: conversion.taskId, * title: 'Title', * }) */ insertDocs(params: InsertDocsParams, options?: InsertDocsOptions): Promise; private _insertDocs; /** * Insert the Media Player app. */ insertMedia(title: string, src: string): Promise; /** Controls mainView/DocsViewer/Presentation/Slide. Pages are one-based. */ dispatchDocsEvent(event: DocsEvent, options?: DocsEventOptions): Promise; getPageState(options?: PageStateOptions): Promise; /** Focus commit, not a guarantee that the App has rendered successfully. */ focusApp(appId: string): Promise; /** * Insert the Monaco Code Editor app. * @deprecated Use `app.manager.addApp({ kind: 'Monaco' })` instead. */ insertCodeEditor(): Promise; /** * Insert the Countdown app. * @deprecated Use `app.manager.addApp({ kind: 'Countdown' })` instead. */ insertCountdown(): Promise; /** * Insert the GeoGebra app. * @deprecated Use `app.manager.addApp({ kind: 'GeoGebra' })` instead. */ insertGeoGebra(): Promise; destroy(): Promise; } interface FastboardOptions { sdkConfig: Omit & { region: NonNullable; }; joinRoom: Omit & { callbacks?: Partial>; }; managerConfig?: Omit; netlessApps?: NetlessApp[]; enableAppliancePlugin?: AppliancePluginOptions; /** Runtime callbacks/logger/cursor adapter; functions must not be placed in options.extras. */ appliancePluginAdaptor?: Omit; enableAppInMainViewPlugin?: true | AppInMainViewOptions; } /** * Create a FastboardApp instance. * @example * let app = await createFastboard({ * sdkConfig: { * appIdentifier: import.meta.env.VITE_APPID, * region: 'cn-hz', * }, * joinRoom: { * uid: unique_id, * uuid: import.meta.env.VITE_ROOM_UUID, * roomToken: import.meta.env.VITE_ROOM_TOKEN, * }, * }) */ declare function createFastboard = any>({ sdkConfig, joinRoom: { callbacks, ...joinRoomParams }, managerConfig, netlessApps, enableAppliancePlugin, appliancePluginAdaptor, enableAppInMainViewPlugin, }: FastboardOptions): Promise>; declare class FastboardPlayerBase = any> { readonly sdk: WhiteWebSdk; readonly player: Player; readonly manager: WindowManager; readonly syncedStore: SyncedStore; readonly appliancePlugin?: AppliancePluginInstance | undefined; readonly appInMainViewPlugin?: AppInMainViewInstance | undefined; constructor(sdk: WhiteWebSdk, player: Player, manager: WindowManager, syncedStore: SyncedStore, appliancePlugin?: AppliancePluginInstance | undefined, appInMainViewPlugin?: AppInMainViewInstance | undefined); protected _destroyed: boolean; private _destroyTask?; destroy(): Promise; } type PlayerPhase = `${PlayerPhase$1}`; declare class FastboardPlayer = any> extends FastboardPlayerBase { /** * Render this player to some DOM. */ bindContainer(container: HTMLElement): void; /** * Move window-manager's collector to some place. */ bindCollector(container: HTMLElement): void; /** * Player current time in milliseconds. */ readonly currentTime: Writable; /** * Player state, like "is it playing?". */ readonly phase: Readable<"waitingFirstFrame" | "playing" | "pause" | "stop" | "ended" | "buffering">; /** * Will become true after buffering. */ readonly canplay: Readable; /** * Playback speed, default `1`. */ readonly playbackRate: Writable; /** * Playback duration in milliseconds. */ readonly duration: Readable; /** * Get state of room at that time, like "who was in the room?". */ readonly state: Readable; /** * Seek to some time in milliseconds. */ seek(timestamp: number): Promise; /** * Change player state to playing. */ play(): void; /** * Change player state to paused. */ pause(): void; /** * Change player state to stopped. */ stop(): void; /** * Set playback speed, a shortcut for `speed.set(x)`. */ setPlaybackRate(value: number): void; } interface FastboardReplayOptions { sdkConfig: Omit & { region: NonNullable; }; replayRoom: Omit & { callbacks?: Partial; }; managerConfig?: Omit; netlessApps?: NetlessApp[]; enableAppliancePlugin?: AppliancePluginOptions; appliancePluginAdaptor?: Omit; enableAppInMainViewPlugin?: true | AppInMainViewOptions; } /** * Create a FastboardPlayer instance. * @example * let player = await replayFastboard({ * sdkConfig: { * appIdentifier: import.meta.env.VITE_APPID, * region: 'cn-hz', * }, * replayRoom: { * room: "room uuid", * roomToken: "NETLESSROOM_...", * beginTimestamp: 1646619090394, * duration: 70448, * }, * }) */ declare function replayFastboard = any>({ sdkConfig, replayRoom: { callbacks, ...replayRoomParams }, managerConfig, netlessApps, enableAppliancePlugin, appliancePluginAdaptor, enableAppInMainViewPlugin, }: FastboardReplayOptions): Promise>; declare const register: typeof WindowManager.register; interface AppsConfig { [kind: string]: Omit; } declare const version: string; declare function addRoomListener(room: Room, name: K, listener: RoomCallbacks[K]): () => void; declare function addPlayerListener(player: Player, name: K, listener: PlayerCallbacks[K]): () => void; /** * Note: view listeners will be invalid on reconnection. * You have to rebind them after the phase changed. * @example * const bindCamera = () => addViewListener(mainView, "onCameraUpdated", setCamera) * let dispose = bindCamera(), phase_ = "disconnected" * setCamera(mainView.camera) * addRoomListener(room, "onPhaseChanged", (phase) => { * if (phase === "connected" && phase_ === "reconnecting") { * dispose() * dispose = bindCamera() * setCamera(mainView.camera) * } * phase_ = phase * }) */ declare function addViewListener(view: View, name: K, listener: ViewCallbacks[K]): () => void; declare function addManagerListener(manager: WindowManager, name: K, listener: (value: PublicEvent[K]) => void): () => void; /** * Send a page or scale command to mainView, DocsViewer, Presentation, or Slide. * This is a wrapper around `WindowManager.dispatchDocsEvent()`. * * The Promise resolves to a structured acceptance result. Observe * `unifiedPageStateChange` for the actual page or relative scale. * * @example * ```js * // send "next page" to the focused app * await dispatchDocsEvent(fastboard, "nextPage") * * // send "prev page" to a concrete app * await dispatchDocsEvent(fastboard, "prevPage", { target: "Slide-1a2b3c4d" }) * ``` */ declare function dispatchDocsEvent(fastboard: FastboardApp | WindowManager, event: DocsEvent, options?: DocsEventOptions): Promise; export { Appliance, AppsConfig, AppsStatus, FastboardApp, FastboardOptions, FastboardPlayer, FastboardReplayOptions, InsertDocsDynamic, InsertDocsOptions, 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, register, replayFastboard, version, warn, writable };